[4/9] net/hns3: dump device MAC info

Message ID 20220211044930.2449-5-humin29@huawei.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series dump device info |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

humin (Q) Feb. 11, 2022, 4:49 a.m. UTC
  This patch dumps device MAC info which hns3 PMD private info offers.

Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
---
 drivers/net/hns3/hns3_ethdev_dump.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
  

Patch

diff --git a/drivers/net/hns3/hns3_ethdev_dump.c b/drivers/net/hns3/hns3_ethdev_dump.c
index 80e7e0f996..6ceeb5a349 100644
--- a/drivers/net/hns3/hns3_ethdev_dump.c
+++ b/drivers/net/hns3/hns3_ethdev_dump.c
@@ -54,6 +54,28 @@  get_io_func_hint_name(uint32_t hint)
 	}
 }
 
+static void
+get_dev_mac_info(FILE *file, struct hns3_adapter *hns)
+{
+	struct hns3_hw *hw = &hns->hw;
+	struct hns3_pf *pf = &hns->pf;
+
+	fprintf(file, "  - MAC Info:\n");
+	fprintf(file,
+		"\t  -- query_type=%u\n"
+		"\t  -- supported_speed=0x%x\n"
+		"\t  -- advertising=0x%x\n"
+		"\t  -- lp_advertising=0x%x\n"
+		"\t  -- support_autoneg=%s\n"
+		"\t  -- support_fc_autoneg=%s\n",
+		hw->mac.query_type,
+		hw->mac.supported_speed,
+		hw->mac.advertising,
+		hw->mac.lp_advertising,
+		hw->mac.support_autoneg != 0 ? "Yes" : "No",
+		pf->support_fc_autoneg ? "Yes" : "No");
+}
+
 static void
 get_dev_feature_capability(FILE *file, struct hns3_hw *hw)
 {
@@ -125,5 +147,11 @@  hns3_eth_dev_priv_dump(struct rte_eth_dev *dev, FILE *file)
 	get_device_basic_info(file, dev);
 	get_dev_feature_capability(file, hw);
 
+	/* VF only supports dumping basic info and feaure capability */
+	if (hns->is_vf)
+		return 0;
+
+	get_dev_mac_info(file, hns);
+
 	return 0;
 }