From: Ferruh Yigit Date: Thu, 19 Oct 2017 22:39:55 +0000 (+0100) Subject: ethdev: extract xstat basic stat count calculation X-Git-Tag: spdx-start~1134 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=2624e2f40a7f6ae013331759759ef98c9a5a2ce2;p=dpdk.git ethdev: extract xstat basic stat count calculation Extract into static inline function so that can be used by other functions. Signed-off-by: Ferruh Yigit --- diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index 68b0318bb7..8a485d644d 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -1563,6 +1563,22 @@ rte_eth_stats_reset(uint16_t port_id) return 0; } +static inline int +get_xstats_basic_count(struct rte_eth_dev *dev) +{ + uint16_t nb_rxqs, nb_txqs; + int count; + + nb_rxqs = RTE_MIN(dev->data->nb_rx_queues, RTE_ETHDEV_QUEUE_STAT_CNTRS); + nb_txqs = RTE_MIN(dev->data->nb_tx_queues, RTE_ETHDEV_QUEUE_STAT_CNTRS); + + count = RTE_NB_STATS; + count += nb_rxqs * RTE_NB_RXQ_STATS; + count += nb_txqs * RTE_NB_TXQ_STATS; + + return count; +} + static int get_xstats_count(uint16_t port_id) { @@ -1584,11 +1600,9 @@ get_xstats_count(uint16_t port_id) } else count = 0; - count += RTE_NB_STATS; - count += RTE_MIN(dev->data->nb_rx_queues, RTE_ETHDEV_QUEUE_STAT_CNTRS) * - RTE_NB_RXQ_STATS; - count += RTE_MIN(dev->data->nb_tx_queues, RTE_ETHDEV_QUEUE_STAT_CNTRS) * - RTE_NB_TXQ_STATS; + + count += get_xstats_basic_count(dev); + return count; }