DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ferruh Yigit <ferruh.yigit@intel.com>
To: Thomas Monjalon <thomas@monjalon.net>
Cc: dev@dpdk.org, Ferruh Yigit <ferruh.yigit@intel.com>,
	David Marchand <david.marchand@6wind.com>,
	Olivier Matz <olivier.matz@6wind.com>,
	Remy Horton <remy.horton@intel.com>
Subject: [dpdk-dev] [PATCH] ethdev: document xstats API assumption
Date: Thu, 28 Jun 2018 15:16:02 +0100	[thread overview]
Message-ID: <20180628141602.91695-1-ferruh.yigit@intel.com> (raw)
In-Reply-To: <1528359323-22885-1-git-send-email-david.marchand@6wind.com>

Documents the assumption that 'xstats[i].id == i' and
key=xstats_names[i].name, value=xstats[i].value

xstats[i].id is still used for xstats _by_id() APIs.

This patch reverts some part of the commit 6d52d1d4afb4 ("ethdev:
clarify extended statistics documentation")

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
Cc: David Marchand <david.marchand@6wind.com>
Cc: Olivier Matz <olivier.matz@6wind.com>
Cc: Remy Horton <remy.horton@intel.com>
---
 lib/librte_ethdev/rte_ethdev.h | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h
index 5760f45d3..261dabafb 100644
--- a/lib/librte_ethdev/rte_ethdev.h
+++ b/lib/librte_ethdev/rte_ethdev.h
@@ -2008,6 +2008,15 @@ int rte_eth_stats_reset(uint16_t port_id);
 /**
  * Retrieve names of extended statistics of an Ethernet device.
  *
+ * There is an assumption that 'xstat_names' and 'xstats' arrays are matched
+ * by array index:
+ *  xstats_names[i].name => xstats[i].value
+ *
+ * And the array index is same with id field of 'struct rte_eth_xstat':
+ *  xstats[i].id == i
+ *
+ * This assumption makes key-value pair matching less flexible but simpler.
+ *
  * @param port_id
  *   The port identifier of the Ethernet device.
  * @param xstats_names
@@ -2032,13 +2041,20 @@ int rte_eth_xstats_get_names(uint16_t port_id,
 /**
  * Retrieve extended statistics of an Ethernet device.
  *
+ * There is an assumption that 'xstat_names' and 'xstats' arrays are matched
+ * by array index:
+ *  xstats_names[i].name => xstats[i].value
+ *
+ * And the array index is same with id field of 'struct rte_eth_xstat':
+ *  xstats[i].id == i
+ *
+ * This assumption makes key-value pair matching less flexible but simpler.
+ *
  * @param port_id
  *   The port identifier of the Ethernet device.
  * @param xstats
  *   A pointer to a table of structure of type *rte_eth_xstat*
- *   to be filled with device statistics ids and values: id is the
- *   index of the name string in xstats_names (see rte_eth_xstats_get_names()),
- *   and value is the statistic counter.
+ *   to be filled with device statistics ids and values.
  *   This parameter can be set to NULL if n is 0.
  * @param n
  *   The size of the xstats array (number of elements).
-- 
2.17.1

  parent reply	other threads:[~2018-06-28 13:16 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-07  8:15 [dpdk-dev] [PATCH] app/testpmd: add sanity checks when retrieving xstats David Marchand
2018-06-12  7:09 ` David Marchand
2018-06-12  8:38 ` Remy Horton
2018-06-13 15:39 ` [dpdk-dev] [dpdk-stable] " Ferruh Yigit
2018-06-14  6:39   ` Remy Horton
2018-06-14 10:55     ` Ferruh Yigit
2018-06-14 19:33       ` Remy Horton
2018-06-28 14:16 ` Ferruh Yigit [this message]
2018-06-29  7:15   ` [dpdk-dev] [PATCH] ethdev: document xstats API assumption David Marchand
2018-07-04 17:38     ` Ferruh Yigit
2018-07-03 16:11   ` Van Haaren, Harry
2018-07-07 17:45   ` Andrew Rybchenko

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=20180628141602.91695-1-ferruh.yigit@intel.com \
    --to=ferruh.yigit@intel.com \
    --cc=david.marchand@6wind.com \
    --cc=dev@dpdk.org \
    --cc=olivier.matz@6wind.com \
    --cc=remy.horton@intel.com \
    --cc=thomas@monjalon.net \
    /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).