DPDK patches and discussions
 help / color / mirror / Atom feed
From: Tomasz Duszynski <tdu@semihalf.com>
To: Ferruh Yigit <ferruh.yigit@intel.com>
Cc: Tomasz Duszynski <tdu@semihalf.com>,
	dev@dpdk.org, mw@semihalf.com, dima@marvell.com,
	nsamsono@marvell.com, jck@semihalf.com, jianbo.liu@arm.com
Subject: Re: [dpdk-dev] [PATCH v2 6/8] net/mrvl: add extended statistics
Date: Thu, 15 Mar 2018 08:09:14 +0100	[thread overview]
Message-ID: <20180315070914.GA15180@sh> (raw)
In-Reply-To: <8210985b-4898-88f1-2f90-0a69862078c1@intel.com>

On Wed, Mar 14, 2018 at 05:21:07PM +0000, Ferruh Yigit wrote:
> On 3/12/2018 8:42 AM, Tomasz Duszynski wrote:
> > Add extended statistics implementation.
> >
> > Signed-off-by: Natalie Samsonov <nsamsono@marvell.com>
> > Signed-off-by: Tomasz Duszynski <tdu@semihalf.com>
>
> <...>
>
> > @@ -1674,6 +1784,94 @@ mrvl_eth_filter_ctrl(struct rte_eth_dev *dev __rte_unused,
> >  	}
> >  }
> >
> > +/**
> > + * DPDK callback to get xstats by id.
> > + *
> > + * @param dev
> > + *   Pointer to the device structure.
> > + * @param ids
> > + *   Pointer to the ids table.
> > + * @param values
> > + *   Pointer to the values table.
> > + * @param n
> > + *   Values table size.
> > + * @returns
> > + *   Number of read values, negative value otherwise.
> > + */
> > +static int
> > +mrvl_xstats_get_by_id(struct rte_eth_dev *dev, const uint64_t *ids,
> > +		      uint64_t *values, unsigned int n)
> > +{
> > +	unsigned int i, num = RTE_DIM(mrvl_xstats_tbl);
> > +	uint64_t vals[n];
> > +	int ret;
> > +
> > +	if (!ids) {
>
> You will not get NULL ids, this case covered by ethdev layer, for both by_id()
> functions.
>
> > +		struct rte_eth_xstat xstats[num];
> > +		int j;
> > +
> > +		ret = mrvl_xstats_get(dev, xstats, num);
> > +		for (j = 0; j < ret; i++)
> > +			values[j] = xstats[j].value;
> > +
> > +		return ret;
> > +	}
> > +
> > +	ret = mrvl_xstats_get_by_id(dev, NULL, vals, n);
> > +	if (ret < 0)
> > +		return ret;
> > +
> > +	for (i = 0; i < n; i++) {
> > +		if (ids[i] >= num) {
> > +			RTE_LOG(ERR, PMD, "id value is not valid\n");
> > +			return -1;
> > +		}
> > +
> > +		values[i] = vals[ids[i]];
> > +	}
> > +
> > +	return n;
> > +}
> > +
> > +/**
> > + * DPDK callback to get xstats names by ids.
> > + *
> > + * @param dev
> > + *   Pointer to the device structure.
> > + * @param xstats_names
> > + *   Pointer to table with xstats names.
> > + * @param ids
> > + *   Pointer to table with ids.
> > + * @param size
> > + *   Xstats names table size.
> > + * @returns
> > + *   Number of names read, negative value otherwise.
> > + */
> > +static int
> > +mrvl_xstats_get_names_by_id(struct rte_eth_dev *dev,
> > +			    struct rte_eth_xstat_name *xstats_names,
> > +			    const uint64_t *ids, unsigned int size)
> > +{
> > +	unsigned int i, num = RTE_DIM(mrvl_xstats_tbl);
> > +	struct rte_eth_xstat_name names[num];
> > +
> > +	if (!ids)
> > +		return mrvl_xstats_get_names(dev, xstats_names, size);
> > +
> > +	mrvl_xstats_get_names(dev, names, size);
> > +	for (i = 0; i < size; i++) {
> > +		if (ids[i] >= num) {
> > +			RTE_LOG(ERR, PMD, "id value is not valid");
> > +			return -1;
> > +		}
> > +
> > +		snprintf(xstats_names[i].name, RTE_ETH_XSTATS_NAME_SIZE,
> > +			 "%s", names[ids[i]].name);
> > +	}
> > +
> > +	return size;
> > +}
>
> Specific to *_by_id() implementations, please check ethdev layer APIs for these
> devops, they already do same thing as you did here.
>
> These devops are to access specific ids efficiently with support of PMD, if you
> don't have a quick way to access to an extended stat by id, you may just left
> these unimplemented and abstraction layer will do the work for you, it is up to you.

Good point. Since *_by_id() are using xstats_get_names()/xstats_get()
anyway they do not provide a real speedup. I'll drop that in v3.

>
>
> Thanks,
> ferruh

