igc: Fix infinite initialization loop with early XDP redirect
Subsystems (3)
PATCH v2 1/1 igc: Fix infinite initialization loop with early XDP redirect
When a XDP redirect happens before the link is ready, that transmission will not finish and will timeout, causing an adapter reset. If the redirects do not stop, the adapter will not stop resetting.
Wait for the driver to signal that there's a carrier before allowing transmissions to proceed.
Previous code was relying that when __IGC_DOWN is cleared, the NIC is ready to transmit as all the queues are ready, what happens is that the carrier presence will only be signaled later, after the watchdog workqueue has a chance to run. And during this interval (between clearing __IGC_DOWN and the watchdog running) if any transmission happens the timeout is emitted (detected by igc_tx_timeout()) which causes the reset, with the potential for the inifite loop.
---
v1 -> v2:
- Added more information to the commit message (Maciej Fijalkowski)
drivers/net/ethernet/intel/igc/igc_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/igc/igc_main.c +1 -1
@@ -6491,7 +6491,7 @@ static int igc_xdp_xmit(struct net_device *dev, int num_frames,struct igc_ring *ring;int i, drops; -if (unlikely (test_bit (__IGC_DOWN, &adapter->state))) +if (unlikely (!netif_carrier_ok (dev)))return -ENETDOWN ;if (unlikely (flags & ~XDP_XMIT_FLAGS_MASK ))
Signature · 1 line
2.41.0
Quoted 22 lines · Vinicius Costa Gomes
When a XDP redirect happens before the link is ready, that transmission will not finish and will timeout, causing an adapter reset. If the redirects do not stop, the adapter will not stop resetting.
Wait for the driver to signal that there's a carrier before allowing transmissions to proceed.
Previous code was relying that when
__IGC_DOWNis cleared, the NIC is ready to transmit as all the queues are ready, what happens is that the carrier presence will only be signaled later, after the watchdog workqueue has a chance to run. And during this interval (between clearing__IGC_DOWNand the watchdog running) if any transmission happens the timeout is emitted (detected byigc_tx_timeout()) which causes the reset, with the potential for the inifite loop.Fixes 4ff320361092 ("igc: Add support for XDP_REDIRECT action")Reported-by Ferenc Fejes <[email protected]>Signed-off-by Vinicius Costa Gomes <[email protected]>Tested-by Ferenc Fejes <[email protected]>Reviewed-by Maciej Fijalkowski <[email protected]>
Quoted 7 lines
---
v1 -> v2:
- Added more information to the commit message (Maciej Fijalkowski)drivers/net/ethernet/intel/igc/igc_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)