DPDK patches and discussions
 help / color / mirror / Atom feed
From: Harry van Haaren <harry.van.haaren@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 03/11] ethdev: update xstats_get() strings and Q handling
Date: Tue, 29 Sep 2015 15:32:47 +0100	[thread overview]
Message-ID: <1443537175-13809-4-git-send-email-harry.van.haaren@intel.com> (raw)
In-Reply-To: <1443537175-13809-1-git-send-email-harry.van.haaren@intel.com>

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.

Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
---
 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..370f3ac 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_mbufs_avail_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

  parent reply	other threads:[~2015-09-29 14:33 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-29 14:32 [dpdk-dev] [PATCH 00/11] Port XStats Harry van Haaren
2015-09-29 14:32 ` [dpdk-dev] [PATCH 01/11] doc: add extended statistics notes Harry van Haaren
2015-09-29 14:32 ` [dpdk-dev] [PATCH 02/11] doc: add extended statistics to prog_guide Harry van Haaren
2015-09-29 14:32 ` Harry van Haaren [this message]
2015-09-29 14:32 ` [dpdk-dev] [PATCH 04/11] virtio: add xstats() implementation Harry van Haaren
2015-09-29 14:32 ` [dpdk-dev] [PATCH 05/11] igb: " Harry van Haaren
2015-09-29 14:32 ` [dpdk-dev] [PATCH 06/11] igbvf: " Harry van Haaren
2015-09-29 14:32 ` [dpdk-dev] [PATCH 07/11] ixgbe: update statistic strings to scheme Harry van Haaren
2015-09-29 14:32 ` [dpdk-dev] [PATCH 08/11] ixgbevf: add xstats() functions to VF Harry van Haaren
2015-09-29 14:32 ` [dpdk-dev] [PATCH 09/11] i40e: add xstats() implementation Harry van Haaren
2015-09-29 14:32 ` [dpdk-dev] [PATCH 10/11] i40evf: " Harry van Haaren
2015-09-29 14:32 ` [dpdk-dev] [PATCH 11/11] fm10k: " Harry van Haaren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1443537175-13809-4-git-send-email-harry.van.haaren@intel.com \
    --to=harry.van.haaren@intel.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).