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 AACF5460AB; Fri, 17 Jan 2025 12:49:13 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 466FA42E91; Fri, 17 Jan 2025 12:45:45 +0100 (CET) Received: from smtpbgau1.qq.com (smtpbgau1.qq.com [54.206.16.166]) by mails.dpdk.org (Postfix) with ESMTP id A781042E8D for ; Fri, 17 Jan 2025 12:45:42 +0100 (CET) X-QQ-mid: bizesmtp85t1737114337t0mpqska X-QQ-Originating-IP: hUTBXdfeh13JpOc9L6U4wrcm2ASioS57HuO6UheFxTY= Received: from DSK-zaiyuwang.trustnetic.com ( [36.24.187.167]) by bizesmtp.qq.com (ESMTP) with id ; Fri, 17 Jan 2025 19:45:36 +0800 (CST) X-QQ-SSF: 0000000000000000000000000000000 X-QQ-GoodBg: 0 X-BIZMAIL-ID: 1128673326898433492 From: Zaiyu Wang To: dev@dpdk.org Cc: Zaiyu Wang , Jiawen Wu Subject: [PATCH v3 14/15] net/ngbe: add dump registers ops for VF device Date: Fri, 17 Jan 2025 19:44:52 +0800 Message-Id: <20250117114455.15864-15-zaiyuwang@trustnetic.com> X-Mailer: git-send-email 2.21.0.windows.1 In-Reply-To: <20250117114455.15864-1-zaiyuwang@trustnetic.com> References: <20250109040227.1016-1-zaiyuwang@trustnetic.com> <20250117114455.15864-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: Nqx94+Mdhisl6VNOzxeEA7+PO75eu+v+68KwWLr46RZOE2JI2lKAmHFh vlhi9SFJU6DJNIvB51bf9hexXWzOAsf6HhbI9dzQv0CLRIi7mmOjb2N/yF/0rdg9yQk2BeJ 9kkhbSwukNqZB4rHyYcfnPBdTi8IW8hnm21pKefTp0iVYJOPsdrxgEo2zuLYhgaLKC7gnqn SFJNngxCrvYxI2+W4RC7jzOs4ooXoty0CsRI/5812uY/i8j/D2nsXwU4w7hT8BckQztDdJk dg/JIh5KSlRExGdAv6DyBkjFugWrrxTrODbZo9ug8jDnjwixtaV+QD5OuumqWkxhWaNiMSV lBYhgW8FcSbaipCx1qBDCWPSwdUQ3lT+sGMqFIBGKDH68mY8hQFisbADHiV8SaREFoB3JEv 9GV7x3oQOavO31NeXwXL+2ELN8fj/sQgCkmZ0cCLoXn0YJFxejgaQJnL5KkoWry9w8FDfYN 6s5A4ZQF6UG6EsNpujUUr1//uryDH9glq6syUeaSLf/UmVYwKDNvvfuc0lEzAb4U2xnI3ps nIAnY1gAVDvnt6E+bcIqDg5Qadih7x3F2fqtnXuP77KYFWY5Mg8rphshW1gmYmtbrP2+dLr bgVVIpME1Xh8MjBJbpcHQ9OdXoVNyv0YLtKKuqJC1CrD+F4i2pxX7gYVCjc9yFcORve1Mae tPtVczwvx8rKksB4yxnKW3QOk82SmGUbBBhM+tq7YQz1xZnoJrVqYJep7tR+132pXz16QSZ Wa+llFNmz69ia0u7Mj3T+mV5fKl6+yBN2d1887aW54hcU94MYhZ0VWtCDQsCkKFnfRAC+fU s1tS+oxhL1RRwqLMs+B9xcUgSKWAnf+som4mc3D90HA1I1DH1jp751QqNBHInJM83Gw0Eau RokQIwS+wPxfyHx3csXPPcaoAXI+OobjbqQTzEtYYUpKmoIlbL0lBKwjbyTrMHt7+gGL7J0 /Tnsj7Vxiw78z0KyFXAAOacjgUTPzHin+UkGKsHEbEBaZSPsNxPTo1cAirIDM0LNJyfPyRZ s2t6lCEzQT/rBsusje9ufhUYy8s/PepZ8CcbfcPg== X-QQ-XMRINFO: NI4Ajvh11aEj8Xl/2s1/T8w= X-QQ-RECHKSPAM: 0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: 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 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