DPDK patches and discussions
 help / color / Atom feed
From: Ferruh Yigit <ferruh.yigit@intel.com>
To: Ferruh Yigit <ferruh.yigit@intel.com>,
	Thomas Monjalon <thomas@monjalon.net>,
	Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Cc: dev@dpdk.org, techboard@dpdk.org, Min Hu <humin29@huawei.com>
Subject: [dpdk-dev] [RFC 1/2] ethdev: move queue stats to xstats
Date: Mon, 12 Oct 2020 17:46:00 +0100
Message-ID: <20201012164602.1965694-1-ferruh.yigit@intel.com> (raw)

Queue stats are stored in 'struct rte_eth_stats' as array and array size
is defined by 'RTE_ETHDEV_QUEUE_STAT_CNTRS' compile time flag.

As a result of technical board discussion, decided to remove the queue
statistics from 'struct rte_eth_stats' in the long term.

Instead PMDs should represent the queue statistics via xstats, this
gives more flexibility on the number of the queues supported.

Currently queue stats in the xstats are filled by ethdev layer, using
the basic stats, when queue stats removed from basic stats the
responsibility to fill the relevant xstats will be pushed to the PMDs.

During the switch period, a temporary
'RTE_ETH_DEV_QUEUE_STATS_IN_XSTATS' device flag is created. The PMDs
providing the queue stats in the xstats should set this flag to bypass
the relevant part in ethdev layer.

When all PMDs switch to the xstats for the queue stats, queue stats
related fields from 'struct rte_eth_stats' will be removed, as well as
'RTE_ETH_DEV_QUEUE_STATS_IN_XSTATS' flag.
Later 'RTE_ETHDEV_QUEUE_STAT_CNTRS' compile time flag also can be
removed.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
 lib/librte_ethdev/rte_ethdev.c | 19 +++++++++++++++----
 lib/librte_ethdev/rte_ethdev.h |  2 ++
 2 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
index 892c246a53..66665ad4ee 100644
--- a/lib/librte_ethdev/rte_ethdev.c
+++ b/lib/librte_ethdev/rte_ethdev.c
@@ -2446,8 +2446,10 @@ get_xstats_basic_count(struct rte_eth_dev *dev)
 	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;
+	if ((dev->data->dev_flags & RTE_ETH_DEV_QUEUE_STATS_IN_XSTATS) == 0) {
+		count += nb_rxqs * RTE_NB_RXQ_STATS;
+		count += nb_txqs * RTE_NB_TXQ_STATS;
+	}
 
 	return count;
 }
@@ -2538,6 +2540,10 @@ rte_eth_basic_stats_get_names(struct rte_eth_dev *dev,
 			sizeof(xstats_names[0].name));
 		cnt_used_entries++;
 	}
