From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id AE780460C1; Mon, 20 Jan 2025 10:45:02 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6FED040DDB; Mon, 20 Jan 2025 10:44:13 +0100 (CET) Received: from smtpbgjp3.qq.com (smtpbgjp3.qq.com [54.92.39.34]) by mails.dpdk.org (Postfix) with ESMTP id 4C69040DCE for ; Mon, 20 Jan 2025 10:44:08 +0100 (CET) X-QQ-mid: bizesmtp86t1737366244tfe6z4x3 X-QQ-Originating-IP: 7e1FSdEDk6eqXuVH8LCnQakKlwp3i/mSCifC9Psc1zY= Received: from DSK-zaiyuwang.trustnetic.com ( [115.197.136.137]) by bizesmtp.qq.com (ESMTP) with id ; Mon, 20 Jan 2025 17:44:03 +0800 (CST) X-QQ-SSF: 0000000000000000000000000000000 X-QQ-GoodBg: 0 X-BIZMAIL-ID: 7931361007404831418 From: Zaiyu Wang To: dev@dpdk.org Cc: Zaiyu Wang , Jiawen Wu Subject: [PATCH v4 14/15] net/ngbe: add dump registers ops for VF device Date: Mon, 20 Jan 2025 17:42:40 +0800 Message-Id: <20250120094242.1844-15-zaiyuwang@trustnetic.com> X-Mailer: git-send-email 2.21.0.windows.1 In-Reply-To: <20250120094242.1844-1-zaiyuwang@trustnetic.com> References: <20250109040227.1016-1-zaiyuwang@trustnetic.com> <20250120094242.1844-1-zaiyuwang@trustnetic.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:trustnetic.com:qybglogicsvrgz:qybglogicsvrgz5a-1 X-QQ-XMAILINFO: MXHIEC8P0R7hXOHVY62I/O+mEXM/wo2Sk2m7sq1R0YO86z3WrQPGyu7m p8Z29Qtuu/w7q4Z8lE4dNJLNzY39zdHvx8QtqlrzMYPmIBzA8fbbszS4K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: 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 3c54047fd8..745ef4dc32 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 e0e5950672..bbd9fea328 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) { @@ -1268,6 +1340,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