Skip to content

Conversation

@yseraf
Copy link

@yseraf yseraf commented Jan 28, 2026

This patch addresses a controller freeze occurring under high incoming traffic loads on GEM-based platforms like the ATSAMA5D41. When the DMA exhausted all available buffers, it triggered a Buffer Not Available (BNA) condition in the Receive Status Register (RSR).

On this hardware, clearing the BNA flag without first resolving the underlying resource shortage caused the controller to enter a permanent blocked state. The recovery logic introduced here forces a slot release by incrementing the consumer index (rx_tail), acknowledges the error in RSR, and performs a descriptor refill before allowing NAPI to continue. To isolate this critical repair phase from asynchronous bus errors, the HRESP interrupt is transiently masked. This GEM-specific implementation is separated from the legacy MACB polling to avoid regressions on older architectures.

This patch addresses a controller freeze occurring under high incoming
traffic loads on GEM-based platforms like the ATSAMA5D41. When the DMA
exhausted all available buffers, it triggered a Buffer Not Available
(BNA) condition in the Receive Status Register (RSR).

On this hardware, clearing the BNA flag without first resolving the
underlying resource shortage caused the controller to enter a
permanent blocked state. The recovery logic introduced here forces
a slot release by incrementing the consumer index (rx_tail),
acknowledges the error in RSR, and performs a descriptor refill
before allowing NAPI to continue. To isolate this critical repair
phase from asynchronous bus errors, the HRESP interrupt is
transiently masked. This GEM-specific implementation is separated
from the legacy MACB polling to avoid regressions on older
architectures.

Signed-off-by: Yannick Serafini <[email protected]>
@yseraf
Copy link
Author

yseraf commented Jan 28, 2026

The bug and this patch can be easily tested using Packet Sender application with its UDP Traffic Generator utils :
image

Without patch, the Ethernet controller gets stuck almost instantly (in few dozen of seconds).
With the patch, the Ethernet controller keep working even under heavy load for hours.

Note: the standard Ethernet controller behaviour and performance like bandwidth is not affected by the patch, it just makes the ATSAMA5Dxx a true network compatible CPU.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant