Fix multi process path selection in Intel drivers
cover Fix multi process path selection in Intel drivers
This series fixes and makes consistent the approach to selecting Rx and Tx paths in a multi process scenario across the Intel drivers that use the common path selection framework.
In v25.11 the i40e, iavf and ice drivers prevented Rx path selection by secondary processes, in favour of simply selecting the path chosen by the primary process. However, this model does not work if the primary process hasn't started the device before the secondary process encounters the path selection logic. To address this, permit path selection by any process, so long as the device has not yet been started. This allows for the use case where the secondary process is the process that starts the device.
The idpf and cpfl drivers are updated to follow this model as well.
The same issue exists for the Tx path selection for i40e, iavf, ice, idpf and cpfl, so implement the same logic when selecting a Tx path as well ie. permit path selection if the device has not been started.
I kept the patches for fixing the Rx and Tx path selection separate, as the patches that target the Rx side will need to be backported to v25.11 whereas the patches for the Tx side do not as that logic was introduced post v25.11.
Ciara Loftus (10):
net/i40e: permit secondary process Rx path selection net/iavf: permit secondary process Rx path selection net/ice: permit secondary process Rx path selection net/idpf: prevent Rx path selection after device start net/cpfl: prevent Rx path selection after device start net/i40e: permit secondary process Tx path selection net/iavf: permit secondary process Tx path selection net/ice: permit secondary process Tx path selection net/idpf: permit secondary process Tx path selection net/cpfl: permit secondary process Tx path selection
drivers/net/intel/cpfl/cpfl_rxtx.c | 9 +++++++-- drivers/net/intel/i40e/i40e_rxtx.c | 8 ++++---- drivers/net/intel/iavf/iavf_rxtx.c | 8 ++++---- drivers/net/intel/ice/ice_rxtx.c | 8 ++++---- drivers/net/intel/idpf/idpf_rxtx.c | 9 +++++++-- 5 files changed, 26 insertions(+), 16 deletions(-)
Signature · 1 line
2.43.0
PATCH 1/10 net/i40e: permit secondary process Rx path selection
Commit 258f346f5d5e ("net/i40e: use same Rx path across processes") changed the way that secondary processes selected their Rx burst function. Instead of letting secondary processes select their own function, they now used the function selected by the primary process. However, the primary process only selects the function at device start, so if the primary process hadn't started the device by the time the secondary process was selecting its Rx burst function, the secondary process would not select the correct function.
This commit addresses this issue by allowing the secondary process to select the path if the device has not been started yet.
--- drivers/net/intel/i40e/i40e_rxtx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/intel/i40e/i40e_rxtx.c +2 -2
@@ -3494,8 +3494,8 @@ i40e_set_rx_function(struct rte_eth_dev *dev)uint16_t i;enum rte_vect_max_simd rx_simd_width =i40e_get_max_simd_bitwidth (); -/* The primary process selects the rx path for all processes. */ -if (rte_eal_process_type () !=RTE_PROC_PRIMARY ) +/* If the device has started the function has already been selected. */ +if (dev->data->dev_started) goto out;/* In order to allow Vector Rx there are a few configuration
Signature · 1 line
2.43.0
PATCH 2/10 net/iavf: permit secondary process Rx path selection
In reply to Ciara LoftusCommit 3f59c3d97a89 ("net/iavf: use same Rx path across processes") changed the way that secondary processes selected their Rx burst function. Instead of letting secondary processes select their own function, they now used the function selected by the primary process. However, the primary process only selects the function at device start, so if the primary process hadn't started the device by the time the secondary process was selecting its Rx burst function, the secondary process would not select the correct function.
This commit addresses this issue by allowing the secondary process to select the path if the device has not been started yet.
--- drivers/net/intel/iavf/iavf_rxtx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/intel/iavf/iavf_rxtx.c +2 -2
@@ -4173,8 +4173,8 @@ iavf_set_rx_function(struct rte_eth_dev *dev) .simd_width = RTE_VECT_SIMD_DISABLED, }; -/* The primary process selects the rx path for all processes. */ -if (rte_eal_process_type () !=RTE_PROC_PRIMARY ) +/* If the device has started the function has already been selected. */ +if (dev->data->dev_started) goto out;for (i =0 ; i < dev->data->nb_rx_queues; i++) {
Signature · 1 line
2.43.0
PATCH 3/10 net/ice: permit secondary process Rx path selection
In reply to Ciara LoftusCommit 197e70fb8961 ("net/ice: use same Rx path across processes") changed the way that secondary processes selected their Rx burst function. Instead of letting secondary processes select their own function, they now used the function selected by the primary process. However, the primary process only selects the function at device start, so if the primary process hadn't started the device by the time the secondary process was selecting its Rx burst function, the secondary process would not select the correct function.
This commit addresses this issue by allowing the secondary process to select the path if the device has not been started yet.
--- drivers/net/intel/ice/ice_rxtx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/intel/ice/ice_rxtx.c +2 -2
@@ -3822,8 +3822,8 @@ ice_set_rx_function(struct rte_eth_dev *dev) .simd_width = RTE_VECT_SIMD_DISABLED, }; -/* The primary process selects the rx path for all processes. */ -if (rte_eal_process_type () !=RTE_PROC_PRIMARY ) +/* If the device has started the function has already been selected. */ +if (dev->data->dev_started) goto out;#ifdef RTE_ARCH_X86
Signature · 1 line
2.43.0
PATCH 4/10 net/idpf: prevent Rx path selection after device start
In reply to Ciara LoftusTo fall in line with other drivers using the Rx path selection infrastructure, prevent Rx path selection after the device has started.
--- drivers/net/intel/idpf/idpf_rxtx.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/intel/idpf/idpf_rxtx.c +5 -0
@@ -783,6 +783,10 @@ idpf_set_rx_function(struct rte_eth_dev *dev)struct idpf_rx_queue *rxq;int i; +/* If the device has started the function has already been selected. */ +if (dev->data->dev_started) + goto out; +if (idpf_rx_vec_dev_check_default (dev) ==IDPF_VECTOR_PATH &&rte_vect_get_max_simd_bitwidth () >=RTE_VECT_SIMD_256 ) req_features.simd_width =idpf_get_max_simd_bitwidth ();
@@ -814,6 +818,7 @@ idpf_set_rx_function(struct rte_eth_dev *dev) }#endif +out: dev->rx_pkt_burst = idpf_rx_path_infos[ad->rx_func_type].pkt_burst;PMD_DRV_LOG (NOTICE ,"Using %s Rx (port %d)." , idpf_rx_path_infos[ad->rx_func_type].info, dev->data->port_id);
Signature · 1 line
2.43.0
PATCH 5/10 net/cpfl: prevent Rx path selection after device start
In reply to Ciara LoftusTo fall in line with other drivers using the Rx path selection infrastructure, prevent Rx path selection after the device has started.
--- drivers/net/intel/cpfl/cpfl_rxtx.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/intel/cpfl/cpfl_rxtx.c +5 -0
@@ -1430,6 +1430,10 @@ cpfl_set_rx_function(struct rte_eth_dev *dev)struct cpfl_rx_queue *cpfl_rxq;int i; +/* If the device has started the function has already been selected. */ +if (dev->data->dev_started) + goto out; +if (cpfl_rx_vec_dev_check_default (dev) ==CPFL_VECTOR_PATH &&rte_vect_get_max_simd_bitwidth () >=RTE_VECT_SIMD_256 ) req_features.simd_width =cpfl_get_max_simd_bitwidth ();
@@ -1462,6 +1466,7 @@ cpfl_set_rx_function(struct rte_eth_dev *dev) }#endif +out: dev->rx_pkt_burst = idpf_rx_path_infos[ad->rx_func_type].pkt_burst;PMD_DRV_LOG (NOTICE ,"Using %s Rx (port %d)." , idpf_rx_path_infos[ad->rx_func_type].info, dev->data->port_id);
Signature · 1 line
2.43.0
PATCH 6/10 net/i40e: permit secondary process Tx path selection
In reply to Ciara LoftusCommit 8d57c1788806 ("net/i40e: use common Tx path selection infrastructure") changed the way that secondary processes selected their Tx burst function. Instead of letting secondary processes select their own function, they now used the function selected by the primary process. However, the primary process only selects the function at device start, so if the primary process hadn't started the device by the time the secondary process was selecting its Tx burst function, the secondary process would not select the correct function.
This commit addresses this issue by allowing the secondary process to select the path if the device has not been started yet.
--- drivers/net/intel/i40e/i40e_rxtx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/intel/i40e/i40e_rxtx.c +2 -2
@@ -3597,8 +3597,8 @@ i40e_set_tx_function(struct rte_eth_dev *dev) .simple_tx = ad->tx_simple_allowed }; -/* The primary process selects the tx path for all processes. */ -if (rte_eal_process_type () !=RTE_PROC_PRIMARY ) +/* If the device has started the function has already been selected. */ +if (dev->data->dev_started) goto out;if (ad->tx_vec_allowed) {
Signature · 1 line
2.43.0
PATCH 7/10 net/iavf: permit secondary process Tx path selection
In reply to Ciara LoftusCommit ebcfb039afa8 ("net/iavf: use common Tx path selection infrastructure") changed the way that secondary processes selected their Tx burst function. Instead of letting secondary processes select their own function, they now used the function selected by the primary process. However, the primary process only selects the function at device start, so if the primary process hadn't started the device by the time the secondary process was selecting its Tx burst function, the secondary process would not select the correct function.
This commit addresses this issue by allowing the secondary process to select the path if the device has not been started yet.
--- drivers/net/intel/iavf/iavf_rxtx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/intel/iavf/iavf_rxtx.c +2 -2
@@ -4235,8 +4235,8 @@ iavf_set_tx_function(struct rte_eth_dev *dev) .simd_width = RTE_VECT_SIMD_DISABLED, }; -/* The primary process selects the tx path for all processes. */ -if (rte_eal_process_type () !=RTE_PROC_PRIMARY ) +/* If the device has started the function has already been selected. */ +if (dev->data->dev_started) goto out;#ifdef RTE_ARCH_X86
Signature · 1 line
2.43.0
PATCH 8/10 net/ice: permit secondary process Tx path selection
In reply to Ciara LoftusCommit cf96ec231d02 ("net/ice: use common Tx path selection infrastructure") changed the way that secondary processes selected their Tx burst function. Instead of letting secondary processes select their own function, they now used the function selected by the primary process. However, the primary process only selects the function at device start, so if the primary process hadn't started the device by the time the secondary process was selecting its Tx burst function, the secondary process would not select the correct function.
This commit addresses this issue by allowing the secondary process to select the path if the device has not been started yet.
--- drivers/net/intel/ice/ice_rxtx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/intel/ice/ice_rxtx.c +2 -2
@@ -4163,8 +4163,8 @@ ice_set_tx_function(struct rte_eth_dev *dev) .simd_width = RTE_VECT_SIMD_DISABLED, }; -/* The primary process selects the tx path for all processes. */ -if (rte_eal_process_type () !=RTE_PROC_PRIMARY ) +/* If the device has started the function has already been selected. */ +if (dev->data->dev_started) goto out; req_features.simple_tx = ad->tx_simple_allowed;
Signature · 1 line
2.43.0
PATCH 9/10 net/idpf: permit secondary process Tx path selection
In reply to Ciara LoftusCommit 7cab7e67363a ("net/idpf: use common Tx path selection infrastructure") changed the way that secondary processes selected their Tx burst function. Instead of letting secondary processes select their own function, they now used the function selected by the primary process. However, the primary process only selects the function at device start, so if the primary process hadn't started the device by the time the secondary process was selecting its Tx burst function, the secondary process would not select the correct function.
This commit addresses this issue by allowing the secondary process to select the path if the device has not been started yet.
--- drivers/net/intel/idpf/idpf_rxtx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/intel/idpf/idpf_rxtx.c +2 -2
@@ -842,8 +842,8 @@ idpf_set_tx_function(struct rte_eth_dev *dev) .single_queue = (vport->txq_model == VIRTCHNL2_QUEUE_MODEL_SINGLE) }; -/* The primary process selects the tx path for all processes. */ -if (rte_eal_process_type () !=RTE_PROC_PRIMARY ) +/* If the device has started the function has already been selected. */ +if (dev->data->dev_started) goto out;#ifdef RTE_ARCH_X86
Signature · 1 line
2.43.0
PATCH 10/10 net/cpfl: permit secondary process Tx path selection
In reply to Ciara LoftusCommit 6970745698b9 ("net/cpfl: use common Tx path selection infrastructure") changed the way that secondary processes selected their Tx burst function. Instead of letting secondary processes select their own function, they now used the function selected by the primary process. However, the primary process only selects the function at device start, so if the primary process hadn't started the device by the time the secondary process was selecting its Tx burst function, the secondary process would not select the correct function.
This commit addresses this issue by allowing the secondary process to select the path if the device has not been started yet.
--- drivers/net/intel/cpfl/cpfl_rxtx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/intel/cpfl/cpfl_rxtx.c +2 -2
@@ -1491,8 +1491,8 @@ cpfl_set_tx_function(struct rte_eth_dev *dev) .single_queue = (vport->txq_model == VIRTCHNL2_QUEUE_MODEL_SINGLE) }; -/* The primary process selects the tx path for all processes. */ -if (rte_eal_process_type () !=RTE_PROC_PRIMARY ) +/* If the device has started the function has already been selected. */ +if (dev->data->dev_started) goto out;#ifdef RTE_ARCH_X86
Signature · 1 line
2.43.0
v2 cover Fix multi process path selection in Intel drivers
In reply to Ciara LoftusThis series fixes and makes consistent the approach to selecting Rx and Tx paths in a multi process scenario across the Intel drivers that use the common path selection framework.
In v25.11 the i40e, iavf and ice drivers prevented Rx path selection by secondary processes, in favour of simply selecting the path chosen by the primary process. However, this model does not work if the primary process hasn't started the device before the secondary process encounters the path selection logic. To address this, permit path selection by any process, so long as the device has not yet been started. This allows for the use case where the secondary process is the process that starts the device.
The idpf and cpfl drivers are updated to follow this model as well.
The same issue exists for the Tx path selection for i40e, iavf, ice, idpf and cpfl, so implement the same logic when selecting a Tx path as well ie. permit path selection if the device has not been started.
I kept the patches for fixing the Rx and Tx path selection separate, as the patches that target the Rx side will need to be backported to v25.11 whereas the patches for the Tx side do not as that logic was introduced post v25.11.
v2: fix some cross compile build errors
Ciara Loftus (10):
net/i40e: permit secondary process Rx path selection net/iavf: permit secondary process Rx path selection net/ice: permit secondary process Rx path selection net/idpf: prevent Rx path selection after device start net/cpfl: prevent Rx path selection after device start net/i40e: permit secondary process Tx path selection net/iavf: permit secondary process Tx path selection net/ice: permit secondary process Tx path selection net/idpf: permit secondary process Tx path selection net/cpfl: permit secondary process Tx path selection
drivers/net/intel/cpfl/cpfl_rxtx.c | 13 ++++++++++--- drivers/net/intel/i40e/i40e_rxtx.c | 8 ++++---- drivers/net/intel/iavf/iavf_rxtx.c | 8 ++++---- drivers/net/intel/ice/ice_rxtx.c | 8 ++++---- drivers/net/intel/idpf/idpf_rxtx.c | 13 ++++++++++--- 5 files changed, 32 insertions(+), 18 deletions(-)
Signature · 1 line
2.43.0
PATCH v2 1/10 net/i40e: permit secondary process Rx path selection
Commit 258f346f5d5e ("net/i40e: use same Rx path across processes") changed the way that secondary processes selected their Rx burst function. Instead of letting secondary processes select their own function, they now used the function selected by the primary process. However, the primary process only selects the function at device start, so if the primary process hadn't started the device by the time the secondary process was selecting its Rx burst function, the secondary process would not select the correct function.
This commit addresses this issue by allowing the secondary process to select the path if the device has not been started yet.
--- drivers/net/intel/i40e/i40e_rxtx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/intel/i40e/i40e_rxtx.c +2 -2
@@ -3494,8 +3494,8 @@ i40e_set_rx_function(struct rte_eth_dev *dev)uint16_t i;enum rte_vect_max_simd rx_simd_width =i40e_get_max_simd_bitwidth (); -/* The primary process selects the rx path for all processes. */ -if (rte_eal_process_type () !=RTE_PROC_PRIMARY ) +/* If the device has started the function has already been selected. */ +if (dev->data->dev_started) goto out;/* In order to allow Vector Rx there are a few configuration
Signature · 1 line
2.43.0
Re: [PATCH v2 01/10] net/i40e: permit secondary process Rx path selection
Quoted 25 lines · Ciara Loftus
Commit
258f346f5d5e("net/i40e: use same Rx path across processes") changed the way that secondary processes selected their Rx burst function. Instead of letting secondary processes select their own function, they now used the function selected by the primary process. However, the primary process only selects the function at device start, so if the primary process hadn't started the device by the time the secondary process was selecting its Rx burst function, the secondary process would not select the correct function.This commit addresses this issue by allowing the secondary process to select the path if the device has not been started yet.
Fixes 258f346f5d5e ("net/i40e: use same Rx path across processes")Signed-off-by Ciara Loftus <[email protected]>--- drivers/net/intel/i40e/i40e_rxtx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/net/intel/i40e/i40e_rxtx.c +0
-0
drivers/net/intel/i40e/i40e_rxtx.c i40e_set_rx_function(struct rte_eth_dev *dev) · line 3500
Quoted 9 lines
drivers/net/intel/i40e/i40e_rxtx.c +2
-2@@ -3494,8 +3494,8 @@ i40e_set_rx_function(struct rte_eth_dev *dev)uint16_t i;enum rte_vect_max_simd rx_simd_width =i40e_get_max_simd_bitwidth (); -/* The primary process selects the rx path for all processes. */ -if (rte_eal_process_type () !=RTE_PROC_PRIMARY ) +/* If the device has started the function has already been selected. */ +if (dev->data->dev_started) goto out;
There is no atomic ops or mutual exclusion here, so what happens if two processes both call this function at the same time? Do both just get the same result or do we end up with some conflicts?
RE: [PATCH v2 01/10] net/i40e: permit secondary process Rx path selection
Quoted 31 lines · Ciara Loftus
Quoted 15 lines
Commit
258f346f5d5e("net/i40e: use same Rx path across processes") changed the way that secondary processes selected their Rx burst function. Instead of letting secondary processes select their own function, they now used the function selected by the primary process. However, the primary process only selects the function at device start, so if the primary process hadn't started the device by the time the secondary process was selecting its Rx burst function, the secondary process would not select the correct function.This commit addresses this issue by allowing the secondary process to select the path if the device has not been started yet.
Fixes 258f346f5d5e ("net/i40e: use same Rx path across processes")Review
Quoted 6 lines
Signed-off-by Ciara Loftus <[email protected]>--- drivers/net/intel/i40e/i40e_rxtx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)(quoted diff) +0
-0
b/drivers/net/intel/i40e/i40e_rxtx.cdrivers/net/intel/i40e/i40e_rxtx.c i40e_set_rx_function(struct rte_eth_dev *dev) · line 3495
Quoted 6 lines
index
1c3586778c..3deeff165d100644drivers/net/intel/i40e/i40e_rxtx.c +0
-0@@ -3494,8 +3494,8 @@ i40e_set_rx_function(struct rte_eth_dev *dev)uint16_t i; enum rte_vect_max_simd rx_simd_width =
i40e_get_max_simd_bitwidth();Quoted 1 line
Quoted 9 lines
drivers/net/intel/i40e/i40e_rxtx.c i40e_set_rx_function(struct rte_eth_dev *dev) · line 3499
Quoted 6 lines
drivers/net/intel/i40e/i40e_rxtx.c +2
-2-/* The primary process selects the rx path for all processes. */ -if (rte_eal_process_type () !=RTE_PROC_PRIMARY ) +/* If the device has started the function has already been selected. */ +if (dev->data->dev_started) goto out;There is no atomic ops or mutual exclusion here, so what happens if two processes both call this function at the same time? Do both just get the same result or do we end up with some conflicts?
If two processes were to call the path selection at the same time, in most cases they should both land on the same result. Both would be using the same information from dev->data to build up the req_features structure which is used as input to the path selection function. The effect would be both writing the same values to shared variables eg. rx_func_type in dev->data->dev_private
However I've identified two exceptions:
1. If the primary and secondary processes have different max SIMD bitwidths configured, two different paths could be selected. However, this is an invalid use case IMO.
2. When LLDP is enabled in iavf, the global variable "rte_pmd_iavf_tx_lldp_dynfield_offset" is set for the process from which it was enabled. The Tx path selection will set req_features.ctx_desc if that variable is positive. However that variable will be different between processes so different processes may in this case select a different path (eg. one with a ctx desc and one without). I think adding a bool lldp_enabled to the iavf_adapter struct can work around this. I'll submit a v3 with this change.
PATCH v2 2/10 net/iavf: permit secondary process Rx path selection
In reply to Ciara LoftusCommit 3f59c3d97a89 ("net/iavf: use same Rx path across processes") changed the way that secondary processes selected their Rx burst function. Instead of letting secondary processes select their own function, they now used the function selected by the primary process. However, the primary process only selects the function at device start, so if the primary process hadn't started the device by the time the secondary process was selecting its Rx burst function, the secondary process would not select the correct function.
This commit addresses this issue by allowing the secondary process to select the path if the device has not been started yet.
--- drivers/net/intel/iavf/iavf_rxtx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/intel/iavf/iavf_rxtx.c +2 -2
@@ -4173,8 +4173,8 @@ iavf_set_rx_function(struct rte_eth_dev *dev) .simd_width = RTE_VECT_SIMD_DISABLED, }; -/* The primary process selects the rx path for all processes. */ -if (rte_eal_process_type () !=RTE_PROC_PRIMARY ) +/* If the device has started the function has already been selected. */ +if (dev->data->dev_started) goto out;for (i =0 ; i < dev->data->nb_rx_queues; i++) {
Signature · 1 line
2.43.0
PATCH v2 3/10 net/ice: permit secondary process Rx path selection
In reply to Ciara LoftusCommit 197e70fb8961 ("net/ice: use same Rx path across processes") changed the way that secondary processes selected their Rx burst function. Instead of letting secondary processes select their own function, they now used the function selected by the primary process. However, the primary process only selects the function at device start, so if the primary process hadn't started the device by the time the secondary process was selecting its Rx burst function, the secondary process would not select the correct function.
This commit addresses this issue by allowing the secondary process to select the path if the device has not been started yet.
--- drivers/net/intel/ice/ice_rxtx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/intel/ice/ice_rxtx.c +2 -2
@@ -3822,8 +3822,8 @@ ice_set_rx_function(struct rte_eth_dev *dev) .simd_width = RTE_VECT_SIMD_DISABLED, }; -/* The primary process selects the rx path for all processes. */ -if (rte_eal_process_type () !=RTE_PROC_PRIMARY ) +/* If the device has started the function has already been selected. */ +if (dev->data->dev_started) goto out;#ifdef RTE_ARCH_X86
Signature · 1 line
2.43.0
PATCH v2 4/10 net/idpf: prevent Rx path selection after device start
In reply to Ciara LoftusTo fall in line with other drivers using the Rx path selection infrastructure, prevent Rx path selection after the device has started.
---
v2:
* Fix unused label error for non x86 arch
--- drivers/net/intel/idpf/idpf_rxtx.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/net/intel/idpf/idpf_rxtx.c +8 -1
@@ -782,11 +782,17 @@ idpf_set_rx_function(struct rte_eth_dev *dev)#ifdef RTE_ARCH_X86 struct idpf_rx_queue *rxq;int i; +#endif + +/* If the device has started the function has already been selected. */ +if (dev->data->dev_started) + goto out; +#ifdef RTE_ARCH_X86 if (idpf_rx_vec_dev_check_default (dev) ==IDPF_VECTOR_PATH &&rte_vect_get_max_simd_bitwidth () >=RTE_VECT_SIMD_256 ) req_features.simd_width =idpf_get_max_simd_bitwidth (); -#endif /* RTE_ARCH_X86 */ +#endif req_features.single_queue = (vport->rxq_model ==VIRTCHNL2_QUEUE_MODEL_SINGLE ); req_features.scattered = dev->data->scattered_rx;
@@ -814,6 +820,7 @@ idpf_set_rx_function(struct rte_eth_dev *dev) }#endif +out: dev->rx_pkt_burst = idpf_rx_path_infos[ad->rx_func_type].pkt_burst;PMD_DRV_LOG (NOTICE ,"Using %s Rx (port %d)." , idpf_rx_path_infos[ad->rx_func_type].info, dev->data->port_id);
Signature · 1 line
2.43.0
PATCH v2 5/10 net/cpfl: prevent Rx path selection after device start
In reply to Ciara LoftusTo fall in line with other drivers using the Rx path selection infrastructure, prevent Rx path selection after the device has started.
---
* Fix unused label error for non x86 arch
--- drivers/net/intel/cpfl/cpfl_rxtx.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/net/intel/cpfl/cpfl_rxtx.c +8 -1
@@ -1429,11 +1429,17 @@ cpfl_set_rx_function(struct rte_eth_dev *dev)#ifdef RTE_ARCH_X86 struct cpfl_rx_queue *cpfl_rxq;int i; +#endif + +/* If the device has started the function has already been selected. */ +if (dev->data->dev_started) + goto out; +#ifdef RTE_ARCH_X86 if (cpfl_rx_vec_dev_check_default (dev) ==CPFL_VECTOR_PATH &&rte_vect_get_max_simd_bitwidth () >=RTE_VECT_SIMD_256 ) req_features.simd_width =cpfl_get_max_simd_bitwidth (); -#endif /* RTE_ARCH_X86 */ +#endif req_features.single_queue = (vport->rxq_model ==VIRTCHNL2_QUEUE_MODEL_SINGLE ); req_features.scattered = dev->data->scattered_rx;
@@ -1462,6 +1468,7 @@ cpfl_set_rx_function(struct rte_eth_dev *dev) }#endif +out: dev->rx_pkt_burst = idpf_rx_path_infos[ad->rx_func_type].pkt_burst;PMD_DRV_LOG (NOTICE ,"Using %s Rx (port %d)." , idpf_rx_path_infos[ad->rx_func_type].info, dev->data->port_id);
Signature · 1 line
2.43.0
PATCH v2 6/10 net/i40e: permit secondary process Tx path selection
In reply to Ciara LoftusCommit 8d57c1788806 ("net/i40e: use common Tx path selection infrastructure") changed the way that secondary processes selected their Tx burst function. Instead of letting secondary processes select their own function, they now used the function selected by the primary process. However, the primary process only selects the function at device start, so if the primary process hadn't started the device by the time the secondary process was selecting its Tx burst function, the secondary process would not select the correct function.
This commit addresses this issue by allowing the secondary process to select the path if the device has not been started yet.
--- drivers/net/intel/i40e/i40e_rxtx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/intel/i40e/i40e_rxtx.c +2 -2
@@ -3597,8 +3597,8 @@ i40e_set_tx_function(struct rte_eth_dev *dev) .simple_tx = ad->tx_simple_allowed }; -/* The primary process selects the tx path for all processes. */ -if (rte_eal_process_type () !=RTE_PROC_PRIMARY ) +/* If the device has started the function has already been selected. */ +if (dev->data->dev_started) goto out;if (ad->tx_vec_allowed) {
Signature · 1 line
2.43.0
PATCH v2 7/10 net/iavf: permit secondary process Tx path selection
In reply to Ciara LoftusCommit ebcfb039afa8 ("net/iavf: use common Tx path selection infrastructure") changed the way that secondary processes selected their Tx burst function. Instead of letting secondary processes select their own function, they now used the function selected by the primary process. However, the primary process only selects the function at device start, so if the primary process hadn't started the device by the time the secondary process was selecting its Tx burst function, the secondary process would not select the correct function.
This commit addresses this issue by allowing the secondary process to select the path if the device has not been started yet.
--- drivers/net/intel/iavf/iavf_rxtx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/intel/iavf/iavf_rxtx.c +2 -2
@@ -4235,8 +4235,8 @@ iavf_set_tx_function(struct rte_eth_dev *dev) .simd_width = RTE_VECT_SIMD_DISABLED, }; -/* The primary process selects the tx path for all processes. */ -if (rte_eal_process_type () !=RTE_PROC_PRIMARY ) +/* If the device has started the function has already been selected. */ +if (dev->data->dev_started) goto out;#ifdef RTE_ARCH_X86
Signature · 1 line
2.43.0
PATCH v2 8/10 net/ice: permit secondary process Tx path selection
In reply to Ciara LoftusCommit cf96ec231d02 ("net/ice: use common Tx path selection infrastructure") changed the way that secondary processes selected their Tx burst function. Instead of letting secondary processes select their own function, they now used the function selected by the primary process. However, the primary process only selects the function at device start, so if the primary process hadn't started the device by the time the secondary process was selecting its Tx burst function, the secondary process would not select the correct function.
This commit addresses this issue by allowing the secondary process to select the path if the device has not been started yet.
--- drivers/net/intel/ice/ice_rxtx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/intel/ice/ice_rxtx.c +2 -2
@@ -4163,8 +4163,8 @@ ice_set_tx_function(struct rte_eth_dev *dev) .simd_width = RTE_VECT_SIMD_DISABLED, }; -/* The primary process selects the tx path for all processes. */ -if (rte_eal_process_type () !=RTE_PROC_PRIMARY ) +/* If the device has started the function has already been selected. */ +if (dev->data->dev_started) goto out; req_features.simple_tx = ad->tx_simple_allowed;
Signature · 1 line
2.43.0
PATCH v2 9/10 net/idpf: permit secondary process Tx path selection
In reply to Ciara LoftusCommit 7cab7e67363a ("net/idpf: use common Tx path selection infrastructure") changed the way that secondary processes selected their Tx burst function. Instead of letting secondary processes select their own function, they now used the function selected by the primary process. However, the primary process only selects the function at device start, so if the primary process hadn't started the device by the time the secondary process was selecting its Tx burst function, the secondary process would not select the correct function.
This commit addresses this issue by allowing the secondary process to select the path if the device has not been started yet.
--- drivers/net/intel/idpf/idpf_rxtx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/intel/idpf/idpf_rxtx.c +2 -2
@@ -844,8 +844,8 @@ idpf_set_tx_function(struct rte_eth_dev *dev) .single_queue = (vport->txq_model == VIRTCHNL2_QUEUE_MODEL_SINGLE) }; -/* The primary process selects the tx path for all processes. */ -if (rte_eal_process_type () !=RTE_PROC_PRIMARY ) +/* If the device has started the function has already been selected. */ +if (dev->data->dev_started) goto out;#ifdef RTE_ARCH_X86
Signature · 1 line
2.43.0
PATCH v2 10/10 net/cpfl: permit secondary process Tx path selection
In reply to Ciara LoftusCommit 6970745698b9 ("net/cpfl: use common Tx path selection infrastructure") changed the way that secondary processes selected their Tx burst function. Instead of letting secondary processes select their own function, they now used the function selected by the primary process. However, the primary process only selects the function at device start, so if the primary process hadn't started the device by the time the secondary process was selecting its Tx burst function, the secondary process would not select the correct function.
This commit addresses this issue by allowing the secondary process to select the path if the device has not been started yet.
--- drivers/net/intel/cpfl/cpfl_rxtx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/intel/cpfl/cpfl_rxtx.c +2 -2
@@ -1493,8 +1493,8 @@ cpfl_set_tx_function(struct rte_eth_dev *dev) .single_queue = (vport->txq_model == VIRTCHNL2_QUEUE_MODEL_SINGLE) }; -/* The primary process selects the tx path for all processes. */ -if (rte_eal_process_type () !=RTE_PROC_PRIMARY ) +/* If the device has started the function has already been selected. */ +if (dev->data->dev_started) goto out;#ifdef RTE_ARCH_X86
Signature · 1 line
2.43.0
v3 cover Fix multi process path selection in Intel drivers
In reply to Ciara LoftusThis series fixes and makes consistent the approach to selecting Rx and Tx paths in a multi process scenario across the Intel drivers that use the common path selection framework.
In v25.11 the i40e, iavf and ice drivers prevented Rx path selection by secondary processes, in favour of simply selecting the path chosen by the primary process. However, this model does not work if the primary process hasn't started the device before the secondary process encounters the path selection logic. To address this, permit path selection by any process, so long as the device has not yet been started. This allows for the use case where the secondary process is the process that starts the device.
The idpf and cpfl drivers are updated to follow this model as well.
The same issue exists for the Tx path selection for i40e, iavf, ice, idpf and cpfl, so implement the same logic when selecting a Tx path as well ie. permit path selection if the device has not been started.
If two processes were to call the path selection at the same time, in most cases they should both land on the same result. Both would be using the same information from dev->data to build up the structure that is used as input to the path selection function. The effect would be both writing the same values to shared variables eg. rx_func_type in dev->data->dev_private. For this reason I did not add any locking around the path selection logic. The only exception would be the case where the primary and secondary processes are configured with different maximum SIMD bitwidths however this is an invalid use case IMO.
I kept the patches for fixing the Rx and Tx path selection separate, as the patches that target the Rx side will need to be backported to v25.11 whereas the patches for the Tx side do not as that logic was introduced post v25.11.
v3: In iavf ensure a secondary process can see if the primary process has enabled LLDP, which ensures that the correct Tx path will be chosen ie. one with context descriptor support if LLDP is enabled.
Ciara Loftus (10):
net/i40e: permit secondary process Rx path selection net/iavf: permit secondary process Rx path selection net/ice: permit secondary process Rx path selection net/idpf: prevent Rx path selection after device start net/cpfl: prevent Rx path selection after device start net/i40e: permit secondary process Tx path selection net/iavf: permit secondary process Tx path selection net/ice: permit secondary process Tx path selection net/idpf: permit secondary process Tx path selection net/cpfl: permit secondary process Tx path selection
drivers/net/intel/cpfl/cpfl_rxtx.c | 13 ++++++++++--- drivers/net/intel/i40e/i40e_rxtx.c | 8 ++++---- drivers/net/intel/iavf/iavf_ethdev.c | 5 +++++ drivers/net/intel/iavf/iavf_rxtx.c | 8 ++++---- drivers/net/intel/ice/ice_rxtx.c | 8 ++++---- drivers/net/intel/idpf/idpf_rxtx.c | 13 ++++++++++--- 6 files changed, 37 insertions(+), 18 deletions(-)
Signature · 1 line
2.43.0
PATCH v3 1/10 net/i40e: permit secondary process Rx path selection
Commit 258f346f5d5e ("net/i40e: use same Rx path across processes") changed the way that secondary processes selected their Rx burst function. Instead of letting secondary processes select their own function, they now used the function selected by the primary process. However, the primary process only selects the function at device start, so if the primary process hadn't started the device by the time the secondary process was selecting its Rx burst function, the secondary process would not select the correct function.
This commit addresses this issue by allowing the secondary process to select the path if the device has not been started yet.
--- drivers/net/intel/i40e/i40e_rxtx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/intel/i40e/i40e_rxtx.c +2 -2
@@ -3001,8 +3001,8 @@ i40e_set_rx_function(struct rte_eth_dev *dev)uint16_t i;enum rte_vect_max_simd rx_simd_width =i40e_get_max_simd_bitwidth (); -/* The primary process selects the rx path for all processes. */ -if (rte_eal_process_type () !=RTE_PROC_PRIMARY ) +/* If the device has started the function has already been selected. */ +if (dev->data->dev_started) goto out;/* In order to allow Vector Rx there are a few configuration
Signature · 1 line
2.43.0
Re: [PATCH v3 01/10] net/i40e: permit secondary process Rx path selection
Quoted 9 lines · Ciara Loftus
Commit
258f346f5d5e("net/i40e: use same Rx path across processes") changed the way that secondary processes selected their Rx burst function. Instead of letting secondary processes select their own function, they now used the function selected by the primary process. However, the primary process only selects the function at device start, so if the primary process hadn't started the device by the time the secondary process was selecting its Rx burst function, the secondary process would not select the correct function.
Quoted 7 lines
This commit addresses this issue by allowing the secondary process to select the path if the device has not been started yet.
Fixes 258f346f5d5e ("net/i40e: use same Rx path across processes")Signed-off-by Ciara Loftus <[email protected]>
PATCH v3 2/10 net/iavf: permit secondary process Rx path selection
In reply to Ciara LoftusCommit 3f59c3d97a89 ("net/iavf: use same Rx path across processes") changed the way that secondary processes selected their Rx burst function. Instead of letting secondary processes select their own function, they now used the function selected by the primary process. However, the primary process only selects the function at device start, so if the primary process hadn't started the device by the time the secondary process was selecting its Rx burst function, the secondary process would not select the correct function.
This commit addresses this issue by allowing the secondary process to select the path if the device has not been started yet.
--- drivers/net/intel/iavf/iavf_rxtx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/intel/iavf/iavf_rxtx.c +2 -2
@@ -3815,8 +3815,8 @@ iavf_set_rx_function(struct rte_eth_dev *dev) .simd_width = RTE_VECT_SIMD_DISABLED, }; -/* The primary process selects the rx path for all processes. */ -if (rte_eal_process_type () !=RTE_PROC_PRIMARY ) +/* If the device has started the function has already been selected. */ +if (dev->data->dev_started) goto out;for (i =0 ; i < dev->data->nb_rx_queues; i++) {
Signature · 1 line
2.43.0
Re: [PATCH v3 02/10] net/iavf: permit secondary process Rx path selection
Quoted 9 lines · Ciara Loftus
Commit
3f59c3d97a89("net/iavf: use same Rx path across processes") changed the way that secondary processes selected their Rx burst function. Instead of letting secondary processes select their own function, they now used the function selected by the primary process. However, the primary process only selects the function at device start, so if the primary process hadn't started the device by the time the secondary process was selecting its Rx burst function, the secondary process would not select the correct function.
Quoted 8 lines
This commit addresses this issue by allowing the secondary process to select the path if the device has not been started yet.
Fixes 3f59c3d97a89 ("net/iavf: use same Rx path across processes")Signed-off-by Ciara Loftus <[email protected]>---
PATCH v3 3/10 net/ice: permit secondary process Rx path selection
In reply to Ciara LoftusCommit 197e70fb8961 ("net/ice: use same Rx path across processes") changed the way that secondary processes selected their Rx burst function. Instead of letting secondary processes select their own function, they now used the function selected by the primary process. However, the primary process only selects the function at device start, so if the primary process hadn't started the device by the time the secondary process was selecting its Rx burst function, the secondary process would not select the correct function.
This commit addresses this issue by allowing the secondary process to select the path if the device has not been started yet.
--- drivers/net/intel/ice/ice_rxtx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/intel/ice/ice_rxtx.c +2 -2
@@ -3371,8 +3371,8 @@ ice_set_rx_function(struct rte_eth_dev *dev) .simd_width = RTE_VECT_SIMD_DISABLED, }; -/* The primary process selects the rx path for all processes. */ -if (rte_eal_process_type () !=RTE_PROC_PRIMARY ) +/* If the device has started the function has already been selected. */ +if (dev->data->dev_started) goto out;#ifdef RTE_ARCH_X86
Signature · 1 line
2.43.0
Re: [PATCH v3 03/10] net/ice: permit secondary process Rx path selection
Quoted 9 lines · Ciara Loftus
Commit
197e70fb8961("net/ice: use same Rx path across processes") changed the way that secondary processes selected their Rx burst function. Instead of letting secondary processes select their own function, they now used the function selected by the primary process. However, the primary process only selects the function at device start, so if the primary process hadn't started the device by the time the secondary process was selecting its Rx burst function, the secondary process would not select the correct function.
Quoted 8 lines
This commit addresses this issue by allowing the secondary process to select the path if the device has not been started yet.
Fixes 197e70fb8961 ("net/ice: use same Rx path across processes")Signed-off-by Ciara Loftus <[email protected]>---
PATCH v3 4/10 net/idpf: prevent Rx path selection after device start
In reply to Ciara LoftusTo fall in line with other drivers using the Rx path selection infrastructure, prevent Rx path selection after the device has started.
---
v2:
* Fix unused label error for non x86 arch
--- drivers/net/intel/idpf/idpf_rxtx.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/net/intel/idpf/idpf_rxtx.c +8 -1
@@ -795,11 +795,17 @@ idpf_set_rx_function(struct rte_eth_dev *dev)#ifdef RTE_ARCH_X86 struct idpf_rx_queue *rxq;int i; +#endif + +/* If the device has started the function has already been selected. */ +if (dev->data->dev_started) + goto out; +#ifdef RTE_ARCH_X86 if (idpf_rx_vec_dev_check_default (dev) ==IDPF_VECTOR_PATH &&rte_vect_get_max_simd_bitwidth () >=RTE_VECT_SIMD_256 ) req_features.simd_width =idpf_get_max_simd_bitwidth (); -#endif /* RTE_ARCH_X86 */ +#endif req_features.single_queue = (vport->rxq_model ==VIRTCHNL2_QUEUE_MODEL_SINGLE ); req_features.scattered = dev->data->scattered_rx;
@@ -827,6 +833,7 @@ idpf_set_rx_function(struct rte_eth_dev *dev) }#endif +out: dev->rx_pkt_burst = idpf_rx_path_infos[ad->rx_func_type].pkt_burst;PMD_DRV_LOG (NOTICE ,"Using %s Rx (port %d)." , idpf_rx_path_infos[ad->rx_func_type].info, dev->data->port_id);
Signature · 1 line
2.43.0
Re: [PATCH v3 04/10] net/idpf: prevent Rx path selection after device start
Quoted 11 lines · Ciara Loftus
To fall in line with other drivers using the Rx path selection infrastructure, prevent Rx path selection after the device has started.
Signed-off-by Ciara Loftus <[email protected]>---
v2:
* Fix unused label error for non x86 arch--- drivers/net/intel/idpf/idpf_rxtx.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
PATCH v3 5/10 net/cpfl: prevent Rx path selection after device start
In reply to Ciara LoftusTo fall in line with other drivers using the Rx path selection infrastructure, prevent Rx path selection after the device has started.
---
* Fix unused label error for non x86 arch
--- drivers/net/intel/cpfl/cpfl_rxtx.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/net/intel/cpfl/cpfl_rxtx.c +8 -1
@@ -1446,11 +1446,17 @@ cpfl_set_rx_function(struct rte_eth_dev *dev)#ifdef RTE_ARCH_X86 struct cpfl_rx_queue *cpfl_rxq;int i; +#endif + +/* If the device has started the function has already been selected. */ +if (dev->data->dev_started) + goto out; +#ifdef RTE_ARCH_X86 if (cpfl_rx_vec_dev_check_default (dev) ==CPFL_VECTOR_PATH &&rte_vect_get_max_simd_bitwidth () >=RTE_VECT_SIMD_256 ) req_features.simd_width =cpfl_get_max_simd_bitwidth (); -#endif /* RTE_ARCH_X86 */ +#endif req_features.single_queue = (vport->rxq_model ==VIRTCHNL2_QUEUE_MODEL_SINGLE ); req_features.scattered = dev->data->scattered_rx;
@@ -1479,6 +1485,7 @@ cpfl_set_rx_function(struct rte_eth_dev *dev) }#endif +out: dev->rx_pkt_burst = idpf_rx_path_infos[ad->rx_func_type].pkt_burst;PMD_DRV_LOG (NOTICE ,"Using %s Rx (port %d)." , idpf_rx_path_infos[ad->rx_func_type].info, dev->data->port_id);
Signature · 1 line
2.43.0
Re: [PATCH v3 05/10] net/cpfl: prevent Rx path selection after device start
Quoted 10 lines · Ciara Loftus
To fall in line with other drivers using the Rx path selection infrastructure, prevent Rx path selection after the device has started.
Signed-off-by Ciara Loftus <[email protected]>---
* Fix unused label error for non x86 arch--- drivers/net/intel/cpfl/cpfl_rxtx.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
PATCH v3 6/10 net/i40e: permit secondary process Tx path selection
In reply to Ciara LoftusCommit 8d57c1788806 ("net/i40e: use common Tx path selection infrastructure") changed the way that secondary processes selected their Tx burst function. Instead of letting secondary processes select their own function, they now used the function selected by the primary process. However, the primary process only selects the function at device start, so if the primary process hadn't started the device by the time the secondary process was selecting its Tx burst function, the secondary process would not select the correct function.
This commit addresses this issue by allowing the secondary process to select the path if the device has not been started yet.
--- drivers/net/intel/i40e/i40e_rxtx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/intel/i40e/i40e_rxtx.c +2 -2
@@ -3104,8 +3104,8 @@ i40e_set_tx_function(struct rte_eth_dev *dev) .simple_tx = ad->tx_simple_allowed }; -/* The primary process selects the tx path for all processes. */ -if (rte_eal_process_type () !=RTE_PROC_PRIMARY ) +/* If the device has started the function has already been selected. */ +if (dev->data->dev_started) goto out;if (ad->tx_vec_allowed) {
Signature · 1 line
2.43.0
Re: [PATCH v3 06/10] net/i40e: permit secondary process Tx path selection
Quoted 9 lines · Ciara Loftus
Commit
8d57c1788806("net/i40e: use common Tx path selection infrastructure") changed the way that secondary processes selected their Tx burst function. Instead of letting secondary processes select their own function, they now used the function selected by the primary process. However, the primary process only selects the function at device start, so if the primary process hadn't started the device by the time the secondary process was selecting its Tx burst function, the secondary process would not select the correct function.
Quoted 7 lines
This commit addresses this issue by allowing the secondary process to select the path if the device has not been started yet.
Fixes 8d57c1788806 ("net/i40e: use common Tx path selection infrastructure")Signed-off-by Ciara Loftus <[email protected]>---
PATCH v3 7/10 net/iavf: permit secondary process Tx path selection
In reply to Ciara LoftusCommit ebcfb039afa8 ("net/iavf: use common Tx path selection infrastructure") changed the way that secondary processes selected their Tx burst function. Instead of letting secondary processes select their own function, they now used the function selected by the primary process. However, the primary process only selects the function at device start, so if the primary process hadn't started the device by the time the secondary process was selecting its Tx burst function, the secondary process would not select the correct function.
This commit addresses this issue by allowing the secondary process to select the path if the device has not been started yet.
This commit also introduces logic to the secondary process probe sequence that ensures that if a dynamic mbuf field was registered in the primary process for LLDP, that the offset is visible in the secondary process. This also ensures that a correct Tx path with context descriptor support will be selected by the secondary process.
--- drivers/net/intel/iavf/iavf_ethdev.c | 5 +++++ drivers/net/intel/iavf/iavf_rxtx.c | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-)
drivers/net/intel/iavf/iavf_ethdev.c +5 -0
@@ -2804,6 +2804,11 @@ iavf_dev_init(struct rte_eth_dev *eth_dev)*/ if (rte_eal_process_type () !=RTE_PROC_PRIMARY ) {iavf_set_rx_function (eth_dev); +/* LLDP may have been enabled by the primary process. Store the offset before +* setting the TX function because it may be used in the selection function. +*/ + rte_pmd_iavf_tx_lldp_dynfield_offset = +rte_mbuf_dynfield_lookup (IAVF_TX_LLDP_DYNFIELD ,NULL );iavf_set_tx_function (eth_dev);return 0 ; }
drivers/net/intel/iavf/iavf_rxtx.c +2 -2
@@ -3877,8 +3877,8 @@ iavf_set_tx_function(struct rte_eth_dev *dev) .simd_width = RTE_VECT_SIMD_DISABLED, }; -/* The primary process selects the tx path for all processes. */ -if (rte_eal_process_type () !=RTE_PROC_PRIMARY ) +/* If the device has started the function has already been selected. */ +if (dev->data->dev_started) goto out;#ifdef RTE_ARCH_X86
Signature · 1 line
2.43.0
Re: [PATCH v3 07/10] net/iavf: permit secondary process Tx path selection
Quoted 18 lines · Ciara Loftus
Commit
ebcfb039afa8("net/iavf: use common Tx path selection infrastructure") changed the way that secondary processes selected their Tx burst function. Instead of letting secondary processes select their own function, they now used the function selected by the primary process. However, the primary process only selects the function at device start, so if the primary process hadn't started the device by the time the secondary process was selecting its Tx burst function, the secondary process would not select the correct function.This commit addresses this issue by allowing the secondary process to select the path if the device has not been started yet.
This commit also introduces logic to the secondary process probe sequence that ensures that if a dynamic mbuf field was registered in the primary process for LLDP, that the offset is visible in the secondary process. This also ensures that a correct Tx path with context descriptor support will be selected by the secondary process.
Quoted 4 lines
Fixes ebcfb039afa8 ("net/iavf: use common Tx path selection infrastructure")Signed-off-by Ciara Loftus <[email protected]>---
PATCH v3 8/10 net/ice: permit secondary process Tx path selection
In reply to Ciara LoftusCommit cf96ec231d02 ("net/ice: use common Tx path selection infrastructure") changed the way that secondary processes selected their Tx burst function. Instead of letting secondary processes select their own function, they now used the function selected by the primary process. However, the primary process only selects the function at device start, so if the primary process hadn't started the device by the time the secondary process was selecting its Tx burst function, the secondary process would not select the correct function.
This commit addresses this issue by allowing the secondary process to select the path if the device has not been started yet.
--- drivers/net/intel/ice/ice_rxtx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/intel/ice/ice_rxtx.c +2 -2
@@ -3712,8 +3712,8 @@ ice_set_tx_function(struct rte_eth_dev *dev) .simd_width = RTE_VECT_SIMD_DISABLED, }; -/* The primary process selects the tx path for all processes. */ -if (rte_eal_process_type () !=RTE_PROC_PRIMARY ) +/* If the device has started the function has already been selected. */ +if (dev->data->dev_started) goto out; req_features.simple_tx = ad->tx_simple_allowed;
Signature · 1 line
2.43.0
Re: [PATCH v3 08/10] net/ice: permit secondary process Tx path selection
Quoted 9 lines · Ciara Loftus
Commit
cf96ec231d02("net/ice: use common Tx path selection infrastructure") changed the way that secondary processes selected their Tx burst function. Instead of letting secondary processes select their own function, they now used the function selected by the primary process. However, the primary process only selects the function at device start, so if the primary process hadn't started the device by the time the secondary process was selecting its Tx burst function, the secondary process would not select the correct function.
Quoted 7 lines
This commit addresses this issue by allowing the secondary process to select the path if the device has not been started yet.
Fixes cf96ec231d02 ("net/ice: use common Tx path selection infrastructure")Signed-off-by Ciara Loftus <[email protected]>---
PATCH v3 9/10 net/idpf: permit secondary process Tx path selection
In reply to Ciara LoftusCommit 7cab7e67363a ("net/idpf: use common Tx path selection infrastructure") changed the way that secondary processes selected their Tx burst function. Instead of letting secondary processes select their own function, they now used the function selected by the primary process. However, the primary process only selects the function at device start, so if the primary process hadn't started the device by the time the secondary process was selecting its Tx burst function, the secondary process would not select the correct function.
This commit addresses this issue by allowing the secondary process to select the path if the device has not been started yet.
--- drivers/net/intel/idpf/idpf_rxtx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/intel/idpf/idpf_rxtx.c +2 -2
@@ -875,8 +875,8 @@ idpf_set_tx_function(struct rte_eth_dev *dev) .simple_tx = simple_allowed }; -/* The primary process selects the tx path for all processes. */ -if (rte_eal_process_type () !=RTE_PROC_PRIMARY ) +/* If the device has started the function has already been selected. */ +if (dev->data->dev_started) goto out;#ifdef RTE_ARCH_X86
Signature · 1 line
2.43.0
Re: [PATCH v3 09/10] net/idpf: permit secondary process Tx path selection
Quoted 9 lines · Ciara Loftus
Commit
7cab7e67363a("net/idpf: use common Tx path selection infrastructure") changed the way that secondary processes selected their Tx burst function. Instead of letting secondary processes select their own function, they now used the function selected by the primary process. However, the primary process only selects the function at device start, so if the primary process hadn't started the device by the time the secondary process was selecting its Tx burst function, the secondary process would not select the correct function.
Quoted 7 lines
This commit addresses this issue by allowing the secondary process to select the path if the device has not been started yet.
Fixes 7cab7e67363a ("net/idpf: use common Tx path selection infrastructure")Signed-off-by Ciara Loftus <[email protected]>---
PATCH v3 10/10 net/cpfl: permit secondary process Tx path selection
In reply to Ciara LoftusCommit 6970745698b9 ("net/cpfl: use common Tx path selection infrastructure") changed the way that secondary processes selected their Tx burst function. Instead of letting secondary processes select their own function, they now used the function selected by the primary process. However, the primary process only selects the function at device start, so if the primary process hadn't started the device by the time the secondary process was selecting its Tx burst function, the secondary process would not select the correct function.
This commit addresses this issue by allowing the secondary process to select the path if the device has not been started yet.
--- drivers/net/intel/cpfl/cpfl_rxtx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/intel/cpfl/cpfl_rxtx.c +2 -2
@@ -1529,8 +1529,8 @@ cpfl_set_tx_function(struct rte_eth_dev *dev) .simple_tx = simple_allowed }; -/* The primary process selects the tx path for all processes. */ -if (rte_eal_process_type () !=RTE_PROC_PRIMARY ) +/* If the device has started the function has already been selected. */ +if (dev->data->dev_started) goto out;#ifdef RTE_ARCH_X86
Signature · 1 line
2.43.0
Re: [PATCH v3 10/10] net/cpfl: permit secondary process Tx path selection
Quoted 9 lines · Ciara Loftus
Commit
6970745698b9("net/cpfl: use common Tx path selection infrastructure") changed the way that secondary processes selected their Tx burst function. Instead of letting secondary processes select their own function, they now used the function selected by the primary process. However, the primary process only selects the function at device start, so if the primary process hadn't started the device by the time the secondary process was selecting its Tx burst function, the secondary process would not select the correct function.
Quoted 7 lines
This commit addresses this issue by allowing the secondary process to select the path if the device has not been started yet.
Fixes 6970745698b9 ("net/cpfl: use common Tx path selection infrastructure")Signed-off-by Ciara Loftus <[email protected]>---
Bruce Richardson
AppliedQuoted 37 lines · Ciara Loftus
This series fixes and makes consistent the approach to selecting Rx and Tx paths in a multi process scenario across the Intel drivers that use the common path selection framework.
In v25.11 the i40e, iavf and ice drivers prevented Rx path selection by secondary processes, in favour of simply selecting the path chosen by the primary process. However, this model does not work if the primary process hasn't started the device before the secondary process encounters the path selection logic. To address this, permit path selection by any process, so long as the device has not yet been started. This allows for the use case where the secondary process is the process that starts the device.
The idpf and cpfl drivers are updated to follow this model as well.The same issue exists for the Tx path selection for i40e, iavf, ice, idpf and cpfl, so implement the same logic when selecting a Tx path as well ie. permit path selection if the device has not been started.
If two processes were to call the path selection at the same time, in most cases they should both land on the same result. Both would be using the same information from
dev->datato build up the structure that is used as input to the path selection function. The effect would be both writing the same values to shared variables eg.rx_func_typeindev->data->dev_private. For this reason I did not add any locking around the path selection logic. The only exception would be the case where the primary and secondary processes are configured with different maximum SIMD bitwidths however this is an invalid use case IMO.I kept the patches for fixing the Rx and Tx path selection separate, as the patches that target the Rx side will need to be backported to v25.11 whereas the patches for the Tx side do not as that logic was introduced post v25.11.
v3: In iavf ensure a secondary process can see if the primary process has enabled LLDP, which ensures that the correct Tx path will be chosen ie. one with context descriptor support if LLDP is enabled.
Quoted 12 lines
Ciara Loftus (10):
net/i40e: permit secondary process Rx path selection net/iavf: permit secondary process Rx path selection net/ice: permit secondary process Rx path selection net/idpf: prevent Rx path selection after device start net/cpfl: prevent Rx path selection after device start net/i40e: permit secondary process Tx path selection net/iavf: permit secondary process Tx path selection net/ice: permit secondary process Tx path selection net/idpf: permit secondary process Tx path selection net/cpfl: permit secondary process Tx path selection
Applied to next-net-intel.
I've squashed the final 5 patches together as they are the same changes just made to different drivers + one other small incidental change for iavf The first 5 I've kept all separate as they are also for backporting, and having them smaller should make that easier.
Thanks,
/Bruce