Article View: linux.kernel.netdev
Article #20580Re: [PATCH v2 net 2/4] net: enetc: reserve VLAN extension BDs for software TSO
From: netdev-bot+sashiko
Date: Mon, 23 Nov 2026 00:28
Date: Mon, 23 Nov 2026 00:28
138 lines
13371 bytes
13371 bytes
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 commit message only describes the ring-space check in
enetc_start_xmit().
Pre-existing issues:
- [High] This problem was not introduced by this patch, but it is a high-
severity pre-existing issue: a lost wake-up race between stopping theβ¦
--
net: enetc: reserve VLAN extension BDs for software TSO
This patch adds enetc_tso_count_descs(), which extends tso_count_descs()
with one extra extension BD per segment when the skb carries a VLAN tag.
It uses the new helper for the free-BD check in enetc_start_xmit() and
for the ring-size check in enetc_features_check().
> diff --git a/drivers/net/ethernet/freescale/enetc/enetc.c b/drivers/net/ethernet/freescale/enetc/enetc.c
> index 1606ac57016f3..7f089a84d9a65 100644
> --- a/drivers/net/ethernet/freescale/enetc/enetc.c
> +++ b/drivers/net/ethernet/freescale/enetc/enetc.c
[ ... ]
> @@ -1034,7 +1045,7 @@ static netdev_tx_t enetc_start_xmit(struct sk_buff *skb,
>
> count = enetc_lso_hw_offload(tx_ring, skb);
> } else {
> - if (enetc_bd_unused(tx_ring) < tso_count_descs(skb)) {
> + if (enetc_bd_unused(tx_ring) < enetc_tso_count_descs(skb)) {
> netif_stop_subqueue(ndev, tx_ring->index);
> return NETDEV_TX_BUSY;
> }
[Severity: High]
This isn't a bug introduced by this patch, but can this stop path lose a
wake-up from TX completion?
When the free-BD check fails, enetc_start_xmit() calls
netif_stop_subqueue() and returns NETDEV_TX_BUSY. There is no smp_mb()
and no second enetc_bd_unused() check after the stop. The LSO path, the
non-GSO path and the trailing ENETC_TXBDS_MAX_NEEDED() stop all have the
same shape.
On the completion side, enetc_clean_tx_ring() stores next_to_clean only
after its whole cleaning loop has finished. It then tests the stopped
state with no barrier in between:
drivers/net/ethernet/freescale/enetc/enetc.c:enetc_clean_tx_ring() {
...
tx_ring->next_to_clean = i;
...
if (unlikely(tx_frm_cnt && netif_carrier_ok(ndev) &&
__netif_subqueue_stopped(ndev, tx_ring->index) &&
!test_bit(ENETC_TX_DOWN, &priv->flags) &&
(enetc_bd_unused(tx_ring) >=
ENETC_TXBDS_MAX_NEEDED(priv->max_frags)))) {
netif_wake_subqueue(ndev, tx_ring->index);
}
...
}
Consider this interleaving:
CPU0 (ndo_start_xmit) CPU1 (NAPI)
enetc_bd_unused() reads old
next_to_clean, ring looks full
finishes reclaiming the last frames
tx_ring->next_to_clean = i;
__netif_subqueue_stopped() is false,
so no netif_wake_subqueue()
netif_stop_subqueue()
return NETDEV_TX_BUSY
The ring is now empty, so no later TX completion will reach this check
with tx_frm_cnt > 0. Polls driven by RX clean 0 TX frames. The driver has
no ndo_tx_timeout, and the only other wake is netif_tx_start_all_queues()
in the open path.
Would the queue stay stopped until the interface is brought down and up
again?
enetc_bd_unused() also reads next_to_clean and next_to_use with plain
loads while both contexts write them, without READ_ONCE()/WRITE_ONCE().
With this patch, VLAN TSO skbs hit the NETDEV_TX_BUSY path more often,
because the estimate now includes the per-segment extension BDs. The
synchronization is unchanged.
Would netif_txq_maybe_stop() and netif_txq_completed_wake() from
include/net/netdev_queues.h work here? Another option is an open-coded
stop, smp_mb() and re-check, paired with a barrier after next_to_clean is
updated. The later patches in this series don't seem to address this.
[ ... ]
> @@ -1114,7 +1125,7 @@ netdev_features_t enetc_features_check(struct sk_buff *skb,
> if (!skb_is_gso(skb) || enetc_skb_uses_lso(priv, skb))
> return features;
>
> - if (tso_count_descs(skb) >= priv->tx_bd_count)
> + if (enetc_tso_count_descs(skb) >= priv->tx_bd_count)
> features &= ~NETIF_F_GSO_MASK;
[Severity: Low]
This isn't a bug, but should the commit message mention this second call
site? The body only covers the free-BD check in enetc_start_xmit():
enetc_start_xmit() uses tso_count_descs() to check whether the TX ring
has enough free BDs for a software TSO frame.
This hunk changes runtime behavior. VLAN-tagged software TSO skbs whose
adjusted estimate reaches priv->tx_bd_count now lose GSO, so the core
segments them before ndo_start_xmit().
The change is also required. Without it, a VLAN skb where
tso_count_descs() < tx_bd_count <= enetc_tso_count_descs() would still
pass as GSO. Since enetc_bd_unused() is at most bd_count - 1,
enetc_start_xmit() would then return NETDEV_TX_BUSY forever.
That is the stall fixed by the previous patch, "net: enetc: let core
segment GSO skb when TSO would not fit the TX ring". That patch also added
enetc_features_check() itself.
Right now only the changelog below the '---' mentions this ("old v5->v1:
also patch enetc_features_check()"), and that text won't be kept in git.
Could the body describe the enetc_features_check() change and the
dependency on the previous patch, for stable backports?
--
Sashiko AI review Β· https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261118235055.1225115-1-vladimir.oltean%40nxp.com
Technical Details
Message-ID:
<179539373470.3135.3154873961019393933@kernel.org>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-368884-linux-kernel-netdev=dewy.ruReferences:
<20261118235055.1225115-3-vladimir.oltean@nxp.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-368884-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH v2 net 2/4] net: enetc: reserve VLAN extension BDs for software TSO Date: Mon, 23 Nov 2026 00:28:54 +0000 Organization: Usenet Network Message-ID: <179539373470.3135.3154873961019393933@kernel.org> References: <20261118235055.1225115-3-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="3753301"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:eCgEp+WIdlKng/UMUhsaeQGcBQA= sha256:+3m4t7IEWoLV5BcpYtLqQTnnoBO/VWdytjRlB5yFAwg= sha1:IPKhmfeSakKxqofBdC561GQGDAM= sha256:7Kp1WpzI4nBKkvxtFhWSPiIRxFXFCS0hnJ5ehV9vL/s= 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 5FA61125D8B; Mon, 23 Nov 2026 03:29:11 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.5 X-Spam-Status: No, score=-3.5 tagged_above=-9999 required=6.31 tests=[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 HW2oTssxaNFn; Mon, 23 Nov 2026 03:29:07 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-368884-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 sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74]) by mail.dewy.ru (Postfix) with ESMTPS id 8CC6A125D88; Mon, 23 Nov 2026 03:28:58 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sto.lore.kernel.org (Postfix) with ESMTP id 1A59B602046; Mon, 23 Nov 2026 00:28:58 +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=1795393737; b=0qE/isLIvbF/SG4RQnA0wHMbjaYsMOez6sAupcSqrb6vaVdTUh2J3gHHqb11OSi6gCwz VkoDHpOyLJqTDpoexQWHry64iiafNAoMIBDn3JyAqK3llPQQm6uMgdjTJTQh0G0m1y1bb yqGqBaX4yxsQ0+W1eZK0xT30+CEH+Ltz3IVlc6klX4JA0QcBBHWHMus8FD1pQOLcZvfUC su4GeZPABLPKNBBd3c0+UXH5FNKNIzWJ+LBIepHHOuFdXEK++M2qI0V/vrts+GXgb7hj3 zzkytzzSkfMbHKXRi+gXIUheqRpkmsZ/qVuji/GFK6obAFgK05PqXpJ+QVyWtAdTEGw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795393737; 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=j2hyzzDNOVdZB/HbaRnmZg2TF5KrRkGypUydgkuULYM=; b=3sb8AqKq0B8czxBxG5Sgpsr0KE/b4jASfOUtvLYP3v5JlqheU5bxzy8hKQERq76rawAI H9RCTeZ7+eupbhlo3kEydhJ+TkyELN6B764pz/AeulQcR1qO/ypbYJyNnGJ0uZCxnxYVG 5VG8xDsr69+7EGB/hyiyKpTILRdsvXqAcxrmYJWJ5DGa2Fs8/lJzfzb+3J0YBuJ98Iq8T qY2CJ1vXBofnBxV0g1K4C4+qavIQTIpzVgZFhBvN+NATa3KWURpNhi/xLhlkYwOP8cmWN yF2xNgUbwtfI2i6edLi5jrsZxI6Mfv4igbuA+hqySyjSKWzRzluIQnCQJU66AcKJlDA== 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=EJRnZver; 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 60F20606A31E; Mon, 23 Nov 2026 00:28:57 +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=EJRnZver 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=1795393736; b=OLhTkfXq8FQCawGIuSC0ENzqx80DadBXHucro43Lj92xWIfqRwd99OrJCfne+Se2ojlX 8XUluhAnU61zEcJIO6z5RiDXh1314oxIA4B56qwq6GLjBuFeILBWK8RKn15RYUutRtbh0 MXMcZC+v/exJOF+M0H4BTfjpp5XOThJqt2XKsE/Z5TYlBdWMqrb/8Pc9NkXhKnJdnljE/ UtY7ySqa+5c0Z6cpAkEG9CKkqars+XXE+tWfc+ngOj3tnU1k78/FDOLjz126vGFjKVhdC dqc5G+8JOlaRTxujeVa0r1LVbdZZecNIFpv39ioGU2TXi5j/XHc29Un23YmRrxrkiNA== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795393736; 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=j2hyzzDNOVdZB/HbaRnmZg2TF5KrRkGypUydgkuULYM=; b=pdt0JHgCVCaa6lntMpbA6EdftI5s0LhAatY/famfy69dxiMdGIX4jhEADPZFroaDTa5o vuzpNenXPllqSZSIZuuxNTbUnXW82GiLShBoRTPstrjYcMagWQ+K6m2O96CSg4rvC/30s TDhIwWeu2bCUfJruGJRPlI4PFmIqJljQAjAf/Yu/DkM+GgPvSa16huln2T0TAidiIqxP0 xYIQARI7FV6b9qtL8YuIBpa7WQZA4B0+a2bda45MchHRPul6v/1S2OTbkMPQBf8iYZ7Ct 0Kd42ZbGko/PuXUqAGXVDPMm6F3UZiHGXhNjDYFWimdm/mrgWJCmMFO9OhC2nI4n0Ag== 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=EJRnZver; 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 84019606A32D; Mon, 23 Nov 2026 00:28:56 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 210AC1F000C6; Mon, 23 Nov 2026 00:28:55 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795393735; bh=j2hyzzDNOVdZB/HbaRnmZg2TF5KrRkGypUydgkuULYM=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=EJRnZverzv4wtUNpJxZ5r6ESJw3NP586cLPDnlUkmJV82A1bNCwUmgd+PZBzlfjgn UzOswbqw9B7UpMofAML5b3tXJXhHJEvz9JU1hkQ+XVabQ04dGm8NTS/vV2F8k/eGhB yLOt0TROoyKwUld7QltyeqLGqfwta8aRO/MS+XuMjiSdJ97CJ4MbhUKavjFa6Bx4a6 cLmtdsCrqOalLg8ExvYz2Hc09X88rb6gJbp1t0hlZ/Oqk0D4NAdjsGeDPLSJCu3dd/ XNPLDZaHyNKxs6cxdcVhR9VJf8AnfP3y/VGmJ3Ai0CGy0BJP/Jm6VxJy868dtmGnU5 EiVU1kKM1ZuLQ== 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: <20261118235055.1225115-3-vladimir.oltean@nxp.com> X-sashiko-severity: Low 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