!427 [sync] PR-424: sync add multicast enable in dpdk_ethdev_init

From: @openeuler-sync-bot 
Reviewed-by: @jiangheng12 
Signed-off-by: @jiangheng12
This commit is contained in:
openeuler-ci-bot 2023-06-21 03:07:12 +00:00 committed by Gitee
commit b1a311957b
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 147 additions and 1 deletions

View File

@ -0,0 +1,115 @@
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

View File

@ -0,0 +1,25 @@
From dd3d8211edce4dbf0550a3736b07d9fb96472897 Mon Sep 17 00:00:00 2001
From: kircher <majun65@huawei.com>
Date: Tue, 20 Jun 2023 17:35:34 +0800
Subject: [PATCH] add multicast enable in dpdk_ethdev_init
---
src/lstack/core/lstack_dpdk.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/lstack/core/lstack_dpdk.c b/src/lstack/core/lstack_dpdk.c
index 1dab9a3..f865d55 100644
--- a/src/lstack/core/lstack_dpdk.c
+++ b/src/lstack/core/lstack_dpdk.c
@@ -566,6 +566,8 @@ int32_t dpdk_ethdev_init(int port_id, bool bond_port)
}
}
+ rte_eth_allmulticast_enable(port_id);
+
return 0;
}
--
2.27.0

View File

@ -2,7 +2,7 @@
Name: gazelle
Version: 1.0.1
Release: 65
Release: 66
Summary: gazelle is a high performance user-mode stack
License: MulanPSL-2.0
URL: https://gitee.com/openeuler/gazelle
@ -266,6 +266,8 @@ Patch9248: 0248-rpc-pool-use-dpdk-mempool-replace-array.patch
Patch9249: 0249-fix-t_params-use-after-free-in-kernel-event-thread.patch
Patch9250: 0250-adapt-to-dpdk-19.11-and-dpdk-21.11.patch
Patch9251: 0251-change-send_ring_size-32-in-lstack-conf.patch
Patch9252: 0252-add-use_sockmap-in-cfg-to-distinguish-whether-to-use.patch
Patch9253: 0253-add-multicast-enable-in-dpdk_ethdev_init.patch
%description
%{name} is a high performance user-mode stack.
@ -307,6 +309,10 @@ install -Dpm 0640 %{_builddir}/%{name}-%{version}/src/ltran/ltran.conf %{b
%config(noreplace) %{conf_path}/ltran.conf
%changelog
* Mon Jun 19 2023 jiangheng12 <jiangheng14@huawei.com> - 1.0.1-66
- add multicast enable in dpdk_ethdev_init
- add use_sockmap in cfg to distinguish whether to use dpdk ring communication between processes
* Mon Jun 19 2023 jiangheng12 <jiangheng14@huawei.com> - 1.0.1-65
- remove obsolete args num_wakeup in doc