From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 069BEA0508; Thu, 14 Apr 2022 15:02:03 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DF7F44113D; Thu, 14 Apr 2022 15:01:57 +0200 (CEST) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 4BD3E40E64 for ; Thu, 14 Apr 2022 15:01:56 +0200 (CEST) Received: from kwepemi500012.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4KfKLX4hYHzgYdV for ; Thu, 14 Apr 2022 21:00:04 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by kwepemi500012.china.huawei.com (7.221.188.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 14 Apr 2022 21:01:54 +0800 From: "Min Hu (Connor)" To: CC: "Min Hu (Connor)" , Yisen Zhuang , Lijun Ou Subject: [PATCH 2/5] net/hns3: refactor feature capability dump Date: Thu, 14 Apr 2022 21:00:53 +0800 Message-ID: <20220414130056.37428-3-humin29@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20220414130056.37428-1-humin29@huawei.com> References: <20220414130056.37428-1-humin29@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemi500012.china.huawei.com (7.221.188.12) X-CFilter-Loop: Reflected X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org This patch refactor feature capability dump. Fixes: 14ea9f0a62c6 ("net/hns3: dump device feature capability") Signed-off-by: Min Hu (Connor) --- 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 -#include -#include -#include - #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