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 852F9C8E2 for ; Fri, 26 Jun 2015 14:59:36 +0200 (CEST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP; 26 Jun 2015 05:59:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,684,1427785200"; d="scan'208";a="514644544" Received: from sie-lab-212-170.ir.intel.com (HELO silpixa00378251.ir.intel.com) ([10.237.212.170]) by FMSMGA003.fm.intel.com with ESMTP; 26 Jun 2015 05:59:33 -0700 From: Maryam Tahhan To: dev@dpdk.org Date: Fri, 26 Jun 2015 13:59:14 +0100 Message-Id: <1435323558-169985-4-git-send-email-maryam.tahhan@intel.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1435323558-169985-1-git-send-email-maryam.tahhan@intel.com> References: <1435323558-169985-1-git-send-email-maryam.tahhan@intel.com> Subject: [dpdk-dev] [PATCH v3 3/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: Fri, 26 Jun 2015 12:59:37 -0000 Extend rte_eth_xstats_get to retrieve additional stats from the device driver as well the ethdev generic stats. Signed-off-by: Maryam Tahhan --- drivers/net/ixgbe/ixgbe_ethdev.c | 2 +- lib/librte_ether/rte_ethdev.c | 20 ++++++++++++++------ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 0f62bcb..099e464 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -2035,7 +2035,7 @@ ixgbe_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstats *xstats, total_qprdc = 0; rxnfgpc = 0; txdgpc = 0; - count = 0; + count = n; ixgbe_read_stats_registers(hw, hw_stats, &total_missed_rx, &total_qbrc, &total_qprc, &rxnfgpc, &txdgpc, &total_qprdc); diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index 02cd07f..6451621 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -1741,7 +1741,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, *stats_ptr; if (!rte_eth_dev_is_valid_port(port_id)) { @@ -1751,14 +1751,18 @@ rte_eth_xstats_get(uint8_t port_id, struct rte_eth_xstats *xstats, dev = &rte_eth_devices[port_id]; - /* implemented by the driver */ - if (dev->dev_ops->xstats_get != NULL) - return (*dev->dev_ops->xstats_get)(dev, xstats, n); - - /* else, return generic statistics */ + /* 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; + + /* implemented by the driver */ + if (dev->dev_ops->xstats_get != NULL) { + /* Retrieve the additional count size */ + xcount = (*dev->dev_ops->xstats_get)(dev, xstats, 0); + count += xcount; + } + if (n < count) return count; @@ -1805,6 +1809,10 @@ rte_eth_xstats_get(uint8_t port_id, struct rte_eth_xstats *xstats, } } + /* Display stats after the generic stats*/ + if (dev->dev_ops->xstats_get != NULL) + (*dev->dev_ops->xstats_get)(dev, xstats, count); + return count; } -- 1.9.3