patches for DPDK stable branches
 help / color / mirror / Atom feed
* [PATCH 1/1] drivers/net: fix checking for Tx simple
@ 2023-09-02  9:37 Min Zhou
  2023-09-04  1:59 ` zhoumin
  0 siblings, 1 reply; 2+ messages in thread
From: Min Zhou @ 2023-09-02  9:37 UTC (permalink / raw)
  To: liudongdong3, yisen.zhuang, Yuying.Zhang, beilei.xing,
	qiming.yang, qi.z.zhang, ferruh.yigit, roretzla, chenbo.xia,
	ajit.khaparde, jerinj, zhoumin
  Cc: dev, stable, maobibo

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/1] drivers/net: fix checking for Tx simple
  2023-09-02  9:37 [PATCH 1/1] drivers/net: fix checking for Tx simple Min Zhou
@ 2023-09-04  1:59 ` zhoumin
  0 siblings, 0 replies; 2+ messages in thread
From: zhoumin @ 2023-09-04  1:59 UTC (permalink / raw)
  To: liudongdong3, yisen.zhuang, Yuying.Zhang, beilei.xing,
	qiming.yang, qi.z.zhang, ferruh.yigit, roretzla, chenbo.xia,
	ajit.khaparde, jerinj
  Cc: dev, stable, maobibo

I'm sorry, I think the checking logic is certainly right after I read 
more codes in other drivers. I just wanted to use the i40e_xmit_pkts() 
function to send packets via testpmd. I noticed that the 
tx_simple_allowed should be false if I want to use the function to send 
packets. So, I'm studying how to set the offload in testpmd cmdline to 
achieve it.

On Sat, Sep 2, 2023 at 5:37PM, Min Zhou wrote:
> 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)


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-09-04  1:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-02  9:37 [PATCH 1/1] drivers/net: fix checking for Tx simple Min Zhou
2023-09-04  1:59 ` zhoumin

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).