From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 5C87B1B6F6 for ; Tue, 6 Feb 2018 17:07:07 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Feb 2018 08:07:05 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,469,1511856000"; d="scan'208";a="28558919" Received: from silpixa00399126.ir.intel.com (HELO silpixa00399126.ger.corp.intel.com) ([10.237.223.223]) by fmsmga001.fm.intel.com with ESMTP; 06 Feb 2018 08:07:04 -0800 From: Bruce Richardson To: thomas@monjalon.net Cc: dev@dpdk.org, Bruce Richardson Date: Tue, 6 Feb 2018 16:06:59 +0000 Message-Id: <20180206160659.87323-1-bruce.richardson@intel.com> X-Mailer: git-send-email 2.14.3 Subject: [dpdk-dev] [PATCH] ether: fix incorrect stats query for lowest xstat id X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Feb 2018 16:07:07 -0000 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 --- 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