On Tue, Nov 24, 2026 at 03:19:29PM +0100, Loktionov, Aleksandr wrote:
> 
> 
> > -----Original Message-----
> > From: Magnus Karlsson <[email protected]>
> > Sent: Tuesday, November 24, 2026 2:30 PM
> > To: Karlsson, Magnus <[email protected]>;
> > [email protected]; [email protected]; Nguyen,
> > Anthony L <[email protected]>; Fijalkowski, Maciej
> > <[email protected]>; Kitszel, Przemyslaw
> > <[email protected]>
> > Subject: [PATCH iwl-net v2] ice: account for XDP_TX buffers when
> > cleaning a Tx ring
> > 
> > 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. ice_clean_tx_ring() frees the buffers 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.
> > 
> > ice_xsk_clean_xdp_ring() used to decrement the counter for the XDP_TX
> > buffers it freed, through ice_clean_xdp_tx_buf(), until that helper was
> > replaced with a plain xsk_buff_free(). Decrement it again for each
> > XDP_TX buffer it frees. ice_unmap_and_free_tx_buf() frees buffers on
> > regular XDP rings, which count XDP_TX and redirected frames rather than
> > buffers, so reset the counter in ice_clean_tx_ring() as well, so that a
> > zero-copy socket bound afterwards starts from zero.
> > 
> > Fixes: 59e92bfe4df7 ("ice: xsk: Borrow xdp_tx_active logic from i40e")
> > Fixes: a24b4c6e9aab ("ice: xsk: Do not convert to buff to frame for
> 
> Why two fixes? Do you fix two bugs in one commit - better split into patcset.
> One bug makes reproduction more often - mention it in commit message.
> Leave single Fixes: tag per commit please.

There's nothing wrong or unusual with having two fixes tags in single
commit, the fix needs to be atomic so this suggestion is bogus.

Acked-by: Maciej Fijalkowski <[email protected]>

> 
> > XDP_TX")
> > Signed-off-by: Magnus Karlsson <[email protected]>
> > ---
> > v1 -> v2:
> > - Decrement the counter for each freed XDP_TX buffer (Maciej)
> > - v1: https://lore.kernel.org/intel-wired-lan/20261118135952.1063685-1-
> > [email protected]/
> > ---
> >  drivers/net/ethernet/intel/ice/ice_txrx.c | 1 +
> > drivers/net/ethernet/intel/ice/ice_xsk.c  | 1 +
> >  2 files changed, 2 insertions(+)
> > 
> > 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;
> > diff --git a/drivers/net/ethernet/intel/ice/ice_xsk.c
> > b/drivers/net/ethernet/intel/ice/ice_xsk.c
> > index 0c1ce3e86a45..2d9dbdb82cdd 100644
> > --- a/drivers/net/ethernet/intel/ice/ice_xsk.c
> > +++ b/drivers/net/ethernet/intel/ice/ice_xsk.c
> > @@ -942,6 +942,7 @@ void ice_xsk_clean_xdp_ring(struct ice_tx_ring
> > *xdp_ring)
> >             if (tx_buf->type == ICE_TX_BUF_XSK_TX) {
> >                     tx_buf->type = ICE_TX_BUF_EMPTY;
> >                     xsk_buff_free(tx_buf->xdp);
> > +                   xdp_ring->xdp_tx_active--;
> >             } else {
> >                     xsk_frames++;
> >             }
> > --
> > 2.38.1
> 

Reply via email to