From: netdev-bot+sashiko@kernel.org
To: david.wu@rock-chips.com
Cc: netdev@vger.kernel.org, andrew+netdev@lunn.ch,
davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
pabeni@redhat.com, maxime.chevallier@bootlin.com,
joabreu@synopsys.com, peppe.cavallaro@st.com, luis.la@mail.de,
lorenzo.bianconi@oss.qualcomm.com, mcoquelin.stm32@gmail.com,
alexandre.torgue@foss.st.com, rmk+kernel@armlinux.org.uk,
Anandu.Padinhare@electrifex.com,
linux-stm32@st-md-mailman.stormreply.com,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [RESEND PATCH net] net: stmmac: dwmac4: schedule RX NAPI on Receive Buffer Unavailable
Date: Tue, 24 Nov 2026 15:21:50 +0000 [thread overview]
Message-ID: <179553371014.3135.698233709015906306@kernel.org> (raw)
In-Reply-To: <20261120150805.763415-1-david.wu@rock-chips.com>
Thank you for your contribution! Sashiko AI review found 3 potential
issue(s) to consider.
Critical: 0 · High: 1 · Medium: 1 · Low: 1
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [High] The fix only works when RBU is handled through
stmmac_napi_check().
- [Medium] In dwmac4_dma_interrupt(), the new `ret |= handle_rx` for RBU
(line 160) is followed by the TPS and FBE branches, which still use…
- [Low] The commit fixes a user-visible permanent RX hang and names
commit 1b9707e6f1a9 ('net: stmmac: enable RPS and RBU interrupts') as…
--
net: stmmac: dwmac4: schedule RX NAPI on Receive Buffer Unavailable
When dwmac4_dma_interrupt() sees the Receive Buffer Unavailable (RBU)
abnormal interrupt, this patch makes it return handle_rx so that the RX
NAPI is scheduled. That NAPI poll refills the ring and lets the suspended
RX DMA resume. The goal is to match the existing XGMAC RBU handling.
> Commit 1b9707e6f1a9 ("net: stmmac: enable RPS and RBU interrupts")
> enabled the RBU interrupt for dwmac4, but the interrupt handler only
> updates the statistics counter without scheduling the RX NAPI. The RX
> NAPI is therefore never invoked, stmmac_rx_refill() never runs, and
> the RX path hangs forever once the ring has been exhausted.
[Severity: Low]
Should this have a Fixes: 1b9707e6f1a9 ("net: stmmac: enable RPS and RBU
interrupts") tag, and perhaps a Cc: stable? The trailers only include
Signed-off-by and Reviewed-by. Commit 686b5f47f8cc ("net: stmmac: Clear DMA
errors for multi-channel interrupts") does carry a Fixes: tag for the same
commit.
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c
> index 02aa1a3dd1e25..de6bd6f8a7d58 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c
> @@ -155,8 +155,10 @@ int dwmac4_dma_interrupt(struct stmmac_priv *priv, void __iomem *ioaddr,
>
> /* ABNORMAL interrupts */
> if (unlikely(intr_status & DMA_CHAN_STATUS_AIS)) {
> - if (unlikely(intr_status & DMA_CHAN_STATUS_RBU))
> + if (unlikely(intr_status & DMA_CHAN_STATUS_RBU)) {
> x->rx_buf_unav_irq++;
> + ret |= handle_rx;
> + }
[Severity: High]
Does this also cover GMAC4 platforms in multi-MSI mode
(STMMAC_FLAG_MULTI_MSI_EN, e.g. dwmac-intel mGbE, dwmac-motorcomm YT6801,
dwmac-s32, dwmac-loongson)?
On those platforms RBU is part of the error mask:
#define DMA_CHAN_STATUS_MSK_ERR (DMA_CHAN_STATUS_AIS | DMA_CHAN_STATUS_FBE | DMA_CHAN_STATUS_RPS | DMA_CHAN_STATUS_RBU)
The common IRQ handler gets here with DMA_DIR_ERR:
stmmac_mac_interrupt()
stmmac_dma_err_interrupt()
stmmac_dma_interrupt_status(..., DMA_DIR_ERR)
dwmac4_dma_interrupt()
stmmac_dma_err_interrupt() only checks for tx_hard_error, so the
handle_rx bit returned here is dropped:
status = stmmac_dma_interrupt_status(priv, priv->ioaddr,
&priv->xstats, chan,
DMA_DIR_ERR);
if (unlikely(status & tx_hard_error))
stmmac_global_err(priv);
The write-back at the end of dwmac4_dma_interrupt() still acknowledges RBU
and AIS:
writel(intr_status & intr_en,
ioaddr + DMA_CHAN_STATUS(dwmac4_addrs, chan));
That consumes the RBU event, and the RX NAPI is never scheduled. Wouldn't
the RX DMA then stay suspended, with stmmac_rx_refill() never running? That
is the same RX hang the commit message describes.
RBU is in both DMA_CHAN_STATUS_MSK_RX and DMA_CHAN_STATUS_MSK_ERR, and
nothing serializes the read/ack sequence across vectors. So the common IRQ
handler could also beat the per-channel RX vector and swallow the event
even when the RX vector saw it too.
Commit 686b5f47f8cc ("net: stmmac: Clear DMA errors for multi-channel
interrupts") is what sends RBU to this error path in multi-MSI mode.
Could stmmac_dma_err_interrupt() honour handle_rx for chan <
rx_queues_to_use the same way stmmac_napi_check() does? That would mean
disabling the RX DMA irq under ch->lock and calling __napi_schedule() on
rx_napi.
[Severity: Medium]
A few lines further down, the TPS and FBE branches still use plain
assignment:
if (unlikely(intr_status & DMA_CHAN_STATUS_TPS)) {
x->tx_process_stopped_irq++;
ret = tx_hard_error;
}
if (unlikely(intr_status & DMA_CHAN_STATUS_FBE)) {
x->fatal_bus_error_irq++;
ret = tx_hard_error;
}
If RBU appears in the same status read as TPS or FBE, is the handle_rx bit
set here overwritten?
In single IRQ mode (DMA_DIR_RXTX), stmmac_napi_check() would then skip
rx_napi, and stmmac_dma_interrupt() would only run TX recovery:
} else if (unlikely(status[chan] == tx_hard_error)) {
stmmac_tx_err(priv, chan);
}
By then the write-back has already acknowledged RBU, so the RX ring would
stay exhausted. In multi-MSI RX mode, FBE is also in the RX mask, so RBU
together with FBE loses handle_rx in the same way.
TPS isn't in DMA_CHAN_INTR_ABNORMAL, so the writel(intr_status & intr_en,
...) write-back never acknowledges it. If the hardware keeps TPS latched
after a runtime TX DMA stop (stmmac_tx_err() and stmmac_disable_tx_queue()
both call stmmac_stop_tx_dma()), every later RBU in RXTX mode could hit
this overwrite. That part depends on how the IP latches TPS, and I couldn't
confirm it from the code.
The XGMAC handler named in the commit message, dwxgmac2_dma_interrupt(),
uses ret |= tx_hard_error, so handle_rx is kept there. Just changing dwmac4
to |= wouldn't be enough, though, because stmmac_dma_interrupt() tests
status[chan] == tx_hard_error.
Could handle_rx be ORed in after the TPS/FBE assignments? The other option
would be to change both the assignments and the callers' equality tests.
> if (unlikely(intr_status & DMA_CHAN_STATUS_RPS))
> x->rx_process_stopped_irq++;
> if (unlikely(intr_status & DMA_CHAN_STATUS_ETI))
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261120150805.763415-1-david.wu%40rock-chips.com
prev parent reply other threads:[~2026-11-24 15:22 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-20 15:08 [RESEND PATCH net] net: stmmac: dwmac4: schedule RX NAPI on Receive Buffer Unavailable David Wu
2026-11-24 15:21 ` netdev-bot+sashiko [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=179553371014.3135.698233709015906306@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=Anandu.Padinhare@electrifex.com \
--cc=alexandre.torgue@foss.st.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=david.wu@rock-chips.com \
--cc=edumazet@kernel.org \
--cc=joabreu@synopsys.com \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=lorenzo.bianconi@oss.qualcomm.com \
--cc=luis.la@mail.de \
--cc=maxime.chevallier@bootlin.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=peppe.cavallaro@st.com \
--cc=rmk+kernel@armlinux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox