netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
To: Tirthendu Sarkar <tirthendu.sarkar@intel.com>
Cc: <intel-wired-lan@lists.osuosl.org>, <jesse.brandeburg@intel.com>,
	<anthony.l.nguyen@intel.com>, <netdev@vger.kernel.org>,
	<bpf@vger.kernel.org>, <magnus.karlsson@intel.com>
Subject: Re: [PATCH intel-next v5 6/8] i40e: introduce next_to_process to i40e_ring
Date: Thu, 16 Feb 2023 15:42:09 +0100	[thread overview]
Message-ID: <Y+5AwZ5TE3OXQT+f@boxer> (raw)
In-Reply-To: <20230216140043.109345-7-tirthendu.sarkar@intel.com>

On Thu, Feb 16, 2023 at 07:30:41PM +0530, Tirthendu Sarkar wrote:
> Add a new field called next_to_process in the i40e_ring that is
> advanced for every buffer and change the semantics of next_to_clean to
> point to the first buffer of a packet. Driver will use next_to_process
> in the same way next_to_clean was used previously.
> 
> For the non multi-buffer case, next_to_process and next_to_clean will
> always be the same since each packet consists of a single buffer.
> 
> Signed-off-by: Tirthendu Sarkar <tirthendu.sarkar@intel.com>
> ---
>  drivers/net/ethernet/intel/i40e/i40e_txrx.c | 26 ++++++++++++---------
>  drivers/net/ethernet/intel/i40e/i40e_txrx.h |  4 ++++
>  2 files changed, 19 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
> index 01340f620d96..94c50fa223bd 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c
> +++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
> @@ -1524,6 +1524,7 @@ void i40e_clean_rx_ring(struct i40e_ring *rx_ring)
>  
>  	rx_ring->next_to_alloc = 0;
>  	rx_ring->next_to_clean = 0;
> +	rx_ring->next_to_process = 0;
>  	rx_ring->next_to_use = 0;
>  }
>  
> @@ -1576,6 +1577,7 @@ int i40e_setup_rx_descriptors(struct i40e_ring *rx_ring)
>  
>  	rx_ring->next_to_alloc = 0;
>  	rx_ring->next_to_clean = 0;
> +	rx_ring->next_to_process = 0;
>  	rx_ring->next_to_use = 0;
>  
>  	/* XDP RX-queue info only needed for RX rings exposed to XDP */
> @@ -2076,7 +2078,7 @@ static struct i40e_rx_buffer *i40e_get_rx_buffer(struct i40e_ring *rx_ring,
>  {
>  	struct i40e_rx_buffer *rx_buffer;
>  
> -	rx_buffer = i40e_rx_bi(rx_ring, rx_ring->next_to_clean);
> +	rx_buffer = i40e_rx_bi(rx_ring, rx_ring->next_to_process);
>  	rx_buffer->page_count =
>  #if (PAGE_SIZE < 8192)
>  		page_count(rx_buffer->page);
> @@ -2375,16 +2377,16 @@ void i40e_finalize_xdp_rx(struct i40e_ring *rx_ring, unsigned int xdp_res)
>  }
>  
>  /**
> - * i40e_inc_ntc: Advance the next_to_clean index
> + * i40e_inc_ntp: Advance the next_to_process index
>   * @rx_ring: Rx ring
>   **/
> -static void i40e_inc_ntc(struct i40e_ring *rx_ring)
> +static void i40e_inc_ntp(struct i40e_ring *rx_ring)
>  {
> -	u32 ntc = rx_ring->next_to_clean + 1;
> +	u32 ntp = rx_ring->next_to_process + 1;
>  
> -	ntc = (ntc < rx_ring->count) ? ntc : 0;
> -	rx_ring->next_to_clean = ntc;
> -	prefetch(I40E_RX_DESC(rx_ring, ntc));
> +	ntp = (ntp < rx_ring->count) ? ntp : 0;
> +	rx_ring->next_to_process = ntp;
> +	prefetch(I40E_RX_DESC(rx_ring, ntp));
>  }
>  
>  /**
> @@ -2421,6 +2423,7 @@ static int i40e_clean_rx_irq(struct i40e_ring *rx_ring, int budget,
>  	xdp_prog = READ_ONCE(rx_ring->xdp_prog);
>  
>  	while (likely(total_rx_packets < (unsigned int)budget)) {
> +		u16 ntp = rx_ring->next_to_process;

u32

>  		struct i40e_rx_buffer *rx_buffer;
>  		union i40e_rx_desc *rx_desc;
>  		unsigned int size;
> @@ -2433,7 +2436,7 @@ static int i40e_clean_rx_irq(struct i40e_ring *rx_ring, int budget,
>  			cleaned_count = 0;
>  		}
>  
> -		rx_desc = I40E_RX_DESC(rx_ring, rx_ring->next_to_clean);
> +		rx_desc = I40E_RX_DESC(rx_ring, ntp);
>  
>  		/* status_error_len will always be zero for unused descriptors
>  		 * because it's cleared in cleanup, and overlaps with hdr_addr
> @@ -2452,8 +2455,8 @@ static int i40e_clean_rx_irq(struct i40e_ring *rx_ring, int budget,
>  			i40e_clean_programming_status(rx_ring,
>  						      rx_desc->raw.qword[0],
>  						      qword);
> -			rx_buffer = i40e_rx_bi(rx_ring, rx_ring->next_to_clean);
> -			i40e_inc_ntc(rx_ring);
> +			rx_buffer = i40e_rx_bi(rx_ring, ntp);
> +			i40e_inc_ntp(rx_ring);
>  			i40e_reuse_rx_page(rx_ring, rx_buffer);
>  			cleaned_count++;
>  			continue;
> @@ -2509,7 +2512,8 @@ static int i40e_clean_rx_irq(struct i40e_ring *rx_ring, int budget,
>  		i40e_put_rx_buffer(rx_ring, rx_buffer);
>  		cleaned_count++;
>  
> -		i40e_inc_ntc(rx_ring);
> +		i40e_inc_ntp(rx_ring);
> +		rx_ring->next_to_clean = rx_ring->next_to_process;
>  		if (i40e_is_non_eop(rx_ring, rx_desc))
>  			continue;
>  
> diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.h b/drivers/net/ethernet/intel/i40e/i40e_txrx.h
> index 3e2935365104..6e0fd73367df 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_txrx.h
> +++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.h
> @@ -338,6 +338,10 @@ struct i40e_ring {
>  	u8 dcb_tc;			/* Traffic class of ring */
>  	u8 __iomem *tail;
>  
> +	/* Next descriptor to be processed; next_to_clean is updated only on
> +	 * processing EOP descriptor
> +	 */
> +	u16 next_to_process;
>  	/* high bit set means dynamic, use accessor routines to read/write.
>  	 * hardware only supports 2us resolution for the ITR registers.
>  	 * these values always store the USER setting, and must be converted
> -- 
> 2.34.1
> 

  reply	other threads:[~2023-02-16 14:42 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-16 14:00 [PATCH intel-next v5 0/8] i40e: support XDP multi-buffer Tirthendu Sarkar
2023-02-16 14:00 ` [PATCH intel-next v5 1/8] i40e: consolidate maximum frame size calculation for vsi Tirthendu Sarkar
2023-02-16 14:00 ` [PATCH intel-next v5 2/8] i40e: change Rx buffer size for legacy-rx to support XDP multi-buffer Tirthendu Sarkar
2023-02-16 14:00 ` [PATCH intel-next v5 3/8] i40e: add pre-xdp page_count in rx_buffer Tirthendu Sarkar
2023-02-16 14:00 ` [PATCH intel-next v5 4/8] i40e: Change size to truesize when using i40e_rx_buffer_flip() Tirthendu Sarkar
2023-02-16 14:00 ` [PATCH intel-next v5 5/8] i40e: use frame_sz instead of recalculating truesize for building skb Tirthendu Sarkar
2023-02-16 14:00 ` [PATCH intel-next v5 6/8] i40e: introduce next_to_process to i40e_ring Tirthendu Sarkar
2023-02-16 14:42   ` Maciej Fijalkowski [this message]
2023-02-16 14:00 ` [PATCH intel-next v5 7/8] i40e: add xdp_buff to i40e_ring struct Tirthendu Sarkar
2023-02-16 14:00 ` [PATCH intel-next v5 8/8] i40e: add support for XDP multi-buffer Rx Tirthendu Sarkar
2023-02-16 14:43 ` [PATCH intel-next v5 0/8] i40e: support XDP multi-buffer Maciej Fijalkowski
2023-02-17 17:02 ` Tony Nguyen

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=Y+5AwZ5TE3OXQT+f@boxer \
    --to=maciej.fijalkowski@intel.com \
    --cc=anthony.l.nguyen@intel.com \
    --cc=bpf@vger.kernel.org \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=jesse.brandeburg@intel.com \
    --cc=magnus.karlsson@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=tirthendu.sarkar@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 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).