DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Min Hu (Connor)" <humin29@huawei.com>
To: <dev@dpdk.org>
Cc: "Min Hu (Connor)" <humin29@huawei.com>,
	Yisen Zhuang <yisen.zhuang@huawei.com>,
	Lijun Ou <oulijun@huawei.com>
Subject: [PATCH 2/5] net/hns3: refactor feature capability dump
Date: Thu, 14 Apr 2022 21:00:53 +0800	[thread overview]
Message-ID: <20220414130056.37428-3-humin29@huawei.com> (raw)
In-Reply-To: <20220414130056.37428-1-humin29@huawei.com>

This patch refactor feature capability dump.

Fixes: 14ea9f0a62c6 ("net/hns3: dump device feature capability")

Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
---
 drivers/net/hns3/hns3_ethdev.h      |  2 +-
 drivers/net/hns3/hns3_ethdev_dump.c | 40 ++++++++++++++---------------
 2 files changed, 20 insertions(+), 22 deletions(-)

diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h
index 9a0fa09b57..75a89c3d1c 100644
--- a/drivers/net/hns3/hns3_ethdev.h
+++ b/drivers/net/hns3/hns3_ethdev.h
@@ -874,7 +874,7 @@ struct hns3_adapter {
 
 #define HNS3_DEVARG_MBX_TIME_LIMIT_MS	"mbx_time_limit_ms"
 
-enum {
+enum hns3_dev_cap {
 	HNS3_DEV_SUPPORT_DCB_B,
 	HNS3_DEV_SUPPORT_COPPER_B,
 	HNS3_DEV_SUPPORT_FD_QUEUE_REGION_B,
diff --git a/drivers/net/hns3/hns3_ethdev_dump.c b/drivers/net/hns3/hns3_ethdev_dump.c
index 8b7a90a67e..059a4d8644 100644
--- a/drivers/net/hns3/hns3_ethdev_dump.c
+++ b/drivers/net/hns3/hns3_ethdev_dump.c
@@ -2,15 +2,11 @@
  * Copyright(C) 2022 HiSilicon Limited
  */
 
-#include <rte_kvargs.h>
-#include <rte_bus_pci.h>
-#include <ethdev_pci.h>
-#include <rte_pci.h>
-
 #include "hns3_common.h"
 #include "hns3_logs.h"
 #include "hns3_regs.h"
 #include "hns3_rxtx.h"
+#include "hns3_ethdev.h"
 
 static const char *
 get_adapter_state_name(enum hns3_adapter_state state)
@@ -84,27 +80,29 @@ get_dev_mac_info(FILE *file, struct hns3_adapter *hns)
 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",
+	const struct {
+		enum hns3_dev_cap cap;
+		const char *name;
+	} caps_name[] = {
+		{HNS3_DEV_SUPPORT_DCB_B, "DCB"},
+		{HNS3_DEV_SUPPORT_COPPER_B, "COPPER"},
+		{HNS3_DEV_SUPPORT_FD_QUEUE_REGION_B, "FD QUEUE REGION"},
+		{HNS3_DEV_SUPPORT_PTP_B, "PTP"},
+		{HNS3_DEV_SUPPORT_TX_PUSH_B, "TX PUSH"},
+		{HNS3_DEV_SUPPORT_INDEP_TXRX_B, "INDEP TXRX"},
+		{HNS3_DEV_SUPPORT_STASH_B, "STASH"},
+		{HNS3_DEV_SUPPORT_RXD_ADV_LAYOUT_B, "RXD Advanced Layout"},
+		{HNS3_DEV_SUPPORT_OUTER_UDP_CKSUM_B, "OUTER UDP CKSUM"},
+		{HNS3_DEV_SUPPORT_RAS_IMP_B, "RAS IMP"},
+		{HNS3_DEV_SUPPORT_TM_B, "TM"},
 	};
 	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");
+		fprintf(file, "\t  -- support %s: %s\n", caps_name[i].name,
+			hns3_get_bit(hw->capability, caps_name[i].cap) ? "Yes" :
+									 "No");
 }
 
 static const char *
-- 
2.33.0


  parent reply	other threads:[~2022-04-14 13:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-14 13:00 [PATCH 0/5] refactor for device info dump Min Hu (Connor)
2022-04-14 13:00 ` [PATCH 1/5] net/hns3: refactor adapter state dump Min Hu (Connor)
2022-04-14 13:00 ` Min Hu (Connor) [this message]
2022-04-14 13:00 ` [PATCH 3/5] net/hns3: refactor queue info dump Min Hu (Connor)
2022-04-14 13:00 ` [PATCH 4/5] net/hns3: fix dump TM info Min Hu (Connor)
2022-04-14 13:00 ` [PATCH 5/5] net/hns3: fix dump device info Min Hu (Connor)
2022-05-05 16:28 ` [PATCH 0/5] refactor for device info dump Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220414130056.37428-3-humin29@huawei.com \
    --to=humin29@huawei.com \
    --cc=dev@dpdk.org \
    --cc=oulijun@huawei.com \
    --cc=yisen.zhuang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).