๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #16851

Re: [PATCH net 1/3] net: enetc: let core segment GSO super-skb when TSO would not fit the TX ring

#16851
From: netdev-bot+sashiko
Date: Mon, 16 Nov 2026 00:21
126 lines
12580 bytes
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
Technical Details
Message-ID: <179478849492.3136.15273523164661728794@kernel.org>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-363938-linux-kernel-netdev=dewy.ru
References: <20261111233149.479596-2-vladimir.oltean@nxp.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-363938-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
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
Organization: Usenet Network
Message-ID: <179478849492.3136.15273523164661728794@kernel.org>
References: <20261111233149.479596-2-vladimir.oltean@nxp.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1942244"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:ImmSdn3GYqCeVeowWvkQ5WyzlMg= sha256:d9hUmnSX3T8cSxKJynZzXIUUQ8w7+Ch7jY3jycVMWBU=
	sha1:KB7Car2bqWNtSmqP3lNp8gAy3iA= sha256:/H9vO2wUG1lgp1byVteeS9f4I/RURflYuK02yms7u94=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 0FB7E114AC3; Mon, 16 Nov 2026 03:21:54 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.4
X-Spam-Status: No, score=-3.4 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id 7v8cP1Hp38iH;
	Mon, 16 Nov 2026 03:21:50 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-363938-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id B1187114ABE; Mon, 16 Nov 2026 03:21:40 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id 4E1952E65C; Mon, 16 Nov 2026 00:21:38 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1794788497;
	b=4uQ0odamsUa4ts0wHldALvDsFWxHjH7kZkRlxNhvhtrQQKHjWoYy1YWX82RkWZMtILaQ
	 GDTEmW1ZIGtT8K4mYMkHrjK19ZnzXz37ns3SzmyHTvd7ClGDOuI7wgJ9UDL7U/YwjHylz
	 9bl6M5dgIUPW89ocDn6rMoobcB3NdpVW26JilYNT5UK5A4z+TqZxSPqMVsu/bfc98IqUA
	 5NBBO2M0Gc0GTKqP1U3jeG/4hL5mc+LCV/s03G8SF0ZjUkLtYiVjq/fmimA3Sq43BRWwV
	 vDkmkfyfJzNJx8XsurZyYdy03kSHbCz1QCltp+IUVoAQfgyZTDwHY9YraEPrCE6UwkQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794788497;
	h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc:
	 Date:Message-ID:In-Reply-To:References:X-sashiko-severity:
	 Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version;
	bh=815aWJsIt4ff4spJiIdcgyH80McTdDzk8dYP7BF5UfE=;
	b=dBI0A1+5wRVRWOQ4Ll8t+B8pHsrf3UZazlVPRfoc1ZLDzf0PS3fvcxtKqXhPMslU9dR8
	 Fc35vHG/WMscvBghzK3Iww7MgRhLganVnVBilppgu66JtoUC8HfHDnjhI7TGlBmCNmAtw
	 BjCx0LuPvTQyaimuWVYpMr5XHJvKGRtmMCF4P2Vp71bscgdWZjVTiyplCNPl47q9y5YOR
	 8XjkDyMkHw6SCFXv/+21NMrW87obMhX28sW8wWrKep8wMK+K31xtrA4NNbosefoLSQ/wT
	 p6Tw1ELTzi7tqPku5jHIOlTlVBmfUnGDrPBYZ0lkiR/3KBpI5Xq2PYt6761csdzPZ6w==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Ufz0BKHA;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 456CA606A339;
	Mon, 16 Nov 2026 00:21:37 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Ufz0BKHA
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1794788496;
	b=wRhoNYdQiWISIZWfla642OoU9RZOT8QqIPle2TsDuvVpALBPQPkthbtCHFwG72oTTTTR
	 kNWywGY3riVZyF+9YjoZS7TzzfEVIxjF6cDvpo7lsnhAOncGQDf5p1svn9oVhsnR3fErv
	 X7WGwjj9sz21gQFOrCSscBa0KFSg4hXI32pCFjzWNObnEp/I87Kni4y6LD4mbyU8kIz/y
	 rTCRljRMbhEPvm/4JV+2jCCNmAeixWp55Oj5zSwYSSOXrPwHDA3gC+L6v8vAfe5QOsALy
	 YlDO/huC69AquhDfK1/dwJr4KW24FT+pJMD9j4WgLo5JWJ1IRX9WbKQrpmbs8hImBjg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794788496;
	h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID:
	 In-Reply-To:References:X-sashiko-severity:Content-Type:
	 Content-Transfer-Encoding:MIME-Version;
	bh=815aWJsIt4ff4spJiIdcgyH80McTdDzk8dYP7BF5UfE=;
	b=xR+gGs6uho2Rbzpr5sUzdTZndX5pd3GBvQczL8sSXEsXQhbtTh8AWKJvJoMU7NCPz8mQ
	 QIik4KjD96Pfnf8iravbRN7RtOFBjy/D0IjfsILcV6LmI+pFLiO/hmW8mdbsLqXXiCtJw
	 A/zKDq7g/BSY4pH/pk8yptrz4WeftHk0x8Epp/5N9t2GOg1eXHjNTAnWFLS/t/YaMSBON
	 FIW1/mZi3osGdChsKSxUE/mrHhOfNDx8uR1oBt1F6cFYuIIRiF90Q19aUI3bWVNpPyFhN
	 WqdmN3XtY/uYc42Nw9TYyNnMmGb4LysqHveyG1LLt0ZftgR81EZ+dRMc7PCMAn889zw==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Ufz0BKHA;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6393A606A31F;
	Mon, 16 Nov 2026 00:21:36 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5D6F61F000C4;
	Mon, 16 Nov 2026 00:21:35 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1794788496;
	bh=815aWJsIt4ff4spJiIdcgyH80McTdDzk8dYP7BF5UfE=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=Ufz0BKHAiOj+0HG8bEM6pyZd1pdIgfRi0M6zQikOEJdLN7e6dQ0yORTyLNykKclo0
	 8K8FDdYpR/a1+QiqDL9952KTMNEowILtNT9lq/kb9ZB1Jm+n/fBK2UCjlv/HVia7hh
	 4tPft6/NwlGVFogQ5245X7jqF57En9suCNeYPgrYSHVOWr6W/KsKxovwhLmqN9tGBh
	 bpq9qG1zZgB3WSCm6Hlrc2ljf1pxeLaqOwlgwuJUKSlKR2otAbDHOREgTDtTFZhi96
	 e7elNXKpvVFaZw+OHhXKots8v9RzBt4JDDTeY7pWrppf+CjwBMBr/8EXoeOn6FhqoR
	 h5gDXKz4qX0Xg==
X-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
X-In-Reply-To: <20261111233149.479596-2-vladimir.oltean@nxp.com>
X-sashiko-severity: High
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list