Thread (14 messages) flat view 14 messages, 3 authors, 2d ago

Re: [PATCH net 1/3] net: macb: never give hardware a NULL RX buffer

From: Théo Lebrun <theo.lebrun@bootlin.com>
Date: 2026-09-24 16:31:01
Also in: lkml, stable

On Thu Sep 24, 2026 at 5:41 PM CEST, Jakub Kicinski wrote:
On Thu, 24 Sep 2026 17:13:58 +0200 Théo Lebrun wrote:
quoted
quoted
If the AI interprets the rx poll side correctly these seem like a major
flaw in setting the USED bit :(  
Yes the AI is correct (unsurprisingly). But two things:
If it's correct then patch needs to be changed.
Please don't write puzzles for me to solve.
quoted
 - before this patch what happened was that HW read the NULL descriptor,
   so not much better
 - we can detect in gem_rx() using our ring buffer cursors that tell us
   what we've managed to allocate, that we gem_rx() doesn't iterate
   over descriptors that haven't been allocated
Grammatically dubious puzzles at that.
Sorry for the fuzzy message.
Yes, Sashiko is correct and, yes, the patch will change.

To explain more in detail: gem_rx() iterates over descriptors using
RX_USED as signal that a descriptor was filled by the hardware. The
risk is to reach a descriptor where allocation failed (and we used
RX_USED as signal for the hardware to not fill it up). We can avoid
that using our cursors (queue->rx_tail and queue->rx_prepared_head)
that tell us the range of allocated descriptors.

In concrete terms, we stop iterating in gem_rx() if

	queue->rx_tail == queue->rx_prepared_head

or if

	desc->addr & MACB_BIT(RX_USED)

Thanks,

--
Théo Lebrun, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help