mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH net v5 0/2] net: atl1c: fix the RX buffer leak on errored frames
@ 2026-11-25 11:31 Federico Musto
  2026-11-25 11:31 ` [PATCH net v5 1/2] net: atl1c: wait for in-flight RX polls before the link-down ring reset Federico Musto
  2026-11-25 11:31 ` [PATCH net v5 2/2] net: atl1c: free the RX buffer when the descriptor reports an error Federico Musto
  0 siblings, 2 replies; 5+ messages in thread
From: Federico Musto @ 2026-11-25 11:31 UTC (permalink / raw)
  To: Chris Snook, Andrew Lunn, David S . Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, netdev
  Cc: linux-kernel, Federico Musto

Patch 2 is v5 of the fix for the skb and the DMA mapping leaked by every
RX frame whose descriptor reports an error. Patch 1 closes the race
between the RX poll and the ring reset of the link-down path.

v5 addresses the Sashiko AI review of v4:

 - 1/2 no longer proceeds with the ring reset when it stops waiting
   because __AT_DOWN appeared: a concurrent close/down/suspend resets the
   rings itself after napi_disable(), so the work item now leaves them
   alone. The wait is also bounded (~0.5-1 s, then the reset is skipped
   with a ratelimited warning), so a threaded busy-poll cannot stall the
   work item with interrupts masked. The wait only runs on the work-item
   path; atl1c_up() reaches the handler before napi_enable() and skips
   it. The carrier-off store is now ordered before the NAPI_STATE_SCHED
   sampling with an explicit smp_mb(): the handshake is a store-buffer
   pattern and the scheduling side is ordered by the cmpxchg in
   napi_schedule_prep().
 - 2/2 adds a dma_rmb() between the valid-bit test on word3 and the rest
   of the descriptor. word0 now decides whether a reset is scheduled and
   the ring is zeroed after a reset, so without the barrier a stale word0
   could schedule a spurious reset on weakly ordered CPUs.

The per-patch changelogs are below the "---" of each patch.

Both problems were found by code inspection. Build-tested with W=1 and
sparse on netdev/net: no new warnings.

Runtime-tested on a MikroTik CCR2004-1G-2XS-PCIe, which exposes emulated
AR8151 functions, with these two patches ported onto the driver of a
7.0.14-29-pve kernel plus diagnostic counters.  27 link-down events were
handled and the link recovered every time: 9 from the first campaign (3
PHY link flaps and 6 link drops that this card produces about 1.3 s
after an MTU change), and 18 from later flap campaigns, partly under
sustained RX load.  The load caught an RX poll in flight four times:
the wait loop iterated, the poll finished within a few milliseconds and
the reset proceeded normally.  The __AT_DOWN skip, the timeout branch,
the out-of-sync reset and the error path of patch 2 have not been
exercised on hardware.  No RRD out-of-sync events across ~4.3 GiB of
traffic plus the load campaigns, no Oops, no warnings.

One observation, reported for completeness: twice, about 1.3 s after an
MTU change and immediately before the device signalled link down, the
IOMMU blocked a DMA read from the device to an unmapped address.  Both
faults precede the link-down interrupt, so before the work item touched
by this series ran.  I have not established the cause; this card is
known to issue stale DMA around that event.

v4: https://lore.kernel.org/netdev/20261117225521.19689-1-federico@rimpianto.com/
v3: https://lore.kernel.org/netdev/20261103225218.19206-1-federico@rimpianto.com/
v2: https://lore.kernel.org/netdev/20261102215253.68185-1-federico@rimpianto.com/
v1: https://lore.kernel.org/netdev/20261027115156.17128-1-federico@rimpianto.com/

Federico Musto (2):
  net: atl1c: wait for in-flight RX polls before the link-down ring
    reset
  net: atl1c: free the RX buffer when the descriptor reports an error

 .../net/ethernet/atheros/atl1c/atl1c_main.c   | 169 +++++++++++++-----
 1 file changed, 121 insertions(+), 48 deletions(-)

-- 
2.54.0 (Apple Git-157)


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-11-29 11:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-25 11:31 [PATCH net v5 0/2] net: atl1c: fix the RX buffer leak on errored frames Federico Musto
2026-11-25 11:31 ` [PATCH net v5 1/2] net: atl1c: wait for in-flight RX polls before the link-down ring reset Federico Musto
2026-11-29 11:48   ` netdev-bot+sashiko
2026-11-25 11:31 ` [PATCH net v5 2/2] net: atl1c: free the RX buffer when the descriptor reports an error Federico Musto
2026-11-29 11:48   ` netdev-bot+sashiko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®