Skip to contentSkip to conversation

Fix multi process path selection in Intel drivers

PATCH Superseded Ciara Loftus 2 participants 46 messages Feb 5 – Feb 18 Network drivers

lore
Share & tools
lore
#0 lore raw

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
#1 lore raw

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.

Fixes 258f346f5d5e ("net/i40e: use same Rx path across processes")
---
 drivers/net/intel/i40e/i40e_rxtx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/intel/i40e/i40e_rxtx.c +2 -2
index 1c3586778c..3deeff165d 100644
@@ -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
#2 lore raw

PATCH 2/10 net/iavf: permit secondary process Rx path selection

In reply to 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.

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")
---
 drivers/net/intel/iavf/iavf_rxtx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/intel/iavf/iavf_rxtx.c +2 -2
index 4b763627bc..bca80eccfa 100644
@@ -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
#3 lore raw

PATCH 3/10 net/ice: permit secondary process Rx path selection

In reply to 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.

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")
---
 drivers/net/intel/ice/ice_rxtx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/intel/ice/ice_rxtx.c +2 -2
index f3bc79423d..bbd9cfa7a5 100644
@@ -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
#4 lore raw

PATCH 4/10 net/idpf: prevent Rx path selection after device start

In reply to Ciara Loftus

To 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
index cee454244f..de880bdc5f 100644
@@ -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
#5 lore raw

PATCH 5/10 net/cpfl: prevent Rx path selection after device start

In reply to Ciara Loftus

To 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
index d0438b5da0..1de53f8827 100644
@@ -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
#6 lore raw

PATCH 6/10 net/i40e: permit secondary process Tx path selection

In reply to 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.

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")
---
 drivers/net/intel/i40e/i40e_rxtx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/intel/i40e/i40e_rxtx.c +2 -2
index 3deeff165d..1c46e19582 100644
@@ -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
#7 lore raw

PATCH 7/10 net/iavf: permit secondary process Tx path selection

In reply to 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.

Fixes ebcfb039afa8 ("net/iavf: use common Tx path selection infrastructure")
---
 drivers/net/intel/iavf/iavf_rxtx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/intel/iavf/iavf_rxtx.c +2 -2
index bca80eccfa..abe0f7c529 100644
@@ -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
#8 lore raw

PATCH 8/10 net/ice: permit secondary process Tx path selection

In reply to 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.

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")
---
 drivers/net/intel/ice/ice_rxtx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/intel/ice/ice_rxtx.c +2 -2
index bbd9cfa7a5..8ed47b957f 100644
@@ -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
#9 lore raw

PATCH 9/10 net/idpf: permit secondary process Tx path selection

In reply to 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.

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")
---
 drivers/net/intel/idpf/idpf_rxtx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/intel/idpf/idpf_rxtx.c +2 -2
index de880bdc5f..344bca995d 100644
@@ -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
#10 lore raw

PATCH 10/10 net/cpfl: permit secondary process Tx path selection

In reply to 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.

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")
---
 drivers/net/intel/cpfl/cpfl_rxtx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/intel/cpfl/cpfl_rxtx.c +2 -2
index 1de53f8827..7c0d576b75 100644
@@ -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
#11 lore raw

v2 cover Fix multi process path selection in Intel drivers

In reply to 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.

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
#12 lore raw

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.

Fixes 258f346f5d5e ("net/i40e: use same Rx path across processes")
---
 drivers/net/intel/i40e/i40e_rxtx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/intel/i40e/i40e_rxtx.c +2 -2
index 1c3586778c..3deeff165d 100644
@@ -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
#13 lore raw

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")
---
 drivers/net/intel/i40e/i40e_rxtx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/intel/i40e/i40e_rxtx.c +0 -0
index 1c3586778c..3deeff165d 100644

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?

#14 lore raw

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

drivers/net/intel/i40e/i40e_rxtx.c i40e_set_rx_function(struct rte_eth_dev *dev) · line 3495

Quoted 6 lines

index 1c3586778c..3deeff165d 100644

drivers/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.

#15 lore raw

PATCH v2 2/10 net/iavf: permit secondary process Rx path selection

In reply to 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.

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")
---
 drivers/net/intel/iavf/iavf_rxtx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/intel/iavf/iavf_rxtx.c +2 -2
index 4b763627bc..bca80eccfa 100644
@@ -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
#16 lore raw

PATCH v2 3/10 net/ice: permit secondary process Rx path selection

In reply to 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.

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")
---
 drivers/net/intel/ice/ice_rxtx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/intel/ice/ice_rxtx.c +2 -2
index f3bc79423d..bbd9cfa7a5 100644
@@ -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
#17 lore raw

PATCH v2 4/10 net/idpf: prevent Rx path selection after device start

In reply to Ciara Loftus

To 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
index cee454244f..e7d44f7beb 100644
@@ -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
#18 lore raw

PATCH v2 5/10 net/cpfl: prevent Rx path selection after device start

In reply to Ciara Loftus

To 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
index d0438b5da0..7da360d56e 100644
@@ -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
#19 lore raw

PATCH v2 6/10 net/i40e: permit secondary process Tx path selection

In reply to 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.

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")
---
 drivers/net/intel/i40e/i40e_rxtx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/intel/i40e/i40e_rxtx.c +2 -2
