DPDK patches and discussions
 help / color / mirror / Atom feed
From: Allain Legacy <allain.legacy@windriver.com>
To: <ferruh.yigit@intel.com>
Cc: <dev@dpdk.org>
Subject: [dpdk-dev] [PATCH 13/16] net/avp: device statistics operations
Date: Fri, 24 Feb 2017 20:23:12 -0500	[thread overview]
Message-ID: <1487985795-136044-14-git-send-email-allain.legacy@windriver.com> (raw)
In-Reply-To: <1487985795-136044-1-git-send-email-allain.legacy@windriver.com>

Adds support for device get/set operations against an AVP device so that an
application can query and reset statistics on an AVP device.

Signed-off-by: Allain Legacy <allain.legacy@windriver.com>
Signed-off-by: Matt Peters <matt.peters@windriver.com>
---
 config/common_base           |  1 +
 drivers/net/avp/avp_ethdev.c | 81 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 82 insertions(+)

diff --git a/config/common_base b/config/common_base
index fe8363d..02dac41 100644
--- a/config/common_base
+++ b/config/common_base
@@ -355,6 +355,7 @@ CONFIG_RTE_LIBRTE_AVP_DEBUG_RX=n
 CONFIG_RTE_LIBRTE_AVP_DEBUG_TX=n
 CONFIG_RTE_LIBRTE_AVP_DEBUG_DRIVER=y
 CONFIG_RTE_LIBRTE_AVP_DEBUG_BUFFERS=n
+CONFIG_RTE_LIBRTE_AVP_STATS=y
 
 #
 # Compile the TAP PMD
