All of lore.kernel.org
 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 v1 14/20] net/txgbe: support register dump on VF device
Date: Fri, 22 Jan 2021 17:47:54 +0800	[thread overview]
Message-ID: <20210122094800.197748-15-jiawenwu@trustnetic.com> (raw)
In-Reply-To: <20210122094800.197748-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 37a02c6e1..3d4b69d51 100644
--- a/doc/guides/nics/features/txgbe_vf.ini
+++ b/doc/guides/nics/features/txgbe_vf.ini
@@ -30,6 +30,7 @@ Rx descriptor status = Y
 Tx descriptor status = Y
 Basic stats          = Y
 Extended stats       = Y
+Registers dump       = Y
 Multiprocess aware   = Y
 Linux UIO            = Y
 Linux VFIO           = Y
diff --git a/drivers/net/txgbe/txgbe_ethdev_vf.c b/drivers/net/txgbe/txgbe_ethdev_vf.c
index dd84a4955..05e666d57 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};
 
 #define TXGBEVF_PMD_NAME "rte_txgbevf_pmd" /* PMD name */
 static int txgbevf_dev_xstats_get(struct rte_eth_dev *dev,
@@ -948,6 +978,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)
 {
@@ -1123,6 +1196,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-01-22  9:50 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-22  9:47 [dpdk-dev] [PATCH v1 00/20] net/txgbe: add VF driver support Jiawen Wu
2021-01-22  9:47 ` [dpdk-dev] [PATCH v1 01/20] net/txgbe: add ethdev probe and remove for VF device Jiawen Wu
2021-02-02 17:48   ` Ferruh Yigit
2021-01-22  9:47 ` [dpdk-dev] [PATCH v1 02/20] net/txgbe: add base code for VF driver Jiawen Wu
2021-02-02 17:51   ` Ferruh Yigit
2021-01-22  9:47 ` [dpdk-dev] [PATCH v1 03/20] net/txgbe: support add and remove VF device MAC address Jiawen Wu
2021-01-22  9:47 ` [dpdk-dev] [PATCH v1 04/20] net/txgbe: get VF device information Jiawen Wu
2021-01-22  9:47 ` [dpdk-dev] [PATCH v1 05/20] net/txgbe: add interrupt operation for VF device Jiawen Wu
2021-02-02 17:49   ` Ferruh Yigit
2021-01-22  9:47 ` [dpdk-dev] [PATCH v1 06/20] net/txgbe: get link status of " Jiawen Wu
2021-01-22  9:47 ` [dpdk-dev] [PATCH v1 07/20] net/txgbe: add Rx and Tx unit init for " Jiawen Wu
2021-02-02 17:49   ` Ferruh Yigit
2021-01-22  9:47 ` [dpdk-dev] [PATCH v1 08/20] net/txgbe: add VF device stats and xstats get operation Jiawen Wu
2021-01-22  9:47 ` [dpdk-dev] [PATCH v1 09/20] net/txgbe: add VLAN handle support to VF driver Jiawen Wu
2021-02-02 17:52   ` Ferruh Yigit
2021-01-22  9:47 ` [dpdk-dev] [PATCH v1 10/20] net/txgbe: add RSS support for VF device Jiawen Wu
2021-01-22  9:47 ` [dpdk-dev] [PATCH v1 11/20] net/txgbe: add VF device promiscuous and allmulticast mode Jiawen Wu
2021-01-22  9:47 ` [dpdk-dev] [PATCH v1 12/20] net/txgbe: support multicast MAC filter for VF driver Jiawen Wu
2021-01-22  9:47 ` [dpdk-dev] [PATCH v1 13/20] net/txgbe: support to update MTU on VF device Jiawen Wu
2021-01-22  9:47 ` Jiawen Wu [this message]
2021-01-22  9:47 ` [dpdk-dev] [PATCH v1 15/20] net/txgbe: start and stop " Jiawen Wu
2021-01-22  9:47 ` [dpdk-dev] [PATCH v1 16/20] net/txgbe: add some supports as PF driver implemented Jiawen Wu
2021-02-02 17:50   ` Ferruh Yigit
2021-01-22  9:47 ` [dpdk-dev] [PATCH v1 17/20] net/txgbe: support VF representor Jiawen Wu
2021-01-22  9:47 ` [dpdk-dev] [PATCH v1 18/20] net/txgbe: hardware support for " Jiawen Wu
2021-02-02 17:50   ` Ferruh Yigit
2021-01-22  9:47 ` [dpdk-dev] [PATCH v1 19/20] net/txgbe: support VLAN filter " Jiawen Wu
2021-01-22  9:48 ` [dpdk-dev] [PATCH v1 20/20] doc: update release note for txgbe Jiawen Wu
2021-02-02 17:50   ` Ferruh Yigit
2021-02-02 18:07 ` [dpdk-dev] [PATCH v1 00/20] net/txgbe: add VF driver support Ferruh Yigit
2021-02-03  7:48   ` Jiawen Wu
2021-02-10 13:24     ` 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=20210122094800.197748-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 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.