From: "Min Hu (Connor)" <humin29@huawei.com>
To: <dev@dpdk.org>
Cc: Chengwen Feng <fengchengwen@huawei.com>, <stable@dpdk.org>,
Min Hu <humin29@huawei.com>,
Yisen Zhuang <yisen.zhuang@huawei.com>,
Lijun Ou <oulijun@huawei.com>
Subject: [PATCH v2 4/7] net/hns3: fix more mbufs are freed when Tx done cleanup
Date: Thu, 5 May 2022 20:27:04 +0800 [thread overview]
Message-ID: <20220505122707.61182-5-humin29@huawei.com> (raw)
In-Reply-To: <20220505122707.61182-1-humin29@huawei.com>
From: Chengwen Feng <fengchengwen@huawei.com>
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
next prev parent reply other threads:[~2022-05-05 12:28 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20220406092240.52900-1-humin29@huawei.com>
[not found] ` <20220505122707.61182-1-humin29@huawei.com>
2022-05-05 12:27 ` [PATCH v2 1/7] net/hns3: fix order of clearing imissed register in PF Min Hu (Connor)
2022-05-05 12:27 ` [PATCH v2 2/7] net/hns3: fix MAC and queues HW statistics overflow Min Hu (Connor)
2022-05-05 12:27 ` [PATCH v2 3/7] net/hns3: fix pseudo-sharing between threads Min Hu (Connor)
2022-05-05 12:27 ` Min Hu (Connor) [this message]
2022-05-05 12:27 ` [PATCH v2 5/7] net/hns3: fix RSS disable Min Hu (Connor)
2022-05-05 12:27 ` [PATCH v2 6/7] net/hns3: fix undo rollback when update RSS hash Min Hu (Connor)
2022-05-05 12:27 ` [PATCH v2 7/7] net/hns3: remove redundant RSS tuple field Min Hu (Connor)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220505122707.61182-5-humin29@huawei.com \
--to=humin29@huawei.com \
--cc=dev@dpdk.org \
--cc=fengchengwen@huawei.com \
--cc=oulijun@huawei.com \
--cc=stable@dpdk.org \
--cc=yisen.zhuang@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).