[PATCH 1/1] drivers/net: fix checking for Tx simple
Min Zhou
zhoumin at loongson.cn
Sat Sep 2 11:37:08 CEST 2023
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 at dpdk.org
Signed-off-by: Min Zhou <zhoumin at 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
More information about the dev
mailing list