Skip to content

Commit fe40427

Browse files
oleremkuba-moo
authored andcommitted
net: stmmac: dwmac4: stop hardware from dropping checksum-error packets
Tell the MAC not to discard frames that fail TCP/IP checksum validation. By default, when the hardware checksum engine (CoE) is enabled, dwmac4 silently drops any packet where the offload engine detects a checksum error. These frames are not reported to the driver and are not counted in any statistics as dropped packets. Set the MTL_OP_MODE_DIS_TCP_EF bit when initializing the Rx channel so that all packets are delivered, even if they failed hardware checksum validation. CoE remains enabled, but instead of dropping such frames, the driver propagates the error status and marks the skb with CHECKSUM_NONE. This allows the stack to verify and drop the packet while updating statistics. This change follows the decision made in the discussion: Link: https://lore.kernel.org/all/[email protected]/ It depends on the previous patches that added proper error propagation in the Rx path. Signed-off-by: Oleksij Rempel <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 644b843 commit fe40427

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

drivers/net/ethernet/stmicro/stmmac/dwmac4.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,7 @@ static inline u32 mtl_chanx_base_addr(const struct dwmac4_addrs *addrs,
341341
#define MTL_OP_MODE_RFA_SHIFT 8
342342

343343
#define MTL_OP_MODE_EHFC BIT(7)
344+
#define MTL_OP_MODE_DIS_TCP_EF BIT(6)
344345

345346
#define MTL_OP_MODE_RTC_MASK GENMASK(1, 0)
346347
#define MTL_OP_MODE_RTC_SHIFT 0

drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,8 @@ static void dwmac4_dma_rx_chan_op_mode(struct stmmac_priv *priv,
268268

269269
mtl_rx_op = readl(ioaddr + MTL_CHAN_RX_OP_MODE(dwmac4_addrs, channel));
270270

271+
mtl_rx_op |= MTL_OP_MODE_DIS_TCP_EF;
272+
271273
if (mode == SF_DMA_MODE) {
272274
pr_debug("GMAC: enable RX store and forward mode\n");
273275
mtl_rx_op |= MTL_OP_MODE_RSF;

0 commit comments

Comments
 (0)