From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jerin Jacob Subject: [PATCH v3 04/20] thunderx/nicvf: add get_reg and get_reg_length support Date: Tue, 7 Jun 2016 22:10:16 +0530 Message-ID: <1465317632-11471-5-git-send-email-jerin.jacob@caviumnetworks.com> References: <1464540424-12631-1-git-send-email-jerin.jacob@caviumnetworks.com> <1465317632-11471-1-git-send-email-jerin.jacob@caviumnetworks.com> Mime-Version: 1.0 Content-Type: text/plain Cc: , , Jerin Jacob , Maciej Czekaj , Kamil Rytarowski , Zyta Szpak , Slawomir Rosek , Radoslaw Biernacki To: Return-path: Received: from na01-bn1-obe.outbound.protection.outlook.com (mail-bn1bon0093.outbound.protection.outlook.com [157.56.111.93]) by dpdk.org (Postfix) with ESMTP id E507A9AD6 for ; Tue, 7 Jun 2016 18:41:34 +0200 (CEST) In-Reply-To: <1465317632-11471-1-git-send-email-jerin.jacob@caviumnetworks.com> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Signed-off-by: Jerin Jacob Signed-off-by: Maciej Czekaj Signed-off-by: Kamil Rytarowski Signed-off-by: Zyta Szpak Signed-off-by: Slawomir Rosek Signed-off-by: Radoslaw Biernacki --- drivers/net/thunderx/nicvf_ethdev.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c index 5d28eea..34b4735 100644 --- a/drivers/net/thunderx/nicvf_ethdev.c +++ b/drivers/net/thunderx/nicvf_ethdev.c @@ -70,6 +70,9 @@ #include "nicvf_logs.h" static int nicvf_dev_link_update(struct rte_eth_dev *dev, int wait_to_complete); +static int nicvf_dev_get_reg_length(struct rte_eth_dev *dev); +static int nicvf_dev_get_regs(struct rte_eth_dev *dev, + struct rte_dev_reg_info *regs); static inline int nicvf_atomic_write_link_status(struct rte_eth_dev *dev, @@ -145,9 +148,36 @@ nicvf_dev_link_update(struct rte_eth_dev *dev, return nicvf_atomic_write_link_status(dev, &link); } +static int +nicvf_dev_get_reg_length(struct rte_eth_dev *dev __rte_unused) +{ + return nicvf_reg_get_count(); +} + +static int +nicvf_dev_get_regs(struct rte_eth_dev *dev, struct rte_dev_reg_info *regs) +{ + uint64_t *data = regs->data; + struct nicvf *nic = nicvf_pmd_priv(dev); + + if (data == NULL) + return -EINVAL; + + /* Support only full register dump */ + if ((regs->length == 0) || + (regs->length == (uint32_t)nicvf_reg_get_count())) { + regs->version = nic->vendor_id << 16 | nic->device_id; + nicvf_reg_dump(nic, data); + return 0; + } + return -ENOTSUP; +} + /* Initialize and register driver with DPDK Application */ static const struct eth_dev_ops nicvf_eth_dev_ops = { .link_update = nicvf_dev_link_update, + .get_reg_length = nicvf_dev_get_reg_length, + .get_reg = nicvf_dev_get_regs, }; static int -- 2.5.5