All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ravi Kumar <Ravi1.kumar@amd.com>
To: dev@dpdk.org
Cc: ferruh.yigit@intel.com
Subject: [PATCH v5 15/18] net/axgbe: support generic transmit and receive stats api
Date: Fri,  6 Apr 2018 08:36:48 -0400	[thread overview]
Message-ID: <1523018211-65765-15-git-send-email-Ravi1.kumar@amd.com> (raw)
In-Reply-To: <1523018211-65765-1-git-send-email-Ravi1.kumar@amd.com>

This patch adds support for port statistics api defined
for ethernet PMDs.

Signed-off-by: Ravi Kumar <Ravi1.kumar@amd.com>
---
 doc/guides/nics/axgbe.rst          |  1 +
 doc/guides/nics/features/axgbe.ini |  1 +
 drivers/net/axgbe/axgbe_ethdev.c   | 52 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 54 insertions(+)

diff --git a/doc/guides/nics/axgbe.rst b/doc/guides/nics/axgbe.rst
index 009be03..e30f494 100644
--- a/doc/guides/nics/axgbe.rst
+++ b/doc/guides/nics/axgbe.rst
@@ -20,6 +20,7 @@ AXGBE PMD has support for:
 - Base L2 features
 - TSS (Transmit Side Scaling)
 - Promiscuous mode
+- Port statistics
 - Multicast mode
 - RSS (Receive Side Scaling)
 - Checksum offload
diff --git a/doc/guides/nics/features/axgbe.ini b/doc/guides/nics/features/axgbe.ini
index 9f4d38f..042ff1e 100644
--- a/doc/guides/nics/features/axgbe.ini
+++ b/doc/guides/nics/features/axgbe.ini
@@ -13,5 +13,6 @@ RSS hash             = Y
 CRC offload          = Y
 L3 checksum offload  = Y
 L4 checksum offload  = Y
+Basic stats          = Y
 Linux UIO            = Y
 x86-64               = Y
diff --git a/drivers/net/axgbe/axgbe_ethdev.c b/drivers/net/axgbe/axgbe_ethdev.c
index e5495bd..8c7b0ee 100644
--- a/drivers/net/axgbe/axgbe_ethdev.c
+++ b/drivers/net/axgbe/axgbe_ethdev.c
@@ -21,6 +21,9 @@ static void axgbe_dev_allmulticast_enable(struct rte_eth_dev *dev);
 static void axgbe_dev_allmulticast_disable(struct rte_eth_dev *dev);
 static int axgbe_dev_link_update(struct rte_eth_dev *dev,
 				 int wait_to_complete);
+static int axgbe_dev_stats_get(struct rte_eth_dev *dev,
+				struct rte_eth_stats *stats);
+static void axgbe_dev_stats_reset(struct rte_eth_dev *dev);
 static void axgbe_dev_info_get(struct rte_eth_dev *dev,
 			       struct rte_eth_dev_info *dev_info);
 
