bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
To: Alexander Lobakin <alexandr.lobakin@intel.com>
Cc: bpf@vger.kernel.org, ast@kernel.org, daniel@iogearbox.net,
	netdev@vger.kernel.org, magnus.karlsson@intel.com
Subject: Re: [PATCH bpf-next v3 6/7] ice: xsk: improve AF_XDP ZC Tx and use batching API
Date: Fri, 21 Jan 2022 15:41:24 +0100	[thread overview]
Message-ID: <YerGFNmhH0DTH5G9@boxer> (raw)
In-Reply-To: <20220121131742.24424-1-alexandr.lobakin@intel.com>

On Fri, Jan 21, 2022 at 02:17:42PM +0100, Alexander Lobakin wrote:
> From: Alexander Lobakin <alexandr.lobakin@intel.com>
> Date: Fri, 21 Jan 2022 13:54:47 +0100
> 
> > From: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
> > Date: Fri, 21 Jan 2022 13:00:10 +0100
> > 
> > > Apply the logic that was done for regular XDP from commit 9610bd988df9
> > > ("ice: optimize XDP_TX workloads") to the ZC side of the driver. On top
> > > of that, introduce batching to Tx that is inspired by i40e's
> > > implementation with adjustments to the cleaning logic - take into the
> > > account NAPI budget in ice_clean_xdp_irq_zc().
> > > 
> > > Separating the stats structs onto separate cache lines seemed to improve
> > > the performance.
> > > 
> > > Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
> > > ---
> > >  drivers/net/ethernet/intel/ice/ice_txrx.c |   2 +-
> > >  drivers/net/ethernet/intel/ice/ice_txrx.h |   2 +-
> > >  drivers/net/ethernet/intel/ice/ice_xsk.c  | 256 ++++++++++++++--------
> > >  drivers/net/ethernet/intel/ice/ice_xsk.h  |  27 ++-
> > >  4 files changed, 186 insertions(+), 101 deletions(-)
> > > 
> > > +/**
> > > + * ice_fill_tx_hw_ring - produce the number of Tx descriptors onto ring
> > > + * @xdp_ring: XDP ring to produce the HW Tx descriptors on
> > > + * @descs: AF_XDP descriptors to pull the DMA addresses and lengths from
> > > + * @nb_pkts: count of packets to be send
> > > + * @total_bytes: bytes accumulator that will be used for stats update
> > > + */
> > > +static void ice_fill_tx_hw_ring(struct ice_tx_ring *xdp_ring, struct xdp_desc *descs,
> > > +				u32 nb_pkts, unsigned int *total_bytes)
> > > +{
> > > +	u16 tx_thresh = xdp_ring->tx_thresh;
> > > +	struct ice_tx_desc *tx_desc;
> > 
> > And @tx_desc as well.
> > 
> > > +	u32 batched, leftover, i;
> > > +
> > > +	batched = nb_pkts & ~(PKTS_PER_BATCH - 1);
> > > +	leftover = nb_pkts & (PKTS_PER_BATCH - 1);
> > > +	for (i = 0; i < batched; i += PKTS_PER_BATCH)
> > > +		ice_xmit_pkt_batch(xdp_ring, &descs[i], total_bytes);
> > > +	for (i = batched; i < batched + leftover; i++)
> 
> Breh, I overlooked that. @i will equal @batched after exiting the
> first loop, so the assignment here is redundant (probably harmless
> tho if the compilers are smart enough).

I can drop this and scope variables properly, thanks!

> 
> > > +		ice_xmit_pkt(xdp_ring, &descs[i], total_bytes);
> > > +
> > > +	if (xdp_ring->next_to_use > xdp_ring->next_rs) {
> > > +		tx_desc = ICE_TX_DESC(xdp_ring, xdp_ring->next_rs);
> > > +		tx_desc->cmd_type_offset_bsz |=
> > > +			cpu_to_le64(ICE_TX_DESC_CMD_RS << ICE_TXD_QW1_CMD_S);
> > > +		xdp_ring->next_rs += tx_thresh;
> > > +	}
> > > +}
> > >  
> > > -		prefetch(tx_desc);
> > > +/**

  reply	other threads:[~2022-01-21 14:41 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-21 12:00 [PATCH v3 bpf-next 0/7] xsk: Intel driver improvements Maciej Fijalkowski
2022-01-21 12:00 ` [PATCH bpf-next v3 1/7] ice: remove likely for napi_complete_done Maciej Fijalkowski
2022-01-21 12:00 ` [PATCH bpf-next v3 2/7] ice: xsk: handle SW XDP ring wrap and bump tail more often Maciej Fijalkowski
2022-01-21 12:29   ` Alexander Lobakin
2022-01-21 14:31     ` Maciej Fijalkowski
2022-01-24 16:44       ` Maciej Fijalkowski
2022-01-21 12:00 ` [PATCH bpf-next v3 3/7] ice: make Tx threshold dependent on ring length Maciej Fijalkowski
2022-01-21 12:40   ` Rx: " Alexander Lobakin
2022-01-21 14:34     ` Maciej Fijalkowski
2022-01-21 12:00 ` [PATCH bpf-next v3 4/7] i40e: xsk: move tmp desc array from driver to pool Maciej Fijalkowski
2022-01-21 12:00 ` [PATCH bpf-next v3 5/7] ice: xsk: avoid potential dead AF_XDP Tx processing Maciej Fijalkowski
2022-01-21 12:00 ` [PATCH bpf-next v3 6/7] ice: xsk: improve AF_XDP ZC Tx and use batching API Maciej Fijalkowski
2022-01-21 12:54   ` Alexander Lobakin
2022-01-21 13:17     ` Alexander Lobakin
2022-01-21 14:41       ` Maciej Fijalkowski [this message]
2022-01-21 12:00 ` [PATCH bpf-next v3 7/7] ice: xsk: borrow xdp_tx_active logic from i40e 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=YerGFNmhH0DTH5G9@boxer \
    --to=maciej.fijalkowski@intel.com \
    --cc=alexandr.lobakin@intel.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=magnus.karlsson@intel.com \
    --cc=netdev@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).