代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/gazelle 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From f0f6c7eb303b772d27e0720662485eb36e9c7d34 Mon Sep 17 00:00:00 2001
From: jiangheng <jiangheng14@huawei.com>
Date: Fri, 16 Jun 2023 10:00:33 +0800
Subject: [PATCH] add use_sockmap in cfg to distinguish whether to use dpdk
ring communication between processes
---
src/lstack/core/lstack_cfg.c | 8 ++++++++
src/lstack/core/lstack_lwip.c | 5 +++++
src/lstack/core/lstack_protocol_stack.c | 10 +++++++---
src/lstack/include/lstack_cfg.h | 1 +
src/lstack/netif/lstack_ethdev.c | 1 -
5 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/src/lstack/core/lstack_cfg.c b/src/lstack/core/lstack_cfg.c
index a21992e..daf49ea 100644
--- a/src/lstack/core/lstack_cfg.c
+++ b/src/lstack/core/lstack_cfg.c
@@ -71,6 +71,7 @@ static int32_t parse_seperate_sendrecv_args(void);
static int32_t parse_tuple_filter(void);
static int32_t parse_use_bond4(void);
static int32_t parse_bond4_slave_mac(void);
+static int32_t parse_use_sockmap(void);
#define PARSE_ARG(_arg, _arg_string, _default_val, _min_val, _max_val, _ret) \
do { \
@@ -125,6 +126,7 @@ static struct config_vector_t g_config_tbl[] = {
{ "tuple_filter", parse_tuple_filter },
{ "use_bond4", parse_use_bond4 },
{ "bond4_slave_mac", parse_bond4_slave_mac },
+ { "use_sockmap", parse_use_sockmap },
{ NULL, NULL }
};
@@ -1106,3 +1108,9 @@ static int32_t parse_bond4_slave_mac(void)
return ret;
}
+static int32_t parse_use_sockmap(void)
+{
+ int32_t ret;
+ PARSE_ARG(g_config_params.use_sockmap, "use_sockmap", 0, 0, 1, ret);
+ return ret;
+}
diff --git a/src/lstack/core/lstack_lwip.c b/src/lstack/core/lstack_lwip.c
index 34b4aa7..d53591d 100644
--- a/src/lstack/core/lstack_lwip.c
+++ b/src/lstack/core/lstack_lwip.c
@@ -1545,6 +1545,11 @@ err_t same_node_memzone_create(const struct rte_memzone **zone, int size, int po
err_t same_node_ring_create(struct rte_ring **ring, int size, int port, char *name, char *rx)
{
+ if (!get_global_cfg_params()->use_sockmap) {
+ *ring = NULL;
+ return -1;
+ }
+
unsigned flags;
char ring_name[RING_NAME_LEN] = {0};
if (strcmp(name, "listen") == 0) {
diff --git a/src/lstack/core/lstack_protocol_stack.c b/src/lstack/core/lstack_protocol_stack.c
index a8c5e14..e13f039 100644
--- a/src/lstack/core/lstack_protocol_stack.c
+++ b/src/lstack/core/lstack_protocol_stack.c
@@ -443,6 +443,7 @@ static void* gazelle_stack_thread(void *arg)
struct cfg_params *cfg = get_global_cfg_params();
uint8_t use_ltran_flag = cfg->use_ltran;
bool kni_switch = cfg->kni_switch;
+ bool use_sockmap = cfg->use_sockmap;
uint32_t read_connect_number = cfg->read_connect_number;
uint32_t rpc_number = cfg->rpc_number;
uint32_t nic_read_number = cfg->nic_read_number;
@@ -471,9 +472,12 @@ static void* gazelle_stack_thread(void *arg)
gazelle_eth_dev_poll(stack, use_ltran_flag, nic_read_number);
- /* reduce traversal times */
- if ((wakeup_tick & 0xff) == 0) {
- read_same_node_recv_list(stack);
+ if (use_sockmap) {
+ netif_poll(&stack->netif);
+ /* reduce traversal times */
+ if ((wakeup_tick & 0xff) == 0) {
+ read_same_node_recv_list(stack);
+ }
}
read_recv_list(stack, read_connect_number);
diff --git a/src/lstack/include/lstack_cfg.h b/src/lstack/include/lstack_cfg.h
index 4d0f611..b000519 100644
--- a/src/lstack/include/lstack_cfg.h
+++ b/src/lstack/include/lstack_cfg.h
@@ -106,6 +106,7 @@ struct cfg_params {
bool use_bond4;
uint8_t bond4_slave1_mac_addr[ETHER_ADDR_LEN];
uint8_t bond4_slave2_mac_addr[ETHER_ADDR_LEN];
+ bool use_sockmap;
};
struct cfg_params *get_global_cfg_params(void);
diff --git a/src/lstack/netif/lstack_ethdev.c b/src/lstack/netif/lstack_ethdev.c
index 2052240..3ea8e52 100644
--- a/src/lstack/netif/lstack_ethdev.c
+++ b/src/lstack/netif/lstack_ethdev.c
@@ -761,7 +761,6 @@ int32_t gazelle_eth_dev_poll(struct protocol_stack *stack, uint8_t use_ltran_fla
{
uint32_t nr_pkts;
- netif_poll(&stack->netif);
nr_pkts = stack->dev_ops.rx_poll(stack, stack->pkts, nic_read_number);
if (nr_pkts == 0) {
return 0;
--
2.27.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。