--
- Tomasz Duszyński

  reply	other threads:[~2018-03-15  7:09 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-21 14:14 [dpdk-dev] [PATCH 0/8] net/mrvl: add new features to PMD Tomasz Duszynski
2018-02-21 14:14 ` [dpdk-dev] [PATCH 1/8] net/mrvl: fix crash when port is closed without starting Tomasz Duszynski
2018-02-21 14:14 ` [dpdk-dev] [PATCH 2/8] net/mrvl: add ingress policer support Tomasz Duszynski
2018-02-21 14:14 ` [dpdk-dev] [PATCH 3/8] net/mrvl: add egress scheduler/rate limiter support Tomasz Duszynski
2018-02-21 14:14 ` [dpdk-dev] [PATCH 4/8] net/mrvl: document policer/scheduler/rate limiter usage Tomasz Duszynski
2018-02-21 14:14 ` [dpdk-dev] [PATCH 5/8] net/mrvl: add classifier support Tomasz Duszynski
2018-03-07 11:07   ` Ferruh Yigit
2018-03-07 11:16     ` Tomasz Duszynski
2018-03-07 11:24       ` Ferruh Yigit
2018-03-08 13:23         ` Tomasz Duszynski
2018-02-21 14:14 ` [dpdk-dev] [PATCH 6/8] net/mrvl: add extended statistics Tomasz Duszynski
2018-02-21 14:14 ` [dpdk-dev] [PATCH 7/8] net/mrvl: add Rx flow control Tomasz Duszynski
2018-02-21 14:14 ` [dpdk-dev] [PATCH 8/8] net/mrvl: add Tx queue start/stop Tomasz Duszynski
2018-03-12  8:42 ` [dpdk-dev] [PATCH v2 0/8] net/mrvl: add new features to PMD Tomasz Duszynski
2018-03-12  8:42   ` [dpdk-dev] [PATCH v2 1/8] net/mrvl: fix crash when port is closed without starting Tomasz Duszynski
2018-03-12  8:42   ` [dpdk-dev] [PATCH v2 2/8] net/mrvl: add ingress policer support Tomasz Duszynski
2018-03-12  8:42   ` [dpdk-dev] [PATCH v2 3/8] net/mrvl: add egress scheduler/rate limiter support Tomasz Duszynski
2018-03-12  8:42   ` [dpdk-dev] [PATCH v2 4/8] net/mrvl: document policer/scheduler/rate limiter usage Tomasz Duszynski
2018-03-12  8:42   ` [dpdk-dev] [PATCH v2 5/8] net/mrvl: add classifier support Tomasz Duszynski
2018-03-12  8:42   ` [dpdk-dev] [PATCH v2 6/8] net/mrvl: add extended statistics Tomasz Duszynski
2018-03-14 17:21     ` Ferruh Yigit
2018-03-15  7:09       ` Tomasz Duszynski [this message]
2018-03-12  8:42   ` [dpdk-dev] [PATCH v2 7/8] net/mrvl: add Rx flow control Tomasz Duszynski
2018-03-12  8:42   ` [dpdk-dev] [PATCH v2 8/8] net/mrvl: add Tx queue start/stop Tomasz Duszynski
2018-03-15  7:51   ` [dpdk-dev] [PATCH v3 0/8] net/mrvl: add new features to PMD Tomasz Duszynski
2018-03-15  7:51     ` [dpdk-dev] [PATCH v3 1/8] net/mrvl: fix crash when port is closed without starting Tomasz Duszynski
2018-03-15  7:51     ` [dpdk-dev] [PATCH v3 2/8] net/mrvl: add ingress policer support Tomasz Duszynski
2018-03-15  7:51     ` [dpdk-dev] [PATCH v3 3/8] net/mrvl: add egress scheduler/rate limiter support Tomasz Duszynski
2018-03-15  7:52     ` [dpdk-dev] [PATCH v3 4/8] net/mrvl: document policer/scheduler/rate limiter usage Tomasz Duszynski
2018-03-15  7:52     ` [dpdk-dev] [PATCH v3 5/8] net/mrvl: add classifier support Tomasz Duszynski
2018-03-15  7:52     ` [dpdk-dev] [PATCH v3 6/8] net/mrvl: add extended statistics Tomasz Duszynski
2018-03-15  7:52     ` [dpdk-dev] [PATCH v3 7/8] net/mrvl: add Rx flow control Tomasz Duszynski
2018-03-15  7:52     ` [dpdk-dev] [PATCH v3 8/8] net/mrvl: add Tx queue start/stop Tomasz Duszynski
2018-03-15 15:09     ` [dpdk-dev] [PATCH v3 0/8] net/mrvl: add new features to PMD 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=20180315070914.GA15180@sh \
    --to=tdu@semihalf.com \
    --cc=dev@dpdk.org \
    --cc=dima@marvell.com \
    --cc=ferruh.yigit@intel.com \
    --cc=jck@semihalf.com \
    --cc=jianbo.liu@arm.com \
    --cc=mw@semihalf.com \
    --cc=nsamsono@marvell.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).