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

Maryam Tahhan maryam.tahhan at intel.com
Tue Jun 9 17:10:43 CEST 2015


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 <maryam.tahhan at intel.com>
---
 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



More information about the dev mailing list