ether: fix incorrect stats query for lowest xstat id
PATCH 1/1 ether: fix incorrect stats query for lowest xstat id
When querying either the name or the value of a stat using the xstats APIs, a check is done to see if the regular stats API or the xstats APIs for the driver need to be used. However, the id of the stat requested is checked to see if it is greater than the number of basic stats, rather than checking for greater-or-equal, meaning that the xstat with the lowest id gets incorrectly treated as a basic stat.
This problem manifests itself when you call proc_info using "--xstats-id" for the first xstat, you get no name of the stat printed, and a random(ish) stat value.
--- lib/librte_ether/rte_ethdev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
lib/librte_ether/rte_ethdev.c +2 -2
@@ -2045,7 +2045,7 @@ rte_eth_xstats_get_names_by_id(uint16_t port_id,if (ids) {for (i =0 ; i < size; i++) { -if (ids[i] > basic_count) { +if (ids[i] >= basic_count) { no_ext_stat_requested =0 ;break ; }
@@ -2225,7 +2225,7 @@ rte_eth_xstats_get_by_id(uint16_t port_id, const uint64_t *ids,if (ids) {for (i =0 ; i < size; i++) { -if (ids[i] > basic_count) { +if (ids[i] >= basic_count) { no_ext_stat_requested =0 ;break ; }
Signature · 1 line
2.14.3
Quoted 7 lines · Bruce Richardson
When querying either the name or the value of a stat using the xstats APIs, a check is done to see if the regular stats API or the xstats APIs for the driver need to be used. However, the id of the stat requested is checked to see if it is greater than the number of basic stats, rather than checking for greater-or-equal, meaning that the xstat with the lowest id gets incorrectly treated as a basic stat.
Quoted 7 lines
This problem manifests itself when you call
proc_infousing "--xstats-id" for the first xstat, you get no name of the stat printed, and a random(ish) stat value.Fixes 4773152f850b ("ethdev: optimize xstats by ids APIs")Signed-off-by Bruce Richardson <[email protected]>
Thomas Monjalon
Applied06/02/2018 17:06, Bruce Richardson:
Quoted 7 lines
When querying either the name or the value of a stat using the xstats APIs, a check is done to see if the regular stats API or the xstats APIs for the driver need to be used. However, the id of the stat requested is checked to see if it is greater than the number of basic stats, rather than checking for greater-or-equal, meaning that the xstat with the lowest id gets incorrectly treated as a basic stat.
Quoted 7 lines
This problem manifests itself when you call
proc_infousing "--xstats-id" for the first xstat, you get no name of the stat printed, and a random(ish) stat value.Fixes 4773152f850b ("ethdev: optimize xstats by ids APIs")Signed-off-by Bruce Richardson <[email protected]>
Applied, thanks
It looks like the stats functions are the most reworked and fixed. It is a no-end story. According to git statistics, it is probably the most complicate code of DPDK :)
I am thinking about being more conservative and do not accept any new change in these rocket science functions ;)