From: Ferruh Yigit Date: Thu, 28 Jun 2018 14:16:02 +0000 (+0100) Subject: ethdev: document xstats API assumption X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=0109a56e73c8a21abd45ac99f0112fbf59c75fb3;p=dpdk.git ethdev: document xstats API assumption 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 --- diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h index aa991da62f..42803e3f1a 100644 --- a/lib/librte_ethdev/rte_ethdev.h +++ b/lib/librte_ethdev/rte_ethdev.h @@ -2014,6 +2014,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 @@ -2038,13 +2047,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).