Skip to contentSkip to conversation

net/mlx5: fix fast-path ops setup in secondary process

PATCH Superseded [email protected] 1 participant 1 message Feb 20 Network drivers

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH 7/8 net/mlx5: fix fast-path ops setup in secondary process

From: Long Li <[email protected]>

On hotplug, the secondary process is not able to set rte_eth_fp_ops because the primary process has not finished setting up the device for datapath.

When the primary process re-attaches a VF during a hot-add event (e.g. Accelerated Networking re-enabled on Azure), it sends MLX5_MP_REQ_START_RXTX to the secondary process. The secondary handler sets rx/tx burst functions and reinitializes UAR mappings, but does not update the fast-path queue data pointers. The stale rxq.data and txq.data in rte_eth_fp_ops cause a segfault when the secondary resumes polling the re-added VF port.

Fix this by setting rte_eth_fp_ops rxq.data and txq.data to point to the device's RX/TX queue arrays in the secondary process when the primary requests to start datapath, before the memory barrier.

Also update rte_eth_fp_ops burst function pointers in the STOP_RXTX handler. Without this, the secondary's rte_eth_fp_ops retains stale burst function pointers after stop, since rte_eth_fp_ops is process-local and eth_dev_fp_ops_reset() in rte_eth_dev_stop() only affects the primary.

Without this fix, the secondary process crashes with SIGSEGV in rte_eth_rx_burst() at qd = p->rxq.data[queue_id] when the VF is hot-added back.

Fixes 2aac5b5d119f ("net/mlx5: sync stop/start with secondary process")
---
 drivers/net/mlx5/linux/mlx5_mp_os.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/net/mlx5/linux/mlx5_mp_os.c +4 -0
index f2e71c9bd4..955a990a39 100644
@@ -189,6 +189,8 @@ struct rte_mp_msg mp_res;
 			}
 		}
 		close(mp_msg->fds[0]);
+		rte_eth_fp_ops[param->port_id].rxq.data = dev->data->rx_queues;
+		rte_eth_fp_ops[param->port_id].txq.data = dev->data->tx_queues;
 		rte_mb();
 		mp_init_msg(&priv->mp_id, &mp_res, param->type);
 		res->result = 0;
@@ -198,6 +200,8 @@ struct rte_mp_msg mp_res;
 		DRV_LOG(INFO, "port %u stopping datapath", dev->data->port_id);
 		dev->rx_pkt_burst = rte_eth_pkt_burst_dummy;
 		dev->tx_pkt_burst = rte_eth_pkt_burst_dummy;
+		rte_eth_fp_ops[param->port_id].rx_pkt_burst = rte_eth_pkt_burst_dummy;
+		rte_eth_fp_ops[param->port_id].tx_pkt_burst = rte_eth_pkt_burst_dummy;
 		rte_mb();
 		mp_init_msg(&priv->mp_id, &mp_res, param->type);
 		res->result = 0;
Signature · 1 line
2.43.0