sync solve problem that rte_pktmbuf_poll_creat in same numa .
(cherry picked from commit f9784aa3960e2a2fbb560a9d8e9d896b2848f8c4)
This commit is contained in:
parent
ccf2da11c9
commit
af32524b45
28
0034-dfx-add-four-snmp-udp-datas.patch
Normal file
28
0034-dfx-add-four-snmp-udp-datas.patch
Normal file
@ -0,0 +1,28 @@
|
||||
From fcab00c220dfd8eaced2e07d4bc3cb9be71b82ff Mon Sep 17 00:00:00 2001
|
||||
From: yinbin <yinbin8@huawei.com>
|
||||
Date: Mon, 6 Nov 2023 16:38:32 +0800
|
||||
Subject: [PATCH] dfx: add four snmp udp datas
|
||||
|
||||
---
|
||||
src/ltran/ltran_dfx.c | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
diff --git a/src/ltran/ltran_dfx.c b/src/ltran/ltran_dfx.c
|
||||
index e5fd0c8..582a4b7 100644
|
||||
--- a/src/ltran/ltran_dfx.c
|
||||
+++ b/src/ltran/ltran_dfx.c
|
||||
@@ -846,6 +846,11 @@ static void gazelle_print_lstack_stat_snmp_core(const struct gazelle_stack_dfx_d
|
||||
printf("ip_fw_dgm: %u\n", snmp->ip_fw_dgm);
|
||||
printf("ip_in_recv: %u\n", snmp->ip_in_recv);
|
||||
|
||||
+ printf("udp_in_datagrams: %u\n", snmp->udp_in_datagrams);
|
||||
+ printf("udp_no_ports: %u\n", snmp->udp_no_ports);
|
||||
+ printf("udp_in_errors: %u\n", snmp->udp_in_errors);
|
||||
+ printf("udp_out_datagrams: %u\n", snmp->udp_out_datagrams);
|
||||
+
|
||||
printf("tcp_act_open: %u\n", snmp->tcp_act_open);
|
||||
printf("tcp_passive_open: %u\n", snmp->tcp_passive_open);
|
||||
printf("tcp_attempt_fail: %u\n", snmp->tcp_attempt_fail);
|
||||
--
|
||||
2.23.0
|
||||
|
||||
38
0035-cfg-nic-queue-size-only-support-power-of-2.patch
Normal file
38
0035-cfg-nic-queue-size-only-support-power-of-2.patch
Normal file
@ -0,0 +1,38 @@
|
||||
From cb8d274804ccc9d9c5bb434d1c2e60aaf14e8fd5 Mon Sep 17 00:00:00 2001
|
||||
From: jiangheng <jiangheng14@huawei.com>
|
||||
Date: Wed, 8 Nov 2023 20:53:22 +0800
|
||||
Subject: [PATCH] cfg: nic queue size only support power of 2
|
||||
|
||||
---
|
||||
src/lstack/core/lstack_cfg.c | 8 ++++++++
|
||||
1 file changed, 8 insertions(+)
|
||||
|
||||
diff --git a/src/lstack/core/lstack_cfg.c b/src/lstack/core/lstack_cfg.c
|
||||
index 8e83c0d..d2d0fc1 100644
|
||||
--- a/src/lstack/core/lstack_cfg.c
|
||||
+++ b/src/lstack/core/lstack_cfg.c
|
||||
@@ -1191,6 +1191,10 @@ static int32_t parse_nic_rxqueue_size(void)
|
||||
int32_t ret;
|
||||
PARSE_ARG(g_config_params.nic.rxqueue_size, "nic_rxqueue_size", 4096,
|
||||
NIC_QUEUE_SIZE_MIN, NIC_QUEUE_SIZE_MAX, ret);
|
||||
+ if (!rte_is_power_of_2(g_config_params.nic.rxqueue_size)) {
|
||||
+ LSTACK_LOG(ERR, LSTACK, "nic queue size only support power of two\n");
|
||||
+ return -1;
|
||||
+ }
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -1199,6 +1203,10 @@ static int32_t parse_nic_txqueue_size(void)
|
||||
int32_t ret;
|
||||
PARSE_ARG(g_config_params.nic.txqueue_size, "nic_txqueue_size", 2048,
|
||||
NIC_QUEUE_SIZE_MIN, NIC_QUEUE_SIZE_MAX, ret);
|
||||
+ if (!rte_is_power_of_2(g_config_params.nic.txqueue_size)) {
|
||||
+ LSTACK_LOG(ERR, LSTACK, "nic queue size only support power of two\n");
|
||||
+ return -1;
|
||||
+ }
|
||||
return ret;
|
||||
}
|
||||
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@ -0,0 +1,29 @@
|
||||
From 8e5dd5204c57e4443cb79cb01cdc8c16665e6734 Mon Sep 17 00:00:00 2001
|
||||
From: yinbin <yinbin8@huawei.com>
|
||||
Date: Fri, 10 Nov 2023 18:07:14 +0800
|
||||
Subject: [PATCH] stack: fix possible coredump when arp packet broadcast in rtc
|
||||
mode
|
||||
|
||||
---
|
||||
src/lstack/core/lstack_protocol_stack.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/lstack/core/lstack_protocol_stack.c b/src/lstack/core/lstack_protocol_stack.c
|
||||
index 3662948..bafb569 100644
|
||||
--- a/src/lstack/core/lstack_protocol_stack.c
|
||||
+++ b/src/lstack/core/lstack_protocol_stack.c
|
||||
@@ -852,9 +852,9 @@ void stack_broadcast_arp(struct rte_mbuf *mbuf, struct protocol_stack *cur_stack
|
||||
return;
|
||||
}
|
||||
}
|
||||
- ret = dpdk_alloc_pktmbuf(stack->rxtx_pktmbuf_pool, &mbuf_copy, 1);
|
||||
+ ret = dpdk_alloc_pktmbuf(cur_stack->rxtx_pktmbuf_pool, &mbuf_copy, 1);
|
||||
if (ret != 0) {
|
||||
- stack->stats.rx_allocmbuf_fail++;
|
||||
+ cur_stack->stats.rx_allocmbuf_fail++;
|
||||
return;
|
||||
}
|
||||
copy_mbuf(mbuf_copy, mbuf);
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@ -0,0 +1,53 @@
|
||||
From c4e5033d44b4e6ff5a2b35e0087a26539bd9d785 Mon Sep 17 00:00:00 2001
|
||||
From: Honggang LI <honggangli@163.com>
|
||||
Date: Mon, 13 Nov 2023 09:35:57 +0800
|
||||
Subject: [PATCH] Fix coredump issue and skip rte_pdump_init for secondary
|
||||
process
|
||||
|
||||
Signed-off-by: Honggang LI <honggangli@163.com>
|
||||
---
|
||||
src/lstack/core/lstack_dpdk.c | 14 ++++++++------
|
||||
src/lstack/core/lstack_lwip.c | 2 +-
|
||||
2 files changed, 9 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/src/lstack/core/lstack_dpdk.c b/src/lstack/core/lstack_dpdk.c
|
||||
index 1a5b568..5fc641e 100644
|
||||
--- a/src/lstack/core/lstack_dpdk.c
|
||||
+++ b/src/lstack/core/lstack_dpdk.c
|
||||
@@ -125,12 +125,14 @@ int32_t dpdk_eal_init(void)
|
||||
LSTACK_PRE_LOG(LSTACK_INFO, "dpdk_eal_init success\n");
|
||||
}
|
||||
|
||||
- ret = rte_pdump_init();
|
||||
- if (ret < 0) {
|
||||
- LSTACK_PRE_LOG(LSTACK_ERR, "rte_pdump_init failed init, rte_errno %d\n", rte_errno);
|
||||
- /* We do not care whether the pdump is successfully loaded. So, just print an alarm. */
|
||||
- } else {
|
||||
- LSTACK_PRE_LOG(LSTACK_INFO, "rte_pdump_init success\n");
|
||||
+ if (get_global_cfg_params()->is_primary) {
|
||||
+ ret = rte_pdump_init();
|
||||
+ if (ret < 0) {
|
||||
+ LSTACK_PRE_LOG(LSTACK_ERR, "rte_pdump_init failed init, rte_errno %d\n", rte_errno);
|
||||
+ /* We do not care whether the pdump is successfully loaded. So, just print an alarm. */
|
||||
+ } else {
|
||||
+ LSTACK_PRE_LOG(LSTACK_INFO, "rte_pdump_init success\n");
|
||||
+ }
|
||||
}
|
||||
|
||||
return ret;
|
||||
diff --git a/src/lstack/core/lstack_lwip.c b/src/lstack/core/lstack_lwip.c
|
||||
index cdb0089..a2b02df 100644
|
||||
--- a/src/lstack/core/lstack_lwip.c
|
||||
+++ b/src/lstack/core/lstack_lwip.c
|
||||
@@ -1216,7 +1216,7 @@ uint32_t do_lwip_get_conntable(struct gazelle_stat_lstack_conn_info *conn,
|
||||
conn[conn_num].l_port = pcbl->local_port;
|
||||
conn[conn_num].tcp_sub_state = pcbl->state;
|
||||
struct netconn *netconn = (struct netconn *)pcbl->callback_arg;
|
||||
- conn[conn_num].fd = netconn->socket;
|
||||
+ conn[conn_num].fd = netconn != NULL ? netconn->socket : -1;
|
||||
if (netconn != NULL && netconn->acceptmbox != NULL) {
|
||||
conn[conn_num].recv_cnt = rte_ring_count(netconn->acceptmbox->ring);
|
||||
}
|
||||
--
|
||||
2.23.0
|
||||
|
||||
159
0038-solve-problem-that-rte_pktmbuf_poll_creat-in-same-nu.patch
Normal file
159
0038-solve-problem-that-rte_pktmbuf_poll_creat-in-same-nu.patch
Normal file
@ -0,0 +1,159 @@
|
||||
From 2a5891557162fb5743f13cb550dc7ff109476176 Mon Sep 17 00:00:00 2001
|
||||
From: hantwofish <hankangkang5@huawei.com>
|
||||
Date: Wed, 1 Nov 2023 18:34:07 +0800
|
||||
Subject: [PATCH] solve problem that rte_pktmbuf_poll_creat in same numa .
|
||||
|
||||
---
|
||||
src/lstack/core/lstack_dpdk.c | 11 +++---
|
||||
src/lstack/core/lstack_protocol_stack.c | 52 ++++++++++++++++++++-----
|
||||
src/lstack/include/lstack_dpdk.h | 2 +-
|
||||
3 files changed, 50 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/src/lstack/core/lstack_dpdk.c b/src/lstack/core/lstack_dpdk.c
|
||||
index 48fa67d..88a6c45 100644
|
||||
--- a/src/lstack/core/lstack_dpdk.c
|
||||
+++ b/src/lstack/core/lstack_dpdk.c
|
||||
@@ -110,7 +110,7 @@ int32_t dpdk_eal_init(void)
|
||||
{
|
||||
int32_t ret;
|
||||
struct cfg_params *global_params = get_global_cfg_params();
|
||||
-
|
||||
+
|
||||
ret = rte_eal_init(global_params->dpdk_argc, global_params->dpdk_argv);
|
||||
if (ret < 0) {
|
||||
if (rte_errno == EALREADY) {
|
||||
@@ -137,7 +137,7 @@ int32_t dpdk_eal_init(void)
|
||||
}
|
||||
|
||||
struct rte_mempool *create_pktmbuf_mempool(const char *name, uint32_t nb_mbuf,
|
||||
- uint32_t mbuf_cache_size, uint16_t queue_id)
|
||||
+ uint32_t mbuf_cache_size, uint16_t queue_id, unsigned numa_id)
|
||||
{
|
||||
int32_t ret;
|
||||
char pool_name[PATH_MAX];
|
||||
@@ -145,12 +145,13 @@ struct rte_mempool *create_pktmbuf_mempool(const char *name, uint32_t nb_mbuf,
|
||||
|
||||
ret = snprintf_s(pool_name, sizeof(pool_name), PATH_MAX - 1, "%s_%hu", name, queue_id);
|
||||
if (ret < 0) {
|
||||
+ LSTACK_LOG(ERR, LSTACK, "snprintf_s fail ret=%d \n", ret);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* time stamp before pbuf_custom as priv_data */
|
||||
uint16_t private_size = RTE_ALIGN(sizeof(struct mbuf_private), RTE_CACHE_LINE_SIZE);
|
||||
- pool = rte_pktmbuf_pool_create(pool_name, nb_mbuf, mbuf_cache_size, private_size, MBUF_SZ, rte_socket_id());
|
||||
+ pool = rte_pktmbuf_pool_create(pool_name, nb_mbuf, mbuf_cache_size, private_size, MBUF_SZ, numa_id);
|
||||
if (pool == NULL) {
|
||||
LSTACK_LOG(ERR, LSTACK, "cannot create %s pool rte_err=%d\n", pool_name, rte_errno);
|
||||
}
|
||||
@@ -611,7 +612,7 @@ static int32_t dpdk_ethdev_setup(const struct eth_params *eth_params, uint16_t i
|
||||
int32_t ret;
|
||||
|
||||
struct rte_mempool *rxtx_pktmbuf_pool = get_protocol_stack_group()->total_rxtx_pktmbuf_pool[idx];
|
||||
-
|
||||
+
|
||||
uint16_t socket_id = 0;
|
||||
struct cfg_params *cfg = get_global_cfg_params();
|
||||
if (!cfg->use_ltran && cfg->num_process == 1) {
|
||||
@@ -664,7 +665,7 @@ int32_t dpdk_ethdev_start(void)
|
||||
int32_t dpdk_init_lstack_kni(void)
|
||||
{
|
||||
struct protocol_stack_group *stack_group = get_protocol_stack_group();
|
||||
- stack_group->kni_pktmbuf_pool = create_pktmbuf_mempool("kni_mbuf", KNI_NB_MBUF, 0, 0);
|
||||
+ stack_group->kni_pktmbuf_pool = create_pktmbuf_mempool("kni_mbuf", KNI_NB_MBUF, 0, 0, rte_socket_id());
|
||||
if (stack_group->kni_pktmbuf_pool == NULL) {
|
||||
return -1;
|
||||
}
|
||||
diff --git a/src/lstack/core/lstack_protocol_stack.c b/src/lstack/core/lstack_protocol_stack.c
|
||||
index 3662948..2fd8d0a 100644
|
||||
--- a/src/lstack/core/lstack_protocol_stack.c
|
||||
+++ b/src/lstack/core/lstack_protocol_stack.c
|
||||
@@ -523,6 +523,46 @@ static void gazelle_listen_thread(void *arg)
|
||||
recv_pkts_from_other_process(cfg_param->process_idx, arg);
|
||||
}
|
||||
|
||||
+int32_t stack_group_init_mempool(void)
|
||||
+{
|
||||
+ struct cfg_params *global_cfg_parmas = get_global_cfg_params();
|
||||
+ struct protocol_stack_group *stack_group = get_protocol_stack_group();
|
||||
+ struct rte_mempool *rxtx_mbuf = NULL;
|
||||
+ uint32_t cpu_id = 0;
|
||||
+ unsigned numa_id = 0;
|
||||
+ int queue_id = 0;
|
||||
+
|
||||
+ LSTACK_LOG(INFO, LSTACK,
|
||||
+ "config::num_cpu=%d num_process=%d \n", global_cfg_parmas->num_cpu, global_cfg_parmas->num_process);
|
||||
+
|
||||
+ uint32_t total_mbufs = get_global_cfg_params()->mbuf_count_per_conn * get_global_cfg_params()->tcp_conn_count;
|
||||
+
|
||||
+ for (int cpu_idx = 0; cpu_idx < global_cfg_parmas->num_cpu; cpu_idx++) {
|
||||
+ cpu_id = global_cfg_parmas->cpus[cpu_idx];
|
||||
+ numa_id = numa_node_of_cpu(cpu_id);
|
||||
+
|
||||
+ for (int process_idx = 0; process_idx < global_cfg_parmas->num_process; process_idx++) {
|
||||
+ queue_id = cpu_idx * global_cfg_parmas->num_process + process_idx;
|
||||
+ if (queue_id >= PROTOCOL_STACK_MAX) {
|
||||
+ LSTACK_LOG(ERR, LSTACK, "index is over\n");
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ rxtx_mbuf = create_pktmbuf_mempool(
|
||||
+ "rxtx_mbuf", total_mbufs / stack_group->stack_num, RXTX_CACHE_SZ, queue_id, numa_id);
|
||||
+ if (rxtx_mbuf == NULL) {
|
||||
+ LSTACK_LOG(ERR, LSTACK, "cpuid=%u, numid=%d , rxtx_mbuf idx= %d create_pktmbuf_mempool fail\n",
|
||||
+ cpu_id, numa_id, queue_id);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ get_protocol_stack_group()->total_rxtx_pktmbuf_pool[queue_id] = rxtx_mbuf;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
int32_t stack_group_init(void)
|
||||
{
|
||||
struct protocol_stack_group *stack_group = get_protocol_stack_group();
|
||||
@@ -542,14 +582,8 @@ int32_t stack_group_init(void)
|
||||
stack_group->stack_setup_fail = 0;
|
||||
|
||||
if (get_global_cfg_params()->is_primary) {
|
||||
- uint32_t total_mbufs = get_global_cfg_params()->mbuf_count_per_conn * get_global_cfg_params()->tcp_conn_count;
|
||||
- for (uint16_t idx = 0; idx < get_global_cfg_params()->tot_queue_num; idx++) {
|
||||
- struct rte_mempool* rxtx_mbuf = create_pktmbuf_mempool("rxtx_mbuf",
|
||||
- total_mbufs / stack_group->stack_num, RXTX_CACHE_SZ, idx);
|
||||
- if (rxtx_mbuf == NULL) {
|
||||
- return -1;
|
||||
- }
|
||||
- get_protocol_stack_group()->total_rxtx_pktmbuf_pool[idx] = rxtx_mbuf;
|
||||
+ if (stack_group_init_mempool() != 0) {
|
||||
+ return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -970,7 +1004,7 @@ void stack_recvlist_count(struct rpc_msg *msg)
|
||||
list_for_each_safe(node, temp, list) {
|
||||
count++;
|
||||
}
|
||||
-
|
||||
+
|
||||
msg->result = count;
|
||||
}
|
||||
|
||||
diff --git a/src/lstack/include/lstack_dpdk.h b/src/lstack/include/lstack_dpdk.h
|
||||
index 6ca4f3b..1a054d6 100644
|
||||
--- a/src/lstack/include/lstack_dpdk.h
|
||||
+++ b/src/lstack/include/lstack_dpdk.h
|
||||
@@ -56,7 +56,7 @@ void dpdk_restore_pci(void);
|
||||
bool port_in_stack_queue(uint32_t src_ip, uint32_t dst_ip, uint16_t src_port, uint16_t dst_port);
|
||||
uint16_t get_port_id(void);
|
||||
struct rte_mempool *create_pktmbuf_mempool(const char *name, uint32_t nb_mbuf,
|
||||
- uint32_t mbuf_cache_size, uint16_t queue_id);
|
||||
+ uint32_t mbuf_cache_size, uint16_t queue_id, unsigned numa_id);
|
||||
|
||||
void dpdk_nic_xstats_get(struct gazelle_stack_dfx_data *dfx, uint16_t port_id);
|
||||
int32_t dpdk_alloc_pktmbuf(struct rte_mempool *pool, struct rte_mbuf **mbufs, uint32_t num);
|
||||
--
|
||||
2.23.0
|
||||
|
||||
14
gazelle.spec
14
gazelle.spec
@ -2,7 +2,7 @@
|
||||
|
||||
Name: gazelle
|
||||
Version: 1.0.2
|
||||
Release: 11
|
||||
Release: 12
|
||||
Summary: gazelle is a high performance user-mode stack
|
||||
License: MulanPSL-2.0
|
||||
URL: https://gitee.com/openeuler/gazelle
|
||||
@ -49,6 +49,11 @@ Patch9030: 0030-ethdev-register-offload-to-netif.patch
|
||||
Patch9031: 0031-epoll-fix-epollet-mode-error.patch
|
||||
Patch9032: 0032-bond6.patch
|
||||
Patch9033: 0033-cfg-fix-bond_mode-null.patch
|
||||
Patch9034: 0034-dfx-add-four-snmp-udp-datas.patch
|
||||
Patch9035: 0035-cfg-nic-queue-size-only-support-power-of-2.patch
|
||||
Patch9036: 0036-stack-fix-possible-coredump-when-arp-packet-broadcas.patch
|
||||
Patch9037: 0037-Fix-coredump-issue-and-skip-rte_pdump_init-for-secon.patch
|
||||
Patch9038: 0038-solve-problem-that-rte_pktmbuf_poll_creat-in-same-nu.patch
|
||||
|
||||
%description
|
||||
%{name} is a high performance user-mode stack.
|
||||
@ -90,6 +95,13 @@ install -Dpm 0640 %{_builddir}/%{name}-%{version}/src/ltran/ltran.conf %{b
|
||||
%config(noreplace) %{conf_path}/ltran.conf
|
||||
|
||||
%changelog
|
||||
* Sat Nov 18 2023 hantwofish <hankangkang5@huawei.com> - 1.0.2-12
|
||||
- solve problem that rte_pktmbuf_poll_creat in same numa .
|
||||
- Fix coredump issue and skip rte_pdump_init for secondary process
|
||||
- stack: fix possible coredump when arp packet broadcast in rtc mode
|
||||
- cfg: nic queue size only support power of 2
|
||||
- dfx: add four snmp udp datas
|
||||
|
||||
* Sat Nov 4 2023 yinbin6 <yinbin8@huawei.com> - 1.0.2-11
|
||||
- cfg: fix bond_mode null
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user