Re: [PATCH net-next v5] net: stmmac: dwxgmac2: enable L2 split header support

From: Sagar Cheluvegowda

Date: Tue Nov 24 2026 - 17:03:46 EST



On 11/23/2026 5:33 PM, netdev-bot+sashiko@xxxxxxxxxx wrote:
> [Severity: Low]
> This isn't a bug, but should the commit message say that SPLM = L2OFST
> moves the split point for all split header traffic, and not only for the
> tagged or non-IP packets it talks about?
>
> Untagged and VLAN stripped IPv4/IPv6 TCP/UDP frames were previously split
> at the L3/L4 header boundary. With L2OFST they would be split right after
> the EtherType. Commit d10f1a4e44c3 describes the same change for dwmac4.
>
> stmmac_hw_setup() turns this on by default for every sph_capable XGMAC2
> with RX checksum offload enabled. stmmac_rx() would then build the skb head
> from the 14/18 byte MAC header only. The IP/L4 headers would have to be
> pulled from the buffer 2 page fragment.
>
> Could the commit message state that this changes the RX layout for IP
> traffic on existing XGMAC2 users, and ideally include some throughput
> numbers?
>
Agreed. In v6 I will state in the commit message that SPLM = L2OFST
splits every packet after the L2 header, including untagged IP
packets, which were split at the L3/L4 boundary before. I will also
add throughput numbers.

> [Severity: Medium]
> In hwif.c, the XGMAC2 entry and the XLGMAC entry both use
> .desc = &dwxgmac210_desc_ops. So this parsing change applies to every
> existing split header user, including XLGMAC, which never gets
> config_l2_split.
>
> |[ ... ] |
> Is this fixing an existing RX corruption bug inside a feature patch? If so,
> could it go in a separate patch with a Fixes: tag so that stable picks it
> up? The v5 changelog says the fix wording was removed on purpose. If the
> old behaviour can't actually be reached, could the commit message say the
> change is a no-op for existing configurations?

Agreed. I will send the FD/LD change as a separate fix to net and post
v6 on top of it.

> There is also the L2T branch further down. On XLGMAC, SPLM/SAVE_EN are
> never set, yet non-IP last descriptors with L2T != 0 now take HL from
> RDES2[9:2] >> 2. Are those bits guaranteed to be zero for frames XLGMAC
> never split? "The callback is not implemented for XLGMAC" in the commit
> message makes it sound as if XLGMAC is unaffected.

The databook description of RDES2 HL says: "If header length is zero,
it implies that the MAC did not identify and split the header and both
Buffer 1 and Buffer 2 are used for storing the packet". So for frames
the MAC did not split, HL is zero and hlen stays 0, as it does today.
I will make the commit message clearer that the XLGMAC MAC
configuration is not changed, but the descriptor parsing is shared.

> [Severity: Medium]
> Is RDES2[9:0] the right layout here for non-IP frames?
>
Yes. The databook table "Header Length Availability in RDES2"
(Table 13-28) says:
  FD=0, LD=1: HL not available
  FD=1, LD=0: HL is [9:0]
  FD=1, LD=1: IP packets, HL is [9:0]
              Non-IP packets, HL is [9:2]
The RDES2[1:0] AV status bits are only defined together with L34T,
which is only valid on the last descriptor. So the FD=1/LD=0 branch
follows the table, and I will keep it as is. dwmac4 uses a different
descriptor layout, so it is not a reference here.

> [Severity: Medium]
> What happens here to non-IP frames whose L2 type is 0?
>
> XGMAC_RDES3_L2T is GENMASK(19, 16), the same bits as XGMAC_RDES3_ET_LT, so
> this check really means "L2 type != 0". In the LT encoding, 0 seems to be a
> valid type: an IEEE 802.3 length encapsulated frame (LLC/SNAP, for example
> STP BPDUs).
>
> Suppose the MAC splits such a frame at the L2 offset with SPLM = L2OFST and
> SAVE_EN set. Then *len stays 0, and stmmac_rx_buf1_len() skips this branch:
>
> if (priv->sph_active && hlen) {
> priv->xstats.rx_split_hdr_pkt_n++;
> return hlen;
> }
>
> It returns min(dma_buf_sz, plen) instead, and stmmac_rx_buf2_len() returns
> 0. Wouldn't the skb then contain the split header followed by stale
> page_pool data from buffer 1, with the real payload in buffer 2 dropped?
>
> If HL is always 0 for frames the hardware doesn't split, could the L2T
> check be dropped so that RDES2[9:2] is read for every non-IP FD=1/LD=1
> descriptor? That would match the databook table cited in the commit
> message.

Agreed, this is a bug in this patch. L2T = 0 is an IEEE 802.3 length
packet (e.g. STP BPDUs), and with SPLM = L2OFST the MAC splits it like
any other packet, but hlen stays 0. As HL is zero for frames the MAC
did not split, I will drop the L2T check in v6 and read RDES2[9:2] for
all non-IP packets, and remove the now unused XGMAC_RDES3_L2T define.

> [Severity: High]
> This is a pre-existing issue that this patch didn't introduce, but the
> patch builds on it. When RX checksum offload is turned off,
> stmmac_set_features() now also calls
> stmmac_config_l2_split(priv, priv->hw, false). However, priv->sph_active
> is never cleared. It is only assigned at probe and in stmmac_xdp.c.

Right, this is pre-existing and also affects the other split header
capable cores, as stmmac_rx_buf1_len() keys off priv->sph_active while
the hardware state follows sph_en. I will look at it separately and
send a fix to net, as it is independent of this patch.

pw-bot: cr

Regards,
Sagar