[dpdk-dev,v2,4/7] ethdev: expose extended error stats
Commit Message
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@intel.com>
---
lib/librte_ether/rte_ethdev.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
@@ -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, ð_stats);
/* global stats */