From: Stanislav Fomichev <sdf.kernel@gmail.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org, davem@davemloft.net, edumazet@google.com,
pabeni@redhat.com, anthony.l.nguyen@intel.com,
przemyslaw.kitszel@intel.com, andrew+netdev@lunn.ch,
saeedm@nvidia.com, tariqt@nvidia.com, mbloch@nvidia.com,
maxime.chevallier@bootlin.com, mcoquelin.stm32@gmail.com,
alexandre.torgue@foss.st.com, aleksander.lobakin@intel.com,
horms@kernel.org, magnus.karlsson@intel.com,
maciej.fijalkowski@intel.com, sdf@fomichev.me, ast@kernel.org,
daniel@iogearbox.net, hawk@kernel.org, john.fastabend@gmail.com,
witu@nvidia.com, martin.lau@kernel.org,
yoong.siang.song@intel.com, rohan.g.thomas@intel.com,
intel-wired-lan@lists.osuosl.org, linux-kernel@vger.kernel.org,
linux-rdma@vger.kernel.org,
linux-stm32@st-md-mailman.stormreply.com,
linux-arm-kernel@lists.infradead.org, bpf@vger.kernel.org,
leon@kernel.org
Subject: Re: [Intel-wired-lan] [PATCH net v2 3/3] net: stmmac: skip queueMaxSDU check for AF_XDP
Date: Tue, 18 Aug 2026 10:03:16 -0700 [thread overview]
Message-ID: <aoSOau3NuHTLLxnL@devvm7509.cco0.facebook.com> (raw)
In-Reply-To: <20260818162442.3980697-1-kuba@kernel.org>
On 08/18, Jakub Kicinski wrote:
> This is an AI-generated review of your patch. The human sending this
> email has considered the AI review valid, or at least plausible.
> ---
> net: stmmac: skip queueMaxSDU check for AF_XDP
>
> This drops the per-queue max SDU length check from the stmmac AF_XDP
> zero-copy transmit path, on the grounds that xsk_tx_peek_desc() has
> already reserved a completion ring entry and the old "continue" skipped
> both queuing and completion. The change is tagged for stable via a Fixes:
> tag on c5c3e1bfc9e0.
>
> > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> > index 62de03e65a90c..4a82f4351303a 100644
> > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> > @@ -2710,13 +2710,6 @@ static bool stmmac_xdp_xmit_zc(struct stmmac_priv *priv, u32 queue, u32 budget)
> > if (!xsk_tx_peek_desc(pool, &xdp_desc))
> > break;
> >
> > - if (priv->est && priv->est->enable &&
> > - priv->est->max_sdu[queue] &&
> > - xdp_desc.len > priv->est->max_sdu[queue]) {
> > - priv->xstats.max_sdu_txq_drop[queue]++;
> > - continue;
> > - }
> > -
>
> [Severity: Medium]
> The completion ring imbalance described in the commit message looks real:
> xsk_tx_peek_desc() reserves the cq slot with xskq_prod_reserve_addr() and
> only xsk_tx_completed() submits it, so the old "continue" left the cq
> producer permanently offset.
>
> Was completing the reserved descriptor considered instead of removing the
> check, i.e. keeping the length test and doing:
>
> if (priv->est && priv->est->enable &&
> priv->est->max_sdu[queue] &&
> xdp_desc.len > priv->est->max_sdu[queue]) {
> priv->xstats.max_sdu_txq_drop[queue]++;
> xsk_tx_completed(pool, 1);
> continue;
> }
>
> That would fix the ring accounting without dropping the enforcement.
Don't think this suggestion would work. xsk_tx_completed(1) will complete
the first queued entry, no the current rejected one (completions are in order).
If it's not convincing, I can repost only patches 1 and 2. Or if it sounds
reasonable, can try to explain that part in the description.
> On stmmac, queueMaxSDU has no hardware table. priv->est->max_sdu[] is
> written only by tc_taprio_map_maxsdu_txq() in stmmac_tc.c:
>
> for (j = offset; j < offset + count; j++)
> priv->est->max_sdu[j] = qopt->max_sdu[i] + ETH_HLEN - ETH_TLEN;
>
> and read only by the length checks in stmmac_main.c. With this hunk gone,
> does an AF_XDP zero-copy socket now transmit frames above the configured
> per-queue limit while tc_query_caps() still reports:
>
> caps->gate_mask_per_txq = true;
> caps->supports_queue_max_sdu = true;
>
> That capability is what taprio uses to accept a queueMaxSDU configuration
> in the first place, and sch_taprio comments in
> taprio_skb_exceeds_queue_max_sdu() that "Devices with full offload are
> expected to honor this in hardware".
>
> The "bypasses the qdisc" rationale also applies to stmmac_xdp_xmit_xdpf(),
> which serves XDP_TX and ndo_xdp_xmit and does not traverse the qdisc
> either, yet still enforces the same limit:
>
> if (priv->est && priv->est->enable &&
> priv->est->max_sdu[queue] &&
> xdpf->len > priv->est->max_sdu[queue]) {
> priv->xstats.max_sdu_txq_drop[queue]++;
> return STMMAC_XDP_CONSUMED;
> }
>
> Should that check be removed as well so the XDP paths agree? The cited igc
> precedent checks only in igc_xmit_frame_ring() and in neither of its XDP
> paths, so matching igc would mean touching stmmac_xdp_xmit_xdpf() too.
xdp_tx does not expose xsk-like descriptor rings, so it doesn't apply.
next prev parent reply other threads:[~2026-08-18 17:04 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-13 19:07 [PATCH net v2 0/3] xsk: pre-existing AF_XDP TX metadata fixes from Sashiko Stanislav Fomichev
2026-08-13 19:07 ` [PATCH net v2 1/3] xsk: align TX metadata layout across ABIs Stanislav Fomichev
2026-08-17 10:17 ` Simon Horman
2026-08-17 12:59 ` Arnd Bergmann
2026-08-18 17:03 ` Stanislav Fomichev
2026-08-13 19:07 ` [PATCH net v2 2/3] xsk: honor XDP_TX_METADATA in zero-copy path Stanislav Fomichev
2026-08-13 19:08 ` [PATCH net v2 3/3] net: stmmac: skip queueMaxSDU check for AF_XDP Stanislav Fomichev
2026-08-17 10:17 ` Simon Horman
2026-08-18 10:38 ` [Intel-wired-lan] " Loktionov, Aleksandr
2026-08-18 16:24 ` Jakub Kicinski
2026-08-18 17:03 ` Stanislav Fomichev [this message]
2026-08-18 18:19 ` Jakub Kicinski
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=aoSOau3NuHTLLxnL@devvm7509.cco0.facebook.com \
--to=sdf.kernel@gmail.com \
--cc=aleksander.lobakin@intel.com \
--cc=alexandre.torgue@foss.st.com \
--cc=andrew+netdev@lunn.ch \
--cc=anthony.l.nguyen@intel.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hawk@kernel.org \
--cc=horms@kernel.org \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=john.fastabend@gmail.com \
--cc=kuba@kernel.org \
--cc=leon@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=maciej.fijalkowski@intel.com \
--cc=magnus.karlsson@intel.com \
--cc=martin.lau@kernel.org \
--cc=maxime.chevallier@bootlin.com \
--cc=mbloch@nvidia.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=przemyslaw.kitszel@intel.com \
--cc=rohan.g.thomas@intel.com \
--cc=saeedm@nvidia.com \
--cc=sdf@fomichev.me \
--cc=tariqt@nvidia.com \
--cc=witu@nvidia.com \
--cc=yoong.siang.song@intel.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;
as well as URLs for NNTP newsgroup(s).