From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 229D8101B for ; Fri, 31 Mar 2017 00:28:27 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=intel.com; i=@intel.com; q=dns/txt; s=intel; t=1490912908; x=1522448908; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=AbUwC1bBb6HVUJ57oh4kYGSkBSctQvt8ITCHYIlrGcc=; b=NV32R1x+qARLfHxEDpK3sH2z+/mT9s/QaZ5u5pYexVCG1jeDFXhDc3so uOO5Pw5pRi2pH5Gd94Fb8e5XgLZBGw==; Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Mar 2017 15:28:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,249,1486454400"; d="scan'208";a="67128721" Received: from gklab-246-023.igk.intel.com (HELO Sent) ([10.217.246.23]) by orsmga002.jf.intel.com with SMTP; 30 Mar 2017 15:28:24 -0700 Received: by Sent (sSMTP sendmail emulation); Fri, 31 Mar 2017 00:23:41 +0200 From: Michal Jastrzebski To: dev@dpdk.org Cc: Jacek Piasecki , Kuba Kozak Date: Fri, 31 Mar 2017 00:23:38 +0200 Message-Id: <1490912618-244589-1-git-send-email-michalx.k.jastrzebski@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1490910640-244285-1-git-send-email-michalx.k.jastrzebski@intel.com> References: <1490910640-244285-1-git-send-email-michalx.k.jastrzebski@intel.com> Subject: [dpdk-dev] [PATCH v2 5/5] add support for new xstats API retrieving by 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: Thu, 30 Mar 2017 22:28:28 -0000 Add support for new xstats API retrieving by id in testpmd application Signed-off-by: Jacek Piasecki Signed-off-by: Kuba Kozak --- app/test-pmd/config.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 80491fc..d94a580 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -264,9 +264,9 @@ struct rss_type_info { void nic_xstats_display(portid_t port_id) { - struct rte_eth_xstat *xstats; int cnt_xstats, idx_xstat; struct rte_eth_xstat_name *xstats_names; + uint64_t *values; printf("###### NIC extended statistics for port %-2d\n", port_id); if (!rte_eth_dev_is_valid_port(port_id)) { @@ -275,7 +275,7 @@ struct rss_type_info { } /* Get count */ - cnt_xstats = rte_eth_xstats_get_names(port_id, NULL, 0); + cnt_xstats = rte_eth_xstats_get_names(port_id, NULL, NULL, 0); if (cnt_xstats < 0) { printf("Error: Cannot get count of xstats\n"); return; @@ -288,23 +288,23 @@ struct rss_type_info { return; } if (cnt_xstats != rte_eth_xstats_get_names( - port_id, xstats_names, cnt_xstats)) { + port_id, xstats_names, NULL, cnt_xstats)) { printf("Error: Cannot get xstats lookup\n"); free(xstats_names); return; } /* Get stats themselves */ - xstats = malloc(sizeof(struct rte_eth_xstat) * cnt_xstats); - if (xstats == NULL) { + values = malloc(sizeof(values) * cnt_xstats); + if (values == NULL) { printf("Cannot allocate memory for xstats\n"); free(xstats_names); return; } - if (cnt_xstats != rte_eth_xstats_get(port_id, xstats, cnt_xstats)) { + if (cnt_xstats != rte_eth_xstats_get(port_id, NULL, values, cnt_xstats)) { printf("Error: Unable to get xstats\n"); free(xstats_names); - free(xstats); + free(values); return; } @@ -312,9 +312,9 @@ struct rss_type_info { for (idx_xstat = 0; idx_xstat < cnt_xstats; idx_xstat++) printf("%s: %"PRIu64"\n", xstats_names[idx_xstat].name, - xstats[idx_xstat].value); + values[idx_xstat]); free(xstats_names); - free(xstats); + free(values); } void -- 1.9.1