代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/gazelle 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From aa0bd688a6dae115e136771fda747c9428e65561 Mon Sep 17 00:00:00 2001
From: yangchen <yangchen145@huawei.com>
Date: Tue, 2 Jan 2024 09:32:00 +0800
Subject: [PATCH] lstack_dpdk: limit mbuf max num
---
src/lstack/core/lstack_dpdk.c | 5 +++++
src/lstack/include/lstack_dpdk.h | 18 ++++++++----------
src/ltran/main.c | 2 +-
3 files changed, 14 insertions(+), 11 deletions(-)
diff --git a/src/lstack/core/lstack_dpdk.c b/src/lstack/core/lstack_dpdk.c
index 729a84c..580dd1d 100644
--- a/src/lstack/core/lstack_dpdk.c
+++ b/src/lstack/core/lstack_dpdk.c
@@ -155,6 +155,11 @@ struct rte_mempool *create_pktmbuf_mempool(const char *name, uint32_t nb_mbuf,
LSTACK_LOG(ERR, LSTACK, "snprintf_s fail ret=%d \n", ret);
return NULL;
}
+ /* limit mbuf max num based on the dpdk capability */
+ if (nb_mbuf > MBUF_MAX_NUM) {
+ LSTACK_LOG(ERR, LSTACK, "out of the dpdk mbuf quantity range\n");
+ return NULL;
+ }
/* time stamp before pbuf_custom as priv_data */
uint16_t private_size = RTE_ALIGN(sizeof(struct mbuf_private), RTE_CACHE_LINE_SIZE);
diff --git a/src/lstack/include/lstack_dpdk.h b/src/lstack/include/lstack_dpdk.h
index 4a160e0..2a44c6e 100644
--- a/src/lstack/include/lstack_dpdk.h
+++ b/src/lstack/include/lstack_dpdk.h
@@ -17,22 +17,20 @@
#include "gazelle_opt.h"
#include "gazelle_dfx_msg.h"
-#define RXTX_CACHE_SZ (VDEV_RX_QUEUE_SZ)
-#define KNI_NB_MBUF (DEFAULT_RING_SIZE << 4)
+#define RXTX_CACHE_SZ (VDEV_RX_QUEUE_SZ)
-#define RESERVE_NIC_RECV (1024)
+#define KNI_NB_MBUF (DEFAULT_RING_SIZE << 4)
-#define MBUF_HEADER_LEN 64
-
-#define MAX_PACKET_SZ 2048
+#define MAX_PACKET_SZ 2048
#define RING_SIZE(x) ((x) - 1)
-#define MBUF_SZ (MAX_PACKET_SZ + RTE_PKTMBUF_HEADROOM)
+#define MBUF_SZ (MAX_PACKET_SZ + RTE_PKTMBUF_HEADROOM)
-#define MAX_CORE_NUM 256
-#define CALL_MSG_RING_SIZE (unsigned long long)32
-#define CALL_CACHE_SZ 0
+/* DPDK limit ring head-tail distance in rte_ring_init.
+ * Max value is RTE_RING_SZ_MASK / HTD_MAX_DEF, RTE_RING_SZ_MASK is 0x7fffffff, HTD_MAX_DEF is 8.
+ */
+#define MBUF_MAX_NUM 0xfffffff
int thread_affinity_default(void);
int thread_affinity_init(int cpu_id);
diff --git a/src/ltran/main.c b/src/ltran/main.c
index 87f1e14..c2598a7 100644
--- a/src/ltran/main.c
+++ b/src/ltran/main.c
@@ -55,7 +55,7 @@ static void print_stack(void)
static void sig_default_handler(int32_t sig)
{
- LTRAN_ERR("ltran dumped,caught signal:%d.\n", sig);
+ LTRAN_ERR("ltran dumped, caught signal: %d.\n", sig);
print_stack();
dpdk_kni_release();
int ret = 0;
--
2.33.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。