net/iavf: fix txq flags setting after Tx path selection
PATCH 1/1 net/iavf: fix txq flags setting after Tx path selection
Ensure the txq flags "use_ctx" and "vector_tx" are set/unset properly after tx path selection. Prior to this commit these flags were only configured if a vector path was chosen. Fix this by making their configuration unconditional. Also simplify how the "vector_tx" flag is set by removing the dedicated function that sets the flag in favour of just setting it inline.
--- drivers/net/intel/iavf/iavf_rxtx.c | 15 ++++++--------- drivers/net/intel/iavf/iavf_rxtx.h | 1 - drivers/net/intel/iavf/iavf_rxtx_vec_avx2.c | 7 ------- 3 files changed, 6 insertions(+), 17 deletions(-)
drivers/net/intel/iavf/iavf_rxtx.c +6 -9
@@ -4263,15 +4263,12 @@ iavf_set_tx_function(struct rte_eth_dev *dev) out:#ifdef RTE_ARCH_X86 -if (iavf_tx_path_infos[adapter->tx_func_type].features.simd_width !=0 ) { -for (i =0 ; i < dev->data->nb_tx_queues; i++) { - txq = dev->data->tx_queues[i]; -if (!txq) -continue ; -iavf_txq_vec_setup (txq); - txq->use_ctx = - iavf_tx_path_infos[adapter->tx_func_type].features.ctx_desc; - } +for (i =0 ; i < dev->data->nb_tx_queues; i++) { + txq = dev->data->tx_queues[i]; +if (!txq) +continue ; + txq->use_ctx = iavf_tx_path_infos[adapter->tx_func_type].features.ctx_desc; + txq->vector_tx = iavf_tx_path_infos[adapter->tx_func_type].features.simd_width !=0 ; }#endif
drivers/net/intel/iavf/iavf_rxtx.h +0 -1
@@ -615,7 +615,6 @@ int iavf_get_monitor_addr(void *rx_queue, struct rte_power_monitor_cond *pmc);int iavf_rx_vec_dev_check (struct rte_eth_dev *dev);int iavf_tx_vec_dev_check (struct rte_eth_dev *dev);int iavf_rxq_vec_setup (struct ci_rx_queue *rxq); -int iavf_txq_vec_setup (struct ci_tx_queue *txq);uint16_t iavf_recv_pkts_vec_avx512 (void *rx_queue,struct rte_mbuf **rx_pkts,uint16_t nb_pkts); uint16_t iavf_recv_pkts_vec_avx512_offload(void *rx_queue,
drivers/net/intel/iavf/iavf_rxtx_vec_avx2.c +0 -7
@@ -1811,13 +1811,6 @@ iavf_xmit_pkts_vec_avx2_offload(void *tx_queue, struct rte_mbuf **tx_pkts,return iavf_xmit_pkts_vec_avx2_common (tx_queue, tx_pkts, nb_pkts, true); } -int __rte_cold -iavf_txq_vec_setup (struct ci_tx_queue *txq) -{ - txq->vector_tx = true; -return 0 ; -} - void __rte_coldiavf_rx_queue_release_mbufs_vec (struct ci_rx_queue *rxq) {
Signature · 1 line
2.43.0
Quoted 10 lines · Ciara Loftus
Ensure the txq flags "
use_ctx" and "vector_tx" are set/unset properly after tx path selection. Prior to this commit these flags were only configured if a vector path was chosen. Fix this by making their configuration unconditional. Also simplify how the "vector_tx" flag is set by removing the dedicated function that sets the flag in favour of just setting it inline.Fixes ebcfb039afa8 ("net/iavf: use common Tx path selection infrastructure")Signed-off-by Ciara Loftus <[email protected]>
This patch needs rebase following changes on next-net-intel. Some minor comments inline below also. You can keep my ack on next version.
Quoted 19 lines
--- drivers/net/intel/iavf/iavf_rxtx.c | 15 ++++++--------- drivers/net/intel/iavf/iavf_rxtx.h | 1 - drivers/net/intel/iavf/iavf_rxtx_vec_avx2.c | 7 ------- 3 files changed, 6 insertions(+), 17 deletions(-)drivers/net/intel/iavf/iavf_rxtx.c +0
-5@@ -4263,15 +4263,12 @@ iavf_set_tx_function(struct rte_eth_dev *dev) out: #ifdef RTE_ARCH_X86 -if (iavf_tx_path_infos[adapter->tx_func_type].features.simd_width !=0 ) { -for (i =0 ; i < dev->data->nb_tx_queues; i++) { - txq = dev->data->tx_queues[i]; -if (!txq) -continue ;
drivers/net/intel/iavf/iavf_rxtx.c iavf_set_tx_function(struct rte_eth_dev *dev) · line 4271
Quoted 10 lines
drivers/net/intel/iavf/iavf_rxtx.c +6
-4-iavf_txq_vec_setup (txq); - txq->use_ctx = - iavf_tx_path_infos[adapter->tx_func_type].features.ctx_desc; - } +for (i =0 ; i < dev->data->nb_tx_queues; i++) { + txq = dev->data->tx_queues[i]; +if (!txq) +continue ; + txq->use_ctx = iavf_tx_path_infos[adapter->tx_func_type].features.ctx_desc; + txq->vector_tx = iavf_tx_path_infos[adapter->tx_func_type].features.simd_width !=0 ;
With the rename of the vector_tx value, this becomes a long line that needs splitting. Might be worthwhile getting a pointer to the path info, or the features within it outside the loop to shorten both the assignment lines.
Also, I'm not sure about the comparison to zero for the simd_width. While not likely, it's possible in future we might specify e.g. 64 as the width for scalar ops, so would >= SIMD_128 be safer to use?
Quoted 36 lines
drivers/net/intel/iavf/iavf_rxtx.c +0
-0}#endif drivers/net/intel/iavf/iavf_rxtx.h +0
-1@@ -615,7 +615,6 @@ int iavf_get_monitor_addr(void *rx_queue, struct rte_power_monitor_cond *pmc);int iavf_rx_vec_dev_check (struct rte_eth_dev *dev);int iavf_tx_vec_dev_check (struct rte_eth_dev *dev);int iavf_rxq_vec_setup (struct ci_rx_queue *rxq); -int iavf_txq_vec_setup (struct ci_tx_queue *txq);uint16_t iavf_recv_pkts_vec_avx512 (void *rx_queue,struct rte_mbuf **rx_pkts,uint16_t nb_pkts); uint16_t iavf_recv_pkts_vec_avx512_offload(void *rx_queue,drivers/net/intel/iavf/iavf_rxtx_vec_avx2.c +0
-7@@ -1811,13 +1811,6 @@ iavf_xmit_pkts_vec_avx2_offload(void *tx_queue, struct rte_mbuf **tx_pkts,return iavf_xmit_pkts_vec_avx2_common (tx_queue, tx_pkts, nb_pkts, true); } -int __rte_cold -iavf_txq_vec_setup (struct ci_tx_queue *txq) -{ - txq->vector_tx = true; -return 0 ; -} - void __rte_coldiavf_rx_queue_release_mbufs_vec (struct ci_rx_queue *rxq) {Signature · 1 line
2.43.0
PATCH v2 1/1 net/iavf: fix txq flags setting after Tx path selection
In reply to Ciara LoftusEnsure the txq flags "use_ctx" and "use_vec_entry" are set/unset properly after tx path selection. Prior to this commit these flags were only configured if a vector path was chosen. Fix this by making their configuration unconditional. Also simplify how the "use_vec_entry" flag is set by removing the dedicated function that sets the flag in favour of just setting it inline.
---
v2:
* Get a pointer to the selected tx path features and use it instead of directly referencing it twice in a row.
* Use >= SIMD_128 instead of != 0 to determine if a selected path is vector (future proofing).
--- drivers/net/intel/iavf/iavf_rxtx.c | 17 ++++++++--------- drivers/net/intel/iavf/iavf_rxtx.h | 1 - drivers/net/intel/iavf/iavf_rxtx_vec_avx2.c | 7 ------- 3 files changed, 8 insertions(+), 17 deletions(-)
drivers/net/intel/iavf/iavf_rxtx.c +8 -9
@@ -3871,6 +3871,7 @@ iavf_set_tx_function(struct rte_eth_dev *dev)#ifdef RTE_ARCH_X86 struct ci_tx_queue *txq;int i; +const struct ci_tx_path_features *selected_features;#endif struct ci_tx_path_features req_features = { .tx_offloads = dev->data->dev_conf.txmode.offloads,
@@ -3905,15 +3906,13 @@ iavf_set_tx_function(struct rte_eth_dev *dev) out: #ifdef RTE_ARCH_X86 -if (iavf_tx_path_infos[adapter->tx_func_type].features.simd_width !=0 ) { -for (i =0 ; i < dev->data->nb_tx_queues; i++) { - txq = dev->data->tx_queues[i]; -if (!txq) -continue ; -iavf_txq_vec_setup (txq); - txq->use_ctx = - iavf_tx_path_infos[adapter->tx_func_type].features.ctx_desc; - } + selected_features = &iavf_tx_path_infos[adapter->tx_func_type].features; +for (i =0 ; i < dev->data->nb_tx_queues; i++) { + txq = dev->data->tx_queues[i]; +if (!txq) +continue ; + txq->use_ctx = selected_features->ctx_desc; + txq->use_vec_entry = selected_features->simd_width >=RTE_VECT_SIMD_128 ; }#endif
drivers/net/intel/iavf/iavf_rxtx.h +0 -1
@@ -592,7 +592,6 @@ int iavf_get_monitor_addr(void *rx_queue, struct rte_power_monitor_cond *pmc);int iavf_rx_vec_dev_check (struct rte_eth_dev *dev);int iavf_tx_vec_dev_check (struct rte_eth_dev *dev);int iavf_rxq_vec_setup (struct ci_rx_queue *rxq); -int iavf_txq_vec_setup (struct ci_tx_queue *txq);uint16_t iavf_recv_pkts_vec_avx512 (void *rx_queue,struct rte_mbuf **rx_pkts,uint16_t nb_pkts); uint16_t iavf_recv_pkts_vec_avx512_offload(void *rx_queue,
drivers/net/intel/iavf/iavf_rxtx_vec_avx2.c +0 -7
@@ -1800,13 +1800,6 @@ iavf_xmit_pkts_vec_avx2_offload(void *tx_queue, struct rte_mbuf **tx_pkts,return iavf_xmit_pkts_vec_avx2_common (tx_queue, tx_pkts, nb_pkts, true); } -int __rte_cold -iavf_txq_vec_setup (struct ci_tx_queue *txq) -{ - txq->use_vec_entry = true; -return 0 ; -} - void __rte_coldiavf_rx_queue_release_mbufs_vec (struct ci_rx_queue *rxq) {
Signature · 1 line
2.43.0
Bruce Richardson
AppliedQuoted 11 lines · Ciara Loftus
Ensure the txq flags "
use_ctx" and "use_vec_entry" are set/unset properly after tx path selection. Prior to this commit these flags were only configured if a vector path was chosen. Fix this by making their configuration unconditional. Also simplify how the "use_vec_entry" flag is set by removing the dedicated function that sets the flag in favour of just setting it inline.Fixes ebcfb039afa8 ("net/iavf: use common Tx path selection infrastructure")Signed-off-by Ciara Loftus <[email protected]>Acked-by Bruce Richardson <[email protected]>
Quoted 7 lines
---
v2:
* Get a pointer to the selected tx path features and use it instead of directly referencing it twice in a row.
* Use >=SIMD_128instead of != 0 to determine if a selected path is vector (future proofing).
---
Applied to dpdk-next-net-intel,
Thanks,
/Bruce