[PATCH net 2/2] net: lan969x: fix RX ring stall on frames from inactive ports

From
Daniel Machon <daniel.machon@microchip.com>
Date
2026-11-16 09:56:18
Also in
linux-arm-kernel, lkml
Reply to
Daniel Machon, 2026-11-16
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 <redacted>
Closes: https://lore.kernel.org/netdev/tencent_ACC296C1F221C304053BD0F1F4B0D2C2BA06@qq.com/ (local)
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
Thread (3 messages) 3 messages, 1 author, last reply 12h ago
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help