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 C58C946027; Thu, 9 Jan 2025 05:04:56 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6858F40E37; Thu, 9 Jan 2025 05:04:04 +0100 (CET) Received: from smtpbg151.qq.com (smtpbg151.qq.com [18.169.211.239]) by mails.dpdk.org (Postfix) with ESMTP id 5CC9A40E8A for ; Thu, 9 Jan 2025 05:04:01 +0100 (CET) X-QQ-mid: bizesmtp84t1736395437t999wl5e X-QQ-Originating-IP: nAtIHcAvgbyHhOssA+JqVQFKiwDqJD2dVFW0UZGm8o8= Received: from DSK-zaiyuwang.trustnetic.com ( [218.72.126.41]) by bizesmtp.qq.com (ESMTP) with id ; Thu, 09 Jan 2025 12:03:56 +0800 (CST) X-QQ-SSF: 0000000000000000000000000000000 X-QQ-GoodBg: 0 X-BIZMAIL-ID: 16790965713207461924 From: Zaiyu Wang To: dev@dpdk.org Cc: Zaiyu Wang , Jiawen Wu Subject: [PATCH 14/15] net/ngbe: add dump registers ops for VF device Date: Thu, 9 Jan 2025 12:02:24 +0800 Message-Id: <20250109040227.1016-15-zaiyuwang@trustnetic.com> X-Mailer: git-send-email 2.21.0.windows.1 In-Reply-To: <20250109040227.1016-1-zaiyuwang@trustnetic.com> References: <20250109040227.1016-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: Nkqq4bFvvULWGDZnnMR3fTyWEEYoioo36gANr9YYN5bMeG/jye4d9VZE GX7cYxAtEHffpCN3TIjpLC8qBUOoVqXJcbt1OvUe0b9A28+9cGkRH6RzY5fKyN56o3VzQfy OkE98XXMBVuzwNT9MBkj2qD5TOC2g1apzkBbX+YB/VuEsy2DTibLt/BO3iDZS337QX0AreW 3Hyn5m+RRX4ID5C7BykCN546eYhKg2SCbSfISPtaRhSZZvDNuhSmM+sZFmW0EsByJQ4YrVq mMiBsfktG5k/hV/Na6dBnWePBSoHEZsZLSRVLAVAyzZeL49hhFBFbEAWV0Za3csvD9ynpq0 YqKxnSd+I7PunTxdidJsRqO1gh3+LZH5v7OkNeR+pmPjKiJWVGbpvO+jDKMhViaupIMRuIE mnJ93qPXQGhKfdgWlGHqonolp3l3ItIMVjDQG80/nL8SRFCIesj7+o/c/A5+MqQzclMRgvO SrVYj2sYzRO1df5yGMvUSpC4xgXZRXUIm7l22vKvlhCeZ1ZtPOiLxeGp9DfQZVDoGjBy1KW UufaejfNMhebW+kwhlbt6I1x6rC7c2WmlmTNbgCqDYS3p798qrVhULBe83uNr1nTUJH1KAU tHWW8gSvto1xpmQe9/neh9Z6Tae57m8Vo1cPE6LYe10nN2bWj/kVYKjgGLNOyqFXz82XMfE d09qKRDF6Tz+GIqpDxGOrplQgQvWS7+fimmsI/U9nfiQD9io8ugSga62uPOYjK0sBtLFRGg 5dM70NEzuTuad2w9SVdDh09Sj0+MY4Q/Ae/Rr14aembsUl08ln0uNjMGDTQ7e6cYlDt6uoj KqB3YL17KpryZxceeQ+u4tHmHwwb++zah18DmrB3eeQqpH9dwJkroSCL6k2LFqA60QEDlxG tXMmwcnfHLqp6fDWAMmIm8cXDlvx2yUo9QH43NWCkYLYODz7m7o+UuU5+gyRMheNx/7ZKv1 CyPVjGEsRvjTzEYTTBgAqRXmq5zwHGD3QJmIB2/xlOv2xgZu5iCebyw6sr83SPeknprlgct q7XA4xGg== X-QQ-XMRINFO: Nq+8W0+stu50PRdwbJxPCL0= 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 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