Skip to contentSkip to conversation

net/mlx4: 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 8/8 net/mlx4: fix fast-path ops setup in secondary process

From: Long Li <[email protected]>

The secondary process MLX4_MP_REQ_START_RXTX handler sets dev->rx_pkt_burst and dev->tx_pkt_burst, but does not update rte_eth_fp_ops[].rxq.data and txq.data. Since rte_eth_rx_burst() uses rte_eth_fp_ops (which is process-local), the secondary retains stale queue data pointers after VF hot-add, causing a segfault.

Similarly, the MLX4_MP_REQ_STOP_RXTX handler sets dev burst functions to dummy but does not update rte_eth_fp_ops burst pointers, leaving the secondary calling into freed resources.

Fix by updating rte_eth_fp_ops rxq.data and txq.data in the START_RXTX handler, and rte_eth_fp_ops burst function pointers in the STOP_RXTX handler.

Fixes 080d8bc15905 ("net/mlx4: sync stop/start with secondary process")
---
 drivers/net/mlx4/mlx4_mp.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/net/mlx4/mlx4_mp.c +4 -0
index 534cb31151..00ecadee79 100644
@@ -149,6 +149,8 @@ mp_secondary_handle(const struct rte_mp_msg *mp_msg, const void *peer)
 		}
 #endif
 		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(dev, &mp_res, param->type);
 		res->result = 0;
@@ -158,6 +160,8 @@ mp_secondary_handle(const struct rte_mp_msg *mp_msg, const void *peer)
 		INFO("port %u stopping datapath", dev->data->port_id);
 		dev->tx_pkt_burst = rte_eth_pkt_burst_dummy;
 		dev->rx_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(dev, &mp_res, param->type);
 		res->result = 0;
Signature · 1 line
2.43.0