DPDK patches and discussions
 help / color / mirror / Atom feed
From: Levend Sayar <levendsayar@gmail.com>
To: junfeng.guo@intel.com
Cc: dev@dpdk.org, Levend Sayar <levendsayar@gmail.com>
Subject: [PATCH v2 4/4] net/gve: add standard and extended statistics
Date: Thu, 16 Feb 2023 21:10:25 +0300	[thread overview]
Message-ID: <20230216181025.23485-4-levendsayar@gmail.com> (raw)
In-Reply-To: <20230216181025.23485-1-levendsayar@gmail.com>

NIC statistics are enhanced with rx/tx queue errors.

Signed-off-by: Levend Sayar <levendsayar@gmail.com>
---
 drivers/net/gve/gve_ethdev.c | 49 +++++++++++++++++++++++++++++++-----
 1 file changed, 43 insertions(+), 6 deletions(-)

diff --git a/drivers/net/gve/gve_ethdev.c b/drivers/net/gve/gve_ethdev.c
index 735847ede7..88adec7253 100644
--- a/drivers/net/gve/gve_ethdev.c
+++ b/drivers/net/gve/gve_ethdev.c
@@ -417,6 +417,18 @@ gve_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, unsigned i
 			if (--requested == 0)
 				return n;
 			xstat++;
+
+			xstat->id = indx++;
+			xstat->value = rxq->errors;
+			if (--requested == 0)
+				return n;
+			xstat++;
+
+			xstat->id = indx++;
+			xstat->value = rxq->no_mbufs;
+			if (--requested == 0)
+				return n;
+			xstat++;
 		}
 
 		for (i = 0; i < dev->data->nb_tx_queues; i++) {
@@ -432,10 +444,16 @@ gve_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, unsigned i
 			if (--requested == 0)
 				return n;
 			xstat++;
+
+			xstat->id = indx++;
+			xstat->value = txq->errors;
+			if (--requested == 0)
+				return n;
+			xstat++;
 		}
 	}
 
-	return (dev->data->nb_tx_queues + dev->data->nb_rx_queues) * 2;
+	return (dev->data->nb_rx_queues * 4) + (dev->data->nb_tx_queues * 3);
 }
 
 static int
@@ -454,29 +472,48 @@ gve_xstats_get_names(struct rte_eth_dev *dev, struct rte_eth_xstat_name *xstats_
 		uint16_t i;
 
 		for (i = 0; i < dev->data->nb_rx_queues; i++) {
-			snprintf(xstats_name->name, sizeof(xstats_name->name), "rx_q%d_packets", i);
+			snprintf(xstats_name->name, sizeof(xstats_name->name),
+					"rx_q%d_packets", i);
+			if (--requested == 0)
+				return n;
+			xstats_name++;
+			snprintf(xstats_name->name, sizeof(xstats_name->name),
+					"rx_q%d_bytes", i);
 			if (--requested == 0)
 				return n;
 			xstats_name++;
-			snprintf(xstats_name->name, sizeof(xstats_name->name), "rx_q%d_bytes", i);
+			snprintf(xstats_name->name, sizeof(xstats_name->name),
+					"rx_q%d_errors", i);
+			if (--requested == 0)
+				return n;
+			xstats_name++;
+			snprintf(xstats_name->name, sizeof(xstats_name->name),
+					"rx_q%d_no_mbufs", i);
 			if (--requested == 0)
 				return n;
 			xstats_name++;
 		}
 
 		for (i = 0; i < dev->data->nb_tx_queues; i++) {
-			snprintf(xstats_name->name, sizeof(xstats_name->name), "tx_q%d_packets", i);
+			snprintf(xstats_name->name, sizeof(xstats_name->name),
+					"tx_q%d_packets", i);
+			if (--requested == 0)
+				return n;
+			xstats_name++;
+			snprintf(xstats_name->name, sizeof(xstats_name->name),
+					"tx_q%d_bytes", i);
 			if (--requested == 0)
 				return n;
 			xstats_name++;
-			snprintf(xstats_name->name, sizeof(xstats_name->name), "tx_q%d_bytes", i);
+			snprintf(xstats_name->name, sizeof(xstats_name->name),
+					"tx_q%d_errors", i);
 			if (--requested == 0)
 				return n;
 			xstats_name++;
 		}
 	}
 
-	return (dev->data->nb_tx_queues + dev->data->nb_rx_queues) * 2;
+	return (dev->data->nb_rx_queues * 4) + (dev->data->nb_tx_queues * 3);
 }
 
 static const struct eth_dev_ops gve_eth_dev_ops = {
-- 
2.37.1 (Apple Git-137.1)


  parent reply	other threads:[~2023-02-16 18:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-16 18:10 [PATCH v2 1/4] net/gve: change offloading capability Levend Sayar
2023-02-16 18:10 ` [PATCH v2 2/4] net/gve: add standard and extended statistics Levend Sayar
2023-02-17 12:49   ` Ferruh Yigit
2023-02-16 18:10 ` [PATCH v2 3/4] " Levend Sayar
2023-02-16 18:10 ` Levend Sayar [this message]
2023-02-17 12:43 ` [PATCH v2 1/4] net/gve: change offloading capability Ferruh Yigit
2023-02-18  6:28   ` Levend Sayar

Reply instructions:

You may reply publicly 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=20230216181025.23485-4-levendsayar@gmail.com \
    --to=levendsayar@gmail.com \
    --cc=dev@dpdk.org \
    --cc=junfeng.guo@intel.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).