DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jiawen Wu <jiawenwu@trustnetic.com>
To: dev@dpdk.org
Cc: Jiawen Wu <jiawenwu@trustnetic.com>
Subject: [dpdk-dev] [PATCH v2 14/17] net/txgbe: support register dump on VF device
Date: Fri,  5 Feb 2021 11:34:46 +0800	[thread overview]
Message-ID: <20210205033449.3813939-15-jiawenwu@trustnetic.com> (raw)
In-Reply-To: <20210205033449.3813939-1-jiawenwu@trustnetic.com>

Add support to dump registers for VF.

Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
---
 doc/guides/nics/features/txgbe_vf.ini |  1 +
 drivers/net/txgbe/txgbe_ethdev_vf.c   | 74 +++++++++++++++++++++++++++
 2 files changed, 75 insertions(+)

diff --git a/doc/guides/nics/features/txgbe_vf.ini b/doc/guides/nics/features/txgbe_vf.ini
index 4c072b4a5..5dbc5bbd7 100644
--- a/doc/guides/nics/features/txgbe_vf.ini
+++ b/doc/guides/nics/features/txgbe_vf.ini
@@ -29,6 +29,7 @@ Rx descriptor status = Y
 Tx descriptor status = Y
 Basic stats          = Y
 Extended stats       = Y
+Registers dump       = Y
 Multiprocess aware   = Y
 Linux                = Y
 ARMv8                = Y
diff --git a/drivers/net/txgbe/txgbe_ethdev_vf.c b/drivers/net/txgbe/txgbe_ethdev_vf.c
index 8839b610d..a06f29581 100644
--- a/drivers/net/txgbe/txgbe_ethdev_vf.c
+++ b/drivers/net/txgbe/txgbe_ethdev_vf.c
@@ -14,6 +14,36 @@
 #include "base/txgbe.h"
 #include "txgbe_ethdev.h"
 #include "txgbe_rxtx.h"
+#include "txgbe_regs_group.h"
+
+static const struct reg_info txgbevf_regs_general[] = {
+	{TXGBE_VFRST, 1, 1, "TXGBE_VFRST"},
+	{TXGBE_VFSTATUS, 1, 1, "TXGBE_VFSTATUS"},
+	{TXGBE_VFMBCTL, 1, 1, "TXGBE_VFMAILBOX"},
+	{TXGBE_VFMBX, 16, 4, "TXGBE_VFMBX"},
+	{TXGBE_VFPBWRAP, 1, 1, "TXGBE_VFPBWRAP"},
+	{0, 0, 0, ""}
+};
+
+static const struct reg_info txgbevf_regs_interrupt[] = {
+	{0, 0, 0, ""}
+};
+
+static const struct reg_info txgbevf_regs_rxdma[] = {
+	{0, 0, 0, ""}
+};
+
+static const struct reg_info txgbevf_regs_tx[] = {
+	{0, 0, 0, ""}
+};
+
+/* VF registers */
+static const struct reg_info *txgbevf_regs[] = {
+				txgbevf_regs_general,
+				txgbevf_regs_interrupt,
+				txgbevf_regs_rxdma,
+				txgbevf_regs_tx,
+				NULL};
 
 static int txgbevf_dev_xstats_get(struct rte_eth_dev *dev,
 				  struct rte_eth_xstat *xstats, unsigned int n);
@@ -946,6 +976,49 @@ txgbevf_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)
 	return 0;
 }
 
