From: netdev-bot+sashiko@kernel.org
To: vladimir.oltean@nxp.com
Cc: netdev@vger.kernel.org, andrew+netdev@lunn.ch,
davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
pabeni@redhat.com, claudiu.manoil@nxp.com, wei.fang@nxp.com,
xiaoning.wang@nxp.com, ioana.ciornei@nxp.com,
willemdebruijn.kernel@gmail.com, imx@lists.linux.dev,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 net 4/4] net: enetc: let core segment GSO skb when headers exceed TSO_HEADER_SIZE
Date: Mon, 23 Nov 2026 00:28:58 +0000 [thread overview]
Message-ID: <179539373837.3135.4065744412888442454@kernel.org> (raw)
In-Reply-To: <20261118235055.1225115-5-vladimir.oltean@nxp.com>
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] The comment added in enetc_features_check()
(drivers/net/ethernet/freescale/enetc/enetc.c) explains the VLAN_HLEN…
Pre-existing issues:
- [High] This problem wasn't introduced by this patch, but the patch sits
right on top of it and only partly addresses it.
--
net: enetc: let core segment GSO skb when headers exceed TSO_HEADER_SIZE
This patch changes enetc_features_check() so that it clears
NETIF_F_GSO_MASK when the L2+L3+L4 header length of a GSO skb exceeds
TSO_HEADER_SIZE - VLAN_HLEN. The stack then segments those skbs.
Otherwise enetc_map_tx_tso_buffs() would copy oversized headers into the
fixed 256-byte tso_headers slot. The example given is a large IPv6
Segment Routing Header set through setsockopt(IPV6_RTHDR).
> diff --git a/drivers/net/ethernet/freescale/enetc/enetc.c b/drivers/net/ethernet/freescale/enetc/enetc.c
> index 6cc519eea5bd3..2bc65cf6f5087 100644
> --- a/drivers/net/ethernet/freescale/enetc/enetc.c
> +++ b/drivers/net/ethernet/freescale/enetc/enetc.c
> @@ -1138,7 +1138,19 @@ netdev_features_t enetc_features_check(struct sk_buff *skb,
> return features;
> }
>
> - if (!skb_is_gso(skb) || enetc_skb_uses_lso(priv, skb))
> + if (!skb_is_gso(skb))
> + return features;
> +
> + /* In case NETIF_F_HW_VLAN_CTAG_TX is disabled, validate_xmit_vlan()
> + * has not yet run and a VLAN may still be in the hwaccel area, so we
> + * need to be one step ahead
> + */
[Severity: Low]
This isn't a bug, but does this comment cover every case? enetc never
advertises NETIF_F_HW_VLAN_STAG_TX. enetc_pf_netdev_setup() (and
enetc_vf.c in the same way) only sets the CTAG variants:
ndev->hw_features = NETIF_F_SG | NETIF_F_RXCSUM |
NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX |
NETIF_F_HW_VLAN_CTAG_FILTER |
NETIF_F_HW_CSUM | NETIF_F_TSO | NETIF_F_TSO6 |
NETIF_F_GSO_UDP_L4;
Take an skb whose hwaccel tag is ETH_P_8021AD, for example from an
802.1ad VLAN upper, a tc vlan push with protocol 802.1ad, or an 802.1ad
bridge. For that skb, validate_xmit_vlan() always pushes the tag into
the packet after ndo_features_check has run, even when CTAG TX offload
is enabled:
net/core/dev.c:validate_xmit_vlan() {
...
if (skb_vlan_tag_present(skb) &&
!vlan_hw_offload_capable(features, skb->vlan_proto))
skb = __vlan_hwaccel_push_inside(skb);
...
}
The VLAN_HLEN subtraction is unconditional, so the code already handles
this. Suppose a later change follows the comment and applies the margin
only when NETIF_F_HW_VLAN_CTAG_TX is off. Couldn't an 802.1ad-tagged GSO
skb then write 4 bytes past the tso_headers slot again?
Could the comment mention the 802.1ad case as well?
> + if (enetc_lso_get_hdr_len(skb) > TSO_HEADER_SIZE - VLAN_HLEN) {
> + features &= ~NETIF_F_GSO_MASK;
> + return features;
> + }
[Severity: High]
This is a pre-existing issue, not introduced by this patch. It goes back
to fb8629e2cbfc ("net: enetc: add support for software TSO"), and it sits
right next to this check.
The new check only looks at header length. What happens to IPv6 GSO skbs
that carry extension headers but whose headers still fit in 252 bytes?
Examples are a Segment Routing Header with 1-10 segments, or any routing,
hop-by-hop or destination options header.
On hardware without ENETC_SI_F_LSO, such as LS1028A, these still go
through enetc_start_xmit()->enetc_map_tx_tso_buffs(). The software TSO
path does not seem able to build valid segments for them.
tso_build_hdr() in net/core/tso.c does not count the extension header
bytes in the IPv6 payload length:
iph->payload_len = htons(size + tso->tlen);
enetc_tso_complete_csum() builds the pseudo-header from the outer IPv6
header:
csum_final = csum_ipv6_magic(&ipv6_hdr(skb)->saddr,
&ipv6_hdr(skb)->daddr,
len, ipv6_hdr(skb)->nexthdr, sum);
Here nexthdr is the extension header type (0, 43 or 60), not
IPPROTO_TCP or IPPROTO_UDP. With a routing header, daddr is the first
hop rather than the final destination.
Wouldn't every segment then leave with a short payload_len and a wrong
TCP/UDP checksum, so the receiver drops it?
An unprivileged user can reach this with setsockopt(IPV6_RTHDR). It can
also be triggered remotely when forwarding, because
ipv6_gro_receive()->ipv6_gro_pull_exthdrs() aggregates packets with
routing or destination options headers into GSO skbs that may egress on
enetc.
As the commit message notes, enetc does not benefit from the core guard
in gso_features_check(), because it only advertises NETIF_F_HW_CSUM:
if (features & NETIF_F_IPV6_CSUM &&
skb_has_ipv6_extension_hdr(skb))
features &= ~(NETIF_F_IPV6_CSUM | NETIF_F_TSO6 | NETIF_F_GSO_UDP_L4);
Would it make sense to clear NETIF_F_GSO_MASK in enetc_features_check()
for any IPv6 GSO skb with extension headers? The stack would then
segment these correctly. The remaining header lengths would be bounded
at roughly 14 + 4 + 60 + 60 bytes, which would also close the overflow
this patch targets.
skb_has_ipv6_extension_hdr() is static in net/core/dev.c, so this would
need a local check. One option is vlan_get_protocol(skb) ==
htons(ETH_P_IPV6) && skb_network_header_len(skb) != sizeof(struct
ipv6hdr).
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261118235055.1225115-1-vladimir.oltean%40nxp.com
next prev parent reply other threads:[~2026-11-23 0:28 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-18 23:50 [PATCH v2 net 0/4] ENETC GSO fixes Vladimir Oltean
2026-11-18 23:50 ` [PATCH v2 net 1/4] net: enetc: let core segment GSO skb when TSO would not fit the TX ring Vladimir Oltean
2026-11-23 0:28 ` netdev-bot+sashiko
2026-11-18 23:50 ` [PATCH v2 net 2/4] net: enetc: reserve VLAN extension BDs for software TSO Vladimir Oltean
2026-11-23 0:28 ` netdev-bot+sashiko
2026-11-18 23:50 ` [PATCH v2 net 3/4] net: enetc: fall back to software TX csum for too long L3 headers Vladimir Oltean
2026-11-23 0:28 ` netdev-bot+sashiko
2026-11-18 23:50 ` [PATCH v2 net 4/4] net: enetc: let core segment GSO skb when headers exceed TSO_HEADER_SIZE Vladimir Oltean
2026-11-19 0:03 ` Eric Dumazet
2026-11-19 8:44 ` Vladimir Oltean
2026-11-19 9:38 ` Eric Dumazet
2026-11-19 9:43 ` Vladimir Oltean
2026-11-23 0:28 ` netdev-bot+sashiko [this message]
2026-11-19 9:42 ` [PATCH v2 net 0/4] ENETC GSO fixes Eric Dumazet
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=179539373837.3135.4065744412888442454@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=claudiu.manoil@nxp.com \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=imx@lists.linux.dev \
--cc=ioana.ciornei@nxp.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=vladimir.oltean@nxp.com \
--cc=wei.fang@nxp.com \
--cc=willemdebruijn.kernel@gmail.com \
--cc=xiaoning.wang@nxp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox