From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (unknown [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1AC6E460A7; Fri, 17 Jan 2025 11:47:29 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7CCD742E10; Fri, 17 Jan 2025 11:43:52 +0100 (CET) Received: from smtpbgsg1.qq.com (smtpbgsg1.qq.com [54.254.200.92]) by mails.dpdk.org (Postfix) with ESMTP id A53D642DD5 for ; Fri, 17 Jan 2025 11:43:50 +0100 (CET) X-QQ-mid: bizesmtpsz8t1737110627tfl1yg7 X-QQ-Originating-IP: Oyasm875AYX1SJaysELYXludex7HTkyEmWFIt4ka8dE= Received: from DSK-zaiyuwang.trustnetic.com ( [36.24.187.167]) by bizesmtp.qq.com (ESMTP) with id ; Fri, 17 Jan 2025 18:43:45 +0800 (CST) X-QQ-SSF: 0000000000000000000000000000000 X-QQ-GoodBg: 0 X-BIZMAIL-ID: 11390943362000899899 From: Zaiyu Wang To: dev@dpdk.org Cc: Zaiyu Wang , Jiawen Wu Subject: [PATCH v2 14/15] net/ngbe: add dump registers ops for VF device Date: Fri, 17 Jan 2025 18:41:13 +0800 Message-Id: <20250117104115.16528-15-zaiyuwang@trustnetic.com> X-Mailer: git-send-email 2.21.0.windows.1 In-Reply-To: <20250117104115.16528-1-zaiyuwang@trustnetic.com> References: <20250109040227.1016-1-zaiyuwang@trustnetic.com> <20250117104115.16528-1-zaiyuwang@trustnetic.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtpsz:trustnetic.com:qybglogicsvrgz:qybglogicsvrgz5a-1 X-QQ-XMAILINFO: OTe2UBw5Kvi9WU/mF+KQoDdd1ysO+e0Q+XWQfhgZoYO9AexthsuocQzY dYpwpWfEqG/HZ25+edpBUniLDeF3eVw/7VEB9E1+F3mnXm0hKVazLUcfMkGq+ZEd6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ence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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 --- 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 ceb310e719..909f1e00f8 100644 --- a/doc/guides/nics/features/ngbe_vf.ini +++ b/doc/guides/nics/features/ngbe_vf.ini @@ -26,6 +26,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/ngbe/ngbe_ethdev_vf.c b/drivers/net/ngbe/ngbe_ethdev_vf.c index 53d7767220..0dfc07a8fd 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_close(struct rte_eth_dev *dev); static int ngbevf_dev_link_update(struct rte_eth_dev *dev, @@ -1081,6 +1110,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) { @@ -1265,6 +1337,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