From: Zaiyu Wang <zaiyuwang@trustnetic.com>
To: dev@dpdk.org
Cc: Zaiyu Wang <zaiyuwang@trustnetic.com>,
Jiawen Wu <jiawenwu@trustnetic.com>
Subject: [PATCH 14/15] net/ngbe: add dump registers ops for VF device
Date: Thu, 9 Jan 2025 12:02:24 +0800 [thread overview]
Message-ID: <20250109040227.1016-15-zaiyuwang@trustnetic.com> (raw)
In-Reply-To: <20250109040227.1016-1-zaiyuwang@trustnetic.com>
Add support to dump registers for VF device. Currently we only support a
small number of registers. More registers will be added as needed.
Signed-off-by: Zaiyu Wang <zaiyuwang@trustnetic.com>
---
doc/guides/nics/features/ngbe_vf.ini | 1 +
drivers/net/ngbe/ngbe_ethdev_vf.c | 73 ++++++++++++++++++++++++++++
2 files changed, 74 insertions(+)
diff --git a/doc/guides/nics/features/ngbe_vf.ini b/doc/guides/nics/features/ngbe_vf.ini
index 55763a311a..497b1031b3 100644
--- a/doc/guides/nics/features/ngbe_vf.ini
+++ b/doc/guides/nics/features/ngbe_vf.ini
@@ -27,6 +27,7 @@ Inner L3 checksum = P
Inner L4 checksum = P
Basic stats = Y
Extended stats = Y
+Registers dump = Y
Multiprocess aware = Y
Linux = Y
ARMv8 = Y
diff --git a/drivers/net/ngbe/ngbe_ethdev_vf.c b/drivers/net/ngbe/ngbe_ethdev_vf.c
index ac02b7ac7f..9b2c899c74 100644
--- a/drivers/net/ngbe/ngbe_ethdev_vf.c
+++ b/drivers/net/ngbe/ngbe_ethdev_vf.c
@@ -16,6 +16,35 @@
#include "ngbe_rxtx.h"
#include "ngbe_regs_group.h"
+static const struct reg_info ngbevf_regs_general[] = {
+ {NGBE_VFRST, 1, 1, "NGBE_VFRST"},
+ {NGBE_VFSTATUS, 1, 1, "NGBE_VFSTATUS"},
+ {NGBE_VFMBCTL, 1, 1, "NGBE_VFMAILBOX"},
+ {NGBE_VFMBX, 16, 4, "NGBE_VFMBX"},
+ {NGBE_VFPBWRAP, 1, 1, "NGBE_VFPBWRAP"},
+ {0, 0, 0, ""}
+};
+
+static const struct reg_info ngbevf_regs_interrupt[] = {
+ {0, 0, 0, ""}
+};
+
+static const struct reg_info ngbevf_regs_rxdma[] = {
+ {0, 0, 0, ""}
+};
+
+static const struct reg_info ngbevf_regs_tx[] = {
+ {0, 0, 0, ""}
+};
+
+/* VF registers */
+static const struct reg_info *ngbevf_regs[] = {
+ ngbevf_regs_general,
+ ngbevf_regs_interrupt,
+ ngbevf_regs_rxdma,
+ ngbevf_regs_tx,
+ NULL};
+
#define NGBEVF_PMD_NAME "rte_ngbevf_pmd" /* PMD name */
static int ngbevf_dev_info_get(struct rte_eth_dev *dev,
struct rte_eth_dev_info *dev_info);
@@ -1083,6 +1112,49 @@ ngbevf_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)
return 0;
}
+static int
+ngbevf_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 = ngbevf_regs[g_ind++]))
+ count += ngbe_regs_group_count(reg_group);
+
+ return count;
+}
+
+static int
+ngbevf_get_regs(struct rte_eth_dev *dev,
+ struct rte_dev_reg_info *regs)
+{
+ struct ngbe_hw *hw = ngbe_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 = ngbevf_get_reg_length(dev);
+ regs->width = sizeof(uint32_t);
+ return 0;
+ }
+
+ /* Support only full register dump */
+ if (regs->length == 0 ||
+ regs->length == (uint32_t)ngbevf_get_reg_length(dev)) {
+ regs->version = hw->mac.type << 24 | hw->revision_id << 16 |
+ hw->device_id;
+ while ((reg_group = ngbevf_regs[g_ind++]))
+ count += ngbe_read_regs_group(dev, &data[count],
+ reg_group);
+ return 0;
+ }
+
+ return -ENOTSUP;
+}
+
static int
ngbevf_dev_promiscuous_enable(struct rte_eth_dev *dev)
{
@@ -1266,6 +1338,7 @@ static const struct eth_dev_ops ngbevf_eth_dev_ops = {
.mac_addr_add = ngbevf_add_mac_addr,
.mac_addr_remove = ngbevf_remove_mac_addr,
.mac_addr_set = ngbevf_set_default_mac_addr,
+ .get_reg = ngbevf_get_regs,
};
RTE_PMD_REGISTER_PCI(net_ngbe_vf, rte_ngbevf_pmd);
--
2.21.0.windows.1
next prev parent reply other threads:[~2025-01-09 4:04 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-09 4:02 [PATCH 00/15] net/ngbe: add VF driver support Zaiyu Wang
2025-01-09 4:02 ` [PATCH 01/15] net/ngbe: add ethdev probe and remove for VF device Zaiyu Wang
2025-01-09 4:02 ` [PATCH 02/15] net/ngbe: add support for PF-VF mailbox interface Zaiyu Wang
2025-01-09 4:02 ` [PATCH 03/15] net/ngbe: add hardware configuration code for VF device Zaiyu Wang
2025-01-09 4:02 ` [PATCH 04/15] net/ngbe: add promiscuous and allmulticast ops " Zaiyu Wang
2025-01-09 4:02 ` [PATCH 05/15] net/ngbe: add set MTU " Zaiyu Wang
2025-01-09 4:02 ` [PATCH 06/15] net/ngbe: add add/remove/set mac addr " Zaiyu Wang
2025-01-09 4:02 ` [PATCH 07/15] net/ngbe: add datapath init code " Zaiyu Wang
2025-01-09 4:02 ` [PATCH 08/15] net/ngbe: add vlan related ops " Zaiyu Wang
2025-01-09 4:02 ` [PATCH 09/15] net/ngbe: add interrupt support " Zaiyu Wang
2025-01-09 4:02 ` [PATCH 10/15] net/ngbe: add link update ops " Zaiyu Wang
2025-01-09 4:02 ` [PATCH 11/15] net/ngbe: add stats and xstats " Zaiyu Wang
2025-01-09 4:02 ` [PATCH 12/15] net/ngbe: add start/stop/reset/close " Zaiyu Wang
2025-01-09 4:02 ` [PATCH 13/15] net/ngbe: add multicast MAC filter " Zaiyu Wang
2025-01-09 4:02 ` Zaiyu Wang [this message]
2025-01-09 4:02 ` [PATCH 15/15] net/ngbe: add some ops which PF has implemented Zaiyu Wang
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=20250109040227.1016-15-zaiyuwang@trustnetic.com \
--to=zaiyuwang@trustnetic.com \
--cc=dev@dpdk.org \
--cc=jiawenwu@trustnetic.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).