DPDK patches and discussions
 help / color / mirror / Atom feed
From: Wenzhuo Lu <wenzhuo.lu@intel.com>
To: dev@dpdk.org
Cc: Jingjing Wu <jingjing.wu@intel.com>
Subject: [dpdk-dev] [PATCH v4 06/15] net/avf: support stats
Date: Fri,  5 Jan 2018 16:21:36 +0800	[thread overview]
Message-ID: <1515140505-38655-7-git-send-email-wenzhuo.lu@intel.com> (raw)
In-Reply-To: <1515140505-38655-1-git-send-email-wenzhuo.lu@intel.com>

From: Jingjing Wu <jingjing.wu@intel.com>

Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
---
 doc/guides/nics/features/avf.ini |  1 +
 drivers/net/avf/avf.h            |  2 ++
 drivers/net/avf/avf_ethdev.c     | 27 +++++++++++++++++++++++++++
 drivers/net/avf/avf_vchnl.c      | 27 +++++++++++++++++++++++++++
 4 files changed, 57 insertions(+)

diff --git a/doc/guides/nics/features/avf.ini b/doc/guides/nics/features/avf.ini
index 77e4f53..af84599 100644
--- a/doc/guides/nics/features/avf.ini
+++ b/doc/guides/nics/features/avf.ini
@@ -17,6 +17,7 @@ VLAN offload         = Y
 L3 checksum offload  = Y
 L4 checksum offload  = Y
 Packet type parsing  = Y
+Basic stats          = Y
 Multiprocess aware   = Y
 BSD nic_uio          = Y
 Linux UIO            = Y
