From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michal Jastrzebski Subject: [PATCH v2 5/5] add support for new xstats API retrieving by id Date: Fri, 31 Mar 2017 00:23:38 +0200 Message-ID: <1490912618-244589-1-git-send-email-michalx.k.jastrzebski@intel.com> References: <1490910640-244285-1-git-send-email-michalx.k.jastrzebski@intel.com> Cc: Jacek Piasecki , Kuba Kozak To: dev@dpdk.org 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) In-Reply-To: <1490910640-244285-1-git-send-email-michalx.k.jastrzebski@intel.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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