net/atlantic: read MAC registers for debug purposes
authorPavel Belous <pavel.belous@aquantia.com>
Fri, 12 Oct 2018 11:09:53 +0000 (11:09 +0000)
committerFerruh Yigit <ferruh.yigit@intel.com>
Thu, 18 Oct 2018 08:24:39 +0000 (10:24 +0200)
This patch add support for dumping MAC registers.

Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
Signed-off-by: Pavel Belous <pavel.belous@aquantia.com>
doc/guides/nics/features/atlantic.ini
drivers/net/atlantic/atl_ethdev.c

index f09a756..5ed095b 100644 (file)
@@ -30,6 +30,7 @@ Extended stats       = Y
 Stats per queue      = Y
 FW version           = Y
 EEPROM dump          = Y
+Registers dump       = Y
 Linux UIO            = Y
 ARMv8                = Y
 x86-32               = Y
index 824e624..5bc04f5 100644 (file)
@@ -69,6 +69,10 @@ 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,
                               struct rte_eth_fc_conf *fc_conf);
@@ -229,6 +233,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,
@@ -1124,6 +1130,32 @@ atl_dev_set_eeprom(struct rte_eth_dev *dev, struct rte_dev_eeprom_info *eeprom)
        return hw->aq_fw_ops->set_eeprom(hw, eeprom->data, eeprom->length);
 }
 
+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)
 {