* [PATCH net-next] net: stmmac: dwmac4: schedule RX NAPI on Receive Buffer Unavailable
@ 2026-11-17 4:27 David Wu
0 siblings, 0 replies; 2+ messages in thread
From: David Wu @ 2026-11-17 4:27 UTC (permalink / raw)
To: netdev
Cc: andrew+netdev, Jose.Abreu, davem, rmk+kernel, maxime.chevallier,
lorenzo.bianconi, luis.la, linux-stm32, linux-kernel, David Wu
Once the RX ring is exhausted, the RX DMA enters the suspend state and
no more Receive Interrupts can be generated: incoming frames are kept
in the MTL RX FIFO and are dropped once it overflows. The RX DMA only
resumes after software refills the ring and updates the RX tail
pointer, which is done by the RX NAPI poll (stmmac_rx_refill()).
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.
Schedule the RX NAPI when the RBU interrupt is received, aligning the
dwmac4 behaviour with XGMAC (commit 6338488356d2 ("net: stmmac: xgmac:
Add RBU handling in DMA interrupt")).
This can be observed on a GMAC4 based platform with Split Header (SPH)
enabled under high TCP RX pressure, where the slower RX refill path
lets the RX ring run dry.
Tested with Split Header (SPH) enabled, running a large file download
over TCP:
- Without this change, the RX path hangs permanently once the RX ring
is exhausted: the RX tail pointer is never updated again and the
DMA channel status register latches the RBU bit, while the TX path
keeps running.
- With this change, each RBU interrupt is handled and the RX path
recovers by itself. e.g. 3 RBU events within 6 ms during a download
peak, each one self-recovered (the RX tail pointer resumes advancing
right after), with no further RBU events afterwards.
Signed-off-by: David Wu <david.wu@rock-chips.com>
---
drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c
index a0249715fafa..929aa77ce247 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c
@@ -153,8 +153,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;
+ }
if (unlikely(intr_status & DMA_CHAN_STATUS_RPS))
x->rx_process_stopped_irq++;
if (unlikely(intr_status & DMA_CHAN_STATUS_ETI))
--
2.25.1
^ permalink raw reply [flat|nested] 2+ messages in thread* [PATCH net-next] net: stmmac: dwmac4: schedule RX NAPI on Receive Buffer Unavailable
@ 2026-11-17 3:43 David Wu
0 siblings, 0 replies; 2+ messages in thread
From: David Wu @ 2026-11-17 3:43 UTC (permalink / raw)
To: david.wu
Cc: rmk+kernel, maxime.chevallier, lorenzo.bianconi, luis.la, netdev,
linux-stm32, linux-kernel
Once the RX ring is exhausted, the RX DMA enters the suspend state and
no more Receive Interrupts can be generated: incoming frames are kept
in the MTL RX FIFO and are dropped once it overflows. The RX DMA only
resumes after software refills the ring and updates the RX tail
pointer, which is done by the RX NAPI poll (stmmac_rx_refill()).
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.
Schedule the RX NAPI when the RBU interrupt is received, aligning the
dwmac4 behaviour with XGMAC (commit 6338488356d2 ("net: stmmac: xgmac:
Add RBU handling in DMA interrupt")).
This can be observed on a GMAC4 based platform with Split Header (SPH)
enabled under high TCP RX pressure, where the slower RX refill path
lets the RX ring run dry.
Tested with Split Header (SPH) enabled, running a large file download
over TCP:
- Without this change, the RX path hangs permanently once the RX ring
is exhausted: the RX tail pointer is never updated again and the
DMA channel status register latches the RBU bit, while the TX path
keeps running.
- With this change, each RBU interrupt is handled and the RX path
recovers by itself. e.g. 3 RBU events within 6 ms during a download
peak, each one self-recovered (the RX tail pointer resumes advancing
right after), with no further RBU events afterwards.
Signed-off-by: David Wu <david.wu@rock-chips.com>
---
drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c
index a0249715fafa..929aa77ce247 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c
@@ -153,8 +153,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;
+ }
if (unlikely(intr_status & DMA_CHAN_STATUS_RPS))
x->rx_process_stopped_irq++;
if (unlikely(intr_status & DMA_CHAN_STATUS_ETI))
--
2.25.1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-17 4:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-17 4:27 [PATCH net-next] net: stmmac: dwmac4: schedule RX NAPI on Receive Buffer Unavailable David Wu
-- strict thread matches above, loose matches on Subject: below --
2026-11-17 3:43 David Wu
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®