2 Star 0 Fork 32

我们17走/gazelle

forked from src-openEuler/gazelle 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0113-lstack_dpdk-limit-mbuf-max-num.patch 2.67 KB
一键复制 编辑 原始数据 按行查看 历史
yinbin6 提交于 2024-01-20 14:40 . sync adpat dpdk 23.11
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
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/together17/gazelle.git
git@gitee.com:together17/gazelle.git
together17
gazelle
gazelle
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385