DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ferruh Yigit <ferruh.yigit@intel.com>
To: Stephen Hemminger <stephen@networkplumber.org>, dev@dpdk.org
Cc: Andrew Rybchenko <arybchenko@solarflare.com>,
	Gaetan Rivet <gaetan.rivet@6wind.com>
Subject: Re: [dpdk-dev] [PATCH v5 2/2] net/failsafe: implement xstats
Date: Thu, 17 Oct 2019 15:54:55 +0100	[thread overview]
Message-ID: <f6dd6dbf-8a4a-9e21-ba4b-67f06cb15986@intel.com> (raw)
In-Reply-To: <20190919131729.28681-3-stephen@networkplumber.org>

On 9/19/2019 2:17 PM, Stephen Hemminger wrote:
> Add support for extended statistics in failsafe driver.
> Reports basic statistics for the failsafe driver, and detailed
> statistics for each sub device.

+1, but doesn't need to pull basic stats to the xstats in the PMD level, that
part is already done by xstats API [1],
so 'fs_xstats_get.*()' functions return only sub-device basic stats is good
enough which won't require the new 'rte_eth_basic_stats_.*()' APIs.

Current implementation cause basic stats part duplicated for failsafe device.

[1]
rte_eth_xstats_get_names
  cnt_used_entries = rte_eth_basic_stats_get_names(dev, xstats_names)
  cnt_driver_entries = (*dev->dev_ops->xstats_get_names)(...)
  cnt_used_entries += cnt_driver_entries
  return cnt_used_entries;


btw, while testing this I have observed an always reproducible seg fault by
failsafe on testpmd quit [2], but didn't checked more, @Gaetan can you please
check this when possible?


[2]
Shutting down port 1...
Closing ports...
Done
Segmentation fault (core dumped)

With command:
testpmd -w 0:0.0 --vdev net_null0 --vdev
"net_failsafe0,dev(86:00.1),dev(86:00.3)" -- -i


> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> Acked-by: Gaetan Rivet <gaetan.rivet@6wind.com>

<...>

> +static int
> +fs_xstats_get_names(struct rte_eth_dev *dev,
> +		    struct rte_eth_xstat_name *xstats_names,
> +		    unsigned int limit)
> +{
> +	struct sub_device *sdev;
> +	unsigned int count;
> +	char tmp[RTE_ETH_XSTATS_NAME_SIZE];
> +	uint8_t i;
> +	int r;
> +
> +	/* Caller only cares about count */
> +	if (!xstats_names)
> +		return fs_xstats_count(dev);
> +
> +	r = rte_eth_basic_stats_get_names(dev, xstats_names);
> +	if (r < 0)
> +		return r;
> +
> +	count = r;
> +
> +	fs_lock(dev, 0);
> +	FOREACH_SUBDEV(sdev, i, dev) {
> +		struct rte_eth_xstat_name *sub_names = xstats_names + count;
> +
> +		if (count >= limit)
> +			break;
> +
> +		r = rte_eth_xstats_get_names(PORT_ID(sdev), sub_names,
> +					     limit - count);
> +		if (r < 0) {
> +			fs_unlock(dev, 0);
> +			return r;
> +		}
> +
> +		/* add sub_ prefix to names */
> +		for (i = 0; i < r; i++) {

'i' is used in outer loop as well
thanks to 'C' to let us do these kind of things without any kind of warning.
Also it shows maintainer acked without testing :(

> +			snprintf(tmp, sizeof(tmp), "sub%u_%s",
> +				 i, sub_names[i].name);
> +			memcpy(sub_names[i].name, tmp,
> +			       RTE_ETH_XSTATS_NAME_SIZE);
> +		}
> +
> +		count += r;
> +	}
> +	fs_unlock(dev, 0);
> +
> +	return count;
> +}

<...>

  reply	other threads:[~2019-10-17 14:55 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-26 22:21 [dpdk-dev] [PATCH 0/2] failsafe: add xstats Stephen Hemminger
2019-06-26 22:21 ` [dpdk-dev] [PATCH 1/2] ethdev: expose basic xstats for driver use Stephen Hemminger
2019-06-26 22:21 ` [dpdk-dev] [PATCH 2/2] failsafe: implement xstats Stephen Hemminger
2019-06-26 23:33 ` [dpdk-dev] [PATCH v2 0/2] failsafe: add xstats Stephen Hemminger
2019-06-26 23:33   ` [dpdk-dev] [PATCH v2 1/2] ethdev: expose basic xstats for driver use Stephen Hemminger
2019-07-01 10:54     ` Andrew Rybchenko
2019-07-01 14:59       ` Stephen Hemminger
2019-06-26 23:33   ` [dpdk-dev] [PATCH v2 2/2] failsafe: implement xstats Stephen Hemminger
2019-07-01 12:33     ` Gaëtan Rivet
2019-07-03 17:25 ` [dpdk-dev] [PATCH v2 0/2] *failsafe: add xstats Stephen Hemminger
2019-07-03 17:25   ` [dpdk-dev] [PATCH v2 1/2] ethdev: expose basic xstats for driver use Stephen Hemminger
2019-07-03 17:25   ` [dpdk-dev] [PATCH v2 2/2] failsafe: implement xstats Stephen Hemminger
2019-07-04  9:56   ` [dpdk-dev] [PATCH v2 0/2] *failsafe: add xstats Gaëtan Rivet
2019-08-11 16:06 ` [dpdk-dev] [PATCH v3 0/2] failsafe: " Stephen Hemminger
2019-08-11 16:06   ` [dpdk-dev] [PATCH v3 1/2] ethdev: expose basic xstats for driver use Stephen Hemminger
2019-08-11 16:06   ` [dpdk-dev] [PATCH v3 2/2] net/failsafe: implement xstats Stephen Hemminger
2019-09-19 12:56   ` [dpdk-dev] [PATCH v4 0/2] failsafe: add xstats Stephen Hemminger
2019-09-19 12:56     ` [dpdk-dev] [PATCH 1/2] ethdev: expose basic xstats for driver use Stephen Hemminger
2019-09-19 12:56     ` [dpdk-dev] [PATCH 2/2] net/failsafe: implement xstats Stephen Hemminger
2019-09-19 13:17   ` [dpdk-dev] [PATCH v5 0/2] failsafe: add xstats Stephen Hemminger
2019-09-19 13:17     ` [dpdk-dev] [PATCH v5 1/2] ethdev: expose basic xstats for driver use Stephen Hemminger
2019-09-26 12:46       ` Andrew Rybchenko
2019-09-26 16:09         ` Stephen Hemminger
2019-10-31 16:40         ` Stephen Hemminger
2019-09-19 13:17     ` [dpdk-dev] [PATCH v5 2/2] net/failsafe: implement xstats Stephen Hemminger
2019-10-17 14:54       ` Ferruh Yigit [this message]
2019-10-14 17:04     ` [dpdk-dev] [PATCH v5 0/2] failsafe: add xstats Stephen Hemminger
2019-10-15  9:08       ` 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=f6dd6dbf-8a4a-9e21-ba4b-67f06cb15986@intel.com \
    --to=ferruh.yigit@intel.com \
    --cc=arybchenko@solarflare.com \
    --cc=dev@dpdk.org \
    --cc=gaetan.rivet@6wind.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).