[PATCH net] net: stmmac: retry a failed RX refill from a timer
Sam Edwards
cfsworks at gmail.com
Sun Nov 22 13:02:31 PST 2026
On Sun, Nov 22, 2026 at 12:20 PM Sam Edwards <cfsworks at gmail.com> wrote:
>
> On Sun, Nov 22, 2026 at 10:01 AM Nicolai Buchwitz <nb at tipi-net.de> wrote:
> >
> > Hi Anandu
> >
> > On 20.11.2026 08:49, Anandu Padinhare wrote:
> >
> > > [...]
> >
> > > @@ -6164,6 +6205,8 @@ static int stmmac_napi_poll_rx(struct napi_struct
> > > *napi, int budget)
> > > u64_stats_update_end(&rxq_stats->napi_syncp);
> > >
> > > work_done = stmmac_rx(priv, budget, chan);
> > > + if (unlikely(stmmac_rx_refill_needed(priv, chan)))
> > > + stmmac_rx_refill_timer_arm(ch);
> >
> > After a successful retry, doesn't this leave the last received frame in
> > the ring until the next RX irq? Could the poll refill first?
>
> Do you mean "first as well" or "first instead"? Because "instead" can
> cause avoidable packet loss:
> 1) Initially, network is idle and ring is full of empty DMA buffers
> 2) A burst of exactly one ring's worth of packets arrives
> 3) The RX irq fires and stmmac_rx() attempts its refill-first (none
> needed) then depletes the ring to the maximally-dirty state; the
> refill timer is armed
Thinking about it more: the "unreachable packet" problem happens at
this point too, even with the "first as well" behavior.
Maybe the best way to resolve it is to adopt stmmac_rx_zc()'s behavior
of refilling during the loop?
> 4) During the 10ms timer period, more traffic arrives
> 5) The RX irq doesn't fire again because no additional DMA is
> happening: there are no usable buffers in the ring. So we're forced to
> wait out the timer.
> 6) Any packets during this time (beyond the RxFIFO's capacity) are
> discarded by the hardware
>
> But, "first as well" sounds good to me: before entering the main loop,
> refill 1 buffer (if possible) just to ensure either the IRQ fires
> again immediately (if the FIFO is holding onto another packet for us),
> or the inaccessible ring slot is clean (if the FIFO is empty).
>
> Cheers,
> Sam
>
> >
> > > [...]
> >
> > Regards,
> > Nicolai
More information about the linux-arm-kernel
mailing list