* [PATCH net 0/2] net: sparx5/lan969x: fix RX ring stall on frames from inactive ports
@ 2026-11-16 9:56 Daniel Machon
2026-11-16 9:56 ` [PATCH net 1/2] net: sparx5: " Daniel Machon
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Daniel Machon @ 2026-11-16 9:56 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Steen Hegelund, UNGLinuxDriver
Cc: Zhang Hewei, netdev, linux-arm-kernel, linux-kernel
On Sparx5 and lan969x, a received frame whose source port does not map
to an active port is never consumed from the FDMA RX ring: the NAPI poll
stops on it, and finds the same DB again on every following poll.
Patch 1 fixes Sparx5, where the same skb grows on every poll until
skb_over_panic().
Patch 2 fixes lan969x, where RX stops on all ports.
The issue was reported by Zhang Hewei, and these patches replace his
series [1]. Tested on Sparx5 and lan969x.
[1] https://lore.kernel.org/netdev/tencent_D2451CD0D7B4B812CEBADB56DC722BC33406@qq.com/
Signed-off-by: Daniel Machon <daniel.machon@microchip.com>
---
Daniel Machon (2):
net: sparx5: fix RX ring stall on frames from inactive ports
net: lan969x: fix RX ring stall on frames from inactive ports
drivers/net/ethernet/microchip/sparx5/lan969x/lan969x_fdma.c | 11 ++++++-----
drivers/net/ethernet/microchip/sparx5/sparx5_fdma.c | 12 +++++++++---
2 files changed, 15 insertions(+), 8 deletions(-)
---
base-commit: aa40afa831ebfe45e40a23721711059f2ac584d4
change-id: 20261116-sparx5-rx-inactive-port-df606d3f9b1a
Best regards,
--
Daniel Machon <daniel.machon@microchip.com>
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH net 1/2] net: sparx5: fix RX ring stall on frames from inactive ports
2026-11-16 9:56 [PATCH net 0/2] net: sparx5/lan969x: fix RX ring stall on frames from inactive ports Daniel Machon
@ 2026-11-16 9:56 ` Daniel Machon
2026-11-16 9:56 ` [PATCH net 2/2] net: lan969x: " Daniel Machon
2026-11-18 3:00 ` [PATCH net 0/2] net: sparx5/lan969x: " patchwork-bot+netdevbpf
2 siblings, 0 replies; 6+ messages in thread
From: Daniel Machon @ 2026-11-16 9:56 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Steen Hegelund, UNGLinuxDriver
Cc: Zhang Hewei, netdev, linux-arm-kernel, linux-kernel
If the source port of a received frame does not map to a port with a
netdev, sparx5_fdma_rx_get_frame() returns false without consuming the
DB. The DB keeps its DONE bit, so every following poll picks the same
DB and grows its skb with skb_put() again. This ends in
skb_over_panic(), or in an RX stall if no more frames arrive.
Drop the frame and return true, so that the DB is consumed like any
other. Remove the extraction queue flush, as the FDMA has already
extracted the frame, and ratelimit the error, as the source port comes
from the hardware.
Confirmed on Sparx5 (PCB135) with a kernel modified to give received
frames an out-of-range source port, which made the board reset. The fix
was tested the same way: only the bad frames are dropped.
Fixes: 10615907e9b5 ("net: sparx5: switchdev: adding frame DMA functionality")
Reported-by: Zhang Hewei <memoriaru@foxmail.com>
Closes: https://lore.kernel.org/netdev/tencent_ACC296C1F221C304053BD0F1F4B0D2C2BA06@qq.com/
Signed-off-by: Daniel Machon <daniel.machon@microchip.com>
---
drivers/net/ethernet/microchip/sparx5/sparx5_fdma.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/microchip/sparx5/sparx5_fdma.c b/drivers/net/ethernet/microchip/sparx5/sparx5_fdma.c
index 15ec9b053824f..8675702bf1504 100644
--- a/drivers/net/ethernet/microchip/sparx5/sparx5_fdma.c
+++ b/drivers/net/ethernet/microchip/sparx5/sparx5_fdma.c
@@ -157,9 +157,15 @@ static bool sparx5_fdma_rx_get_frame(struct sparx5 *sparx5, struct sparx5_rx *rx
sparx5->ports[fi.src_port] :
NULL;
if (!port || !port->ndev) {
- dev_err(sparx5->dev, "Data on inactive port %d\n", fi.src_port);
- sparx5_xtr_flush(sparx5, XTR_QUEUE);
- return false;
+ dev_err_ratelimited(sparx5->dev, "Data on inactive port %d\n",
+ fi.src_port);
+
+ /* Drop the frame, but report the DB as consumed so the
+ * caller advances past it and recycles the DCB.
+ */
+ kfree_skb(skb);
+
+ return true;
}
skb->dev = port->ndev;
skb_pull(skb, IFH_LEN * sizeof(u32));
--
2.34.1
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH net 2/2] net: lan969x: fix RX ring stall on frames from inactive ports
2026-11-16 9:56 [PATCH net 0/2] net: sparx5/lan969x: fix RX ring stall on frames from inactive ports Daniel Machon
2026-11-16 9:56 ` [PATCH net 1/2] net: sparx5: " Daniel Machon
@ 2026-11-16 9:56 ` Daniel Machon
2026-11-18 3:00 ` [PATCH net 0/2] net: sparx5/lan969x: " patchwork-bot+netdevbpf
2 siblings, 0 replies; 6+ messages in thread
From: Daniel Machon @ 2026-11-16 9:56 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Steen Hegelund, UNGLinuxDriver
Cc: Zhang Hewei, netdev, linux-arm-kernel, linux-kernel
If the source port of a received frame does not map to an active port,
or build_skb() fails, lan969x_fdma_rx_get_frame() returns the page to
the page_pool and returns NULL, and the NAPI poll loop breaks without
advancing past the DB. The DB keeps its DONE bit, so every following
poll returns the same page to the page_pool again, and RX stops on all
ports.
Drop the frame and advance past the DB like for any other frame, and
replace the WARN_ON() with a ratelimited error, as the source port comes
from the hardware.
Confirmed on lan969x (EV23X71A) with a kernel modified to give received
frames an out-of-range source port, which stopped RX on all ports. The
fix was tested the same way: only the bad frames are dropped.
Fixes: d84ad2c0d80c ("net: lan969x: add FDMA implementation")
Reported-by: Zhang Hewei <memoriaru@foxmail.com>
Closes: https://lore.kernel.org/netdev/tencent_ACC296C1F221C304053BD0F1F4B0D2C2BA06@qq.com/
Signed-off-by: Daniel Machon <daniel.machon@microchip.com>
---
drivers/net/ethernet/microchip/sparx5/lan969x/lan969x_fdma.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/microchip/sparx5/lan969x/lan969x_fdma.c b/drivers/net/ethernet/microchip/sparx5/lan969x/lan969x_fdma.c
index 053d125eda658..fd532c89f9110 100644
--- a/drivers/net/ethernet/microchip/sparx5/lan969x/lan969x_fdma.c
+++ b/drivers/net/ethernet/microchip/sparx5/lan969x/lan969x_fdma.c
@@ -113,8 +113,11 @@ static struct sk_buff *lan969x_fdma_rx_get_frame(struct sparx5 *sparx5,
sparx5_ifh_parse(sparx5, page_address(page), &fi);
port = fi.src_port < consts->n_ports ? sparx5->ports[fi.src_port] :
NULL;
- if (WARN_ON(!port))
+ if (!port) {
+ dev_err_ratelimited(sparx5->dev, "Data on inactive port %d\n",
+ fi.src_port);
goto free_page;
+ }
skb = build_skb(page_address(page), fdma->db_size);
if (unlikely(!skb))
@@ -258,10 +261,8 @@ int lan969x_fdma_napi_poll(struct napi_struct *napi, int weight)
break;
skb = lan969x_fdma_rx_get_frame(sparx5, rx);
- if (!skb)
- break;
-
- napi_gro_receive(&rx->napi, skb);
+ if (skb)
+ napi_gro_receive(&rx->napi, skb);
fdma_db_advance(fdma);
counter++;
--
2.34.1
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH net 0/2] net: sparx5/lan969x: fix RX ring stall on frames from inactive ports
2026-11-16 9:56 [PATCH net 0/2] net: sparx5/lan969x: fix RX ring stall on frames from inactive ports Daniel Machon
2026-11-16 9:56 ` [PATCH net 1/2] net: sparx5: " Daniel Machon
2026-11-16 9:56 ` [PATCH net 2/2] net: lan969x: " Daniel Machon
@ 2026-11-18 3:00 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-11-18 3:00 UTC (permalink / raw)
To: Daniel Machon
Cc: andrew+netdev, davem, edumazet, kuba, pabeni, Steen.Hegelund,
UNGLinuxDriver, memoriaru, netdev, linux-arm-kernel, linux-kernel
Hello:
This series was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Mon, 16 Nov 2026 10:56:03 +0100 you wrote:
> On Sparx5 and lan969x, a received frame whose source port does not map
> to an active port is never consumed from the FDMA RX ring: the NAPI poll
> stops on it, and finds the same DB again on every following poll.
>
> Patch 1 fixes Sparx5, where the same skb grows on every poll until
> skb_over_panic().
>
> [...]
Here is the summary with links:
- [net,1/2] net: sparx5: fix RX ring stall on frames from inactive ports
https://git.kernel.org/netdev/net/c/81d2cf1c6d56
- [net,2/2] net: lan969x: fix RX ring stall on frames from inactive ports
https://git.kernel.org/netdev/net/c/1a47bc214d00
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH net 0/2] net: sparx5/lan969x: fix RX ring stall on frames from inactive ports
@ 2026-11-08 18:45 memoriaru
2026-11-09 7:53 ` Daniel Machon
0 siblings, 1 reply; 6+ messages in thread
From: memoriaru @ 2026-11-08 18:45 UTC (permalink / raw)
To: netdev; +Cc: Steen.Hegelund, daniel.machon, UNGLinuxDriver, 79190669+memoriaru
From: Zhang Hewei <79190669+memoriaru@users.noreply.github.com>
The FDMA RX path on both sparx5 and its lan969x sibling stalls the RX
ring forever when the hardware delivers a frame whose source port does
not map to an active netdev.
In both drivers the RX NAPI loop only advances the software cursor
(fdma_db_advance/fdma_dcb_advance) after a frame has been successfully
delivered. When the source-port lookup fails:
- sparx5 (sparx5_fdma_rx_get_frame()) logs an error, flushes the
extraction FIFO and returns false without touching the cursor,
leaving an skb_put()-extended skb behind in the rx->skb[][] array;
- lan969x (lan969x_fdma_rx_get_frame()) recycles the page and returns
NULL, which makes the poll loop break without touching the cursor.
Since the DCB still carries its hardware DONE bit, every subsequent
NAPI poll picks the same DCB again, takes the same inactive-port branch
and stops again: RX traffic on all ports stalls until the driver module
is reloaded. sparx5_xtr_flush() only drains the QS_XTR hardware FIFO
and does not clear the stall.
Patch 1 treats a bogus frame on sparx5 as consumed: free the skb, clear
the array slot and return true so the NAPI loop advances past the DB as
it does for any other received frame; the slot is refilled by the
dataptr callback when the DCB is recycled. Patch 2 splits the two NULL
meanings on lan969x (allocation failure, which keeps its retry-later
break, vs bogus frame) and advances past bogus frames in the poll loop.
Found by code inspection; the stall needs the hardware to emit a frame
with an invalid source port, which cannot be triggered without hardware.
Review from someone with access to sparx5/lan969x systems would be
appreciated.
Zhang Hewei (2):
net: sparx5: fix RX ring stall on frames from inactive ports
net: lan969x: fix RX ring stall on frames from inactive ports
drivers/net/ethernet/microchip/sparx5/lan969x/lan969x_fdma.c | 18 ++++++++++++++--
drivers/net/ethernet/microchip/sparx5/sparx5_fdma.c | 9 ++++++++-
2 files changed, 25 insertions(+), 2 deletions(-)
--
2.39.5 (Apple Git-154)
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH net 0/2] net: sparx5/lan969x: fix RX ring stall on frames from inactive ports
2026-11-08 18:45 memoriaru
@ 2026-11-09 7:53 ` Daniel Machon
0 siblings, 0 replies; 6+ messages in thread
From: Daniel Machon @ 2026-11-09 7:53 UTC (permalink / raw)
To: memoriaru; +Cc: netdev, Steen.Hegelund, UNGLinuxDriver, 79190669+memoriaru
Hi,
> From: Zhang Hewei <79190669+memoriaru@users.noreply.github.com>
>
> The FDMA RX path on both sparx5 and its lan969x sibling stalls the RX
> ring forever when the hardware delivers a frame whose source port does
> not map to an active netdev.
>
> In both drivers the RX NAPI loop only advances the software cursor
> (fdma_db_advance/fdma_dcb_advance) after a frame has been successfully
> delivered. When the source-port lookup fails:
>
> - sparx5 (sparx5_fdma_rx_get_frame()) logs an error, flushes the
> extraction FIFO and returns false without touching the cursor,
> leaving an skb_put()-extended skb behind in the rx->skb[][] array;
> - lan969x (lan969x_fdma_rx_get_frame()) recycles the page and returns
> NULL, which makes the poll loop break without touching the cursor.
>
> Since the DCB still carries its hardware DONE bit, every subsequent
> NAPI poll picks the same DCB again, takes the same inactive-port branch
> and stops again: RX traffic on all ports stalls until the driver module
> is reloaded. sparx5_xtr_flush() only drains the QS_XTR hardware FIFO
> and does not clear the stall.
>
> Patch 1 treats a bogus frame on sparx5 as consumed: free the skb, clear
> the array slot and return true so the NAPI loop advances past the DB as
> it does for any other received frame; the slot is refilled by the
> dataptr callback when the DCB is recycled. Patch 2 splits the two NULL
> meanings on lan969x (allocation failure, which keeps its retry-later
> break, vs bogus frame) and advances past bogus frames in the poll loop.
>
> Found by code inspection; the stall needs the hardware to emit a frame
> with an invalid source port, which cannot be triggered without hardware.
> Review from someone with access to sparx5/lan969x systems would be
> appreciated.
>
> Zhang Hewei (2):
> net: sparx5: fix RX ring stall on frames from inactive ports
> net: lan969x: fix RX ring stall on frames from inactive ports
>
> drivers/net/ethernet/microchip/sparx5/lan969x/lan969x_fdma.c | 18 ++++++++++++++--
> drivers/net/ethernet/microchip/sparx5/sparx5_fdma.c | 9 ++++++++-
> 2 files changed, 25 insertions(+), 2 deletions(-)
>
> --
> 2.39.5 (Apple Git-154)
>
The fixes looks legit, but before going any fruther, theres a number of issues
with the series as is. The patch bodies are mangled (a blank line after every
line, no 'diff --git' headers), and 1/2 and 2/2 are not threaded under the cover
letter. Also, the noreply GitHub address in From/SoB can't receive mail.
/Daniel
pw-bot: cr
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-11-18 3:00 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-16 9:56 [PATCH net 0/2] net: sparx5/lan969x: fix RX ring stall on frames from inactive ports Daniel Machon
2026-11-16 9:56 ` [PATCH net 1/2] net: sparx5: " Daniel Machon
2026-11-16 9:56 ` [PATCH net 2/2] net: lan969x: " Daniel Machon
2026-11-18 3:00 ` [PATCH net 0/2] net: sparx5/lan969x: " patchwork-bot+netdevbpf
-- strict thread matches above, loose matches on Subject: below --
2026-11-08 18:45 memoriaru
2026-11-09 7:53 ` Daniel Machon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox