From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 4E3598D36 for ; Wed, 30 Sep 2015 11:40:54 +0200 (CEST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga102.fm.intel.com with ESMTP; 30 Sep 2015 02:40:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,611,1437462000"; d="scan'208";a="571197938" Received: from sie-lab-212-222.ir.intel.com (HELO silpixa00366884.ir.intel.com) ([10.237.212.222]) by FMSMGA003.fm.intel.com with ESMTP; 30 Sep 2015 02:40:52 -0700 From: Harry van Haaren To: dev@dpdk.org Date: Wed, 30 Sep 2015 10:40:14 +0100 Message-Id: <1443606022-13581-4-git-send-email-harry.van.haaren@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1443606022-13581-1-git-send-email-harry.van.haaren@intel.com> References: <1443606022-13581-1-git-send-email-harry.van.haaren@intel.com> Subject: [dpdk-dev] [PATCH v2 03/11] ethdev: update xstats_get() strings and Q handling 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: Wed, 30 Sep 2015 09:40:54 -0000 Update the strings used for presenting stats to adhere to the scheme previously presented. Updated xstats_get() function to handle Q information only if xstats() is not implemented in the PMD, providing the PMD with the needed flexibility to expose its extended Q stats. Signed-off-by: Harry van Haaren --- lib/librte_ether/rte_ethdev.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index b309309..4b0184f 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -143,7 +143,7 @@ static const struct rte_eth_xstats_name_off rte_stats_strings[] = { {"tx_bytes", offsetof(struct rte_eth_stats, obytes)}, {"tx_errors", offsetof(struct rte_eth_stats, oerrors)}, {"rx_errors", offsetof(struct rte_eth_stats, ierrors)}, - {"alloc_rx_buff_failed", offsetof(struct rte_eth_stats, rx_nombuf)}, + {"rx_no_mbuf_errors", offsetof(struct rte_eth_stats, rx_nombuf)}, }; #define RTE_NB_STATS (sizeof(rte_stats_strings) / sizeof(rte_stats_strings[0])) @@ -1666,8 +1666,6 @@ rte_eth_xstats_get(uint8_t port_id, struct rte_eth_xstats *xstats, /* 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) { @@ -1679,6 +1677,9 @@ 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) @@ -1698,6 +1699,10 @@ 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++) { @@ -1706,7 +1711,7 @@ rte_eth_xstats_get(uint8_t port_id, struct rte_eth_xstats *xstats, q * sizeof(uint64_t)); val = *stats_ptr; snprintf(xstats[count].name, sizeof(xstats[count].name), - "rx_queue_%u_%s", q, + "rx_q%u_%s", q, rte_rxq_stats_strings[i].name); xstats[count++].value = val; } @@ -1720,7 +1725,7 @@ rte_eth_xstats_get(uint8_t port_id, struct rte_eth_xstats *xstats, q * sizeof(uint64_t)); val = *stats_ptr; snprintf(xstats[count].name, sizeof(xstats[count].name), - "tx_queue_%u_%s", q, + "tx_q%u_%s", q, rte_txq_stats_strings[i].name); xstats[count++].value = val; } -- 1.9.1