summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Machon <daniel.machon@microchip.com>2026-11-16 10:56:05 +0100
committerJakub Kicinski <kuba@kernel.org>2026-11-17 18:52:05 -0800
commit1a47bc214d00fbfaeb9a963a8aac2e4e58d36e71 (patch)
tree20b2510c32cdcd8bbb2b6125a27adef78d65cf37
parent81d2cf1c6d567260e3195d2ef049f44446a462a7 (diff)
net: lan969x: fix RX ring stall on frames from inactive ports
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> Link: https://patch.msgid.link/20261116-sparx5-rx-inactive-port-v1-2-343d8bab58bb@microchip.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-rw-r--r--drivers/net/ethernet/microchip/sparx5/lan969x/lan969x_fdma.c11
1 files 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 053d125eda65..fd532c89f911 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++;