* [PATCH iwl-net v2] igc: Fix infinite initialization loop with early XDP redirect
@ 2023-09-07 0:30 Vinicius Costa Gomes
2023-09-13 10:56 ` [Intel-wired-lan] " naamax.meir
0 siblings, 1 reply; 2+ messages in thread
From: Vinicius Costa Gomes @ 2023-09-07 0:30 UTC (permalink / raw)
To: intel-wired-lan
Cc: sasha.neftin, Vinicius Costa Gomes, Ferenc Fejes,
Maciej Fijalkowski, Jesse Brandeburg, Tony Nguyen,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Vedang Patel, Andre Guedes, Jithu Joseph, netdev, linux-kernel
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.
Fixes: 4ff320361092 ("igc: Add support for XDP_REDIRECT action")
Reported-by: Ferenc Fejes <ferenc.fejes@ericsson.com>
Closes: https://lore.kernel.org/netdev/0caf33cf6adb3a5bf137eeaa20e89b167c9986d5.camel@ericsson.com/
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
Tested-by: Ferenc Fejes <ferenc.fejes@ericsson.com>
Reviewed-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
---
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(-)
diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c
index 293b45717683..98de34d0ce07 100644
--- a/drivers/net/ethernet/intel/igc/igc_main.c
+++ b/drivers/net/ethernet/intel/igc/igc_main.c
@@ -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))
--
2.41.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Intel-wired-lan] [PATCH iwl-net v2] igc: Fix infinite initialization loop with early XDP redirect
2023-09-07 0:30 [PATCH iwl-net v2] igc: Fix infinite initialization loop with early XDP redirect Vinicius Costa Gomes
@ 2023-09-13 10:56 ` naamax.meir
0 siblings, 0 replies; 2+ messages in thread
From: naamax.meir @ 2023-09-13 10:56 UTC (permalink / raw)
To: Vinicius Costa Gomes, intel-wired-lan
Cc: Andre Guedes, netdev, Jesse Brandeburg, Jithu Joseph,
linux-kernel, Ferenc Fejes, Eric Dumazet, Tony Nguyen,
Jakub Kicinski, Paolo Abeni, David S. Miller, Vedang Patel
On 9/7/2023 03:30, Vinicius Costa Gomes wrote:
> 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.
>
> Fixes: 4ff320361092 ("igc: Add support for XDP_REDIRECT action")
> Reported-by: Ferenc Fejes <ferenc.fejes@ericsson.com>
> Closes: https://lore.kernel.org/netdev/0caf33cf6adb3a5bf137eeaa20e89b167c9986d5.camel@ericsson.com/
> Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
> Tested-by: Ferenc Fejes <ferenc.fejes@ericsson.com>
> Reviewed-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
> ---
> 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(-)
Tested-by: Naama Meir <naamax.meir@linux.intel.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-09-13 10:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-07 0:30 [PATCH iwl-net v2] igc: Fix infinite initialization loop with early XDP redirect Vinicius Costa Gomes
2023-09-13 10:56 ` [Intel-wired-lan] " naamax.meir
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).