diff --git a/drivers/net/avp/avp_ethdev.c b/drivers/net/avp/avp_ethdev.c
index ffb6eeb..61861fc 100644
--- a/drivers/net/avp/avp_ethdev.c
+++ b/drivers/net/avp/avp_ethdev.c
@@ -103,6 +103,12 @@ static uint16_t avp_xmit_pkts(void *tx_queue,
 
 static void avp_dev_rx_queue_release(void *rxq);
 static void avp_dev_tx_queue_release(void *txq);
+
+static void avp_dev_stats_get(struct rte_eth_dev *dev,
+			      struct rte_eth_stats *stats);
+static void avp_dev_stats_reset(struct rte_eth_dev *dev);
+
+
 #define AVP_DEV_TO_PCI(eth_dev) RTE_DEV_TO_PCI((eth_dev)->device)
 
 
@@ -149,6 +155,8 @@ static uint16_t avp_xmit_pkts(void *tx_queue,
 	.dev_configure       = avp_dev_configure,
 	.dev_infos_get       = avp_dev_info_get,
 	.vlan_offload_set    = avp_vlan_offload_set,
+	.stats_get           = avp_dev_stats_get,
+	.stats_reset         = avp_dev_stats_reset,
 	.link_update         = avp_dev_link_update,
 	.rx_queue_setup      = avp_dev_rx_queue_setup,
 	.rx_queue_release    = avp_dev_rx_queue_release,
@@ -2095,6 +2103,79 @@ struct avp_queue {
 	}
 }
 
+static void
+avp_dev_stats_get(struct rte_eth_dev *eth_dev, struct rte_eth_stats *stats)
+{
+#ifdef RTE_LIBRTE_AVP_STATS
+	struct avp_dev *avp =
+		RTE_AVP_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
+	unsigned i;
+
+	memset(stats, 0, sizeof(*stats));
+	for (i = 0; i < avp->num_rx_queues; i++) {
+		struct avp_queue *rxq = avp->dev_data->rx_queues[i];
+
+		if (rxq) {
+			stats->ipackets += rxq->packets;
+			stats->ibytes += rxq->bytes;
+			stats->ierrors += rxq->errors;
+
+			stats->q_ipackets[i] += rxq->packets;
+			stats->q_ibytes[i] += rxq->bytes;
+			stats->q_errors[i] += rxq->errors;
+		}
+	}
+
+	for (i = 0; i < avp->num_tx_queues; i++) {
+		struct avp_queue *txq = avp->dev_data->tx_queues[i];
+
+		if (txq) {
+			stats->opackets += txq->packets;
+			stats->obytes += txq->bytes;
+			stats->oerrors += txq->errors;
+
+			stats->q_opackets[i] += txq->packets;
+			stats->q_obytes[i] += txq->bytes;
+			stats->q_errors[i] += txq->errors;
+		}
+	}
+#else
+	(void)eth_dev;
+	(void)stats;
+#endif
+}
+
+static void
+avp_dev_stats_reset(struct rte_eth_dev *eth_dev)
+{
+#ifdef RTE_LIBRTE_AVP_STATS
+	struct avp_dev *avp =
+		RTE_AVP_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
+	unsigned i;
+
+	for (i = 0; i < avp->num_rx_queues; i++) {
+		struct avp_queue *rxq = avp->dev_data->rx_queues[i];
+
+		if (rxq) {
+			rxq->bytes = 0;
+			rxq->packets = 0;
+			rxq->errors = 0;
+		}
+	}
+
+	for (i = 0; i < avp->num_tx_queues; i++) {
+		struct avp_queue *txq = avp->dev_data->tx_queues[i];
+
+		if (txq) {
+			txq->bytes = 0;
+			txq->packets = 0;
+			txq->errors = 0;
+		}
+	}
+#else
+	(void)eth_dev;
+#endif
+}
 
 RTE_PMD_REGISTER_PCI(rte_avp, rte_avp_pmd.pci_drv);
 RTE_PMD_REGISTER_PCI_TABLE(rte_avp, pci_id_avp_map);
-- 
1.8.3.1

  parent reply	other threads:[~2017-02-25  1:24 UTC|newest]

Thread overview: 172+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-25  1:22 [dpdk-dev] [PATCH 00/16] Wind River Systems AVP PMD Allain Legacy
2017-02-25  1:23 ` [dpdk-dev] [PATCH 01/16] config: adds attributes for the " Allain Legacy
2017-02-25  1:23 ` [dpdk-dev] [PATCH 02/16] net/avp: public header files Allain Legacy
2017-02-25  1:23 ` [dpdk-dev] [PATCH 03/16] maintainers: claim responsibility for AVP PMD Allain Legacy
2017-02-25  1:23 ` [dpdk-dev] [PATCH 04/16] net/avp: add PMD version map file Allain Legacy
2017-02-25  1:23 ` [dpdk-dev] [PATCH 05/16] net/avp: debug log macros Allain Legacy
2017-02-25  1:23 ` [dpdk-dev] [PATCH 06/16] drivers/net: adds driver makefiles for AVP PMD Allain Legacy
2017-02-25  1:23 ` [dpdk-dev] [PATCH 07/16] net/avp: driver registration Allain Legacy
2017-02-25  1:23 ` [dpdk-dev] [PATCH 08/16] net/avp: device initialization Allain Legacy
2017-02-25  1:23 ` [dpdk-dev] [PATCH 09/16] net/avp: device configuration Allain Legacy
2017-02-25  1:23 ` [dpdk-dev] [PATCH 10/16] net/avp: queue setup and release Allain Legacy
2017-02-25  1:23 ` [dpdk-dev] [PATCH 11/16] net/avp: packet receive functions Allain Legacy
2017-02-25  1:23 ` [dpdk-dev] [PATCH 12/16] net/avp: packet transmit functions Allain Legacy
2017-02-25  1:23 ` Allain Legacy [this message]
2017-02-25  1:23 ` [dpdk-dev] [PATCH 14/16] net/avp: device promiscuous functions Allain Legacy
2017-02-25  1:23 ` [dpdk-dev] [PATCH 15/16] net/avp: device start and stop operations Allain Legacy
2017-02-25  1:23 ` [dpdk-dev] [PATCH 16/16] doc: adds information related to the AVP PMD Allain Legacy
2017-02-26 19:08 ` [dpdk-dev] [PATCH v2 00/16] Wind River Systems " Allain Legacy
2017-02-26 19:08   ` [dpdk-dev] [PATCH v2 01/15] config: adds attributes for the " Allain Legacy
2017-02-26 19:08   ` [dpdk-dev] [PATCH v2 02/15] net/avp: public header files Allain Legacy
2017-02-28 11:49     ` Jerin Jacob
2017-03-01 13:25       ` Legacy, Allain
2017-02-26 19:08   ` [dpdk-dev] [PATCH v2 03/15] maintainers: claim responsibility for AVP PMD Allain Legacy
2017-02-26 19:08   ` [dpdk-dev] [PATCH v2 04/15] net/avp: add PMD version map file Allain Legacy
2017-02-26 19:08   ` [dpdk-dev] [PATCH v2 05/15] net/avp: debug log macros Allain Legacy
2017-02-26 19:08   ` [dpdk-dev] [PATCH v2 06/15] drivers/net: adds driver makefiles for AVP PMD Allain Legacy
2017-02-26 19:08   ` [dpdk-dev] [PATCH v2 07/15] net/avp: driver registration Allain Legacy
2017-02-27 16:47     ` Stephen Hemminger
2017-02-27 17:10       ` Legacy, Allain
2017-02-27 16:53     ` Stephen Hemminger
2017-02-27 17:09       ` Legacy, Allain
2017-02-26 19:08   ` [dpdk-dev] [PATCH v2 08/15] net/avp: device initialization Allain Legacy
2017-02-28 11:57     ` Jerin Jacob
2017-03-01 13:29       ` Legacy, Allain
2017-02-26 19:08   ` [dpdk-dev] [PATCH v2 09/15] net/avp: device configuration Allain Legacy
2017-02-26 19:08   ` [dpdk-dev] [PATCH v2 10/15] net/avp: queue setup and release Allain Legacy
2017-02-26 19:08   ` [dpdk-dev] [PATCH v2 11/15] net/avp: packet receive functions Allain Legacy
2017-02-27 16:46     ` Stephen Hemminger
2017-02-27 17:06       ` Legacy, Allain
2017-02-28 10:27         ` Bruce Richardson
2017-03-01 13:23           ` Legacy, Allain
2017-03-01 14:14             ` Thomas Monjalon
2017-03-01 14:54               ` Legacy, Allain
2017-03-01 15:10               ` Stephen Hemminger
2017-03-01 15:40                 ` Legacy, Allain
2017-02-26 19:09   ` [dpdk-dev] [PATCH v2 12/15] net/avp: packet transmit functions Allain Legacy
2017-02-26 22:18     ` Legacy, Allain
2017-02-26 19:09   ` [dpdk-dev] [PATCH v2 13/15] net/avp: device promiscuous functions Allain Legacy
2017-02-26 19:09   ` [dpdk-dev] [PATCH v2 14/15] net/avp: device start and stop operations Allain Legacy
2017-02-26 19:09   ` [dpdk-dev] [PATCH v2 15/15] doc: adds information related to the AVP PMD Allain Legacy
2017-02-27 17:04     ` Mcnamara, John
2017-02-27 17:07       ` Legacy, Allain
2017-02-27  8:54   ` [dpdk-dev] [PATCH v2 00/16] Wind River Systems " Vincent JARDIN
2017-02-27 12:15     ` Legacy, Allain
2017-02-27 15:17       ` Wiles, Keith
2017-03-02  0:19   ` [dpdk-dev] [PATCH v3 " Allain Legacy
2017-03-02  0:19     ` [dpdk-dev] [PATCH v3 01/16] config: adds attributes for the " Allain Legacy
2017-03-02  0:19     ` [dpdk-dev] [PATCH v3 02/16] net/avp: public header files Allain Legacy
2017-03-03 14:37       ` Chas Williams
2017-03-03 15:35         ` Legacy, Allain
2017-03-02  0:19     ` [dpdk-dev] [PATCH v3 03/16] maintainers: claim responsibility for AVP PMD Allain Legacy
2017-03-02  0:19     ` [dpdk-dev] [PATCH v3 04/16] net/avp: add PMD version map file Allain Legacy
2017-03-02  0:19     ` [dpdk-dev] [PATCH v3 05/16] net/avp: debug log macros Allain Legacy
2017-03-02  0:19     ` [dpdk-dev] [PATCH v3 06/16] drivers/net: adds driver makefiles for AVP PMD Allain Legacy
2017-03-02  0:19     ` [dpdk-dev] [PATCH v3 07/16] net/avp: driver registration Allain Legacy
2017-03-02  0:20     ` [dpdk-dev] [PATCH v3 08/16] net/avp: device initialization Allain Legacy
2017-03-03 15:04       ` Chas Williams
2017-03-09 14:03         ` Legacy, Allain
2017-03-09 14:48         ` Legacy, Allain
2017-03-02  0:20     ` [dpdk-dev] [PATCH v3 09/16] net/avp: device configuration Allain Legacy
2017-03-02  0:20     ` [dpdk-dev] [PATCH v3 10/16] net/avp: queue setup and release Allain Legacy
2017-03-02  0:20     ` [dpdk-dev] [PATCH v3 11/16] net/avp: packet receive functions Allain Legacy
2017-03-02  0:20     ` [dpdk-dev] [PATCH v3 12/16] net/avp: packet transmit functions Allain Legacy
2017-03-02  0:20     ` [dpdk-dev] [PATCH v3 13/16] net/avp: device statistics operations Allain Legacy
2017-03-02  0:35       ` Stephen Hemminger
2017-03-09 13:48         ` Legacy, Allain
2017-03-02  0:20     ` [dpdk-dev] [PATCH v3 14/16] net/avp: device promiscuous functions Allain Legacy
2017-03-02  0:20     ` [dpdk-dev] [PATCH v3 15/16] net/avp: device start and stop operations Allain Legacy
2017-03-02  0:37       ` Stephen Hemminger
2017-03-09 13:49         ` Legacy, Allain
2017-03-02  0:20     ` [dpdk-dev] [PATCH v3 16/16] doc: adds information related to the AVP PMD Allain Legacy
2017-03-03 16:21       ` Vincent JARDIN
2017-03-13 19:17         ` Legacy, Allain
2017-03-13 19:16     ` [dpdk-dev] [PATCH v4 00/17] Wind River Systems " Allain Legacy
2017-03-13 19:16       ` [dpdk-dev] [PATCH v4 01/17] config: adds attributes for the " Allain Legacy
2017-03-13 19:16       ` [dpdk-dev] [PATCH v4 02/17] net/avp: public header files Allain Legacy
2017-03-13 19:16       ` [dpdk-dev] [PATCH v4 03/17] maintainers: claim responsibility for AVP PMD Allain Legacy
2017-03-13 19:16       ` [dpdk-dev] [PATCH v4 04/17] net/avp: add PMD version map file Allain Legacy
2017-03-16 14:52         ` Ferruh Yigit
2017-03-16 15:33           ` Legacy, Allain
2017-03-13 19:16       ` [dpdk-dev] [PATCH v4 05/17] net/avp: debug log macros Allain Legacy
2017-03-13 19:16       ` [dpdk-dev] [PATCH v4 06/17] drivers/net: adds driver makefiles for AVP PMD Allain Legacy
2017-03-13 19:16       ` [dpdk-dev] [PATCH v4 07/17] net/avp: driver registration Allain Legacy
2017-03-16 14:53         ` Ferruh Yigit
2017-03-16 15:37           ` Legacy, Allain
2017-03-13 19:16       ` [dpdk-dev] [PATCH v4 08/17] net/avp: device initialization Allain Legacy
2017-03-13 19:16       ` [dpdk-dev] [PATCH v4 09/17] net/avp: device configuration Allain Legacy
2017-03-13 19:16       ` [dpdk-dev] [PATCH v4 10/17] net/avp: queue setup and release Allain Legacy
2017-03-13 19:16       ` [dpdk-dev] [PATCH v4 11/17] net/avp: packet receive functions Allain Legacy
2017-03-13 19:16       ` [dpdk-dev] [PATCH v4 12/17] net/avp: packet transmit functions Allain Legacy
2017-03-13 19:16       ` [dpdk-dev] [PATCH v4 13/17] net/avp: device statistics operations Allain Legacy
2017-03-13 19:16       ` [dpdk-dev] [PATCH v4 14/17] net/avp: device promiscuous functions Allain Legacy
2017-03-13 19:16       ` [dpdk-dev] [PATCH v4 15/17] net/avp: device start and stop operations Allain Legacy
2017-03-13 19:16       ` [dpdk-dev] [PATCH v4 16/17] net/avp: migration interrupt handling Allain Legacy
2017-03-13 19:16       ` [dpdk-dev] [PATCH v4 17/17] doc: adds information related to the AVP PMD Allain Legacy
2017-03-16 14:53         ` Ferruh Yigit
2017-03-16 15:37           ` Legacy, Allain
2017-03-14 17:37       ` [dpdk-dev] [PATCH v4 00/17] Wind River Systems AVP PMD vs virtio? Vincent JARDIN
2017-03-15  4:10         ` O'Driscoll, Tim
2017-03-15 10:55           ` Thomas Monjalon
2017-03-15 14:02             ` Vincent JARDIN
2017-03-16  3:18               ` O'Driscoll, Tim
2017-03-16  8:52                 ` Francois Ozog
2017-03-16  9:51                   ` Wiles, Keith
2017-03-16 10:32                 ` Chas Williams
2017-03-16 18:09                   ` Francois Ozog
2017-03-15 11:29           ` Ferruh Yigit
2017-03-15 14:08             ` Vincent JARDIN
2017-03-15 18:18               ` Ferruh Yigit
2017-03-15 14:02           ` Vincent JARDIN
2017-03-15 14:02           ` Vincent JARDIN
2017-03-15 20:19             ` Wiles, Keith
2017-03-16 23:17           ` Stephen Hemminger
2017-03-16 23:41             ` [dpdk-dev] [PATCH v4 00/17] Wind River Systems AVP PMD vs virtio? - ivshmem is back Vincent JARDIN
2017-03-17  0:08               ` Wiles, Keith
2017-03-17  0:15                 ` O'Driscoll, Tim
2017-03-17  0:11               ` Wiles, Keith
2017-03-17  0:14                 ` Stephen Hemminger
2017-03-17  0:31                 ` Vincent JARDIN
2017-03-17  0:53                   ` Wiles, Keith
2017-03-17  8:48                     ` Thomas Monjalon
2017-03-17 10:15                       ` Legacy, Allain
2017-03-17 13:52                       ` Michael S. Tsirkin
2017-03-20 22:30                         ` Hobywan Kenoby
2017-03-21 11:06                           ` Thomas Monjalon
     [not found]                       ` <20170317093320.GA11116@stefanha-x1.localdomain>
2017-03-30  8:55                         ` Markus Armbruster
2017-03-23 11:23       ` [dpdk-dev] [PATCH v5 00/14] Wind River Systems AVP PMD Allain Legacy
2017-03-23 11:24         ` [dpdk-dev] [PATCH v5 01/14] drivers/net: adds AVP PMD base files Allain Legacy
2017-03-23 11:24         ` [dpdk-dev] [PATCH v5 02/14] net/avp: public header files Allain Legacy
2017-03-23 11:24         ` [dpdk-dev] [PATCH v5 03/14] net/avp: debug log macros Allain Legacy
2017-03-23 11:24         ` [dpdk-dev] [PATCH v5 04/14] net/avp: driver registration Allain Legacy
2017-03-23 11:24         ` [dpdk-dev] [PATCH v5 05/14] net/avp: device initialization Allain Legacy
2017-03-23 11:24         ` [dpdk-dev] [PATCH v5 06/14] net/avp: device configuration Allain Legacy
2017-03-23 11:24         ` [dpdk-dev] [PATCH v5 07/14] net/avp: queue setup and release Allain Legacy
2017-03-23 11:24         ` [dpdk-dev] [PATCH v5 08/14] net/avp: packet receive functions Allain Legacy
2017-03-23 11:24         ` [dpdk-dev] [PATCH v5 09/14] net/avp: packet transmit functions Allain Legacy
2017-03-23 11:24         ` [dpdk-dev] [PATCH v5 10/14] net/avp: device statistics operations Allain Legacy
2017-03-23 11:24         ` [dpdk-dev] [PATCH v5 11/14] net/avp: device promiscuous functions Allain Legacy
2017-03-23 11:24         ` [dpdk-dev] [PATCH v5 12/14] net/avp: device start and stop operations Allain Legacy
2017-03-23 11:24         ` [dpdk-dev] [PATCH v5 13/14] net/avp: migration interrupt handling Allain Legacy
2017-03-23 11:24         ` [dpdk-dev] [PATCH v5 14/14] doc: adds information related to the AVP PMD Allain Legacy
2017-03-23 14:18         ` [dpdk-dev] [PATCH v5 00/14] Wind River Systems " Ferruh Yigit
2017-03-23 18:28           ` Legacy, Allain
2017-03-23 20:35             ` Vincent Jardin
2017-03-28 11:53         ` [dpdk-dev] [PATCH v6 " Allain Legacy
2017-03-28 11:53           ` [dpdk-dev] [PATCH v6 01/14] drivers/net: adds AVP PMD base files Allain Legacy
2017-03-28 11:53           ` [dpdk-dev] [PATCH v6 02/14] net/avp: public header files Allain Legacy
2017-03-28 11:53           ` [dpdk-dev] [PATCH v6 03/14] net/avp: debug log macros Allain Legacy
2017-03-28 11:53           ` [dpdk-dev] [PATCH v6 04/14] net/avp: driver registration Allain Legacy
2017-03-28 11:54           ` [dpdk-dev] [PATCH v6 05/14] net/avp: device initialization Allain Legacy
2017-03-28 11:54           ` [dpdk-dev] [PATCH v6 06/14] net/avp: device configuration Allain Legacy
2017-03-29 10:28             ` Ferruh Yigit
2017-03-28 11:54           ` [dpdk-dev] [PATCH v6 07/14] net/avp: queue setup and release Allain Legacy
2017-03-28 11:54           ` [dpdk-dev] [PATCH v6 08/14] net/avp: packet receive functions Allain Legacy
2017-03-28 11:54           ` [dpdk-dev] [PATCH v6 09/14] net/avp: packet transmit functions Allain Legacy
2017-03-28 11:54           ` [dpdk-dev] [PATCH v6 10/14] net/avp: device statistics operations Allain Legacy
2017-03-28 11:54           ` [dpdk-dev] [PATCH v6 11/14] net/avp: device promiscuous functions Allain Legacy
2017-03-28 11:54           ` [dpdk-dev] [PATCH v6 12/14] net/avp: device start and stop operations Allain Legacy
2017-03-28 11:54           ` [dpdk-dev] [PATCH v6 13/14] net/avp: migration interrupt handling Allain Legacy
2017-03-28 11:54           ` [dpdk-dev] [PATCH v6 14/14] doc: adds information related to the AVP PMD Allain Legacy
2017-03-29 10:44           ` [dpdk-dev] [PATCH v6 00/14] Wind River Systems " Vincent JARDIN
2017-03-29 11:05             ` 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=1487985795-136044-14-git-send-email-allain.legacy@windriver.com \
    --to=allain.legacy@windriver.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 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).