DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Ferruh Yigit <ferruh.yigit@amd.com>
Cc: Junfeng Guo <junfeng.guo@intel.com>,
	qi.z.zhang@intel.com, jingjing.wu@intel.com,
	beilei.xing@intel.com, dev@dpdk.org, jeroendb@google.com,
	rushilg@google.com, jrkim@google.com,
	Xiaoyun Li <xiaoyun.li@intel.com>
Subject: Re: [PATCH] net/gve: add support for basic stats
Date: Wed, 7 Dec 2022 08:39:48 -0800	[thread overview]
Message-ID: <20221207083948.22af7cae@hermes.local> (raw)
In-Reply-To: <fa58bec0-c7e7-3c9f-fb03-7c4b773bc4be@amd.com>

On Wed, 7 Dec 2022 15:09:08 +0000
Ferruh Yigit <ferruh.yigit@amd.com> wrote:

> On 11/24/2022 7:33 AM, Junfeng Guo wrote:
> > Add support for dev_ops of stats_get and stats_reset.
> > 
> > Queue stats update will be moved into xstat [1], but the basic stats
> > items may still be required. So we just keep the remaining ones and
> > will implement the queue stats via xstats in the coming release.
> > 
> > [1]
> > https://elixir.bootlin.com/dpdk/v22.07/ \
> > 	source/doc/guides/rel_notes/deprecation.rst#L118
> > 
> > Signed-off-by: Xiaoyun Li <xiaoyun.li@intel.com>
> > Signed-off-by: Junfeng Guo <junfeng.guo@intel.com>  
> 
> <...>
> 
> > +static int
> > +gve_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
> > +{
> > +	uint16_t i;
> > +
> > +	for (i = 0; i < dev->data->nb_tx_queues; i++) {
> > +		struct gve_tx_queue *txq = dev->data->tx_queues[i];
> > +		if (txq == NULL)
> > +			continue;
> > +
> > +		stats->opackets += txq->packets;
> > +		stats->obytes += txq->bytes;
> > +		stats->oerrors += txq->errors;  
> 
> Hi Junfeng, Qi, Jingjing, Beilei,
> 
> Above logic looks wrong to me, did you test it?
> 
> If the 'gve_dev_stats_get()' called multiple times (without stats reset
> in between), same values will be keep added to stats.
> Some hw based implementations does this, because reading from stats
> registers automatically reset those registers but this shouldn't be case
> for this driver.
> 
> I expect it to be something like:
> 
> local_stats = 0
> foreach queue
> 	local_stats += queue->stats
> stats = local_stats

The zero of local_stats is unnecessary.
The only caller of the PMD stats_get is rte_ethdev_stats_get
and it zeros the stats structure before calling the PMD.


int
rte_eth_stats_get(uint16_t port_id, struct rte_eth_stats *stats)
{
	struct rte_eth_dev *dev;

	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
	dev = &rte_eth_devices[port_id];

	memset(stats, 0, sizeof(*stats));
...
	stats->rx_nombuf = dev->data->rx_mbuf_alloc_failed;
	return eth_err(port_id, (*dev->dev_ops->stats_get)(dev, stats));

If any PMD has extra memset in their stats get that could be removed.

  reply	other threads:[~2022-12-07 16:39 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-24  7:33 Junfeng Guo
2022-11-24 16:59 ` Stephen Hemminger
2022-11-24 17:26   ` Ferruh Yigit
2022-11-26  3:16     ` Rushil Gupta
2022-11-26 17:34       ` Stephen Hemminger
2022-11-28 11:12         ` Ferruh Yigit
2022-11-28 17:24           ` Stephen Hemminger
2022-11-29  1:42             ` Guo, Junfeng
2022-12-07 15:09 ` Ferruh Yigit
2022-12-07 16:39   ` Stephen Hemminger [this message]
2022-12-19 19:17     ` Rushil Gupta
2022-12-19 19:38       ` Joshua Washington
2023-01-18 16:22         ` Ferruh Yigit
2023-01-31  1:51           ` Joshua Washington
2023-01-31 10:05             ` Ferruh Yigit
2023-02-02 23:00               ` Joshua Washington
2023-02-03 17:39 ` Ferruh Yigit

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=20221207083948.22af7cae@hermes.local \
    --to=stephen@networkplumber.org \
    --cc=beilei.xing@intel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@amd.com \
    --cc=jeroendb@google.com \
    --cc=jingjing.wu@intel.com \
    --cc=jrkim@google.com \
    --cc=junfeng.guo@intel.com \
    --cc=qi.z.zhang@intel.com \
    --cc=rushilg@google.com \
    --cc=xiaoyun.li@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).