From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 792CE41CE2; Sun, 19 Feb 2023 18:35:49 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2370042D29; Sun, 19 Feb 2023 18:35:49 +0100 (CET) Received: from mail-pj1-f53.google.com (mail-pj1-f53.google.com [209.85.216.53]) by mails.dpdk.org (Postfix) with ESMTP id 1879A40698 for ; Sun, 19 Feb 2023 18:35:47 +0100 (CET) Received: by mail-pj1-f53.google.com with SMTP id ot9so1027374pjb.3 for ; Sun, 19 Feb 2023 09:35:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=7sp509y5yKBDUhxiVrcPOqfpplD9oCHtY+UUl5mclCY=; b=IeprxGu3ZSyl3FW35zhrRCK1HslO4udYL2nKwKu/jqGtNOFUV7dYwA2/IdwFdFF275 7vG4rnDvOnpUZ/vW9QA3e0UzOvRYYWP/tYyA7FI4EQIqHMxGeAgk/osI2hm/nzgqDTmq l/e92dAC3flRMPuGOaRQ4xYcM4M/sY0NL4/VW0HH1Dw/fCgKWEavDVIEV746dbi2Qo88 w4RrlgoNGD265500xfTTkft7JkR5VTqYnQEB74wUdF04Muy0pTEmquZUI3WFDu3XjkvB BYWkxEK5ClRV03DR/xiS9YYjFgYtmWJNCaOF3QQNWAvaFQ7qtMJCTapJzqlWybCde0tP xXaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7sp509y5yKBDUhxiVrcPOqfpplD9oCHtY+UUl5mclCY=; b=imCUJaJVri3ilkUuvSFKjKDoDqth+0uzIWUaxE1JjIZzQKa8WumT1b/9dyTVHEj+II 59NkGTAZ1RRvC63gW8u+XLd2eKDcFpi1QvFQyRrFaQjuISH2kTSviWs0C42uWbDC+lHA YLlmWMqNIM7FnWrxdJD5AbnMOJ9oHM3aGZjzmUMAQHsMx1DUn0DoOTSGTkfGFLO5kUyB CwGnezCa6RPua/jdOh+nn25tRGvlRiG6OhexpoaWgjYbt8h93eSncYTiIyZu6RtiWocp NCmu2QooVc16VdOZu/7j6ezf9OvaL6GQtwUMwCXd0E1S7zsdQrbttC53xnARC0tdqPtt 4Jzw== X-Gm-Message-State: AO0yUKXbkSiqnQXHOE1odxA3EclamEd3jIuE6sHq9csFkvbOgMv5z0Ui IslRIZooAmI9iVlfJMFs8qw8KQ== X-Google-Smtp-Source: AK7set8MXwqlPFIv1AiLoiscgxGHWgxQVTMlTOU0lXGri9BuK2rLE9wOdVOSeXDV1W6utNNzeWwo/Q== X-Received: by 2002:a17:90b:3eca:b0:234:721e:51e5 with SMTP id rm10-20020a17090b3eca00b00234721e51e5mr4311403pjb.10.1676828145743; Sun, 19 Feb 2023 09:35:45 -0800 (PST) Received: from hermes.local (204-195-120-218.wavecable.com. [204.195.120.218]) by smtp.gmail.com with ESMTPSA id mz14-20020a17090b378e00b0022be36be19asm1017252pjb.53.2023.02.19.09.35.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Feb 2023 09:35:45 -0800 (PST) Date: Sun, 19 Feb 2023 09:35:43 -0800 From: Stephen Hemminger To: Levend Sayar Cc: junfeng.guo@intel.com, dev@dpdk.org Subject: Re: [PATCH] net/gve: fix Rx no mbufs stats counter update Message-ID: <20230219093543.45ed457e@hermes.local> In-Reply-To: <20230219003059.85479-1-levendsayar@gmail.com> References: <20230219003059.85479-1-levendsayar@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Sun, 19 Feb 2023 03:30:59 +0300 Levend Sayar 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 > --- > 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. > @@ -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;