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 2/4] net: enetc: reserve VLAN extension BDs for software TSO
Date: Mon, 23 Nov 2026 00:28:54 +0000 [thread overview]
Message-ID: <179539373470.3135.3154873961019393933@kernel.org> (raw)
In-Reply-To: <20261118235055.1225115-3-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 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
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 [this message]
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
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=179539373470.3135.3154873961019393933@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
all inboxes | Powered by JetHome®