[dpdk-dev] [PATCH v3 21/22] net/atlantic: support for read MAC registers for debug purposes

Igor Russkikh igor.russkikh at aquantia.com
Sat Sep 29 12:30:35 CEST 2018


From: Pavel Belous <Pavel.Belous at aquantia.com>

Signed-off-by: Igor Russkikh <igor.russkikh at aquantia.com>
Signed-off-by: Pavel Belous <Pavel.Belous at aquantia.com>
---
 drivers/net/atlantic/atl_ethdev.c | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/drivers/net/atlantic/atl_ethdev.c b/drivers/net/atlantic/atl_ethdev.c
index 90ab8d9c0b1d..c69b2536a3e3 100644
--- a/drivers/net/atlantic/atl_ethdev.c
+++ b/drivers/net/atlantic/atl_ethdev.c
@@ -80,6 +80,9 @@ static int atl_dev_get_eeprom(struct rte_eth_dev *dev,
 static int atl_dev_set_eeprom(struct rte_eth_dev *dev,
 			      struct rte_dev_eeprom_info *eeprom);
 
+/* Regs */
+static int atl_dev_get_regs(struct rte_eth_dev *dev,
+			    struct rte_dev_reg_info *regs);
 
 /* Flow control */
 static int atl_flow_ctrl_get(struct rte_eth_dev *dev,
@@ -238,6 +241,8 @@ static const struct eth_dev_ops atl_eth_dev_ops = {
 	/* Link */
 	.link_update	      = atl_dev_link_update,
 
+	.get_reg              = atl_dev_get_regs,
+
 	/* Stats */
 	.stats_get	      = atl_dev_stats_get,
 	.xstats_get	      = atl_dev_xstats_get,
@@ -1273,6 +1278,32 @@ atl_dev_set_eeprom(struct rte_eth_dev *dev, struct rte_dev_eeprom_info *eeprom)
 }
 
 static int
+atl_dev_get_regs(struct rte_eth_dev *dev, struct rte_dev_reg_info *regs)
+{
+	struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	u32 mif_id;
+	int err;
+
+	if (regs->data == NULL) {
+		regs->length = hw_atl_utils_hw_get_reg_length();
+		regs->width = sizeof(u32);
+		return 0;
+	}
+
+	/* Only full register dump is supported */
+	if (regs->length && regs->length != hw_atl_utils_hw_get_reg_length())
+		return -ENOTSUP;
+
+	err = hw_atl_utils_hw_get_regs(hw, regs->data);
+
+	/* Device version */
+	mif_id = hw_atl_reg_glb_mif_id_get(hw);
+	regs->version = mif_id & 0xFFU;
+
+	return err;
+}
+
+static int
 atl_flow_ctrl_get(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
 {
 	struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-- 
2.7.4



More information about the dev mailing list