net/i40e: unset vector flag when scalar path is chosen
cover net/i40e: unset vector flag when scalar path is chosen
The tx_vec_allowed flag should be set to false if a scalar Tx path is chosen.
If possible this commit can be squashed into the commit it fixes on the next-net-intel tree. If the SSE removal series [1] is merged before this patch is applied, this patch does not require any changes.
[1] https://patches.dpdk.org/project/dpdk/cover/[email protected]/
Ciara Loftus (1):
net/i40e: unset vector flag when scalar path is chosen
drivers/net/intel/i40e/i40e_rxtx.c | 3 +++ 1 file changed, 3 insertions(+)
Signature · 1 line
2.43.0
PATCH 1/1 net/i40e: unset vector flag when scalar path is chosen
The tx_vec_allowed flag should be set to false if a scalar Tx path is chosen.
--- drivers/net/intel/i40e/i40e_rxtx.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/intel/i40e/i40e_rxtx.c +3 -0
@@ -3631,6 +3631,9 @@ i40e_set_tx_function(struct rte_eth_dev *dev) ad->tx_func_type ==I40E_TX_ALTIVEC || ad->tx_func_type == I40E_TX_AVX2) dev->recycle_tx_mbufs_reuse = i40e_recycle_tx_mbufs_reuse_vec; + +if (i40e_tx_path_infos[ad->tx_func_type].features.simd_width <RTE_VECT_SIMD_128 ) + ad->tx_vec_allowed = false; }int
Signature · 1 line
2.43.0
Quoted 15 lines · Ciara Loftus
The
tx_vec_allowedflag should be set to false if a scalar Tx path is chosen.Fixes 1ff08bb7ad90 ("net/i40e: use common Tx path selection infrastructure")Signed-off-by Ciara Loftus <[email protected]>--- drivers/net/intel/i40e/i40e_rxtx.c | 3 +++ 1 file changed, 3 insertions(+)drivers/net/intel/i40e/i40e_rxtx.c +0
-0
drivers/net/intel/i40e/i40e_rxtx.c i40e_set_tx_function(struct rte_eth_dev *dev) · line 3638
Quoted 8 lines
drivers/net/intel/i40e/i40e_rxtx.c +3
-0@@ -3631,6 +3631,9 @@ i40e_set_tx_function(struct rte_eth_dev *dev) ad->tx_func_type ==I40E_TX_ALTIVEC || ad->tx_func_type == I40E_TX_AVX2) dev->recycle_tx_mbufs_reuse = i40e_recycle_tx_mbufs_reuse_vec; + +if (i40e_tx_path_infos[ad->tx_func_type].features.simd_width <RTE_VECT_SIMD_128 ) + ad->tx_vec_allowed = false; }
Under what circumstances would this be a problem, or under what circumstances would we have this situaion?
/Bruce
Quoted 25 lines
Subject: Re: [PATCH 1/1] net/i40e: unset vector flag when scalar path is chosen
Quoted 4 lines · Ciara Loftus
The
tx_vec_allowedflag should be set to false if a scalar Tx path is chosen.Fixes 1ff08bb7ad90 ("net/i40e: use common Tx path selectioninfrastructure")
Review
Quoted 7 lines
Signed-off-by Ciara Loftus <[email protected]>--- drivers/net/intel/i40e/i40e_rxtx.c | 3 +++ 1 file changed, 3 insertions(+)(quoted diff) +0
-0
b/drivers/net/intel/i40e/i40e_rxtx.cdrivers/net/intel/i40e/i40e_rxtx.c i40e_set_tx_function(struct rte_eth_dev *dev) · line 3633
Quoted 7 lines
index
2db58c6b24..dd859bda4e100644drivers/net/intel/i40e/i40e_rxtx.c +0
-0@@ -3631,6 +3631,9 @@ i40e_set_tx_function(struct rte_eth_dev *dev) ad->tx_func_type ==I40E_TX_ALTIVEC || ad->tx_func_type == I40E_TX_AVX2) dev->recycle_tx_mbufs_reuse =
i40e_recycle_tx_mbufs_reuse_vec;
Quoted 8 lines
drivers/net/intel/i40e/i40e_rxtx.c i40e_set_tx_function(struct rte_eth_dev *dev) · line 3635
Quoted 2 lines
drivers/net/intel/i40e/i40e_rxtx.c +2
-0+ + if (i40e_tx_path_infos[ad->tx_func_type].features.simd_width <
RTE_VECT_SIMD_128)drivers/net/intel/i40e/i40e_rxtx.c i40e_set_tx_function(struct rte_eth_dev *dev) · line 3638
Quoted 3 lines
drivers/net/intel/i40e/i40e_rxtx.c +1
-0+ ad->tx_vec_allowed = false; }Under what circumstances would this be a problem, or under what circumstances would we have this situaion?
The circumstances we would have this situation is when the driver determines that tx vectorisation is allowed but we end up selecting a scalar path. The result would be "vector_tx" being set for the txq during tx_queue_start and later during tx_queue_stop, the wrong path being taken in ci_txq_release_all_mbufs
Quoted 2 lines
/Bruce
Quoted 34 lines · Ciara
Quoted 25 lines
Subject: Re: [PATCH 1/1] net/i40e: unset vector flag when scalar path is chosen
Quoted 4 lines · Ciara Loftus
The
tx_vec_allowedflag should be set to false if a scalar Tx path is chosen.Fixes 1ff08bb7ad90 ("net/i40e: use common Tx path selectioninfrastructure")
Review
Quoted 7 lines
Signed-off-by Ciara Loftus <[email protected]>--- drivers/net/intel/i40e/i40e_rxtx.c | 3 +++ 1 file changed, 3 insertions(+)(quoted diff) +0
-0
b/drivers/net/intel/i40e/i40e_rxtx.cdrivers/net/intel/i40e/i40e_rxtx.c i40e_set_tx_function(struct rte_eth_dev *dev) · line 3633
Quoted 7 lines
index
2db58c6b24..dd859bda4e100644drivers/net/intel/i40e/i40e_rxtx.c +0
-0@@ -3631,6 +3631,9 @@ i40e_set_tx_function(struct rte_eth_dev *dev) ad->tx_func_type ==I40E_TX_ALTIVEC || ad->tx_func_type == I40E_TX_AVX2) dev->recycle_tx_mbufs_reuse =
i40e_recycle_tx_mbufs_reuse_vec;Quoted 8 lines
drivers/net/intel/i40e/i40e_rxtx.c i40e_set_tx_function(struct rte_eth_dev *dev) · line 3635
Quoted 2 lines
drivers/net/intel/i40e/i40e_rxtx.c +2
-0+ + if (i40e_tx_path_infos[ad->tx_func_type].features.simd_width <
RTE_VECT_SIMD_128)drivers/net/intel/i40e/i40e_rxtx.c i40e_set_tx_function(struct rte_eth_dev *dev) · line 3638
Quoted 3 lines
drivers/net/intel/i40e/i40e_rxtx.c +1
-0+ ad->tx_vec_allowed = false; }Under what circumstances would this be a problem, or under what circumstances would we have this situaion?
Quoted 6 lines
The circumstances we would have this situation is when the driver determines that tx vectorisation is allowed but we end up selecting a scalar path. The result would be "
vector_tx" being set for the txq duringtx_queue_startand later duringtx_queue_stop, the wrong path being taken inci_txq_release_all_mbufs
Would this be better fixed by some refactoring to chose the release function based on ad->tx_func_type, rather than having a separate vector flag?
If not, may I suggest that you remove the if condition, and just do:
ad->tx_vec_allowed = (i40e_tx_path_infos[ad->tx_func_type].features.simd_width < RTE_VECT_SIMD_128);
Quoted 43 lines · Ciara
Quoted 15 lines
Quoted 15 lines
Subject: Re: [PATCH 1/1] net/i40e: unset vector flag when scalar path is chosen
Quoted 4 lines · Ciara Loftus
The
tx_vec_allowedflag should be set to false if a scalar Tx path is chosen.Fixes 1ff08bb7ad90 ("net/i40e: use common Tx path selectioninfrastructure")
Quoted 6 lines
Signed-off-by Ciara Loftus <[email protected]>--- drivers/net/intel/i40e/i40e_rxtx.c | 3 +++ 1 file changed, 3 insertions(+)Quoted 6 lines
Quoted 6 lines
Review
Quoted 1 line
(quoted diff) +0
-0
b/drivers/net/intel/i40e/i40e_rxtx.cdrivers/net/intel/i40e/i40e_rxtx.c i40e_set_tx_function(struct rte_eth_dev
Quoted 4 lines
index
2db58c6b24..dd859bda4e100644drivers/net/intel/i40e/i40e_rxtx.c +0
-0@@ -3631,6 +3631,9 @@ i40e_set_tx_function(struct rte_eth_dev*dev)
Quoted 13 lines
Quoted 4 lines
drivers/net/intel/i40e/i40e_rxtx.c i40e_set_tx_function(struct rte_eth_dev *dev)
Quoted 3 lines
drivers/net/intel/i40e/i40e_rxtx.c +0
-0ad->tx_func_type ==I40E_TX_ALTIVEC || ad->tx_func_type == I40E_TX_AVX2) dev->recycle_tx_mbufs_reuse =
i40e_recycle_tx_mbufs_reuse_vec;Quoted 8 lines
drivers/net/intel/i40e/i40e_rxtx.c i40e_set_tx_function(struct rte_eth_dev · line 3635
Quoted 2 lines
drivers/net/intel/i40e/i40e_rxtx.c +2
-0+ + if (i40e_tx_path_infos[ad->tx_func_type].features.simd_width <
RTE_VECT_SIMD_128)drivers/net/intel/i40e/i40e_rxtx.c i40e_set_tx_function(struct rte_eth_dev *dev) · line 3638
Quoted 3 lines
drivers/net/intel/i40e/i40e_rxtx.c +1
-0+ ad->tx_vec_allowed = false; }Under what circumstances would this be a problem, or under what circumstances would we have this situaion?
Quoted 6 lines
The circumstances we would have this situation is when the driver determines that tx vectorisation is allowed but we end up selecting a scalar path. The result would be "
vector_tx" being set for the txq duringtx_queue_startand later duringtx_queue_stop, the wrong path being taken inci_txq_release_all_mbufs
Quoted 8 lines
Would this be better fixed by some refactoring to chose the release function based on
ad->tx_func_type, rather than having a separate vector flag?If not, may I suggest that you remove the if condition, and just do:
ad->tx_vec_allowed = (i40e_tx_path_infos[ad->tx_func_type].features.simd_width <
RTE_VECT_SIMD_128);
The release function is in the common code so it must use the txq->vector_tx flag.
I think we need to also keep the adapter->tx_vec_allowed flag as it's used elsewhere in the driver beyond setting the appropriate value to txq->vector_tx. eg. in the i40e_dev_tx_queue_setup_runtime function.
I think there might scope for some further refactoring here but it would end up touching a number of places in the code. In the interest of time and simplicity I propose implementing the fix you suggested above for now and maybe revisiting further refactoring later.