From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id C0378C358 for ; Fri, 5 Jun 2015 19:35:31 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga103.jf.intel.com with ESMTP; 05 Jun 2015 10:35:30 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,560,1427785200"; d="scan'208";a="737835833" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by fmsmga002.fm.intel.com with ESMTP; 05 Jun 2015 10:35:29 -0700 Received: from sivswdev02.ir.intel.com (sivswdev02.ir.intel.com [10.237.217.46]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id t55HZTxN032361; Fri, 5 Jun 2015 18:35:29 +0100 Received: from sivswdev02.ir.intel.com (localhost [127.0.0.1]) by sivswdev02.ir.intel.com with ESMTP id t55HZTKW017217; Fri, 5 Jun 2015 18:35:29 +0100 Received: (from jmcnam2x@localhost) by sivswdev02.ir.intel.com with id t55HZT7u017213; Fri, 5 Jun 2015 18:35:29 +0100 From: Maryam Tahhan To: dev@dpdk.org Date: Fri, 5 Jun 2015 18:35:03 +0100 Message-Id: <1433525705-17041-3-git-send-email-maryam.tahhan@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1433525705-17041-1-git-send-email-maryam.tahhan@intel.com> References: <1433525705-17041-1-git-send-email-maryam.tahhan@intel.com> Subject: [dpdk-dev] [PATCH 2/4] 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, 05 Jun 2015 17:35:32 -0000 Extend rte_eth_xstats_get to retrieve additional stats from the device driver as well the top level extended stats. Add additional drop counters to the extended stats. Signed-off-by: Maryam Tahhan --- lib/librte_ether/rte_ethdev.c | 12 ++++++++---- lib/librte_ether/rte_ethdev.h | 4 ++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index 5a94654..8c22cda 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -129,6 +129,8 @@ static const struct rte_eth_xstats_name_off rte_stats_strings[] = { {"rx_crc_errors", offsetof(struct rte_eth_stats, ibadcrc)}, {"rx_bad_length_errors", offsetof(struct rte_eth_stats, ibadlen)}, {"rx_errors", offsetof(struct rte_eth_stats, ierrors)}, + {"rx_mac_err", offsetof(struct rte_eth_stats, imacerr)}, + {"rx_phy_err", offsetof(struct rte_eth_stats, iphyerr)}, {"alloc_rx_buff_failed", offsetof(struct rte_eth_stats, rx_nombuf)}, {"fdir_match", offsetof(struct rte_eth_stats, fdirmatch)}, {"fdir_miss", offsetof(struct rte_eth_stats, fdirmiss)}, @@ -136,6 +138,8 @@ static const struct rte_eth_xstats_name_off rte_stats_strings[] = { {"rx_flow_control_xon", offsetof(struct rte_eth_stats, rx_pause_xon)}, {"tx_flow_control_xoff", offsetof(struct rte_eth_stats, tx_pause_xoff)}, {"rx_flow_control_xoff", offsetof(struct rte_eth_stats, rx_pause_xoff)}, + {"tx_drops", offsetof(struct rte_eth_stats, odrop)}, + {"rx_drops", offsetof(struct rte_eth_stats, idrop)}, }; #define RTE_NB_STATS (sizeof(rte_stats_strings) / sizeof(rte_stats_strings[0])) @@ -154,7 +158,6 @@ static const struct rte_eth_xstats_name_off rte_txq_stats_strings[] = { #define RTE_NB_TXQ_STATS (sizeof(rte_txq_stats_strings) / \ sizeof(rte_txq_stats_strings[0])) - /** * The user application callback description. * @@ -1741,7 +1744,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; @@ -1754,18 +1757,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 */ diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h index 16dbe00..5bc3b81 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -224,6 +224,10 @@ struct rte_eth_stats { /**< Total number of good bytes received from loopback,VF Only */ uint64_t olbbytes; /**< Total number of good bytes transmitted to loopback,VF Only */ + uint64_t imacerr; /**< Total of RX packets with MAC Errors. */ + uint64_t iphyerr; /**< Total of RX packets with PHY Errors. */ + uint64_t idrop; /**< Total number of dropped received packets. */ + uint64_t odrop; /**< Total number of dropped transmitted packets. */ }; /** -- 1.8.1.4