DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] ether: fix incorrect stats query for lowest xstat id
@ 2018-02-06 16:06 Bruce Richardson
  2018-02-06 17:42 ` Ferruh Yigit
  2018-02-06 17:46 ` Thomas Monjalon
  0 siblings, 2 replies; 3+ messages in thread
From: Bruce Richardson @ 2018-02-06 16:06 UTC (permalink / raw)
  To: thomas; +Cc: dev, 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.

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.

Fixes: 4773152f850b ("ethdev: optimize xstats by ids APIs")

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 lib/librte_ether/rte_ethdev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 78bed1a16..a6ce2a5ba 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -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;
 			}
-- 
2.14.3

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] ether: fix incorrect stats query for lowest xstat id
  2018-02-06 16:06 [dpdk-dev] [PATCH] ether: fix incorrect stats query for lowest xstat id Bruce Richardson
@ 2018-02-06 17:42 ` Ferruh Yigit
  2018-02-06 17:46 ` Thomas Monjalon
  1 sibling, 0 replies; 3+ messages in thread
From: Ferruh Yigit @ 2018-02-06 17:42 UTC (permalink / raw)
  To: Bruce Richardson, thomas; +Cc: dev

On 2/6/2018 4:06 PM, Bruce Richardson wrote:
> 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.
> 
> Fixes: 4773152f850b ("ethdev: optimize xstats by ids APIs")
> 
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>

Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] ether: fix incorrect stats query for lowest xstat id
  2018-02-06 16:06 [dpdk-dev] [PATCH] ether: fix incorrect stats query for lowest xstat id Bruce Richardson
  2018-02-06 17:42 ` Ferruh Yigit
@ 2018-02-06 17:46 ` Thomas Monjalon
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Monjalon @ 2018-02-06 17:46 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev

06/02/2018 17:06, 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.
> 
> 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.
> 
> Fixes: 4773152f850b ("ethdev: optimize xstats by ids APIs")
> 
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>

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 ;)

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-02-06 17:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-06 16:06 [dpdk-dev] [PATCH] ether: fix incorrect stats query for lowest xstat id Bruce Richardson
2018-02-06 17:42 ` Ferruh Yigit
2018-02-06 17:46 ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).