Skip to contentSkip to conversation

net/i40e: fix mbuf fast free wrong check

PATCH In review Murphy Yang 2 participants 2 messages Apr 7, 2021 – Apr 8, 2021 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/i40e: fix mbuf fast free wrong check

If no offload flags are set, then 0 == 0 & <anything> is true. This means that if DEV_TX_OFFLOAD_MBUF_FAST_FREE is not set (and no other flags are set) then this check will still enable tx_simple_allowed.

This patch adds the 'offloads' flag not equal zero to avoid this scenario.

Bugzilla ID: 665

Fixes 399421100e08 ("net/i40e: fix missing mbuf fast free offload")
---
 drivers/net/i40e/i40e_rxtx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/i40e/i40e_rxtx.c +1 -1
index b3d7765e3b..1450b228ca 100644
@@ -3345,7 +3345,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 != 0 && txq->offloads ==
 		 (txq->offloads & DEV_TX_OFFLOAD_MBUF_FAST_FREE) &&
 		 txq->tx_rs_thresh >= RTE_PMD_I40E_TX_MAX_BURST);
 	ad->tx_vec_allowed = (ad->tx_simple_allowed &&
Signature · 1 line
2.17.1
#1 lore raw
Quoted 31 lines

-----Original Message-----
From: Yang, MurphyX <[email protected]>
Sent: Wednesday, April 7, 2021 2:37 PM
To: [email protected]
Cc: Yang, Qiming <[email protected]>; Guo, Jia <[email protected]>; Xing, Beilei <[email protected]>; Zhang, Qi Z <[email protected]>; Yang, SteveX <[email protected]>; Zhang, RobinX <[email protected]>; Yang, MurphyX <[email protected]>
Subject: [PATCH] net/i40e: fix mbuf fast free wrong check

If no offload flags are set, then 0 == 0 & <anything> is true. This means that if DEV_TX_OFFLOAD_MBUF_FAST_FREE is not set (and no other flags are set) then this check will still enable tx_simple_allowed.

This patch adds the 'offloads' flag not equal zero to avoid this scenario.

Bugzilla ID: 665

Fixes 399421100e08 ("net/i40e: fix missing mbuf fast free offload")
---
 drivers/net/i40e/i40e_rxtx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/i40e/i40e_rxtx.c index renamed from drivers/net/i40e/i40e_rxtx.c +0 -0

b3d7765e3b..1450b228ca 100644

drivers/net/i40e/i40e_rxtx.c i40e_set_tx_function_flag(struct rte_eth_dev *dev, · line 3350

Quoted 7 lines
drivers/net/i40e/i40e_rxtx.c +1 -1
@@ -3345,7 +3345,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 != 0 && txq->offloads ==
 		 (txq->offloads & DEV_TX_OFFLOAD_MBUF_FAST_FREE) &&

I don't think this is correct.

Why simple_tx can't be selected if no DEV_TX_OFFLOAD_MBUF_FAST_FREE is required?

Actually, the original code means, the max Tx offload that simple_tx support is DEV_TX_OFFLOAD_MBUF_FAST_FREE, you can't have more than it, but cannot have it.

Quoted 4 lines
drivers/net/i40e/i40e_rxtx.c +0 -0
 		 txq->tx_rs_thresh >= RTE_PMD_I40E_TX_MAX_BURST);

ad->tx_vec_allowed = (ad->tx_simple_allowed &&
--
2.17.1