xsk_get_pool_from_qid() checks the queue id against the stack's real
queue counts, which can be higher than the number of rings the device
has, e.g. after igb falls back from MSI-X to MSI on resume. Disabling
the pool of such a queue then passes a NULL ring to
igb_txrx_ring_disable().

Only disable and re-enable the rings the device has, as
igb_xsk_pool_enable() and igb_xsk_wakeup() already check.

Compile-tested only: the XSK pool path isn't reachable with the QEMU
82576 setup used for the rest of the series.

Fixes: 80f6ccf9f116 ("igb: Introduce XSK data structures and helpers")
Cc: [email protected] # 6.14+
Link: 
https://lore.kernel.org/netdev/[email protected]/
Signed-off-by: Antonio Quartulli <[email protected]>
---
v3: new patch.

 drivers/net/ethernet/intel/igb/igb_xsk.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/igb/igb_xsk.c 
b/drivers/net/ethernet/intel/igb/igb_xsk.c
index ce4a7b5..8ed82bb 100644
--- a/drivers/net/ethernet/intel/igb/igb_xsk.c
+++ b/drivers/net/ethernet/intel/igb/igb_xsk.c
@@ -148,7 +148,12 @@ static int igb_xsk_pool_disable(struct igb_adapter 
*adapter, u16 qid)
                return -EINVAL;
 
        rx_ring = adapter->rx_ring[qid];
-       if_running = netif_running(adapter->netdev) && 
igb_xdp_is_enabled(adapter);
+       /* The stack can know more queues than the device has, e.g. after a
+        * fallback to fewer queues on resume: skip the rings it doesn't have.
+        */
+       if_running = netif_running(adapter->netdev) &&
+                    igb_xdp_is_enabled(adapter) &&
+                    qid < adapter->num_rx_queues;
        if (if_running)
                igb_txrx_ring_disable(adapter, qid);
 
-- 
2.56.1

Reply via email to