1 Star 0 Fork 75

sky/dpdk

forked from src-openEuler/dpdk 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0078-net-hns3-fix-mbuf-free-on-Tx-done-cleanup.patch 1.58 KB
一键复制 编辑 原始数据 按行查看 历史
speech_white 提交于 2022-05-17 19:55 . sync patches for 22.03
From 2d287ea3c2301219c201617df15efa161deabf76 Mon Sep 17 00:00:00 2001
From: Chengwen Feng <fengchengwen@huawei.com>
Date: Thu, 5 May 2022 20:27:04 +0800
Subject: [PATCH] net/hns3: fix mbuf free on Tx done cleanup
Currently, the hns3 PMD may free more mbufs than free_cnt parameter,
this is an incorrect implementation. This patch fixes it.
Fixes: 0b77e8f3d364 ("net/hns3: optimize Tx performance")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
---
drivers/net/hns3/hns3_rxtx.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c
index a28de06dfd..0c91e4721e 100644
--- a/drivers/net/hns3/hns3_rxtx.c
+++ b/drivers/net/hns3/hns3_rxtx.c
@@ -4595,7 +4595,7 @@ hns3_dev_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id)
static int
hns3_tx_done_cleanup_full(struct hns3_tx_queue *txq, uint32_t free_cnt)
{
- uint16_t round_free_cnt;
+ uint16_t round_cnt;
uint32_t idx;
if (free_cnt == 0 || free_cnt > txq->nb_tx_desc)
@@ -4604,13 +4604,13 @@ hns3_tx_done_cleanup_full(struct hns3_tx_queue *txq, uint32_t free_cnt)
if (txq->tx_rs_thresh == 0)
return 0;
- round_free_cnt = roundup(free_cnt, txq->tx_rs_thresh);
- for (idx = 0; idx < round_free_cnt; idx += txq->tx_rs_thresh) {
+ round_cnt = rounddown(free_cnt, txq->tx_rs_thresh);
+ for (idx = 0; idx < round_cnt; idx += txq->tx_rs_thresh) {
if (hns3_tx_free_useless_buffer(txq) != 0)
break;
}
- return RTE_MIN(idx, free_cnt);
+ return idx;
}
int
--
2.33.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/nlgwcy/dpdk.git
git@gitee.com:nlgwcy/dpdk.git
nlgwcy
dpdk
dpdk
master

搜索帮助