Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'stmmac-stop-silently-dropping-bad-checksum-packets'

Oleksij Rempel says:

====================
stmmac: stop silently dropping bad checksum packets

this series reworks how stmmac handles receive checksum offload
(CoE) errors on dwmac4.

At present, when CoE is enabled, the hardware silently discards any
frame that fails checksum validation. These packets never reach the
driver and are not accounted in the generic drop statistics. They are
only visible in the stmmac-specific counters as "payload error" or
"header error" packets, which makes it harder to debug or monitor
network issues.

Following discussion [1], the driver is reworked to propagate checksum
error information up to the stack. With these changes, CoE stays
enabled, but frames that fail hardware validation are no longer dropped
in hardware. Instead, the driver marks them with CHECKSUM_NONE so the
network stack can validate, drop, and properly account them in the
standard drop statistics.

[1] https://lore.kernel.org/all/20250625132117.1b3264e8@kernel.org/
====================

Link: https://patch.msgid.link/20250818090217.2789521-1-o.rempel@pengutronix.de
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+11 -3
+1
drivers/net/ethernet/stmicro/stmmac/dwmac4.h
··· 341 341 #define MTL_OP_MODE_RFA_SHIFT 8 342 342 343 343 #define MTL_OP_MODE_EHFC BIT(7) 344 + #define MTL_OP_MODE_DIS_TCP_EF BIT(6) 344 345 345 346 #define MTL_OP_MODE_RTC_MASK GENMASK(1, 0) 346 347 #define MTL_OP_MODE_RTC_SHIFT 0
+6 -2
drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c
··· 110 110 111 111 message_type = (rdes1 & ERDES4_MSG_TYPE_MASK) >> 8; 112 112 113 - if (rdes1 & RDES1_IP_HDR_ERROR) 113 + if (rdes1 & RDES1_IP_HDR_ERROR) { 114 114 x->ip_hdr_err++; 115 + ret |= csum_none; 116 + } 115 117 if (rdes1 & RDES1_IP_CSUM_BYPASSED) 116 118 x->ip_csum_bypassed++; 117 119 if (rdes1 & RDES1_IPV4_HEADER) 118 120 x->ipv4_pkt_rcvd++; 119 121 if (rdes1 & RDES1_IPV6_HEADER) 120 122 x->ipv6_pkt_rcvd++; 121 - if (rdes1 & RDES1_IP_PAYLOAD_ERROR) 123 + if (rdes1 & RDES1_IP_PAYLOAD_ERROR) { 122 124 x->ip_payload_err++; 125 + ret |= csum_none; 126 + } 123 127 124 128 if (message_type == RDES_EXT_NO_PTP) 125 129 x->no_ptp_rx_msg_type_ext++;
+2
drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c
··· 268 268 269 269 mtl_rx_op = readl(ioaddr + MTL_CHAN_RX_OP_MODE(dwmac4_addrs, channel)); 270 270 271 + mtl_rx_op |= MTL_OP_MODE_DIS_TCP_EF; 272 + 271 273 if (mode == SF_DMA_MODE) { 272 274 pr_debug("GMAC: enable RX store and forward mode\n"); 273 275 mtl_rx_op |= MTL_OP_MODE_RSF;
+2 -1
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
··· 5737 5737 5738 5738 skb->protocol = eth_type_trans(skb, priv->dev); 5739 5739 5740 - if (unlikely(!coe) || !stmmac_has_ip_ethertype(skb)) 5740 + if (unlikely(!coe) || !stmmac_has_ip_ethertype(skb) || 5741 + (status & csum_none)) 5741 5742 skb_checksum_none_assert(skb); 5742 5743 else 5743 5744 skb->ip_summed = CHECKSUM_UNNECESSARY;