[dpdk-dev] [PATCH v5 1/3] ethdev: new xstats API add retrieving by ID
Van Haaren, Harry
harry.van.haaren at intel.com
Wed Apr 12 10:56:00 CEST 2017
> From: Jastrzebski, MichalX K
> Sent: Tuesday, April 11, 2017 5:37 PM
> To: dev at dpdk.org
> Cc: Jain, Deepak K <deepak.k.jain at intel.com>; Van Haaren, Harry <harry.van.haaren at intel.com>;
> Piasecki, JacekX <jacekx.piasecki at intel.com>; Kozak, KubaX <kubax.kozak at intel.com>; Kulasek,
> TomaszX <tomaszx.kulasek at intel.com>
> Subject: [PATCH v5 1/3] ethdev: new xstats API add retrieving by ID
> From: Jacek Piasecki <jacekx.piasecki at intel.com>
> Extended xstats API in ethdev library to allow grouping of stats
> logically so they can be retrieved per logical grouping managed
> by the application.
> Changed existing functions rte_eth_xstats_get_names and
> rte_eth_xstats_get to use a new list of arguments: array of ids
> and array of values. ABI versioning mechanism was used to
> support backward compatibility.
> Introduced two new functions rte_eth_xstats_get_all and
> rte_eth_xstats_get_names_all which keeps functionality of the
> previous ones (respectively rte_eth_xstats_get and
> rte_eth_xstats_get_names) but use new API inside.
> Both functions marked as deprecated.
> Introduced new function: rte_eth_xstats_get_id_by_name
> to retrieve xstats ids by its names.
> test-pmd: add support for new xstats API retrieving by id in
> testpmd application: xstats_get() and
> xstats_get_names() call with modified parameters.
> proc_info: add support for new xstats API retrieving by id to
> proc_info application. There is a new argument --xstats-ids
> in proc_info command line to retrieve statistics given by ids.
> E.g. --xstats-ids="1,3,5,7,8"
> doc: add description for modified xstats API
> Documentation change for modified extended statistics API functions.
> The old API only allows retrieval of *all* of the NIC statistics
> at once. Given this requires a MMIO read PCI transaction per statistic
> it is an inefficient way of retrieving just a few key statistics.
> Often a monitoring agent only has an interest in a few key statistics,
> and the old API forces wasting CPU time and PCIe bandwidth in retrieving
> *all* statistics; even those that the application didn't explicitly
> show an interest in.
> The new, more flexible API allow retrieval of statistics per ID.
> If a PMD wishes, it can be implemented to read just the required
> NIC registers. As a result, the monitoring application no longer wastes
> PCIe bandwidth and CPU time.
> Signed-off-by: Jacek Piasecki <jacekx.piasecki at intel.com>
> Signed-off-by: Kuba Kozak <kubax.kozak at intel.com>
> Signed-off-by: Tomasz Kulasek <tomaszx.kulasek at intel.com>
As part of this patchset 3 functions were added to struct eth_dev_ops, to provide more flexible xstats() APIs.
This patchset uses symbol versioning to keep ABI stable. I have checked ABI using ./devtools/validate-abi.sh script for both GCC 5.4.0 and Clang 3.8.0. GCC indicates Compatible, while Clang says there is a single Medium issue, which I believe to be a false positive (details below).
The clang Medium issue is described as follows by the ABI report;
- struct rte_eth_dev :
Change: Size of field dev_ops has been changed from 624 bytes to 648 bytes [HvH: due to adding 3 xstats function pointers to end of struct]
Effect: Previous accesses of applications and library functions to this field and fields at higher positions of the structure definition may be broken.
The reason I believe this is a false positive is that the "dev_ops" field is defined in the rte_eth_dev struct as follows:
const struct eth_dev_ops *dev_ops;
Any accesses made to dev_ops will be by this pointer-dereference, so the *size* of dev_ops *in* rte_eth_dev struct is still a pointer - it hasn't changed. Hence "accesses to this field and fields at higher positions of the structure" will not be changed - the pointer in the rte_eth_dev struct remains a pointer.
Acked-by: Harry van Haaren <harry.van.haaren at intel.com>
More information about the dev