@@ -82,6 +85,8 @@ static const struct eth_dev_ops axgbe_eth_dev_ops = {
 	.allmulticast_enable  = axgbe_dev_allmulticast_enable,
 	.allmulticast_disable = axgbe_dev_allmulticast_disable,
 	.link_update          = axgbe_dev_link_update,
+	.stats_get            = axgbe_dev_stats_get,
+	.stats_reset          = axgbe_dev_stats_reset,
 	.dev_infos_get        = axgbe_dev_info_get,
 	.rx_queue_setup       = axgbe_dev_rx_queue_setup,
 	.rx_queue_release     = axgbe_dev_rx_queue_release,
@@ -294,6 +299,53 @@ axgbe_dev_link_update(struct rte_eth_dev *dev,
 	return ret;
 }
 
+static int
+axgbe_dev_stats_get(struct rte_eth_dev *dev,
+		    struct rte_eth_stats *stats)
+{
+	struct axgbe_rx_queue *rxq;
+	struct axgbe_tx_queue *txq;
+	unsigned int i;
+
+	for (i = 0; i < dev->data->nb_rx_queues; i++) {
+		rxq = dev->data->rx_queues[i];
+		stats->q_ipackets[i] = rxq->pkts;
+		stats->ipackets += rxq->pkts;
+		stats->q_ibytes[i] = rxq->bytes;
+		stats->ibytes += rxq->bytes;
+	}
+	for (i = 0; i < dev->data->nb_tx_queues; i++) {
+		txq = dev->data->tx_queues[i];
+		stats->q_opackets[i] = txq->pkts;
+		stats->opackets += txq->pkts;
+		stats->q_obytes[i] = txq->bytes;
+		stats->obytes += txq->bytes;
+	}
+
+	return 0;
+}
+
+static void
+axgbe_dev_stats_reset(struct rte_eth_dev *dev)
+{
+	struct axgbe_rx_queue *rxq;
+	struct axgbe_tx_queue *txq;
+	unsigned int i;
+
+	for (i = 0; i < dev->data->nb_rx_queues; i++) {
+		rxq = dev->data->rx_queues[i];
+		rxq->pkts = 0;
+		rxq->bytes = 0;
+		rxq->errors = 0;
+	}
+	for (i = 0; i < dev->data->nb_tx_queues; i++) {
+		txq = dev->data->tx_queues[i];
+		txq->pkts = 0;
+		txq->bytes = 0;
+		txq->errors = 0;
+	}
+}
+
 static void
 axgbe_dev_info_get(struct rte_eth_dev *dev,
 		   struct rte_eth_dev_info *dev_info)
-- 
2.7.4

  parent reply	other threads:[~2018-04-06 12:37 UTC|newest]

Thread overview: 128+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-30 13:10 [PATCH 01/16] net/axgbe: add minimal dev init and uninit support Ravi Kumar
2017-11-30 13:10 ` [PATCH 02/16] net/axgbe: add register map and related macros Ravi Kumar
2017-12-08 21:04   ` Ferruh Yigit
2017-12-11  7:20   ` Jianbo Liu
2017-11-30 13:10 ` [PATCH 03/16] net/axgbe: add phy register map and helper macros Ravi Kumar
2017-11-30 13:11 ` [PATCH 04/16] net/axgbe: add structures for MAC initialization and reset Ravi Kumar
2017-12-08 21:05   ` Ferruh Yigit
2017-11-30 13:11 ` [PATCH 05/16] net/axgbe: add phy initialization and related apis Ravi Kumar
2017-11-30 13:11 ` [PATCH 06/16] net/axgbe: add phy programming apis Ravi Kumar
2017-11-30 13:11 ` [PATCH 07/16] net/axgbe: add interrupt handler for autonegotiation Ravi Kumar
2017-12-08 21:06   ` Ferruh Yigit
2017-11-30 13:11 ` [PATCH 08/16] net/axgbe: add transmit and receive queue setup apis Ravi Kumar
2017-11-30 13:11 ` [PATCH 09/16] net/axgbe: add DMA programming and dev start and stop apis Ravi Kumar
2017-12-08 21:07   ` Ferruh Yigit
2017-11-30 13:11 ` [PATCH 10/16] net/axgbe: add transmit and receive data path apis Ravi Kumar
2017-12-08 21:08   ` Ferruh Yigit
2017-11-30 13:11 ` [PATCH 11/16] net/axgbe: add configure flow control while link adjustment Ravi Kumar
2017-11-30 13:11 ` [PATCH 12/16] net/axgbe: add promiscuous mode support Ravi Kumar
2017-12-08 21:08   ` Ferruh Yigit
2017-11-30 13:11 ` [PATCH 13/16] net/axgbe: add generic transmit and receive stats support Ravi Kumar
2017-11-30 13:11 ` [PATCH 14/16] doc: add documents for AMD axgbe Ethernet PMD Ravi Kumar
2017-12-08 21:09   ` Ferruh Yigit
2017-11-30 13:11 ` [PATCH 15/16] net/axgbe: add support for icc and clang build Ravi Kumar
2017-11-30 13:11 ` [PATCH 16/16] net/axgbe: add support for build 32-bit mode Ravi Kumar
2017-12-08 21:10   ` Ferruh Yigit
2017-12-05  0:25 ` [PATCH 01/16] net/axgbe: add minimal dev init and uninit support Ferruh Yigit
2017-12-08 21:04 ` Ferruh Yigit
2017-12-09 13:18   ` Kumar, Ravi1
2018-01-05  9:52 ` [PATCH v2 " Ravi Kumar
2018-01-05  9:52   ` [PATCH v2 02/16] net/axgbe: add register map and related macros Ravi Kumar
2018-01-05  9:52   ` [PATCH v2 03/16] net/axgbe: add phy register map and helper macros Ravi Kumar
2018-01-05  9:52   ` [PATCH v2 04/16] net/axgbe: add structures for MAC initialization and reset Ravi Kumar
2018-01-05  9:52   ` [PATCH v2 05/16] net/axgbe: add phy initialization and related apis Ravi Kumar
2018-01-05  9:52   ` [PATCH v2 06/16] net/axgbe: add phy programming apis Ravi Kumar
2018-01-05  9:52   ` [PATCH v2 07/16] net/axgbe: add interrupt handler for autonegotiation Ravi Kumar
2018-01-05  9:52   ` [PATCH v2 08/16] net/axgbe: add transmit and receive queue setup apis Ravi Kumar
2018-01-05  9:52   ` [PATCH v2 09/16] net/axgbe: add DMA programming and dev start and stop apis Ravi Kumar
2018-01-05  9:52   ` [PATCH v2 10/16] net/axgbe: add transmit and receive data path apis Ravi Kumar
2018-01-05  9:52   ` [PATCH v2 11/16] doc: add documents for AMD axgbe Ethernet PMD Ravi Kumar
2018-01-05 20:33     ` Stephen Hemminger
2018-01-08  5:40       ` Kumar, Ravi1
2018-01-15 14:51         ` Kovacevic, Marko
2018-01-05  9:52   ` [PATCH v2 12/16] net/axgbe: add link status update Ravi Kumar
2018-01-05  9:52   ` [PATCH v2 13/16] net/axgbe: add configure flow control while link adjustment Ravi Kumar
2018-01-05  9:52   ` [PATCH v2 14/16] net/axgbe: add promiscuous mode support Ravi Kumar
2018-01-05  9:52   ` [PATCH v2 15/16] net/axgbe: add generic transmit and receive status support Ravi Kumar
2018-01-05  9:52   ` [PATCH v2 16/16] net/axgbe: add support for build 32-bit mode Ravi Kumar
2018-01-05 20:32     ` Stephen Hemminger
2018-01-09 20:17   ` [PATCH v2 01/16] net/axgbe: add minimal dev init and uninit support Ferruh Yigit
2018-01-11  6:42     ` Kumar, Ravi1
2018-03-09  8:42   ` [PATCH v3 01/18] " Ravi Kumar
2018-03-09  8:42     ` [PATCH v3 02/18] net/axgbe: add register map and related macros Ravi Kumar
2018-03-09  8:42     ` [PATCH v3 03/18] net/axgbe: add phy register map and helper macros Ravi Kumar
2018-03-09  8:42     ` [PATCH v3 04/18] net/axgbe: add structures for MAC initialization and reset Ravi Kumar
2018-03-16 17:43       ` Ferruh Yigit
2018-03-09  8:42     ` [PATCH v3 05/18] net/axgbe: add phy initialization and related apis Ravi Kumar
2018-03-09  8:42     ` [PATCH v3 06/18] net/axgbe: add phy programming apis Ravi Kumar
2018-03-09  8:42     ` [PATCH v3 07/18] net/axgbe: add interrupt handler for autonegotiation Ravi Kumar
2018-03-09  8:42     ` [PATCH v3 08/18] net/axgbe: add transmit and receive queue setup apis Ravi Kumar
2018-03-16 17:44       ` Ferruh Yigit
2018-03-09  8:42     ` [PATCH v3 09/18] net/axgbe: add DMA programming and dev start and stop apis Ravi Kumar
2018-03-09  8:42     ` [PATCH v3 10/18] net/axgbe: add transmit and receive data path apis Ravi Kumar
2018-03-16 17:45       ` Ferruh Yigit
2018-03-09  8:42     ` [PATCH v3 11/18] doc: add documents for AMD axgbe Ethernet PMD Ravi Kumar
2018-03-16 17:46       ` Ferruh Yigit
2018-03-09  8:42     ` [PATCH v3 12/18] net/axgbe: add link status update Ravi Kumar
2018-03-16 17:46       ` Ferruh Yigit
2018-03-09  8:42     ` [PATCH v3 13/18] net/axgbe: add configure flow control while link adjustment Ravi Kumar
2018-03-09  8:42     ` [PATCH v3 14/18] net/axgbe: add promiscuous mode support Ravi Kumar
2018-03-09  8:42     ` [PATCH v3 15/18] net/axgbe: add generic transmit and receive stats support Ravi Kumar
2018-03-16 17:47       ` Ferruh Yigit
2018-03-09  8:42     ` [PATCH v3 16/18] net/axgbe: add support for build 32-bit mode Ravi Kumar
2018-03-09  8:42     ` [PATCH v3 17/18] net/axgbe: add workaround for axgbe ethernet training bug Ravi Kumar
2018-03-09  8:42     ` [PATCH v3 18/18] net/axgbe: moved license headers to SPDX format Ravi Kumar
2018-03-11 23:31       ` Stephen Hemminger
2018-03-12 11:23         ` Kumar, Ravi1
2018-03-09 16:13     ` [PATCH v3 01/18] net/axgbe: add minimal dev init and uninit support Ferruh Yigit
2018-03-09 16:39       ` Ferruh Yigit
2018-03-12 11:25         ` Kumar, Ravi1
2018-03-16 17:42     ` Ferruh Yigit
2018-03-19 12:33       ` Kumar, Ravi1
2018-04-03 12:21         ` Ferruh Yigit
2018-04-05  6:39     ` [PATCH v4 01/17] " Ravi Kumar
2018-04-05  6:39       ` [PATCH v4 02/17] net/axgbe: add register map and related macros Ravi Kumar
2018-04-05  6:39       ` [PATCH v4 03/17] net/axgbe: add phy register map and helper macros Ravi Kumar
2018-04-05  6:39       ` [PATCH v4 04/17] net/axgbe: add structures for MAC initialization and reset Ravi Kumar
2018-04-05  6:39       ` [PATCH v4 05/17] net/axgbe: add phy initialization and related apis Ravi Kumar
2018-04-05  6:39       ` [PATCH v4 06/17] net/axgbe: add phy programming apis Ravi Kumar
2018-04-05  6:39       ` [PATCH v4 07/17] net/axgbe: add interrupt handler for autonegotiation Ravi Kumar
2018-04-05  6:39       ` [PATCH v4 08/17] net/axgbe: add transmit and receive queue setup apis Ravi Kumar
2018-04-05  6:39       ` [PATCH v4 09/17] net/axgbe: add DMA programming and dev start and stop apis Ravi Kumar
2018-04-05  6:39       ` [PATCH v4 10/17] net/axgbe: add transmit and receive data path apis Ravi Kumar
2018-04-05 11:34         ` Ferruh Yigit
2018-04-06 12:40           ` Kumar, Ravi1
2018-04-05  6:39       ` [PATCH v4 11/17] doc: add documents for AMD axgbe Ethernet PMD Ravi Kumar
2018-04-05  6:39       ` [PATCH v4 12/17] net/axgbe: add link status update Ravi Kumar
2018-04-05  6:39       ` [PATCH v4 13/17] net/axgbe: add configure flow control while link adjustment Ravi Kumar
2018-04-05  6:39       ` [PATCH v4 14/17] net/axgbe: add promiscuous mode support Ravi Kumar
2018-04-05  6:39       ` [PATCH v4 15/17] net/axgbe: support generic transmit and receive stats api Ravi Kumar
2018-04-05  6:39       ` [PATCH v4 16/17] net/axgbe: add support for build 32-bit mode Ravi Kumar
2018-04-05  6:39       ` [PATCH v4 17/17] net/axgbe: add workaround for axgbe ethernet training bug Ravi Kumar
2018-04-05 11:35         ` Ferruh Yigit
2018-04-06 12:41           ` Kumar, Ravi1
2018-04-05 11:34       ` [PATCH v4 01/17] net/axgbe: add minimal dev init and uninit support Ferruh Yigit
2018-04-06 12:39         ` Kumar, Ravi1
2018-04-06 12:36       ` [PATCH v5 01/18] " Ravi Kumar
2018-04-06 12:36         ` [PATCH v5 02/18] net/axgbe: add register map and related macros Ravi Kumar
2018-04-06 12:36         ` [PATCH v5 03/18] net/axgbe: add phy register map and helper macros Ravi Kumar
2018-04-06 12:36         ` [PATCH v5 04/18] net/axgbe: add structures for MAC initialization and reset Ravi Kumar
2018-04-06 12:36         ` [PATCH v5 05/18] net/axgbe: add phy initialization and related apis Ravi Kumar
2018-04-06 12:36         ` [PATCH v5 06/18] net/axgbe: add phy programming apis Ravi Kumar
2018-04-06 12:36         ` [PATCH v5 07/18] net/axgbe: add interrupt handler for autonegotiation Ravi Kumar
2018-04-06 12:36         ` [PATCH v5 08/18] net/axgbe: add transmit and receive queue setup apis Ravi Kumar
2018-04-09  4:49           ` Rosen, Rami
2018-04-09 12:30             ` Ferruh Yigit
2018-04-06 12:36         ` [PATCH v5 09/18] net/axgbe: add DMA programming and dev start and stop apis Ravi Kumar
2018-04-06 12:36         ` [PATCH v5 10/18] net/axgbe: add transmit and receive data path apis Ravi Kumar
2018-04-06 12:36         ` [PATCH v5 11/18] doc: add documents for AMD axgbe Ethernet PMD Ravi Kumar
2018-04-06 12:36         ` [PATCH v5 12/18] net/axgbe: add link status update Ravi Kumar
2018-04-06 12:36         ` [PATCH v5 13/18] net/axgbe: add configure flow control while link adjustment Ravi Kumar
2018-04-06 12:36         ` [PATCH v5 14/18] net/axgbe: add promiscuous mode support Ravi Kumar
2018-04-06 12:36         ` Ravi Kumar [this message]
2018-04-06 12:36         ` [PATCH v5 16/18] net/axgbe: add support for build 32-bit mode Ravi Kumar
2018-04-06 12:36         ` [PATCH v5 17/18] net/axgbe: add workaround for axgbe ethernet training bug Ravi Kumar
2018-04-06 12:36         ` [PATCH v5 18/18] net/axgbe : support meson build Ravi Kumar
2018-04-06 15:55         ` [PATCH v5 01/18] net/axgbe: add minimal dev init and uninit support Ferruh Yigit
2018-04-09  6:00           ` Kumar, Ravi1
2018-11-22 14:39             ` Ferruh Yigit

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=1523018211-65765-15-git-send-email-Ravi1.kumar@amd.com \
    --to=ravi1.kumar@amd.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.