DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 1/3] ethdev: extract xstat basic stat count calculation
@ 2017-10-20  0:03 Ferruh Yigit
  2017-10-20  0:03 ` [dpdk-dev] [PATCH 2/3] ethdev: fix xstats get by id APIS Ferruh Yigit
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Ferruh Yigit @ 2017-10-20  0:03 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev, Ferruh Yigit

Extract into static inline function so that can be used by other
functions.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
 lib/librte_ether/rte_ethdev.c | 24 +++++++++++++++++++-----
 1 file changed, 19 insertions(+), 5 deletions(-)

diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 0b1e92894..798855e15 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -1550,6 +1550,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)
 {
@@ -1571,11 +1587,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;
 }
 
-- 
2.13.6

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2017-10-24  0:31 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-20  0:03 [dpdk-dev] [PATCH 1/3] ethdev: extract xstat basic stat count calculation Ferruh Yigit
2017-10-20  0:03 ` [dpdk-dev] [PATCH 2/3] ethdev: fix xstats get by id APIS Ferruh Yigit
2017-10-20 12:33   ` Ivan Malov
2017-10-23 22:20   ` Thomas Monjalon
2017-10-20  0:03 ` [dpdk-dev] [PATCH 3/3] ethdev: fix negative return values in xstats Ferruh Yigit
2017-10-23 22:26   ` Thomas Monjalon
2017-10-23 23:12 ` [dpdk-dev] [PATCH 1/3] ethdev: extract xstat basic stat count calculation Ferruh Yigit
2017-10-23 23:12   ` [dpdk-dev] [PATCH 2/3] ethdev: fix xstats get by id APIS Ferruh Yigit
2017-10-23 23:12   ` [dpdk-dev] [PATCH 3/3] ethdev: check more errors in xstats retrieval Ferruh Yigit
2017-10-23 23:15   ` [dpdk-dev] [PATCH v2 1/3] ethdev: extract xstat basic stat count calculation Ferruh Yigit
2017-10-23 23:15     ` [dpdk-dev] [PATCH v2 2/3] ethdev: fix xstats get by id APIS Ferruh Yigit
2017-10-23 23:33       ` Thomas Monjalon
2017-10-23 23:15     ` [dpdk-dev] [PATCH v2 3/3] ethdev: check more errors in xstats retrieval Ferruh Yigit
2017-10-24  0:31     ` [dpdk-dev] [PATCH v2 1/3] ethdev: extract xstat basic stat count calculation Ferruh Yigit

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).