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 net 1/3] net: enetc: let core segment GSO super-skb when TSO would not fit the TX ring
Date: Mon, 16 Nov 2026 00:21:34 +0000 [thread overview]
Message-ID: <179478849492.3136.15273523164661728794@kernel.org> (raw)
In-Reply-To: <20261111233149.479596-2-vladimir.oltean@nxp.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 · High: 1 · Medium: 0 · 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).
- [High] The fix is incomplete: SKB_GSO_DODGY skbs can still stall a TX
queue for good.
--
net: enetc: let core segment GSO super-skb when TSO would not fit the TX ring
This adds an ndo_features_check() to the enetc PF and VF drivers. On the
software TSO path, it clears the GSO features for any skb whose
descriptor estimate is larger than the TX ring could ever provide. The
core then segments those skbs itself, which avoids the permanent
NETDEV_TX_BUSY loop in enetc_start_xmit().
> diff --git a/drivers/net/ethernet/freescale/enetc/enetc.c b/drivers/net/ethernet/freescale/enetc/enetc.c
> index c6571b5cc8425..1606ac57016f3 100644
> --- a/drivers/net/ethernet/freescale/enetc/enetc.c
> +++ b/drivers/net/ethernet/freescale/enetc/enetc.c
[ ... ]
> @@ -1098,6 +1103,24 @@ netdev_tx_t enetc_xmit(struct sk_buff *skb, struct net_device *ndev)
> }
> EXPORT_SYMBOL_GPL(enetc_xmit);
>
> +netdev_features_t enetc_features_check(struct sk_buff *skb,
> + struct net_device *ndev,
> + netdev_features_t features)
> +{
> + struct enetc_ndev_priv *priv = netdev_priv(ndev);
> +
> + features = vlan_features_check(skb, features);
> +
> + if (!skb_is_gso(skb) || enetc_skb_uses_lso(priv, skb))
> + return features;
> +
> + if (tso_count_descs(skb) >= priv->tx_bd_count)
> + features &= ~NETIF_F_GSO_MASK;
[Severity: High]
Can SKB_GSO_DODGY skbs still get past this check and stall the queue?
tso_count_descs() is based on skb_shinfo(skb)->gso_segs. The same is
true of enetc_tso_count_descs(), which replaces it later in the series.
For DODGY skbs, gso_segs can still be 0 when ndo_features_check runs.
enetc does not advertise NETIF_F_GSO_ROBUST, so the skb takes this path:
validate_xmit_skb()
__netif_skb_features()
enetc_features_check() <- sees gso_segs == 0, keeps TSO
__skb_gso_segment()
tcp_gso_segment()
tcp_gso_segment() only fixes up gso_segs and then returns the skb
unsegmented:
net/ipv4/tcp_offload.c:tcp_gso_segment() {
...
if (skb_gso_ok(skb, features | NETIF_F_GSO_ROBUST)) {
/* Packet is from an untrusted source, reset gso_segs. */
skb_shinfo(skb)->gso_segs = DIV_ROUND_UP(skb->len, mss);
segs = NULL;
...
}
Take the software TSO path (no ENETC_F_LSO, e.g. LS1028A). A DODGY TCP
skb with a gso_size of 8 and about 64KB of payload gets a gso_segs of
about 8000. That puts the descriptor estimate at about 16000, well
above the 2047 BDs an empty ring can offer.
In that case the enetc_bd_unused() check in enetc_start_xmit() is
always true. The driver calls netif_stop_subqueue() and returns
NETDEV_TX_BUSY every time.
There seem to be two ways to produce such skbs.
The first is AF_PACKET with PACKET_VNET_HDR and PACKET_QDISC_BYPASS.
__virtio_net_hdr_to_skb() does:
shinfo->gso_type |= SKB_GSO_DODGY;
shinfo->gso_segs = 0;
and only clamps gso_size to TCP_MIN_GSO_SIZE. The send path is then
packet_xmit()->dev_direct_xmit()->__dev_direct_xmit()->
validate_xmit_skb_list(). That path skips qdisc_pkt_len_segs_init(),
the only place that recomputes DODGY gso_segs before features_check.
On BUSY, dev_direct_xmit() frees the skb, but the subqueue stays
stopped.
The second is a tc-egress BPF program that calls
bpf_skb_adjust_room(). Both bpf_skb_net_grow() and bpf_skb_net_shrink()
set SKB_GSO_DODGY and reset gso_segs to 0. This happens after
__dev_queue_xmit() has already run qdisc_pkt_len_segs_init(). Ordinary
TCP TSO traffic would then skip the new check, including the small-MSS
peer case from the commit message, and be requeued with BUSY forever.
The only wake-up for the stopped subqueue is in enetc_clean_tx_ring().
It needs tx_frm_cnt > 0, and the driver has no ndo_tx_timeout, so an
idle ring would not recover.
Could the ring-size check use a bound that does not trust gso_segs for
DODGY skbs? One option is DIV_ROUND_UP(skb->len - hdr_len, gso_size).
Another is a fallback in the xmit path for skbs that can never fit the
ring.
> +
> + return features;
> +}
> +EXPORT_SYMBOL_GPL(enetc_features_check);
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261111233149.479596-1-vladimir.oltean%40nxp.com
next prev parent reply other threads:[~2026-11-16 0:21 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-11 23:31 [PATCH net 0/3] ENETC GSO fixes Vladimir Oltean
2026-11-11 23:31 ` [PATCH net 1/3] net: enetc: let core segment GSO super-skb when TSO would not fit the TX ring Vladimir Oltean
2026-11-16 0:21 ` netdev-bot+sashiko [this message]
2026-11-11 23:31 ` [PATCH net 2/3] net: enetc: reserve VLAN extension BDs for software TSO Vladimir Oltean
2026-11-16 0:21 ` netdev-bot+sashiko
2026-11-11 23:31 ` [PATCH net 3/3] net: enetc: let core segment GSO super-skb when headers exceed TSO_HEADER_SIZE Vladimir Oltean
[not found] ` <sashiko-outbox-211955@kernel.org>
2026-11-13 11:49 ` Vladimir Oltean
2026-11-16 0:21 ` netdev-bot+sashiko
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=179478849492.3136.15273523164661728794@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