20/10/2017 02:03, Ferruh Yigit: > ethdev xstat get by id APIs: > rte_eth_xstats_get_names_by_id() > rte_eth_xstats_get_by_id() > > Works on ids calculated as "basic stats + device specific stats" > > When an application asking for id less than "basic stats count", it is > indeed asking basic stats nothing specific to device stats. > > The dev_ops PMDs implements xstats_get_names_by_id and xstats_get_by_id > works on device specific ids. > > This patch adds a check if all stats requested by ids can be provided > via device and if so converts ids to device specific ones. > > This conversion wasn't required before commit 8c49d5f1c219, because > _by_id dev_ops were always used to get whole stats instead of specific > ids. > > Fixes: 8c49d5f1c219 ("ethdev: rework xstats retrieve by id")
It would be easier to understand if starting with a statement of bug. > --- a/lib/librte_ether/rte_ethdev.c > +++ b/lib/librte_ether/rte_ethdev.c > @@ -1644,6 +1644,7 @@ rte_eth_xstats_get_names_by_id(uint16_t port_id, > uint64_t *ids) > { > struct rte_eth_xstat_name *xstats_names_copy; > + unsigned int all_ids_from_pmd = 1; This variable would be better renamed as "no_basic_stat_requested". > + ids_copy[i] = ids[i] - basic_count; This line may deserve a comment.