diff --git a/drivers/net/avf/avf.h b/drivers/net/avf/avf.h
index c97b2ee..680b117 100644
--- a/drivers/net/avf/avf.h
+++ b/drivers/net/avf/avf.h
@@ -204,4 +204,6 @@ int avf_switch_queue(struct avf_adapter *adapter, uint16_t qid,
 void avf_add_del_all_mac_addr(struct avf_adapter *adapter, bool add);
 int avf_dev_link_update(struct rte_eth_dev *dev,
 			__rte_unused int wait_to_complete);
+int avf_query_stats(struct avf_adapter *adapter,
+		    struct virtchnl_eth_stats **pstats);
 #endif /* _AVF_ETHDEV_H_ */
diff --git a/drivers/net/avf/avf_ethdev.c b/drivers/net/avf/avf_ethdev.c
index 7f7ddf9..bf6251b 100644
--- a/drivers/net/avf/avf_ethdev.c
+++ b/drivers/net/avf/avf_ethdev.c
@@ -40,6 +40,8 @@
 static void avf_dev_info_get(struct rte_eth_dev *dev,
 			     struct rte_eth_dev_info *dev_info);
 static const uint32_t *avf_dev_supported_ptypes_get(struct rte_eth_dev *dev);
+static int avf_dev_stats_get(struct rte_eth_dev *dev,
+			     struct rte_eth_stats *stats);
 
 int avf_logtype_init;
 int avf_logtype_driver;
@@ -56,6 +58,7 @@ static void avf_dev_info_get(struct rte_eth_dev *dev,
 	.dev_infos_get              = avf_dev_info_get,
 	.dev_supported_ptypes_get   = avf_dev_supported_ptypes_get,
 	.link_update                = avf_dev_link_update,
+	.stats_get                  = avf_dev_stats_get,
 	.rx_queue_start             = avf_dev_rx_queue_start,
 	.rx_queue_stop              = avf_dev_rx_queue_stop,
 	.tx_queue_start             = avf_dev_tx_queue_start,
@@ -478,6 +481,30 @@ static void avf_dev_info_get(struct rte_eth_dev *dev,
 }
 
 static int
+avf_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
+{
+	struct avf_adapter *adapter =
+		AVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
+	struct virtchnl_eth_stats *pstats = NULL;
+	int ret;
+
+	ret = avf_query_stats(adapter, &pstats);
+	if (ret == 0) {
+		stats->ipackets = pstats->rx_unicast + pstats->rx_multicast +
+						pstats->rx_broadcast;
+		stats->opackets = pstats->tx_broadcast + pstats->tx_multicast +
+						pstats->tx_unicast;
+		stats->imissed = pstats->rx_discards;
+		stats->oerrors = pstats->tx_errors + pstats->tx_discards;
+		stats->ibytes = pstats->rx_bytes;
+		stats->obytes = pstats->tx_bytes;
+	} else {
+		PMD_DRV_LOG(ERR, "Get statistics failed");
+	}
+	return -EIO;
+}
+
+static int
 avf_check_vf_reset_done(struct avf_hw *hw)
 {
 	int i, reset;
diff --git a/drivers/net/avf/avf_vchnl.c b/drivers/net/avf/avf_vchnl.c
index f5da601..e26527f 100644
--- a/drivers/net/avf/avf_vchnl.c
+++ b/drivers/net/avf/avf_vchnl.c
@@ -693,3 +693,30 @@
 		begin = next_begin;
 	} while (begin < AVF_NUM_MACADDR_MAX);
 }
+
+int
+avf_query_stats(struct avf_adapter *adapter,
+		struct virtchnl_eth_stats **pstats)
+{
+	struct avf_info *vf = AVF_DEV_PRIVATE_TO_VF(adapter);
+	struct virtchnl_queue_select q_stats;
+	struct avf_cmd_info args;
+	int err;
+
+	memset(&q_stats, 0, sizeof(q_stats));
+	q_stats.vsi_id = vf->vsi_res->vsi_id;
+	args.ops = VIRTCHNL_OP_GET_STATS;
+	args.in_args = (uint8_t *)&q_stats;
+	args.in_args_size = sizeof(q_stats);
+	args.out_buffer = vf->aq_resp;
+	args.out_size = AVF_AQ_BUF_SZ;
+
+	err = avf_execute_vf_cmd(adapter, &args);
+	if (err) {
+		PMD_DRV_LOG(ERR, "fail to execute command OP_GET_STATS");
+		*pstats = NULL;
+		return err;
+	}
+	*pstats = (struct virtchnl_eth_stats *)args.out_buffer;
+	return 0;
+}
-- 
1.9.3

  parent reply	other threads:[~2018-01-05  8:19 UTC|newest]

Thread overview: 151+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-20  8:26 [dpdk-dev] [RFC 0/9] add new avf PMD Jingjing Wu
2017-10-20  8:26 ` [dpdk-dev] [RFC 1/9] net/avf/base: add base code for " Jingjing Wu
2017-10-20  8:26 ` [dpdk-dev] [RFC 2/9] net/avf: initilization of " Jingjing Wu
2017-11-22  0:02   ` Ferruh Yigit
2017-10-20  8:26 ` [dpdk-dev] [RFC 3/9] net/avf: enable queue and device Jingjing Wu
2017-11-22  0:04   ` Ferruh Yigit
2017-10-20  8:26 ` [dpdk-dev] [RFC 4/9] net/avf: enable basic Rx Tx func Jingjing Wu
2017-11-22  0:06   ` Ferruh Yigit
2017-11-22  0:57     ` Stephen Hemminger
2017-11-22 23:15       ` Ferruh Yigit
2017-11-22  7:55     ` Wu, Jingjing
2017-11-22 22:38       ` Ferruh Yigit
2017-11-23  1:17         ` Wu, Jingjing
2017-10-20  8:26 ` [dpdk-dev] [RFC 5/9] net/avf: enable link status update Jingjing Wu
2017-10-20  8:26 ` [dpdk-dev] [RFC 6/9] net/avf: enable ops for MAC VLAN offload Jingjing Wu
2017-11-22  0:07   ` Ferruh Yigit
2017-10-20  8:26 ` [dpdk-dev] [RFC 7/9] net/avf: enable ops for rss setting Jingjing Wu
2017-11-22  0:07   ` Ferruh Yigit
2017-10-20  8:26 ` [dpdk-dev] [RFC 8/9] net/avf: enable ops to check queue info and status Jingjing Wu
2017-11-22  0:09   ` Ferruh Yigit
2017-11-22  8:23     ` Wu, Jingjing
2017-10-20  8:26 ` [dpdk-dev] [RFC 9/9] net/i40e: support AVF basic interface Jingjing Wu
2017-11-21 23:58 ` [dpdk-dev] [RFC 0/9] add new avf PMD Ferruh Yigit
2017-11-24  6:33 ` [dpdk-dev] [PATCH v2 00/14] " Jingjing Wu
2017-11-24  6:33   ` [dpdk-dev] [PATCH v2 01/14] net/avf/base: add base code for " Jingjing Wu
2017-12-04 19:50     ` Ferruh Yigit
2017-11-24  6:33   ` [dpdk-dev] [PATCH v2 02/14] net/avf: initilization of " Jingjing Wu
2017-12-04 19:52     ` Ferruh Yigit
2017-11-24  6:33   ` [dpdk-dev] [PATCH v2 03/14] net/avf: enable queue and device Jingjing Wu
2017-12-04  8:45     ` Xing, Beilei
2017-12-04 19:56     ` Ferruh Yigit
2017-11-24  6:33   ` [dpdk-dev] [PATCH v2 04/14] net/avf: enable basic Rx Tx func Jingjing Wu
2017-12-04 19:57     ` Ferruh Yigit
2017-12-27  3:07       ` Wu, Jingjing
2017-11-24  6:33   ` [dpdk-dev] [PATCH v2 05/14] net/avf: enable link status update Jingjing Wu
2017-12-04 19:58     ` Ferruh Yigit
2017-12-27  3:07       ` Wu, Jingjing
2017-11-24  6:33   ` [dpdk-dev] [PATCH v2 06/14] net/avf: enable ops to get stats Jingjing Wu
2017-12-04 19:58     ` Ferruh Yigit
2017-11-24  6:33   ` [dpdk-dev] [PATCH v2 07/14] net/avf: enable ops for MAC VLAN offload Jingjing Wu
2017-12-04 19:59     ` Ferruh Yigit
2017-11-24  6:33   ` [dpdk-dev] [PATCH v2 08/14] net/avf: enable ops for RSS setting Jingjing Wu
2017-11-24  6:33   ` [dpdk-dev] [PATCH v2 09/14] net/avf: enable ops for MTU setting Jingjing Wu
2017-11-24  6:33   ` [dpdk-dev] [PATCH v2 10/14] net/avf: enable ops to check queue info and status Jingjing Wu
2017-11-24  6:33   ` [dpdk-dev] [PATCH v2 11/14] net/i40e: support AVF basic interface Jingjing Wu
2017-12-04 20:04     ` Ferruh Yigit
2017-11-24  6:33   ` [dpdk-dev] [PATCH v2 12/14] net/avf: enable sse vector Rx Tx func Jingjing Wu
2017-12-04 20:01     ` Ferruh Yigit
2017-11-24  6:33   ` [dpdk-dev] [PATCH v2 13/14] net/avf: enable bulk allocate Rx func Jingjing Wu
2017-11-24  6:33   ` [dpdk-dev] [PATCH v2 14/14] net/avf: enable Rx interrupt support Jingjing Wu
2017-12-04 20:02     ` Ferruh Yigit
2017-12-04 19:48   ` [dpdk-dev] [PATCH v2 00/14] add new avf PMD Ferruh Yigit
2018-01-04  5:27   ` [dpdk-dev] [PATCH v3 00/15] " Wenzhuo Lu
2018-01-04  5:27     ` [dpdk-dev] [PATCH v3 01/15] net/avf/base: add base code for " Wenzhuo Lu
2018-01-04  5:27     ` [dpdk-dev] [PATCH v3 02/15] net/avf: initialization of " Wenzhuo Lu
2018-01-04  5:27     ` [dpdk-dev] [PATCH v3 03/15] net/avf: enable queue and device Wenzhuo Lu
2018-01-04  5:27     ` [dpdk-dev] [PATCH v3 04/15] net/avf: enable basic Rx Tx func Wenzhuo Lu
2018-01-04  5:27     ` [dpdk-dev] [PATCH v3 05/15] net/avf: enable link status update Wenzhuo Lu
2018-01-04  5:27     ` [dpdk-dev] [PATCH v3 06/15] net/avf: support stats Wenzhuo Lu
2018-01-04  5:27     ` [dpdk-dev] [PATCH v3 07/15] net/avf: enable ops for MAC VLAN offload Wenzhuo Lu
2018-01-04  5:27     ` [dpdk-dev] [PATCH v3 08/15] net/avf: enable ops for RSS setting Wenzhuo Lu
2018-01-04  5:27     ` [dpdk-dev] [PATCH v3 09/15] net/avf: enable ops for MTU setting Wenzhuo Lu
2018-01-04  5:27     ` [dpdk-dev] [PATCH v3 10/15] net/avf: enable ops to check queue info and status Wenzhuo Lu
2018-01-04  5:27     ` [dpdk-dev] [PATCH v3 11/15] net/i40e: support AVF basic interface Wenzhuo Lu
2018-01-04  5:27     ` [dpdk-dev] [PATCH v3 12/15] net/avf: enable sse vector Rx Tx func Wenzhuo Lu
2018-01-04  5:27     ` [dpdk-dev] [PATCH v3 13/15] net/avf: enable bulk allocate Rx func Wenzhuo Lu
2018-01-04  5:27     ` [dpdk-dev] [PATCH v3 14/15] net/avf: enable Rx interrupt support Wenzhuo Lu
2018-01-04  5:27     ` [dpdk-dev] [PATCH v3 15/15] doc: update doc for avf driver Wenzhuo Lu
2018-01-05  8:21   ` [dpdk-dev] [PATCH v4 00/15] add new AVF PMD Wenzhuo Lu
2018-01-05  8:21     ` [dpdk-dev] [PATCH v4 01/15] net/avf/base: add base code for avf PMD Wenzhuo Lu
2018-01-05 20:25       ` Stephen Hemminger
2018-01-08  1:06         ` Lu, Wenzhuo
2018-01-08 15:27           ` Stephen Hemminger
2018-01-09  1:35             ` Lu, Wenzhuo
2018-01-05  8:21     ` [dpdk-dev] [PATCH v4 02/15] net/avf: initialization of " Wenzhuo Lu
2018-01-05 20:29       ` Stephen Hemminger
2018-01-08  1:56         ` Lu, Wenzhuo
2018-01-05  8:21     ` [dpdk-dev] [PATCH v4 03/15] net/avf: enable queue and device Wenzhuo Lu
2018-01-05  8:21     ` [dpdk-dev] [PATCH v4 04/15] net/avf: enable basic Rx Tx func Wenzhuo Lu
2018-01-05  8:21     ` [dpdk-dev] [PATCH v4 05/15] net/avf: enable link status update Wenzhuo Lu
2018-01-05  8:21     ` Wenzhuo Lu [this message]
2018-01-05  8:21     ` [dpdk-dev] [PATCH v4 07/15] net/avf: enable ops for MAC VLAN offload Wenzhuo Lu
2018-01-05  8:21     ` [dpdk-dev] [PATCH v4 08/15] net/avf: enable ops for RSS setting Wenzhuo Lu
2018-01-05  8:21     ` [dpdk-dev] [PATCH v4 09/15] net/avf: enable ops for MTU setting Wenzhuo Lu
2018-01-05  8:21     ` [dpdk-dev] [PATCH v4 10/15] net/avf: enable ops to check queue info and status Wenzhuo Lu
2018-01-05  8:21     ` [dpdk-dev] [PATCH v4 11/15] net/i40e: support AVF basic interface Wenzhuo Lu
2018-01-05  8:21     ` [dpdk-dev] [PATCH v4 12/15] net/avf: enable sse vector Rx Tx func Wenzhuo Lu
2018-01-05  8:21     ` [dpdk-dev] [PATCH v4 13/15] net/avf: enable bulk allocate Rx func Wenzhuo Lu
2018-01-05  8:21     ` [dpdk-dev] [PATCH v4 14/15] net/avf: enable Rx interrupt support Wenzhuo Lu
2018-01-05  8:21     ` [dpdk-dev] [PATCH v4 15/15] doc: update doc for avf driver Wenzhuo Lu
2018-01-07 15:09       ` Zhang, Helin
2018-01-08  2:02         ` Lu, Wenzhuo
2018-01-08  5:13     ` [dpdk-dev] [PATCH v5 00/14] add new AVF PMD Wenzhuo Lu
2018-01-08  5:13       ` [dpdk-dev] [PATCH v5 01/14] net/avf/base: add base code for avf PMD Wenzhuo Lu
2018-01-08  5:13       ` [dpdk-dev] [PATCH v5 02/14] net/avf: initialization of " Wenzhuo Lu
2018-01-09 17:58         ` Ferruh Yigit
2018-01-10  2:59           ` Lu, Wenzhuo
2018-01-08  5:13       ` [dpdk-dev] [PATCH v5 03/14] net/avf: enable queue and device Wenzhuo Lu
2018-01-08  5:13       ` [dpdk-dev] [PATCH v5 04/14] net/avf: enable basic Rx Tx func Wenzhuo Lu
2018-01-08  5:13       ` [dpdk-dev] [PATCH v5 05/14] net/avf: enable link status update Wenzhuo Lu
2018-01-08  5:13       ` [dpdk-dev] [PATCH v5 06/14] net/avf: support stats Wenzhuo Lu
2018-01-08  5:13       ` [dpdk-dev] [PATCH v5 07/14] net/avf: enable ops for MAC VLAN offload Wenzhuo Lu
2018-01-09 17:58         ` Ferruh Yigit
2018-01-10  1:39           ` Lu, Wenzhuo
2018-01-08  5:13       ` [dpdk-dev] [PATCH v5 08/14] net/avf: enable ops for RSS setting Wenzhuo Lu
2018-01-08  5:13       ` [dpdk-dev] [PATCH v5 09/14] net/avf: enable ops for MTU setting Wenzhuo Lu
2018-01-08  5:13       ` [dpdk-dev] [PATCH v5 10/14] net/avf: enable ops to check queue info and status Wenzhuo Lu
2018-01-08  5:13       ` [dpdk-dev] [PATCH v5 11/14] net/i40e: support AVF basic interface Wenzhuo Lu
2018-01-08  5:13       ` [dpdk-dev] [PATCH v5 12/14] net/avf: enable sse vector Rx Tx func Wenzhuo Lu
2018-01-09 17:58         ` Ferruh Yigit
2018-01-10  1:38           ` Lu, Wenzhuo
2018-01-10  9:57             ` Ferruh Yigit
2018-01-08  5:13       ` [dpdk-dev] [PATCH v5 13/14] net/avf: enable bulk allocate Rx func Wenzhuo Lu
2018-01-08  5:13       ` [dpdk-dev] [PATCH v5 14/14] net/avf: enable Rx interrupt support Wenzhuo Lu
2018-01-10  6:15       ` [dpdk-dev] [PATCH v6 00/14] dd new AVF PMD Wenzhuo Lu
2018-01-10  6:15         ` [dpdk-dev] [PATCH v6 01/14] net/avf/base: add base code for avf PMD Wenzhuo Lu
2018-01-10  6:15         ` [dpdk-dev] [PATCH v6 02/14] net/avf: initialization of " Wenzhuo Lu
2018-01-10 17:15           ` Stephen Hemminger
2018-01-11  2:07             ` Lu, Wenzhuo
2018-01-11  8:53               ` Ferruh Yigit
2018-01-10 17:17           ` Stephen Hemminger
2018-01-11  4:52             ` Lu, Wenzhuo
2018-01-10  6:15         ` [dpdk-dev] [PATCH v6 03/14] net/avf: enable queue and device Wenzhuo Lu
2018-01-10  6:15         ` [dpdk-dev] [PATCH v6 04/14] net/avf: enable basic Rx Tx func Wenzhuo Lu
2018-01-10  6:15         ` [dpdk-dev] [PATCH v6 05/14] net/avf: enable link status update Wenzhuo Lu
2018-01-10  9:44           ` Xing, Beilei
2018-01-10  6:15         ` [dpdk-dev] [PATCH v6 06/14] net/avf: support stats Wenzhuo Lu
2018-01-10  6:15         ` [dpdk-dev] [PATCH v6 07/14] net/avf: enable MAC VLAN and promisc ops Wenzhuo Lu
2018-01-10  6:15         ` [dpdk-dev] [PATCH v6 08/14] net/avf: enable ops for RSS setting Wenzhuo Lu
2018-01-10  6:15         ` [dpdk-dev] [PATCH v6 09/14] net/avf: enable ops for MTU setting Wenzhuo Lu
2018-01-10  6:15         ` [dpdk-dev] [PATCH v6 10/14] net/avf: enable ops to check queue info and status Wenzhuo Lu
2018-01-10  6:15         ` [dpdk-dev] [PATCH v6 11/14] net/i40e: support AVF basic interface Wenzhuo Lu
2018-01-10  6:15         ` [dpdk-dev] [PATCH v6 12/14] net/avf: enable sse vector Rx Tx func Wenzhuo Lu
2018-01-10  6:16         ` [dpdk-dev] [PATCH v6 13/14] net/avf: enable bulk allocate Rx func Wenzhuo Lu
2018-01-10  6:16         ` [dpdk-dev] [PATCH v6 14/14] net/avf: enable Rx interrupt support Wenzhuo Lu
2018-01-10 13:01         ` [dpdk-dev] [PATCH v7 00/14] dd new AVF PMD Wenzhuo Lu
2018-01-10 13:01           ` [dpdk-dev] [PATCH v7 01/14] net/avf/base: add base code for avf PMD Wenzhuo Lu
2018-01-10 13:01           ` [dpdk-dev] [PATCH v7 02/14] net/avf: initialization of " Wenzhuo Lu
2018-01-10 13:01           ` [dpdk-dev] [PATCH v7 03/14] net/avf: enable queue and device Wenzhuo Lu
2018-01-10 13:01           ` [dpdk-dev] [PATCH v7 04/14] net/avf: enable basic Rx Tx func Wenzhuo Lu
2018-01-10 13:01           ` [dpdk-dev] [PATCH v7 05/14] net/avf: enable link status update Wenzhuo Lu
2018-01-10 13:01           ` [dpdk-dev] [PATCH v7 06/14] net/avf: support stats Wenzhuo Lu
2018-01-10 13:01           ` [dpdk-dev] [PATCH v7 07/14] net/avf: enable MAC VLAN and promisc ops Wenzhuo Lu
2018-01-10 13:02           ` [dpdk-dev] [PATCH v7 08/14] net/avf: enable ops for RSS setting Wenzhuo Lu
2018-01-10 13:02           ` [dpdk-dev] [PATCH v7 09/14] net/avf: enable ops for MTU setting Wenzhuo Lu
2018-01-10 13:02           ` [dpdk-dev] [PATCH v7 10/14] net/avf: enable ops to check queue info and status Wenzhuo Lu
2018-01-10 13:02           ` [dpdk-dev] [PATCH v7 11/14] net/i40e: support AVF basic interface Wenzhuo Lu
2018-01-10 13:02           ` [dpdk-dev] [PATCH v7 12/14] net/avf: enable sse vector Rx Tx func Wenzhuo Lu
2018-01-10 13:02           ` [dpdk-dev] [PATCH v7 13/14] net/avf: enable bulk allocate Rx func Wenzhuo Lu
2018-01-10 13:02           ` [dpdk-dev] [PATCH v7 14/14] net/avf: enable Rx interrupt support Wenzhuo Lu
2018-01-10 19:14           ` [dpdk-dev] [PATCH v7 00/14] dd new AVF PMD 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=1515140505-38655-7-git-send-email-wenzhuo.lu@intel.com \
    --to=wenzhuo.lu@intel.com \
    --cc=dev@dpdk.org \
    --cc=jingjing.wu@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).