From patchwork Thu Jun 28 14:16:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ferruh Yigit X-Patchwork-Id: 41846 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4D9AC1B42A; Thu, 28 Jun 2018 15:16:25 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id DE56F199B9 for ; Thu, 28 Jun 2018 15:16:23 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Jun 2018 06:16:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,283,1526367600"; d="scan'208";a="70716800" Received: from silpixa00399752.ir.intel.com (HELO silpixa00399752.ger.corp.intel.com) ([10.237.222.212]) by orsmga002.jf.intel.com with ESMTP; 28 Jun 2018 06:16:21 -0700 From: Ferruh Yigit To: Thomas Monjalon Cc: dev@dpdk.org, Ferruh Yigit , David Marchand , Olivier Matz , Remy Horton Date: Thu, 28 Jun 2018 15:16:02 +0100 Message-Id: <20180628141602.91695-1-ferruh.yigit@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <1528359323-22885-1-git-send-email-david.marchand@6wind.com> References: <1528359323-22885-1-git-send-email-david.marchand@6wind.com> Subject: [dpdk-dev] [PATCH] ethdev: document xstats API assumption X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 Reviewed-by: David Marchand Acked-by: Harry van Haaren Acked-by: Harry van Haaren Acked-by: Andrew Rybchenko --- Cc: David Marchand Cc: Olivier Matz Cc: Remy Horton --- 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).