DPDK patches and discussions
 help / color / mirror / Atom feed
From: Levend Sayar <levendsayar@gmail.com>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: junfeng.guo@intel.com, dev@dpdk.org
Subject: Re: [PATCH] net/gve: fix Rx no mbufs stats counter update
Date: Sun, 19 Feb 2023 23:43:08 +0300	[thread overview]
Message-ID: <9B306604-8CC8-4CC6-B58F-9A5B28C3D3CB@gmail.com> (raw)
In-Reply-To: <20230219093543.45ed457e@hermes.local>

[-- Attachment #1: Type: text/plain, Size: 2078 bytes --]



> On 19 Feb 2023, at 20:35, Stephen Hemminger <stephen@networkplumber.org> wrote:
> 
> On Sun, 19 Feb 2023 03:30:59 +0300
> Levend Sayar <levendsayar@gmail.com <mailto:levendsayar@gmail.com>> wrote:
> 
>> rx no_mbufs stats counter update is added for another error case.
>> 
>> Fixes: 4f6b1dd8240c ("net/gve: support basic statistics")
>> Cc: junfeng.guo@intel.com
>> 
>> Signed-off-by: Levend Sayar <levendsayar@gmail.com>
>> ---
>> drivers/net/gve/gve_rx.c | 7 ++++++-
>> 1 file changed, 6 insertions(+), 1 deletion(-)
>> 
>> diff --git a/drivers/net/gve/gve_rx.c b/drivers/net/gve/gve_rx.c
>> index 66fbcf3930..b0427731f8 100644
>> --- a/drivers/net/gve/gve_rx.c
>> +++ b/drivers/net/gve/gve_rx.c
>> @@ -24,6 +24,7 @@ gve_rx_refill(struct gve_rx_queue *rxq)
>> 				nmb = rte_pktmbuf_alloc(rxq->mpool);
>> 				if (!nmb)
>> 					break;
>> +
>> 				rxq->sw_ring[idx + i] = nmb;
>> 			}
>> 			if (i != nb_alloc) {
> 
> Looks like accidental whitespace change included in this patch.

LS: Right. Let me correct.

>> @@ -59,9 +60,13 @@ gve_rx_refill(struct gve_rx_queue *rxq)
>> 				nmb = rte_pktmbuf_alloc(rxq->mpool);
>> 				if (!nmb)
>> 					break;
>> +
>> 				rxq->sw_ring[idx + i] = nmb;
>> 			}
>> -			nb_alloc = i;
>> +			if (i != nb_alloc) {
>> +				rxq->no_mbufs += nb_alloc - i;
>> +				nb_alloc = i;
>> +			}
> 
> Would be better to add unlikely() here like:
> 			if (unlikely(i < nb_alloc)) {
> 				rxq->no_mbufs += nb_alloc - i;
> 				nb_alloc = i;
> 			}
> 
> Or eliminate conditional branch in hot path completely.
> 			rxq->no_mbufs += nb_alloc - i;
> 			nb_alloc = i;
> 
> Or better yet refactor code here to use rte_pktmbuf_alloc_bulk() which
> does single ring operation.
> 
>> 		}
>> 		rxq->nb_avail -= nb_alloc;
>> 		next_avail += nb_alloc;

LS: “unlikely” can be added. You’re right. Code already tries to make a bulk allocation first.
If that bulk allocation does not work, it tries to allocate one my one. 

I will supersede this one and create v2.
Thanks Stephen.

Best,
Levend

[-- Attachment #2: Type: text/html, Size: 26472 bytes --]

  reply	other threads:[~2023-02-19 20:43 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-19  0:30 Levend Sayar
2023-02-19 17:35 ` Stephen Hemminger
2023-02-19 20:43   ` Levend Sayar [this message]
2023-02-19 22:59     ` Stephen Hemminger
2023-02-20 15:19 ` [PATCH v2] " Levend Sayar
2023-02-20 21:11   ` [PATCH v3 1/2] " Levend Sayar
2023-02-20 21:11     ` [PATCH v3 2/2] net/gve: add Rx/Tx queue stats as extended stats Levend Sayar
2023-02-20 22:57       ` Ferruh Yigit
2023-02-21 11:11         ` Levend Sayar
2023-02-21 14:13       ` [PATCH v4] " Levend Sayar
2023-02-21 14:18         ` [PATCH v5] " Levend Sayar
2023-02-21 15:58           ` Ferruh Yigit
2023-02-21 16:44             ` Levend Sayar
2023-02-23  2:49               ` Guo, Junfeng
2023-02-23  6:28                 ` Levend Sayar
2023-02-23 11:09                 ` Ferruh Yigit
2023-02-23 12:30                   ` Levend Sayar
2023-02-20 22:57     ` [PATCH v3 1/2] net/gve: fix Rx no mbufs stats counter update Ferruh Yigit
2023-02-21 10:07       ` Levend Sayar
2023-02-21 10:30         ` Ferruh Yigit
2023-02-23  4:34           ` Guo, Junfeng
2023-02-23  6:29             ` Levend Sayar
2023-02-23 11:10             ` Ferruh Yigit
2023-02-23 12:29               ` Levend Sayar
2023-02-21 15:58     ` Ferruh Yigit
2023-02-21 16:42       ` Levend Sayar

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=9B306604-8CC8-4CC6-B58F-9A5B28C3D3CB@gmail.com \
    --to=levendsayar@gmail.com \
    --cc=dev@dpdk.org \
    --cc=junfeng.guo@intel.com \
    --cc=stephen@networkplumber.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).