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.

Fix this by properly setting up rte_eth_fp_ops in the secondary
process when the primary requests to start datapath. Set both
rxq.data and txq.data to point to the device's RX/TX queue arrays,
enabling the fast-path operations to access queues correctly.

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 cannot transmit or receive
packets because the fast-path queue data pointers are NULL.

Fixes: 62724d1a3981 ("net/mana: start/stop device")
Cc: [email protected]

Signed-off-by: Long Li <[email protected]>
---
 drivers/net/mana/mp.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/mana/mp.c b/drivers/net/mana/mp.c
index 5467d385ce..7c5c0fa88f 100644
--- a/drivers/net/mana/mp.c
+++ b/drivers/net/mana/mp.c
@@ -145,6 +145,9 @@ mana_mp_secondary_handle(const struct rte_mp_msg *mp_msg, 
const void *peer)
                dev->tx_pkt_burst = mana_tx_burst;
                dev->rx_pkt_burst = mana_rx_burst;
 
+               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();
 
                res->result = 0;
@@ -154,6 +157,9 @@ mana_mp_secondary_handle(const struct rte_mp_msg *mp_msg, 
const void *peer)
        case MANA_MP_REQ_STOP_RXTX:
                DRV_LOG(INFO, "Port %u stopping datapath", dev->data->port_id);
 
+               rte_eth_fp_ops[param->port_id].rx_pkt_burst = 
mana_rx_burst_removed;
+               rte_eth_fp_ops[param->port_id].tx_pkt_burst = 
mana_tx_burst_removed;
+
                dev->tx_pkt_burst = mana_tx_burst_removed;
                dev->rx_pkt_burst = mana_rx_burst_removed;
 
-- 
2.43.0

Reply via email to