2 Star 0 Fork 32

我们17走/gazelle

forked from src-openEuler/gazelle 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0106-fix-dpdk_alloc_pktmbuf-time-consuming.patch 1.14 KB
一键复制 编辑 原始数据 按行查看 历史
From d40a2e46403547fc8d12ee1dacc6484eca1fbbeb Mon Sep 17 00:00:00 2001
From: jiangheng <jiangheng14@huawei.com>
Date: Fri, 5 Jan 2024 10:15:22 +0800
Subject: [PATCH] fix dpdk_alloc_pktmbuf time-consuming
---
src/lstack/core/lstack_dpdk.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/lstack/core/lstack_dpdk.c b/src/lstack/core/lstack_dpdk.c
index 729a84c..3182bb5 100644
--- a/src/lstack/core/lstack_dpdk.c
+++ b/src/lstack/core/lstack_dpdk.c
@@ -271,9 +271,14 @@ int32_t create_shared_ring(struct protocol_stack *stack)
int32_t dpdk_alloc_pktmbuf(struct rte_mempool *pool, struct rte_mbuf **mbufs, uint32_t num)
{
- if (rte_mempool_avail_count(pool) < MBUFPOOL_RESERVE_NUM + num) {
+ /*
+ * don't use rte_mempool_avail_count, it traverse cpu local cache,
+ * when RTE_MAX_LCORE is too large, it's time-consuming
+ */
+ if (rte_ring_count(pool->pool_data) < MBUFPOOL_RESERVE_NUM + num) {
return -ENOMEM;
}
+
int32_t ret = rte_pktmbuf_alloc_bulk(pool, mbufs, num);
if (ret != 0) {
LSTACK_LOG(ERR, LSTACK, "rte_pktmbuf_alloc_bulk fail allocNum=%d, ret=%d, info:%s \n",
--
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