From: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
To: Magnus Karlsson <magnus.karlsson@intel.com>
Cc: <magnus.karlsson@gmail.com>, <intel-wired-lan@lists.osuosl.org>,
<anthony.l.nguyen@intel.com>, <przemyslaw.kitszel@intel.com>
Subject: Re: [PATCH iwl-net] ice: reset xdp_tx_active when cleaning a Tx ring
Date: Wed, 18 Nov 2026 15:18:15 +0100 [thread overview]
Message-ID: <av2zp3AEAB08afQa@boxer> (raw)
In-Reply-To: <20261118135920.1063665-1-magnus.karlsson@intel.com>
On Wed, Nov 18, 2026 at 02:59:20PM +0100, Magnus Karlsson wrote:
> xdp_tx_active counts the XDP_TX buffers on an XDP ring, so that
> ice_clean_xdp_irq_zc() can complete AF_XDP zero-copy frames in bulk when
> there are none. It is incremented for every XDP_TX frame and decremented
> when such a frame completes. ice_clean_tx_ring() frees the frames that
> are still on the ring, both through ice_xsk_clean_xdp_ring() and through
> ice_unmap_and_free_tx_buf(), but leaves the counter as it was.
>
> After a ring is cleaned with XDP_TX frames in flight, for example when
> an AF_XDP socket is bound or unbound, xdp_tx_active therefore stays
> non-zero for the lifetime of the ring. ice_clean_xdp_irq_zc() then
> always takes the per-descriptor slow path.
>
> The ring is empty after ice_clean_tx_ring(), so reset the counter
> there, together with next_to_use and next_to_clean.
Has that ever happen on your side?
Maybe to be sure we are not leaking buffers we should teach
ice_xsk_clean_xdp_ring() to decrement xdp_tx_active for ICE_TX_BUF_XSK_TX
and on ice_clean_tx_ring() warn if xdp_tx_active is still non-zero?
Feels a bit rigoristic, but I think I stumbled upon some off-by-one bugs
where we rely on ntc != ntu loop. non-xsk clean goes 0..count.
>
> Fixes: 59e92bfe4df7 ("ice: xsk: Borrow xdp_tx_active logic from i40e")
> Signed-off-by: Magnus Karlsson <magnus.karlsson@intel.com>
> ---
> drivers/net/ethernet/intel/ice/ice_txrx.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/net/ethernet/intel/ice/ice_txrx.c b/drivers/net/ethernet/intel/ice/ice_txrx.c
> index 35a480a1e172..f26646825a1e 100644
> --- a/drivers/net/ethernet/intel/ice/ice_txrx.c
> +++ b/drivers/net/ethernet/intel/ice/ice_txrx.c
> @@ -228,6 +228,7 @@ void ice_clean_tx_ring(struct ice_tx_ring *tx_ring)
>
> tx_ring->next_to_use = 0;
> tx_ring->next_to_clean = 0;
> + tx_ring->xdp_tx_active = 0;
>
> if (!tx_ring->netdev)
> return;
> --
> 2.38.1
>
next prev parent reply other threads:[~2026-11-18 14:18 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-18 13:59 [PATCH iwl-net] ice: reset xdp_tx_active when cleaning a Tx ring Magnus Karlsson
2026-11-18 14:18 ` Maciej Fijalkowski [this message]
2026-11-18 14:32 ` Magnus Karlsson
2026-11-18 15:48 ` Maciej Fijalkowski
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=av2zp3AEAB08afQa@boxer \
--to=maciej.fijalkowski@intel.com \
--cc=anthony.l.nguyen@intel.com \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=magnus.karlsson@gmail.com \
--cc=magnus.karlsson@intel.com \
--cc=przemyslaw.kitszel@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 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.