+static int
+txgbevf_get_reg_length(struct rte_eth_dev *dev __rte_unused)
+{
+	int count = 0;
+	int g_ind = 0;
+	const struct reg_info *reg_group;
+
+	while ((reg_group = txgbevf_regs[g_ind++]))
+		count += txgbe_regs_group_count(reg_group);
+
+	return count;
+}
+
+static int
+txgbevf_get_regs(struct rte_eth_dev *dev,
+		struct rte_dev_reg_info *regs)
+{
+	struct txgbe_hw *hw = TXGBE_DEV_HW(dev);
+	uint32_t *data = regs->data;
+	int g_ind = 0;
+	int count = 0;
+	const struct reg_info *reg_group;
+
+	if (data == NULL) {
+		regs->length = txgbevf_get_reg_length(dev);
+		regs->width = sizeof(uint32_t);
+		return 0;
+	}
+
+	/* Support only full register dump */
+	if (regs->length == 0 ||
+	    regs->length == (uint32_t)txgbevf_get_reg_length(dev)) {
+		regs->version = hw->mac.type << 24 | hw->revision_id << 16 |
+			hw->device_id;
+		while ((reg_group = txgbevf_regs[g_ind++]))
+			count += txgbe_read_regs_group(dev, &data[count],
+						      reg_group);
+		return 0;
+	}
+
+	return -ENOTSUP;
+}
+
 static int
 txgbevf_dev_promiscuous_enable(struct rte_eth_dev *dev)
 {
@@ -1121,6 +1194,7 @@ static const struct eth_dev_ops txgbevf_eth_dev_ops = {
 	.rxq_info_get         = txgbe_rxq_info_get,
 	.txq_info_get         = txgbe_txq_info_get,
 	.mac_addr_set         = txgbevf_set_default_mac_addr,
+	.get_reg              = txgbevf_get_regs,
 	.reta_update          = txgbe_dev_rss_reta_update,
 	.reta_query           = txgbe_dev_rss_reta_query,
 	.rss_hash_update      = txgbe_dev_rss_hash_update,
-- 
2.27.0




  parent reply	other threads:[~2021-02-05  3:36 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-05  3:34 [dpdk-dev] [PATCH v2 00/17] net/txgbe: add VF driver support Jiawen Wu
2021-02-05  3:34 ` [dpdk-dev] [PATCH v2 01/17] net/txgbe: add ethdev probe and remove for VF device Jiawen Wu
2021-02-24 11:39   ` Ferruh Yigit
2021-02-05  3:34 ` [dpdk-dev] [PATCH v2 02/17] net/txgbe: add base code for VF driver Jiawen Wu
2021-02-05  3:34 ` [dpdk-dev] [PATCH v2 03/17] net/txgbe: support add and remove VF device MAC address Jiawen Wu
2021-02-24 11:40   ` Ferruh Yigit
2021-02-05  3:34 ` [dpdk-dev] [PATCH v2 04/17] net/txgbe: get VF device information Jiawen Wu
2021-02-05  3:34 ` [dpdk-dev] [PATCH v2 05/17] net/txgbe: add interrupt operation for VF device Jiawen Wu
2021-02-05  3:34 ` [dpdk-dev] [PATCH v2 06/17] net/txgbe: get link status of " Jiawen Wu
2021-02-24 11:40   ` Ferruh Yigit
2021-02-05  3:34 ` [dpdk-dev] [PATCH v2 07/17] net/txgbe: add Rx and Tx unit init for " Jiawen Wu
2021-02-05  3:34 ` [dpdk-dev] [PATCH v2 08/17] net/txgbe: add VF device stats and xstats get operation Jiawen Wu
2021-02-05  3:34 ` [dpdk-dev] [PATCH v2 09/17] net/txgbe: add VLAN handle support to VF driver Jiawen Wu
2021-02-05  3:34 ` [dpdk-dev] [PATCH v2 10/17] net/txgbe: add RSS support for VF device Jiawen Wu
2021-02-05  3:34 ` [dpdk-dev] [PATCH v2 11/17] net/txgbe: add VF device promiscuous and allmulticast mode Jiawen Wu
2021-02-05  3:34 ` [dpdk-dev] [PATCH v2 12/17] net/txgbe: support multicast MAC filter for VF driver Jiawen Wu
2021-02-05  3:34 ` [dpdk-dev] [PATCH v2 13/17] net/txgbe: support to update MTU on VF device Jiawen Wu
2021-02-05  3:34 ` Jiawen Wu [this message]
2021-02-05  3:34 ` [dpdk-dev] [PATCH v2 15/17] net/txgbe: start and stop " Jiawen Wu
2021-02-05  3:34 ` [dpdk-dev] [PATCH v2 16/17] net/txgbe: add some supports as PF driver implemented Jiawen Wu
2021-02-05  3:34 ` [dpdk-dev] [PATCH v2 17/17] doc: update release note for txgbe Jiawen Wu
2021-02-24 11:41   ` 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=20210205033449.3813939-15-jiawenwu@trustnetic.com \
    --to=jiawenwu@trustnetic.com \
    --cc=dev@dpdk.org \
    /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).