+
+	if (dev->data->dev_flags & RTE_ETH_DEV_QUEUE_STATS_IN_XSTATS)
+		return cnt_used_entries;
+
 	num_q = RTE_MIN(dev->data->nb_rx_queues, RTE_ETHDEV_QUEUE_STAT_CNTRS);
 	for (id_queue = 0; id_queue < num_q; id_queue++) {
 		for (idx = 0; idx < RTE_NB_RXQ_STATS; idx++) {
@@ -2736,6 +2742,9 @@ rte_eth_basic_stats_get(uint16_t port_id, struct rte_eth_xstat *xstats)
 		xstats[count++].value = val;
 	}
 
+	if (dev->data->dev_flags & RTE_ETH_DEV_QUEUE_STATS_IN_XSTATS)
+		return count;
+
 	/* per-rxq stats */
 	for (q = 0; q < nb_rxqs; q++) {
 		for (i = 0; i < RTE_NB_RXQ_STATS; i++) {
@@ -2871,8 +2880,10 @@ rte_eth_xstats_get(uint16_t port_id, struct rte_eth_xstat *xstats,
 	nb_txqs = RTE_MIN(dev->data->nb_tx_queues, RTE_ETHDEV_QUEUE_STAT_CNTRS);
 
 	/* Return generic statistics */
-	count = RTE_NB_STATS + (nb_rxqs * RTE_NB_RXQ_STATS) +
-		(nb_txqs * RTE_NB_TXQ_STATS);
+	count = RTE_NB_STATS;
+	if ((dev->data->dev_flags & RTE_ETH_DEV_QUEUE_STATS_IN_XSTATS) == 0)
+		count += (nb_rxqs * RTE_NB_RXQ_STATS) +
+			(nb_txqs * RTE_NB_TXQ_STATS);
 
 	/* implemented by the driver */
 	if (dev->dev_ops->xstats_get != NULL) {
diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h
index 5bcfbb8b04..42c83303e1 100644
--- a/lib/librte_ethdev/rte_ethdev.h
+++ b/lib/librte_ethdev/rte_ethdev.h
@@ -1694,6 +1694,8 @@ struct rte_eth_dev_owner {
 #define RTE_ETH_DEV_REPRESENTOR  0x0010
 /** Device does not support MAC change after started */
 #define RTE_ETH_DEV_NOLIVE_MAC_ADDR  0x0020
+/** Device provides queue stats in xstats */
+#define RTE_ETH_DEV_QUEUE_STATS_IN_XSTATS 0x0040
 
 /**
  * Iterates over valid ethdev ports owned by a specific owner.
-- 
2.26.2


             reply index

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-12 16:46 Ferruh Yigit [this message]
2020-10-12 16:46 ` [dpdk-dev] [RFC 2/2] doc: announce queue stats moving " Ferruh Yigit
2020-10-12 16:55   ` [dpdk-dev] [dpdk-techboard] " Stephen Hemminger
2020-10-12 21:53 ` [dpdk-dev] [RFC 1/2] ethdev: move queue stats " Thomas Monjalon
2020-10-13  8:31   ` Andrew Rybchenko
2020-10-13  9:05     ` Thomas Monjalon
2020-10-13  9:16       ` Andrew Rybchenko
2020-10-13 22:41         ` Ferruh Yigit
2020-10-13 15:04       ` Stephen Hemminger
2020-10-13 22:53   ` Ferruh Yigit
2020-10-14  2:26 ` [dpdk-dev] [RFC v2 1/2] ethdev: provide device flag to bypass ethdev queue xstats Ferruh Yigit
2020-10-14  2:26   ` [dpdk-dev] [RFC v2 2/2] doc: announce queue stats moving to xstats Ferruh Yigit
2020-10-14  8:43     ` Kinsella, Ray
2020-10-16 14:34       ` Thomas Monjalon
2020-10-16 14:36         ` Bruce Richardson
2020-10-16 14:37         ` Jerin Jacob
2020-10-16 15:07         ` Stephen Hemminger
2020-10-16 17:48           ` Ajit Khaparde
2020-10-14  9:35     ` Igor Ryzhov
2020-10-14  9:45       ` Thomas Monjalon
2020-10-15  7:55         ` Igor Ryzhov
2020-10-15  8:03           ` Thomas Monjalon
2020-10-15 17:39             ` Igor Ryzhov
2020-10-15 17:45               ` Thomas Monjalon
2020-10-14  8:40   ` [dpdk-dev] [RFC v2 1/2] ethdev: provide device flag to bypass ethdev queue xstats Wang, Haiyue
2020-10-14  8:46   ` Wang, Xiao W
2020-10-16 12:16   ` Ferruh Yigit
2020-10-16 14:32     ` Thomas Monjalon
2020-10-16 21:38       ` Ferruh Yigit
2020-10-19  3:03     ` Min Hu (Connor)
2020-10-18 12:09   ` Xu, Rosen

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201012164602.1965694-1-ferruh.yigit@intel.com \
    --to=ferruh.yigit@intel.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=dev@dpdk.org \
    --cc=humin29@huawei.com \
    --cc=techboard@dpdk.org \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

DPDK patches and discussions

Archives are clonable:
	git clone --mirror http://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ http://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev


Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/ public-inbox