[3/9] net/hns3: dump device feature capability

Message ID 20220211044930.2449-4-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
  Kunpeng 920 and Kunpeng 930 support different feature capability.
This patch dumps feature capability Current device supports.

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

Patch

diff --git a/drivers/net/hns3/hns3_ethdev_dump.c b/drivers/net/hns3/hns3_ethdev_dump.c
index 094648cf47..80e7e0f996 100644
--- a/drivers/net/hns3/hns3_ethdev_dump.c
+++ b/drivers/net/hns3/hns3_ethdev_dump.c
@@ -54,6 +54,32 @@  get_io_func_hint_name(uint32_t hint)
 	}
 }
 
+static void
+get_dev_feature_capability(FILE *file, struct hns3_hw *hw)
+{
+	const char * const caps_name[] = {
+		"DCB",
+		"COPPER",
+		"FD QUEUE REGION",
+		"PTP",
+		"TX PUSH",
+		"INDEP TXRX",
+		"STASH",
+		"SIMPLE BD",
+		"RXD Advanced Layout",
+		"OUTER UDP CKSUM",
+		"RAS IMP",
+		"TM",
+		"VF VLAN FILTER MOD",
+	};
+	uint32_t i;
+
+	fprintf(file, "  - Dev Capability:\n");
+	for (i = 0; i < RTE_DIM(caps_name); i++)
+		fprintf(file, "\t  -- support %s: %s\n", caps_name[i],
+			hw->capability & BIT(i) ? "yes" : "no");
+}
+
 static void
 get_device_basic_info(FILE *file, struct rte_eth_dev *dev)
 {
@@ -93,7 +119,11 @@  get_device_basic_info(FILE *file, struct rte_eth_dev *dev)
 int
 hns3_eth_dev_priv_dump(struct rte_eth_dev *dev, FILE *file)
 {
+	struct hns3_adapter *hns = dev->data->dev_private;
+	struct hns3_hw *hw = &hns->hw;
+
 	get_device_basic_info(file, dev);
+	get_dev_feature_capability(file, hw);
 
 	return 0;
 }