Thread (10 messages) 10 messages, 3 authors, 2015-06-17
STALE4021d
Revisions (2)
  1. v1 [diff vs current]
  2. v2 current

[PATCH v2 4/7] ethdev: expose extended error stats

From: Maryam Tahhan <hidden>
Date: 2015-06-09 15:10:57
Subsystem: library code, the rest · Maintainers: Andrew Morton, Linus Torvalds

Extend rte_eth_xstats_get to retrieve additional stats from the device
driver as well the top level extended stats.

Signed-off-by: Maryam Tahhan <redacted>
---
 lib/librte_ether/rte_ethdev.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index a439b4a..ce163a1 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -1745,7 +1745,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;
 
@@ -1758,18 +1758,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, &eth_stats);
 
 	/* global stats */
-- 
1.9.3
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help