index 3deeff165d..1c46e19582 100644
@@ -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
#20 lore raw

PATCH v2 7/10 net/iavf: permit secondary process Tx path selection

In reply to 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.

Fixes ebcfb039afa8 ("net/iavf: use common Tx path selection infrastructure")
---
 drivers/net/intel/iavf/iavf_rxtx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/intel/iavf/iavf_rxtx.c +2 -2
index bca80eccfa..abe0f7c529 100644
@@ -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
#21 lore raw

PATCH v2 8/10 net/ice: permit secondary process Tx path selection

In reply to 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.

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")
---
 drivers/net/intel/ice/ice_rxtx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/intel/ice/ice_rxtx.c +2 -2
index bbd9cfa7a5..8ed47b957f 100644
@@ -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
#22 lore raw

PATCH v2 9/10 net/idpf: permit secondary process Tx path selection

In reply to 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.

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")
---
 drivers/net/intel/idpf/idpf_rxtx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/intel/idpf/idpf_rxtx.c +2 -2
index e7d44f7beb..6d7624731a 100644
@@ -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
#23 lore raw

PATCH v2 10/10 net/cpfl: permit secondary process Tx path selection

In reply to 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.

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")
---
 drivers/net/intel/cpfl/cpfl_rxtx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/intel/cpfl/cpfl_rxtx.c +2 -2
index 7da360d56e..b7d62a1379 100644
@@ -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
#24 lore raw

v3 cover Fix multi process path selection in Intel drivers

In reply to 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->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
#25 lore raw

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.

Fixes 258f346f5d5e ("net/i40e: use same Rx path across processes")
---
 drivers/net/intel/i40e/i40e_rxtx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/intel/i40e/i40e_rxtx.c +2 -2
index ffb303158b..d189ba263b 100644
@@ -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
Acked-by on v3 1/10
#26 lore raw

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")
#27 lore raw

PATCH v3 2/10 net/iavf: permit secondary process Rx path selection

In reply to 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.

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")
---
 drivers/net/intel/iavf/iavf_rxtx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/intel/iavf/iavf_rxtx.c +2 -2
index e621d4bf47..a47d2547dd 100644
@@ -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
Acked-by on v3 2/10
#28 lore raw

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

---

#29 lore raw

PATCH v3 3/10 net/ice: permit secondary process Rx path selection

In reply to 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.

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")
---
 drivers/net/intel/ice/ice_rxtx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/intel/ice/ice_rxtx.c +2 -2
index 321415d839..637c57b209 100644
@@ -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
Acked-by on v3 3/10
#30 lore raw

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

---

#31 lore raw

PATCH v3 4/10 net/idpf: prevent Rx path selection after device start

In reply to Ciara Loftus

To 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
index 6317112353..81bcc08126 100644
@@ -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
Acked-by on v3 4/10
#32 lore raw

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.

---
v2:
* Fix unused label error for non x86 arch

---
 drivers/net/intel/idpf/idpf_rxtx.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
#33 lore raw

PATCH v3 5/10 net/cpfl: prevent Rx path selection after device start

In reply to Ciara Loftus

To 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
index 11451e1666..dc729d31af 100644
@@ -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
Acked-by on v3 5/10
#34 lore raw

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.

---
* Fix unused label error for non x86 arch

---
 drivers/net/intel/cpfl/cpfl_rxtx.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
#35 lore raw

PATCH v3 6/10 net/i40e: permit secondary process Tx path selection

In reply to 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.

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")
---
 drivers/net/intel/i40e/i40e_rxtx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/intel/i40e/i40e_rxtx.c +2 -2
index d189ba263b..c5ac75e0f0 100644
@@ -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
Acked-by on v3 6/10
#36 lore raw

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

---

#37 lore raw

PATCH v3 7/10 net/iavf: permit secondary process Tx path selection

In reply to 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.

Fixes ebcfb039afa8 ("net/iavf: use common Tx path selection infrastructure")
---
 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
index 802e095174..954bce723d 100644
@@ -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
index a47d2547dd..0d19efb94d 100644
@@ -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
Acked-by on v3 7/10
#38 lore raw

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

---

#39 lore raw

PATCH v3 8/10 net/ice: permit secondary process Tx path selection

In reply to 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.

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")
---
 drivers/net/intel/ice/ice_rxtx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/intel/ice/ice_rxtx.c +2 -2
index 637c57b209..31b74be9ba 100644
@@ -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
Acked-by on v3 8/10
#40 lore raw

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

---

#41 lore raw

PATCH v3 9/10 net/idpf: permit secondary process Tx path selection

In reply to 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.

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")
---
 drivers/net/intel/idpf/idpf_rxtx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/intel/idpf/idpf_rxtx.c +2 -2
index 81bcc08126..d387650719 100644
@@ -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
Acked-by on v3 9/10
#42 lore raw

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

---

#43 lore raw

PATCH v3 10/10 net/cpfl: permit secondary process Tx path selection

In reply to 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.

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")
---
 drivers/net/intel/cpfl/cpfl_rxtx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/intel/cpfl/cpfl_rxtx.c +2 -2
index dc729d31af..2e706aaaf1 100644
@@ -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
Acked-by on v3 10/10
#44 lore raw

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

---

#45 lore raw
In reply to Ciara Loftus
Quoted 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->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.

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