From: sashiko-bot@kernel.org
To: vladimir.oltean@nxp.com
Cc: bpf@vger.kernel.org, imx@lists.linux.dev, Frank.Li@kernel.org
Subject: Re: [PATCH v3 net 2/7] net: enetc: ensure enetc_xdp_xmit() calls enetc_update_tx_ring_tail()
Date: Wed, 16 Sep 2026 22:28:06 +0000 [thread overview]
Message-ID: <20260916222806.6011F1F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260915222735.1016937-3-vladimir.oltean@nxp.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] net: enetc: missing XDP_XMIT_FLUSH doorbell when k=0
--
commit d8271163a46118cc9a3212492775857b3ece7ba0
Author: Vladimir Oltean <vladimir.oltean@nxp.com>
net: enetc: ensure enetc_xdp_xmit() calls enetc_update_tx_ring_tail()
This commit modifies enetc_xdp_xmit() to fix the condition that triggers
the TX doorbell. It removes the redundant xdp_tx_frm_cnt variable and
updates the check to verify if at least one frame was sent along with
flush requests.
> diff --git a/drivers/net/ethernet/freescale/enetc/enetc.c b/drivers/net/ethernet/freescale/enetc/enetc.c
> --- a/drivers/net/ethernet/freescale/enetc/enetc.c
> +++ b/drivers/net/ethernet/freescale/enetc/enetc.c
[ ... ]
> @@ -1845,19 +1844,17 @@ int enetc_xdp_xmit(struct net_device *ndev, int num_frames,
> &xdp_redirect_arr[i]);
> break;
> }
> -
> - xdp_tx_frm_cnt++;
> }
>
> - if (unlikely((flags & XDP_XMIT_FLUSH) || k != xdp_tx_frm_cnt))
> + if (unlikely(k && ((flags & XDP_XMIT_FLUSH) || k < num_frames)))
[Severity: High]
Does the addition of the k && condition block the mandatory XDP_XMIT_FLUSH
doorbell if the current transmission call fails to enqueue any frames?
If the devmap subsystem enqueues a full batch of frames with flags=0
(no flush), enetc_xdp_xmit() successfully enqueues them but skips the
doorbell because k == num_frames and flags=0.
Subsequently, devmap calls __dev_flush() which invokes enetc_xdp_xmit()
with flags=XDP_XMIT_FLUSH to ring the doorbell. If the hardware TX ring
is now full, this call fails to enqueue its pending frames, resulting in
k=0.
Since the modified condition evaluates to false when k=0, wouldn't this
skip the doorbell entirely and leave the previously enqueued XDP frames
permanently stuck in the hardware TX ring?
> enetc_update_tx_ring_tail(tx_ring);
>
> - tx_ring->stats.xdp_tx += xdp_tx_frm_cnt;
> - tx_ring->stats.xdp_tx_drops += num_frames - xdp_tx_frm_cnt;
> + tx_ring->stats.xdp_tx += k;
> + tx_ring->stats.xdp_tx_drops += num_frames - k;
>
> enetc_unlock_mdio();
>
> - return xdp_tx_frm_cnt;
> + return k;
> }
> EXPORT_SYMBOL_GPL(enetc_xdp_xmit);
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260915222735.1016937-1-vladimir.oltean@nxp.com?part=2
next prev parent reply other threads:[~2026-09-16 22:28 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-15 22:27 [PATCH v3 net 0/7] Fix short frame transmission in enetc vladimir.oltean
2026-09-15 22:27 ` [PATCH v3 net 1/7] net: enetc: consistenly track dropped frames in enetc_xdp_xmit() vladimir.oltean
2026-09-16 2:16 ` Wei Fang
2026-09-18 10:27 ` Vladimir Oltean
2026-09-16 23:35 ` netdev-bot+sashiko
2026-09-15 22:27 ` [PATCH v3 net 2/7] net: enetc: ensure enetc_xdp_xmit() calls enetc_update_tx_ring_tail() vladimir.oltean
2026-09-16 2:20 ` Wei Fang
2026-09-16 22:28 ` sashiko-bot [this message]
2026-09-18 23:05 ` Vladimir Oltean
2026-09-16 23:35 ` netdev-bot+sashiko
2026-09-15 22:27 ` [PATCH v3 net 3/7] net: enetc: fix bogus TX ring consumer index after reinitialization vladimir.oltean
2026-09-15 22:27 ` [PATCH v3 net 4/7] net: enetc: pad short frames in software vladimir.oltean
2026-09-16 23:35 ` netdev-bot+sashiko
2026-09-17 10:11 ` David Laight
2026-09-21 11:29 ` Vladimir Oltean
2026-09-15 22:27 ` [PATCH v3 net 5/7] net: enetc: pad short XDP frames coming from devmap vladimir.oltean
2026-09-16 22:28 ` sashiko-bot
2026-09-16 23:35 ` netdev-bot+sashiko
2026-09-15 22:27 ` [PATCH v3 net 6/7] net: enetc: linearize PTP event packets with one-step TX timestamping vladimir.oltean
2026-09-16 1:59 ` Wei Fang
2026-09-16 9:50 ` Vladimir Oltean
2026-09-16 22:28 ` sashiko-bot
2026-09-16 23:35 ` netdev-bot+sashiko
2026-09-15 22:27 ` [PATCH v3 net 7/7] net: enetc: drain and cancel one-step TX tstamp queue when going down vladimir.oltean
2026-09-16 23:36 ` 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=20260916222806.6011F1F00893@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=Frank.Li@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=imx@lists.linux.dev \
--cc=sashiko-reviews@lists.linux.dev \
--cc=vladimir.oltean@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.