Thread View: linux.kernel.netdev
2 messages
2 total messages
Started by Arun Iyengar via B4 Relay
Fri, 13 Nov 2026 17:13
[PATCH net] net: stmmac: drop the rest of the frame when napi_build_skb() fails
Author: Arun Iyengar via B4 Relay
Date: Fri, 13 Nov 2026 17:13
Date: Fri, 13 Nov 2026 17:13
66 lines
13240 bytes
13240 bytes
From: Arun Iyengar <aiyengar1990@gmail.com>
If napi_build_skb() fails on the first buffer of a frame that spans
several descriptors, stmmac_rx() drops that buffer but goes on with the
next descriptor of the same frame as if a new frame started there. The
rest of the frame is then passed up the stack as a frame of its own. A
frame spans several descriptors when it does not fit in the RX buffers
of one descriptor.
Mark the frame as errored instead, so that its remaining descriptors are
discarded like those of a frame with a receive error. The frame is
counted once in rx_dropped and once against the NAPI budget.
Fixes: ec222003bd94 ("net: stmmac: Prepare to add Split Header support")
Cc: stable@vger.kernel.org
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
Found while working on the sun8i EMAC jumbo frame series, where frames
over 2032 bytes span several descriptors. Lorenzo's pending net-next
series "net: stmmac: introduce XDP rx multi-buff support" (v10) removes
this path; this is the fix for net and stable and will conflict with it.
Tested on an Orange Pi Zero2 (dwmac-sun8i, MTU 4070), backported to
v7.3.3 with the jumbo series and a test hook that fails
napi_build_skb(): of 12726 multi-descriptor frames, the 1818 failed
ones were dropped and counted in rx_dropped, no fragment reached the
stack, and all other frames arrived intact. Without the patch the 1818
fragments were delivered as frames.
Developed with Claude (Anthropic), which wrote the fix and the commit
message. I reviewed every change.
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 25894771e9e9..d05c5bb8b4b9 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -6029,7 +6029,7 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue)
buf->page);
buf->page = NULL;
rx_dropped++;
- count++;
+ error = 1;
goto drain_data;
}
@@ -6065,7 +6065,7 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue)
if (likely(status & rx_not_ls))
goto read_again;
if (!skb)
- continue;
+ goto next;
/* Got entire packet into SKB. Finish it. */
---
base-commit: ead6fa9a0ab194f02a2f36d634b193e9c5f9a1c6
change-id: 20261113-stmmac-rx-skb-fail-bb6688204075
Best regards,
--
Arun Iyengar <aiyengar1990@gmail.com>
Re: [PATCH net] net: stmmac: drop the rest of the frame when napi_build_skb() fails
Author: patchwork-bot+netdevbpf
Date: Thu, 19 Nov 2026 00:00
Date: Thu, 19 Nov 2026 00:00
26 lines
9034 bytes
9034 bytes
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Fri, 13 Nov 2026 17:13:40 +0000 you wrote:
> From: Arun Iyengar <aiyengar1990@gmail.com>
>
> If napi_build_skb() fails on the first buffer of a frame that spans
> several descriptors, stmmac_rx() drops that buffer but goes on with the
> next descriptor of the same frame as if a new frame started there. The
> rest of the frame is then passed up the stack as a frame of its own. A
> frame spans several descriptors when it does not fit in the RX buffers
> of one descriptor.
>
> [...]
Here is the summary with links:
- [net] net: stmmac: drop the rest of the frame when napi_build_skb() fails
https://git.kernel.org/netdev/net/c/ece404eac250
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads