From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 73C985A58 for ; Fri, 6 Nov 2015 15:13:33 +0100 (CET) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP; 06 Nov 2015 06:13:33 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,252,1444719600"; d="scan'208";a="829187123" Received: from sie-lab-212-222.ir.intel.com (HELO silpixa00366884.ir.intel.com) ([10.237.212.222]) by fmsmga001.fm.intel.com with ESMTP; 06 Nov 2015 06:13:31 -0800 From: Harry van Haaren To: dev@dpdk.org Date: Fri, 6 Nov 2015 14:12:53 +0000 Message-Id: <1446819175-31325-2-git-send-email-harry.van.haaren@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1446819175-31325-1-git-send-email-harry.van.haaren@intel.com> References: <1446819175-31325-1-git-send-email-harry.van.haaren@intel.com> Subject: [dpdk-dev] [PATCH 1/3] ethdev: xstats generic Q stats refactor X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Nov 2015 14:13:33 -0000 This patch refactors the generic queue stats to be exposed by rte_ethdev_xstats_get(). Signed-off-by: Harry van Haaren --- lib/librte_ether/rte_ethdev.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index e0e1dca..b464f30 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -1515,7 +1515,8 @@ rte_eth_xstats_get(uint8_t port_id, struct rte_eth_xstats *xstats, dev = &rte_eth_devices[port_id]; /* Return generic statistics */ - count = RTE_NB_STATS; + count = RTE_NB_STATS + (dev->data->nb_rx_queues * RTE_NB_RXQ_STATS) + + (dev->data->nb_tx_queues * RTE_NB_TXQ_STATS); /* implemented by the driver */ if (dev->dev_ops->xstats_get != NULL) { @@ -1527,9 +1528,6 @@ rte_eth_xstats_get(uint8_t port_id, struct rte_eth_xstats *xstats, if (xcount < 0) return xcount; - } else { - count += dev->data->nb_rx_queues * RTE_NB_RXQ_STATS; - count += dev->data->nb_tx_queues * RTE_NB_TXQ_STATS; } if (n < count + xcount) @@ -1549,10 +1547,6 @@ rte_eth_xstats_get(uint8_t port_id, struct rte_eth_xstats *xstats, xstats[count++].value = val; } - /* if xstats_get() is implemented by the PMD, the Q stats are done */ - if (dev->dev_ops->xstats_get != NULL) - return count + xcount; - /* per-rxq stats */ for (q = 0; q < dev->data->nb_rx_queues; q++) { for (i = 0; i < RTE_NB_RXQ_STATS; i++) { -- 1.9.1