Skip to content

Commit cb47b1f

Browse files
vcgomesdavem330
authored andcommitted
igc: Fix infinite initialization loop with early XDP redirect
When an 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 infinite loop. Fixes: 4ff3203 ("igc: Add support for XDP_REDIRECT action") Reported-by: Ferenc Fejes <[email protected]> Closes: https://lore.kernel.org/netdev/[email protected]/ Signed-off-by: Vinicius Costa Gomes <[email protected]> Tested-by: Ferenc Fejes <[email protected]> Reviewed-by: Maciej Fijalkowski <[email protected]> Tested-by: Naama Meir <[email protected]> Signed-off-by: Tony Nguyen <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent aabb4af commit cb47b1f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/net/ethernet/intel/igc/igc_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6491,7 +6491,7 @@ static int igc_xdp_xmit(struct net_device *dev, int num_frames,
64916491
struct igc_ring *ring;
64926492
int i, drops;
64936493

6494-
if (unlikely(test_bit(__IGC_DOWN, &adapter->state)))
6494+
if (unlikely(!netif_carrier_ok(dev)))
64956495
return -ENETDOWN;
64966496

64976497
if (unlikely(flags & ~XDP_XMIT_FLAGS_MASK))

0 commit comments

Comments
 (0)