net: stmmac: drop the rest of the frame when napi_build_skb() fails

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.

Found while working on the sun8i EMAC jumbo frame series, where frames
over 2032 bytes span several descriptors. Tested on an Orange Pi Zero2
(dwmac-sun8i, MTU 4070), w/ jumbo series and error injection.

Fixes: ec222003bd ("net: stmmac: Prepare to add Split Header support")
Cc: [email protected]
Signed-off-by: Arun Iyengar <[email protected]>
Reviewed-by: Maxime Chevallier <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
This commit is contained in:
Arun Iyengar
2026-11-18 15:47:58 -08:00
committed by Jakub Kicinski
parent d61480a622
commit ece404eac2
@@ -6045,7 +6045,7 @@ read_again:
buf->page);
buf->page = NULL;
rx_dropped++;
count++;
error = 1;
goto drain_data;
}
@@ -6081,7 +6081,7 @@ drain_data:
if (likely(status & rx_not_ls))
goto read_again;
if (!skb)
continue;
goto next;
/* Got entire packet into SKB. Finish it. */