igc: Fix infinite initialization loop with early XDP redirect
Subsystems (3)
PATCH 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.
--- 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 1 line · Vinicius Costa Gomes
When a XDP redirect happens before the link is ready, that
When exactly link was 'ready' in your setup? You said it was enough to launch traffic towards igc iface before running xdp-bench. Was the iface down or up or?
Quoted 3 lines
transmission will not finish and will timeout, causing an adapter reset. If the redirects do not stop, the adapter will not stop resetting.
Please highlight that this driver shares tx resources with netstack. I believe the source of this bug is that the watchdog is responsible to call netif_carrier_on() from a workqueue which happens to be scheduled *after* clearing __IGC_DOWN in igc_up().
Quoted 18 lines
Wait for the driver to signal that there's a carrier before allowing transmissions to proceed.
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]>--- drivers/net/ethernet/intel/igc/igc_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/ethernet/intel/igc/igc_main.c +0
-0
drivers/net/ethernet/intel/igc/igc_main.c static int igc_xdp_xmit(struct net_device *dev, int num_frames, · line 6495
Quoted 6 lines
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 ;
I thought about keeping the bit check as well but given what i wrote above it is probably redundant, so:
Quoted 5 lines
drivers/net/ethernet/intel/igc/igc_main.c +0
-0if (unlikely (flags & ~XDP_XMIT_FLAGS_MASK ))Signature · 1 line
2.41.0
Quoted 6 lines · Maciej Fijalkowski
Quoted 1 line · Vinicius Costa Gomes
When a XDP redirect happens before the link is ready, that
When exactly link was 'ready' in your setup? You said it was enough to launch traffic towards igc iface before running xdp-bench. Was the iface down or up or?
In short, the interface was up and it was brought down "externally".
I should have explained my test better: A is the system under test, B is the monitor; 1. initially the link between systems A and B is up; 2. I setup the vlans and xdp-bench; 3. I start sending traffic; 4. on system B, I brind the NIC connected to A down; 5. infinite initialization loop.
Quoted 10 lines
Quoted 4 lines
transmission will not finish and will timeout, causing an adapter reset. If the redirects do not stop, the adapter will not stop resetting.
Please highlight that this driver shares tx resources with netstack. I believe the source of this bug is that the watchdog is responsible to call
netif_carrier_on()from a workqueue which happens to be scheduled *after* clearing__IGC_DOWNinigc_up().
Sure, will add this information to the commit message and send a v2.
Quoted 21 lines
Quoted 21 lines
Wait for the driver to signal that there's a carrier before allowing transmissions to proceed.
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]>--- drivers/net/ethernet/intel/igc/igc_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/ethernet/intel/igc/igc_main.c +0
-0@@ -6491,7 +6491,7 @@ static int igc_xdp_xmit(struct net_device *dev, int num_frames,struct igc_ring *ring;int i, drops;
Quoted 14 lines
drivers/net/ethernet/intel/igc/igc_main.c static int igc_xdp_xmit(struct net_device *dev, int num_frames, · line 6495
Quoted 3 lines
drivers/net/ethernet/intel/igc/igc_main.c +1
-1-if (unlikely (test_bit (__IGC_DOWN, &adapter->state))) +if (unlikely (!netif_carrier_ok (dev)))return -ENETDOWN ;I thought about keeping the bit check as well but given what i wrote above it is probably redundant, so:
Reviewed-by Maciej Fijalkowski <[email protected]>Quoted 5 lines
drivers/net/ethernet/intel/igc/igc_main.c +0
-0if (unlikely (flags & ~XDP_XMIT_FLAGS_MASK ))Signature · 1 line
2.41.0
Cheers,
Signature · 1 line
Vinicius