From: Min Zhou <zhoumin@loongson.cn>
To: liudongdong3@huawei.com, yisen.zhuang@huawei.com,
Yuying.Zhang@intel.com, beilei.xing@intel.com,
qiming.yang@intel.com, qi.z.zhang@intel.com,
ferruh.yigit@intel.com, roretzla@linux.microsoft.com,
chenbo.xia@intel.com, ajit.khaparde@broadcom.com,
jerinj@marvell.com, zhoumin@loongson.cn
Cc: dev@dpdk.org, stable@dpdk.org, maobibo@loongson.cn
Subject: [PATCH 1/1] drivers/net: fix checking for Tx simple
Date: Sat, 2 Sep 2023 17:37:08 +0800 [thread overview]
Message-ID: <20230902093708.2474711-1-zhoumin@loongson.cn> (raw)
We have such checking logic for Tx simple in some drivers, such as
i40e, ice and hns3:
/* Use a simple Tx queue if possible (only fast free is allowed) */
ad->tx_simple_allowed =
(txq->offloads ==
(txq->offloads & RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE) &&
txq->tx_rs_thresh >= RTE_PMD_I40E_TX_MAX_BURST);
What's confusing is that we will get the same result from above checking if
txq->offloads == 0 or txq->offloads == RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE.
Is this the right checking logic for Tx simple? Besides, I haven't seen the
similar usage to check the offload for RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE.
Fix it if the checking logic is wrong.
Fixes: 295968d1740 ("ethdev: add namespace")
Cc: stable@dpdk.org
Signed-off-by: Min Zhou <zhoumin@loongson.cn>
---
drivers/net/hns3/hns3_rxtx.c | 2 +-
drivers/net/i40e/i40e_rxtx.c | 3 +--
drivers/net/ice/ice_rxtx.c | 3 +--
3 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c
index f3c3b38c55..4c04187ce7 100644
--- a/drivers/net/hns3/hns3_rxtx.c
+++ b/drivers/net/hns3/hns3_rxtx.c
@@ -4357,7 +4357,7 @@ hns3_tx_check_simple_support(struct rte_eth_dev *dev)
{
uint64_t offloads = dev->data->dev_conf.txmode.offloads;
- return (offloads == (offloads & RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE));
+ return !!(offloads & RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE);
}
static bool
diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c
index d96bbbb677..c706c73880 100644
--- a/drivers/net/i40e/i40e_rxtx.c
+++ b/drivers/net/i40e/i40e_rxtx.c
@@ -3421,8 +3421,7 @@ i40e_set_tx_function_flag(struct rte_eth_dev *dev, struct i40e_tx_queue *txq)
/* Use a simple Tx queue if possible (only fast free is allowed) */
ad->tx_simple_allowed =
- (txq->offloads ==
- (txq->offloads & RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE) &&
+ ((txq->offloads & RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE) &&
txq->tx_rs_thresh >= RTE_PMD_I40E_TX_MAX_BURST);
ad->tx_vec_allowed = (ad->tx_simple_allowed &&
txq->tx_rs_thresh <= RTE_I40E_TX_MAX_FREE_BUF_SZ);
diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c
index e07c6d1f15..3dbf6c592d 100644
--- a/drivers/net/ice/ice_rxtx.c
+++ b/drivers/net/ice/ice_rxtx.c
@@ -3640,8 +3640,7 @@ ice_set_tx_function_flag(struct rte_eth_dev *dev, struct ice_tx_queue *txq)
/* Use a simple Tx queue if possible (only fast free is allowed) */
ad->tx_simple_allowed =
- (txq->offloads ==
- (txq->offloads & RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE) &&
+ ((txq->offloads & RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE) &&
txq->tx_rs_thresh >= ICE_TX_MAX_BURST);
if (ad->tx_simple_allowed)
--
2.39.1
next reply other threads:[~2023-09-02 9:38 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-02 9:37 Min Zhou [this message]
2023-09-04 1:59 ` zhoumin
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=20230902093708.2474711-1-zhoumin@loongson.cn \
--to=zhoumin@loongson.cn \
--cc=Yuying.Zhang@intel.com \
--cc=ajit.khaparde@broadcom.com \
--cc=beilei.xing@intel.com \
--cc=chenbo.xia@intel.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.com \
--cc=jerinj@marvell.com \
--cc=liudongdong3@huawei.com \
--cc=maobibo@loongson.cn \
--cc=qi.z.zhang@intel.com \
--cc=qiming.yang@intel.com \
--cc=roretzla@linux.microsoft.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).