All of lore.kernel.org
 help / color / mirror / Atom feed
From: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
To: "Loktionov, Aleksandr" <aleksandr.loktionov@intel.com>
Cc: "Karlsson, Magnus" <magnus.karlsson@intel.com>,
	"magnus.karlsson@gmail.com" <magnus.karlsson@gmail.com>,
	"intel-wired-lan@lists.osuosl.org"
	<intel-wired-lan@lists.osuosl.org>,
	"Nguyen, Anthony L" <anthony.l.nguyen@intel.com>,
	"Kitszel, Przemyslaw" <przemyslaw.kitszel@intel.com>
Subject: Re: [PATCH iwl-net v2] ice: account for XDP_TX buffers when cleaning a Tx ring
Date: Tue, 24 Nov 2026 15:30:58 +0100	[thread overview]
Message-ID: <awWfolL1o5YEn2TM@boxer> (raw)
In-Reply-To: <CH3PR11MB566895E95586F94B282D5AFEE9E5442@CH3PR11MB566895.namprd11.prod.outlook.com>

On Tue, Nov 24, 2026 at 03:19:29PM +0100, Loktionov, Aleksandr wrote:
> 
> 
> > -----Original Message-----
> > From: Magnus Karlsson <magnus.karlsson@intel.com>
> > Sent: Tuesday, November 24, 2026 2:30 PM
> > To: Karlsson, Magnus <magnus.karlsson@intel.com>;
> > magnus.karlsson@gmail.com; intel-wired-lan@lists.osuosl.org; Nguyen,
> > Anthony L <anthony.l.nguyen@intel.com>; Fijalkowski, Maciej
> > <maciej.fijalkowski@intel.com>; Kitszel, Przemyslaw
> > <przemyslaw.kitszel@intel.com>
> > 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 <maciej.fijalkowski@intel.com>

> 
> > XDP_TX")
> > Signed-off-by: Magnus Karlsson <magnus.karlsson@intel.com>
> > ---
> > v1 -> v2:
> > - Decrement the counter for each freed XDP_TX buffer (Maciej)
> > - v1: https://lore.kernel.org/intel-wired-lan/20261118135952.1063685-1-
> > magnus.karlsson@intel.com/
> > ---
> >  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	other threads:[~2026-11-24 14:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24 13:29 [PATCH iwl-net v2] ice: account for XDP_TX buffers when cleaning a Tx ring Magnus Karlsson
2026-11-24 14:19 ` Loktionov, Aleksandr
2026-11-24 14:30   ` Maciej Fijalkowski [this message]

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=awWfolL1o5YEn2TM@boxer \
    --to=maciej.fijalkowski@intel.com \
    --cc=aleksandr.loktionov@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.