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 1/3] ethdev: xstats generic Q stats refactor
Date: Fri,  6 Nov 2015 14:12:53 +0000	[thread overview]
Message-ID: <1446819175-31325-2-git-send-email-harry.van.haaren@intel.com> (raw)
In-Reply-To: <1446819175-31325-1-git-send-email-harry.van.haaren@intel.com>

This patch refactors the generic queue stats to be exposed
by rte_ethdev_xstats_get().

Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
---
 lib/librte_ether/rte_ethdev.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index e0e1dca..b464f30 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -1515,7 +1515,8 @@ rte_eth_xstats_get(uint8_t port_id, struct rte_eth_xstats *xstats,
 	dev = &rte_eth_devices[port_id];
 
 	/* Return generic statistics */
-	count = RTE_NB_STATS;
+	count = RTE_NB_STATS + (dev->data->nb_rx_queues * RTE_NB_RXQ_STATS) +
+		(dev->data->nb_tx_queues * RTE_NB_TXQ_STATS);
 
 	/* implemented by the driver */
 	if (dev->dev_ops->xstats_get != NULL) {
@@ -1527,9 +1528,6 @@ 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)
@@ -1549,10 +1547,6 @@ 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++) {
-- 
1.9.1

  reply	other threads:[~2015-11-06 14:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-06 14:12 [dpdk-dev] [PATCH 0/3] xstats queue handling Harry van Haaren
2015-11-06 14:12 ` Harry van Haaren [this message]
2015-11-08  7:39   ` [dpdk-dev] [PATCH 1/3] ethdev: xstats generic Q stats refactor Tahhan, Maryam
2015-11-06 14:12 ` [dpdk-dev] [PATCH 2/3] ixgbe: refactor xstats queue handling Harry van Haaren
2015-11-08  7:37   ` Tahhan, Maryam
2015-11-06 14:12 ` [dpdk-dev] [PATCH 3/3] i40e: " Harry van Haaren
2015-11-08  7:34   ` Tahhan, Maryam
2015-11-12 16:36 ` [dpdk-dev] [PATCH 0/3] " Thomas Monjalon

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=1446819175-31325-2-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).