On Wed, 18 Nov 2026 at 15:18, Maciej Fijalkowski
<[email protected]> wrote:
>
> 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?
Nope, but I never use XDP_TX to be honest.
> 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?
Sure, but does that belong in this patch?
> 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 <[email protected]>
> > ---
> > 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
> >