代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/gazelle 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From 783ea4a8f8949cb943a94cb6fdb1690852f7faa3 Mon Sep 17 00:00:00 2001
From: yangchen <yangchen145@huawei.com>
Date: Fri, 16 Aug 2024 05:55:40 +0800
Subject: [PATCH] fix mbuf_total calculation error
---
src/lstack/core/lstack_protocol_stack.c | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/src/lstack/core/lstack_protocol_stack.c b/src/lstack/core/lstack_protocol_stack.c
index 6e980a8..ba90d86 100644
--- a/src/lstack/core/lstack_protocol_stack.c
+++ b/src/lstack/core/lstack_protocol_stack.c
@@ -548,29 +548,31 @@ static void* gazelle_stack_thread(void *arg)
int32_t stack_group_init_mempool(void)
{
- struct cfg_params *global_cfg_parmas = get_global_cfg_params();
- uint32_t total_mbufs = get_global_cfg_params()->mbuf_count_per_conn * get_global_cfg_params()->tcp_conn_count;
+ struct cfg_params *cfg_params = get_global_cfg_params();
+ uint32_t total_mbufs = 0;
+ uint32_t total_conn_mbufs = cfg_params->mbuf_count_per_conn * cfg_params->tcp_conn_count;
+ uint32_t total_nic_mbufs = cfg_params->nic.rxqueue_size + cfg_params->nic.txqueue_size;
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);
+ "config::num_cpu=%d num_process=%d \n", cfg_params->num_cpu, cfg_params->num_process);
- for (int cpu_idx = 0; cpu_idx < get_global_cfg_params()->num_queue; cpu_idx++) {
- cpu_id = global_cfg_parmas->cpus[cpu_idx];
+ for (int cpu_idx = 0; cpu_idx < cfg_params->num_queue; cpu_idx++) {
+ cpu_id = cfg_params->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;
+ for (int process_idx = 0; process_idx < cfg_params->num_process; process_idx++) {
+ queue_id = cpu_idx * cfg_params->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 / get_global_cfg_params()->num_queue, RXTX_CACHE_SZ, queue_id, numa_id);
+ total_mbufs = (total_conn_mbufs / cfg_params->num_queue) + total_nic_mbufs + MBUFPOOL_RESERVE_NUM;
+ rxtx_mbuf = create_pktmbuf_mempool("rxtx_mbuf", total_mbufs, 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);
--
2.33.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。