🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.kernel.netdev
3 messages
3 total messages Started by James Clark Thu, 26 Nov 2026 03:13
[PATCH net] net: stmmac: dwmac-socfpga: disable split header on Agilex 5
#22876
Author: James Clark
Date: Thu, 26 Nov 2026 03:13
46 lines
12268 bytes
On Agilex 5, received IPv4 fragments are corrupted when RX checksum
offload is on.

This was observed as corrupted downloads on a Terasic DE25-Nano over
a PPPoE connection with TCP MSS not clamped. It can be reproduced by
running ping -s 2000 to another host on the LAN: ping reports every
reply as corrupted.

Agilex 5 has an XGMAC core, and stmmac turns split header on whenever
RX checksum offload is on.

Set STMMAC_FLAG_SPH_DISABLE for Agilex 5. Other glue drivers set this
flag already. The same failure with fragmented ping is described in
commit 47f753c1108e ("net: stmmac: disable Split Header (SPH) for Intel
platforms"), which noted that according to the DesignWare Ethernet
QoS (not XGMAC) datasheet, split header is not supported for IPv4
fragments.

With the flag set, fragments are received intact.

Fixes: 93d46ea3e984 ("net: stmmac: socfpga: Agilex5 EMAC platform configuration")
Cc: stable@vger.kernel.org
Signed-off-by: James Clark <jjc@jclark.com>
---
I used an LLM coding assistant to help prepare this patch.

 drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
index 3a89c4da2af5..28ffa5ad12d7 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
@@ -578,6 +578,9 @@ static void socfpga_agilex5_setup_plat_dat(struct socfpga_dwmac *dwmac)
 	/* Enable TSO */
 	plat_dat->flags |= STMMAC_FLAG_TSO_EN;
 
+	/* Disable split header */
+	plat_dat->flags |= STMMAC_FLAG_SPH_DISABLE;
+
 	/* Enable TBS */
 	switch (plat_dat->tx_queues_to_use) {
 	case 8:
-- 
2.56.1
Re: [PATCH net] net: stmmac: dwmac-socfpga: disable split header on Agilex 5
#23310
Author: netdev-bot+sashiko
Date: Fri, 27 Nov 2026 03:16
105 lines
12169 bytes
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 0

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] The patch fixes IPv4 fragment corruption with a quirk flag for
  Agilex 5 only, but the root cause it gives does not come from XGMAC…

--

net: stmmac: dwmac-socfpga: disable split header on Agilex 5

This patch sets STMMAC_FLAG_SPH_DISABLE in
socfpga_agilex5_setup_plat_dat(). The aim is to stop IPv4 fragment
corruption that shows up when RX checksum offload, and therefore split
header, is enabled on the Agilex 5 XGMAC core. The commit message
points to commit 47f753c1108e for the Intel platforms, which made the
same change based on the DesignWare Ethernet QoS datasheet.

> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
> index 3a89c4da2af57..28ffa5ad12d7a 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
> @@ -578,6 +578,9 @@ static void socfpga_agilex5_setup_plat_dat(struct socfpga_dwmac *dwmac)
>  	/* Enable TSO */
>  	plat_dat->flags |= STMMAC_FLAG_TSO_EN;
>  
> +	/* Disable split header */
> +	plat_dat->flags |= STMMAC_FLAG_SPH_DISABLE;
> +

[Severity: Medium]
Is the root cause specific to Agilex 5, or does it affect all XGMAC
users?

The commit message says:

    Agilex 5 has an XGMAC core, and stmmac turns split header on whenever
    RX checksum offload is on.

The only evidence it cites is the QoS (GMAC4) datasheet, by way of
commit 47f753c1108e. Nothing in the patch shows that the problem is
limited to Agilex 5.

If this is a general XGMAC hardware limitation, other XGMAC platforms
would still have split header enabled. tegra_mgbe_probe() in
dwmac-tegra.c sets core_type to DWMAC_CORE_XGMAC and sets
STMMAC_FLAG_TSO_EN, but it does not set STMMAC_FLAG_SPH_DISABLE. The
generic "snps,dwxgmac" path in stmmac_probe_config_dt() doesn't set it
either. stmmac_dvr_probe() turns split header on for any core that
reports sphen unless the platform opts out:

    if (priv->dma_cap.sphen &&
        !(priv->plat->flags & STMMAC_FLAG_SPH_DISABLE)) {

Would fragmented IPv4 traffic, for example ping -s 2000, still be
corrupted on those platforms?

There is also a possible driver-side cause in the shared XGMAC receive
path. dwxgmac2_get_rx_header_len() reads HL only when L34T is set:

    if (le32_to_cpu(p->des3) & XGMAC_RDES3_L34T)
        *len = le32_to_cpu(p->des2) & XGMAC_RDES2_HL;

dwmac4_get_rx_header_len() reads RDES2_HL unconditionally.

Commit 96147375d49f9b added the L34T check. Its message says "Split
Header length is only available when L34T == 0", but the code reads HL
only when L34T != 0.

Suppose the hardware splits a fragmented IPv4 frame but reports L34T
as 0. The header length then stays 0. stmmac_rx_buf1_len() would treat
buf1 as holding the whole frame. stmmac_rx_buf2_len() would return 0
for the last descriptor. The skb could then contain the split header
plus stale buf1 contents, and the payload in buf2 would be lost.

stmmac_rx_buf2_len() also assumes that buf2 is fully filled on
non-last descriptors for every core except GMAC4 with split header
active:

    if ((priv->plat->core_type != DWMAC_CORE_GMAC4 || !priv->sph_active) &&
        (status & rx_not_ls))
        return priv->dma_conf.dma_buf_sz;

The GMAC4 comment just above that check says this assumption does not
always hold when split header is enabled.

If the corruption actually comes from this shared dwxgmac2 header
length handling, would it be better to fix it in the core instead of
adding a per-platform flag? That would also let Agilex 5 keep split
header enabled.

>  	/* Enable TBS */
>  	switch (plat_dat->tx_queues_to_use) {
>  	case 8:

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261126031300.211248-1-jjc%40jclark.com
Re: [PATCH net] net: stmmac: dwmac-socfpga: disable split header on Agilex 5
#23336
Author: James Clark
Date: Fri, 27 Nov 2026 04:38
28 lines
12033 bytes
On Fri, 27 Nov 2026 03:16:01 +0000, netdev-bot+sashiko@kernel.org wrote:
> Is the root cause specific to Agilex 5, or does it affect all XGMAC
> users?

Probably not specific to Agilex 5. When the same failure was fixed for
Intel in 47f753c1108e, Intel reported that "according to Synopsys IP
support, they have confirmed the header-payload splitting for IPv4
fragmented packets is not supported for the Synopsys Ether IPs":

https://lore.kernel.org/all/20220428015538.GC26326@linux.intel.com/

So it looks like a limitation of the IP, not a bug in the driver's RX
path.

> If the corruption actually comes from this shared dwxgmac2 header
> length handling, would it be better to fix it in the core instead of
> adding a per-platform flag? That would also let Agilex 5 keep split
> header enabled.

If split header does not support fragments, there is nothing to fix in
the RX path, and Agilex 5 cannot keep split header on. A general fix
would mean not enabling split header by default, which would affect
every stmmac platform. Agilex 5 is the only XGMAC hardware I have, so
I have done what the other seven glue drivers do: disable it for the
platform I could test.

James
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