代码拉取完成,页面将自动刷新
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
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。