From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 7B10D9A88 for ; Tue, 9 Jun 2015 17:10:57 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP; 09 Jun 2015 08:10:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,581,1427785200"; d="scan'208";a="743677427" Received: from sie-lab-212-170.ir.intel.com (HELO silpixa00378251.ir.intel.com) ([10.237.212.170]) by orsmga002.jf.intel.com with ESMTP; 09 Jun 2015 08:10:58 -0700 From: Maryam Tahhan To: dev@dpdk.org Date: Tue, 9 Jun 2015 16:10:43 +0100 Message-Id: <1433862646-91880-5-git-send-email-maryam.tahhan@intel.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1433862646-91880-1-git-send-email-maryam.tahhan@intel.com> References: <1433862646-91880-1-git-send-email-maryam.tahhan@intel.com> Subject: [dpdk-dev] [PATCH v2 4/7] ethdev: expose extended error stats 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: Tue, 09 Jun 2015 15:10:58 -0000 Extend rte_eth_xstats_get to retrieve additional stats from the device driver as well the top level extended stats. Signed-off-by: Maryam Tahhan --- lib/librte_ether/rte_ethdev.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index a439b4a..ce163a1 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -1745,7 +1745,7 @@ rte_eth_xstats_get(uint8_t port_id, struct rte_eth_xstats *xstats, { struct rte_eth_stats eth_stats; struct rte_eth_dev *dev; - unsigned count, i, q; + unsigned count = 0, xcount = 0, i, q; uint64_t val; char *stats_ptr; @@ -1758,18 +1758,19 @@ rte_eth_xstats_get(uint8_t port_id, struct rte_eth_xstats *xstats, /* implemented by the driver */ if (dev->dev_ops->xstats_get != NULL) - return (*dev->dev_ops->xstats_get)(dev, xstats, n); + xcount = (*dev->dev_ops->xstats_get)(dev, xstats, n); /* else, return generic statistics */ count = RTE_NB_STATS; count += dev->data->nb_rx_queues * RTE_NB_RXQ_STATS; count += dev->data->nb_tx_queues * RTE_NB_TXQ_STATS; + count += xcount; if (n < count) return count; /* now fill the xstats structure */ - count = 0; + count = xcount; rte_eth_stats_get(port_id, ð_stats); /* global stats */ -- 1.9.3