* [PATCH net 0/3] net: stmmac: deliver frames with Rx checksum errors to the stack
@ 2026-10-20 19:03 Grische
2026-10-20 19:03 ` [PATCH net 1/3] net: stmmac: honour Rx checksum errors in the AF_XDP zero-copy path Grische
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Grische @ 2026-10-20 19:03 UTC (permalink / raw)
To: netdev
Cc: maxime.chevallier, andrew+netdev, davem, edumazet, kuba, pabeni,
Oleksij Rempel, Grische
On dwmac1000 the MAC drops every frame that fails Rx checksum validation
before the driver sees it. The enhanced descriptor parser would discard
such a frame even if the MAC delivered it. As a result, a VXLAN tunnel
over IPv6 with zero UDP checksums receives nothing while Rx checksum
offload is on, and neither rx_dropped nor rx_errors shows the loss.
Patches 2 and 3 deliver these frames with CHECKSUM_NONE instead, as
commit fe4042797651 ("net: stmmac: dwmac4: stop hardware from dropping
checksum-error packets") did for dwmac4.
Patch 1 makes the AF_XDP zero-copy Rx path honour the checksum error
status. That path already receives such frames on dwmac4, and patches
2 and 3 make them reach it on dwmac1000 as well.
Tested on an Aruba AP-325 (ipq806x-gmac-dwmac) on the net tree, with
and without the series.
Not tested:
- Patch 1 was only compile-tested, as an AF_XDP zero-copy setup was not
available.
- dwmac-loongson, which also uses dwmac1000_dma_ops.
Grische (3):
net: stmmac: honour Rx checksum errors in the AF_XDP zero-copy path
net: stmmac: dwmac1000: don't discard frames with only a checksum
error
net: stmmac: dwmac1000: stop hardware from dropping checksum-error
packets
drivers/net/ethernet/stmicro/stmmac/dwmac1000.h | 1 +
drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c | 2 ++
drivers/net/ethernet/stmicro/stmmac/enh_desc.c | 9 +++++----
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 8 +++++---
4 files changed, 13 insertions(+), 7 deletions(-)
base-commit: 6dc989ea46b96ce170840174b4a38c4a387fb005
--
2.54.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH net 1/3] net: stmmac: honour Rx checksum errors in the AF_XDP zero-copy path
2026-10-20 19:03 [PATCH net 0/3] net: stmmac: deliver frames with Rx checksum errors to the stack Grische
@ 2026-10-20 19:03 ` Grische
2026-10-20 19:03 ` [PATCH net 2/3] net: stmmac: dwmac1000: don't discard frames with only a checksum error Grische
2026-10-20 19:03 ` [PATCH net 3/3] net: stmmac: dwmac1000: stop hardware from dropping checksum-error packets Grische
2 siblings, 0 replies; 4+ messages in thread
From: Grische @ 2026-10-20 19:03 UTC (permalink / raw)
To: netdev
Cc: maxime.chevallier, andrew+netdev, davem, edumazet, kuba, pabeni,
Oleksij Rempel, Grische, stable, Maxime Coquelin,
Alexandre Torgue, Alexei Starovoitov, Daniel Borkmann,
Jesper Dangaard Brouer, John Fastabend, Stanislav Fomichev,
Ong Boon Leong, linux-stm32, linux-arm-kernel, linux-kernel, bpf
Commit ee0aace5f844 ("net: stmmac: Correctly handle Rx checksum offload
errors") taught stmmac_rx() to honour the csum_none status, but
stmmac_dispatch_skb_zc() still ignores it and sets CHECKSUM_UNNECESSARY
for every IP frame whenever the checksum offload engine (CoE) is
enabled.
Since commit fe4042797651 ("net: stmmac: dwmac4: stop hardware from
dropping checksum-error packets") dwmac4 delivers such frames instead of
dropping them, so this path receives them.
Mark the skb CHECKSUM_NONE when csum_none is set, as stmmac_rx() does.
Fixes: bba2556efad6 ("net: stmmac: Enable RX via AF_XDP zero-copy")
Cc: <stable@vger.kernel.org>
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Grische <opensource@grische.xyz>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 9741f97fa37a..32810f949245 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -5463,7 +5463,7 @@ static struct sk_buff *stmmac_construct_skb_zc(struct stmmac_channel *ch,
static void stmmac_dispatch_skb_zc(struct stmmac_priv *priv, u32 queue,
struct dma_desc *p, struct dma_desc *np,
- struct xdp_buff *xdp)
+ struct xdp_buff *xdp, int status)
{
struct stmmac_rxq_stats *rxq_stats = &priv->xstats.rxq_stats[queue];
struct stmmac_channel *ch = &priv->channel[queue];
@@ -5488,7 +5488,8 @@ static void stmmac_dispatch_skb_zc(struct stmmac_priv *priv, u32 queue,
stmmac_rx_vlan(priv->dev, skb);
skb->protocol = eth_type_trans(skb, priv->dev);
- if (unlikely(!coe) || !stmmac_has_ip_ethertype(skb))
+ if (unlikely(!coe) || !stmmac_has_ip_ethertype(skb) ||
+ (status & csum_none))
skb_checksum_none_assert(skb);
else
skb->ip_summed = CHECKSUM_UNNECESSARY;
@@ -5698,7 +5699,8 @@ static int stmmac_rx_zc(struct stmmac_priv *priv, int limit, u32 queue)
switch (res) {
case STMMAC_XDP_PASS:
- stmmac_dispatch_skb_zc(priv, queue, p, np, buf->xdp);
+ stmmac_dispatch_skb_zc(priv, queue, p, np, buf->xdp,
+ status);
xsk_buff_free(buf->xdp);
break;
case STMMAC_XDP_CONSUMED:
--
2.54.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH net 2/3] net: stmmac: dwmac1000: don't discard frames with only a checksum error
2026-10-20 19:03 [PATCH net 0/3] net: stmmac: deliver frames with Rx checksum errors to the stack Grische
2026-10-20 19:03 ` [PATCH net 1/3] net: stmmac: honour Rx checksum errors in the AF_XDP zero-copy path Grische
@ 2026-10-20 19:03 ` Grische
2026-10-20 19:03 ` [PATCH net 3/3] net: stmmac: dwmac1000: stop hardware from dropping checksum-error packets Grische
2 siblings, 0 replies; 4+ messages in thread
From: Grische @ 2026-10-20 19:03 UTC (permalink / raw)
To: netdev
Cc: maxime.chevallier, andrew+netdev, davem, edumazet, kuba, pabeni,
Oleksij Rempel, Grische, stable, Maxime Coquelin,
Alexandre Torgue, Aaro Koskinen, linux-stm32, linux-arm-kernel,
linux-kernel
On dwmac1000 with enhanced descriptors, the hardware sets the Error
Summary (ES) bit of the Rx descriptor not only for L2 errors but also
for an L3/L4 checksum error. enh_desc_get_rx_status() returns
discard_frame whenever ES is set, and since commit 1b746ce8b397 ("net:
stmmac: don't overwrite discard_frame status") the checksum status is
only evaluated for good frames.
Return discard_frame only for L2 errors. A frame with only a checksum
error is then reported as csum_none and reaches the stack as
CHECKSUM_NONE, so the stack verifies the checksum itself. This matches
dwmac4, whose Error Summary check does not include the checksum bits.
Also drop the per-frame pr_err in enh_desc_get_rx_status(). Once the MAC
delivers checksum-error frames, it can be triggered from the wire.
This prepares for setting DMA_CONTROL_DT, which makes the MAC deliver
checksum-error frames instead of dropping them in its Rx FIFO.
Fixes: 1b746ce8b397 ("net: stmmac: don't overwrite discard_frame status")
Cc: <stable@vger.kernel.org> # 6.6.x: ee0aace5f844: net: stmmac: Correctly handle Rx checksum offload errors
Cc: <stable@vger.kernel.org> # 6.6.x
Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Grische <opensource@grische.xyz>
---
drivers/net/ethernet/stmicro/stmmac/enh_desc.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/enh_desc.c b/drivers/net/ethernet/stmicro/stmmac/enh_desc.c
index 051253601225..5c43d32a2f22 100644
--- a/drivers/net/ethernet/stmicro/stmmac/enh_desc.c
+++ b/drivers/net/ethernet/stmicro/stmmac/enh_desc.c
@@ -195,9 +195,6 @@ static int enh_desc_get_rx_status(struct stmmac_extra_stats *x,
if (unlikely(rdes0 & RDES0_OVERFLOW_ERROR))
x->rx_gmac_overflow++;
- if (unlikely(rdes0 & RDES0_IPC_CSUM_ERROR))
- pr_err("\tIPC Csum Error/Giant frame\n");
-
if (unlikely(rdes0 & RDES0_COLLISION))
x->rx_collision++;
if (unlikely(rdes0 & RDES0_RECEIVE_WATCHDOG))
@@ -209,7 +206,11 @@ static int enh_desc_get_rx_status(struct stmmac_extra_stats *x,
if (unlikely(rdes0 & RDES0_CRC_ERROR)) {
x->rx_crc_errors++;
}
- ret = discard_frame;
+ if (rdes0 & (RDES0_DESCRIPTOR_ERROR | RDES0_OVERFLOW_ERROR |
+ RDES0_COLLISION | RDES0_RECEIVE_WATCHDOG |
+ RDES0_MII_ERROR | RDES0_CRC_ERROR |
+ RDES0_LENGTH_ERROR))
+ ret = discard_frame;
}
/* After a payload csum error, the ES bit is set.
--
2.54.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH net 3/3] net: stmmac: dwmac1000: stop hardware from dropping checksum-error packets
2026-10-20 19:03 [PATCH net 0/3] net: stmmac: deliver frames with Rx checksum errors to the stack Grische
2026-10-20 19:03 ` [PATCH net 1/3] net: stmmac: honour Rx checksum errors in the AF_XDP zero-copy path Grische
2026-10-20 19:03 ` [PATCH net 2/3] net: stmmac: dwmac1000: don't discard frames with only a checksum error Grische
@ 2026-10-20 19:03 ` Grische
2 siblings, 0 replies; 4+ messages in thread
From: Grische @ 2026-10-20 19:03 UTC (permalink / raw)
To: netdev
Cc: maxime.chevallier, andrew+netdev, davem, edumazet, kuba, pabeni,
Oleksij Rempel, Grische, stable, Maxime Coquelin,
Alexandre Torgue, Giuseppe Cavallaro, linux-stm32,
linux-arm-kernel, linux-kernel
When the checksum offload engine (CoE) is enabled, the dwmac1000 MAC
silently drops any frame for which the engine detects a checksum error,
before the driver sees it.
This breaks VXLAN over IPv6 with zero UDP checksums, which RFC 6935 and
RFC 6936 allow for tunnels.
Set DMA_CONTROL_DT so that such frames are delivered instead of dropped,
as commit fe4042797651 ("net: stmmac: dwmac4: stop hardware from
dropping checksum-error packets") did for dwmac4. CoE remains enabled,
so the driver still sees the error status and marks the skb
CHECKSUM_NONE for the stack to verify.
Tested on an Aruba AP-325 (ipq806x-gmac-dwmac) with Rx checksum offload
on.
Link: https://lore.kernel.org/all/20250625132117.1b3264e8@kernel.org/
Link: https://github.com/freifunk-gluon/gluon/issues/3783
Fixes: 47dd7a540b8a ("net: add support for STMicroelectronics Ethernet controllers.")
Cc: <stable@vger.kernel.org> # 6.6.x: ee0aace5f844: net: stmmac: Correctly handle Rx checksum offload errors
Cc: <stable@vger.kernel.org> # 6.6.x
Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Grische <opensource@grische.xyz>
---
drivers/net/ethernet/stmicro/stmmac/dwmac1000.h | 1 +
drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c | 2 ++
2 files changed, 3 insertions(+)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac1000.h b/drivers/net/ethernet/stmicro/stmmac/dwmac1000.h
index 1de1f929d61c..004e6e30a68b 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac1000.h
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac1000.h
@@ -163,6 +163,7 @@ enum rx_tx_priority_ratio {
/* DMA operation mode defines (start/stop tx/rx are placed in common header)*/
/* Disable Drop TCP/IP csum error */
+#define DMA_CONTROL_DT 0x04000000
#define DMA_CONTROL_RSF 0x02000000 /* Receive Store and Forward */
#define DMA_CONTROL_DFF 0x01000000 /* Disaable flushing */
/* Threshold for Activating the FC */
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c
index 3ac7a7949529..00c8d4dfb553 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c
@@ -129,6 +129,8 @@ static void dwmac1000_dma_operation_mode_rx(struct stmmac_priv *priv,
{
u32 csr6 = readl(ioaddr + DMA_CHAN_CONTROL(channel));
+ csr6 |= DMA_CONTROL_DT;
+
if (mode == SF_DMA_MODE) {
pr_debug("GMAC: enable RX store and forward mode\n");
csr6 |= DMA_CONTROL_RSF | DMA_CONTROL_DFF;
--
2.54.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-10-20 19:03 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-20 19:03 [PATCH net 0/3] net: stmmac: deliver frames with Rx checksum errors to the stack Grische
2026-10-20 19:03 ` [PATCH net 1/3] net: stmmac: honour Rx checksum errors in the AF_XDP zero-copy path Grische
2026-10-20 19:03 ` [PATCH net 2/3] net: stmmac: dwmac1000: don't discard frames with only a checksum error Grische
2026-10-20 19:03 ` [PATCH net 3/3] net: stmmac: dwmac1000: stop hardware from dropping checksum-error packets Grische
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox