]> git.droids-corp.org - dpdk.git/commitdiff
net/hns3: refactor feature capability dump
authorMin Hu (Connor) <humin29@huawei.com>
Thu, 14 Apr 2022 13:00:53 +0000 (21:00 +0800)
committerFerruh Yigit <ferruh.yigit@xilinx.com>
Thu, 5 May 2022 12:57:10 +0000 (14:57 +0200)
This patch refactors feature capability dump.

Fixes: 14ea9f0a62c6 ("net/hns3: dump device feature capability")
Cc: stable@dpdk.org
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
drivers/net/hns3/hns3_ethdev.h
drivers/net/hns3/hns3_ethdev_dump.c

index 9a0fa09b572724367f4b42e91be6ad552859f450..75a89c3d1c005a2bd361589d77177a38781ce910 100644 (file)
@@ -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,
index 8b7a90a67e08681b453ddc3b93723f0fbf4e3e17..059a4d86440805745120486b4eb4b0df82569c37 100644 (file)
@@ -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 *