代码拉取完成,页面将自动刷新
From 88a34af2338c4b49d6e2af846b9b7cd0d01068d2 Mon Sep 17 00:00:00 2001
From: veega2022 <zhuweijia@huawei.com>
Date: Mon, 15 Jan 2024 17:55:58 +0800
Subject: [PATCH] hikptool: Fixed an issue where the MAC type is incorrectly
displayed
Currently, only the ETH and ROH types can be displayed, add the UB
mac type to be displayed
Fixes: e05c70e1ff25 ("support querying NIC module information")
Signed-off-by: veega2022 <zhuweijia@huawei.com>
---
net/nic/nic_info/hikp_nic_info.c | 11 +++++++++--
net/nic/nic_info/hikp_nic_info.h | 7 +++++++
2 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/net/nic/nic_info/hikp_nic_info.c b/net/nic/nic_info/hikp_nic_info.c
index cd78bc7..992bbf0 100644
--- a/net/nic/nic_info/hikp_nic_info.c
+++ b/net/nic/nic_info/hikp_nic_info.c
@@ -98,6 +98,13 @@ static int hikp_nic_get_curr_die_info(void)
return 0;
}
+static const char *hikp_nic_info_get_mac_type(uint8_t type_val)
+{
+ const char *mac_type[MAC_TYPE_MAX] = {"ETH", "ROH", "UB"};
+
+ return (type_val >= MAC_TYPE_MAX) ? "UNKNOWN" : mac_type[type_val];
+}
+
static void hikp_nic_info_print_cur_pf(const struct bdf_t *bdf)
{
struct tool_target *pf_target = &g_info_param.target;
@@ -113,7 +120,7 @@ static void hikp_nic_info_print_cur_pf(const struct bdf_t *bdf)
bdf->domain, bdf->bus_id, bdf->dev_id, bdf->fun_id);
printf("\t%-16s %u\n", "mac id:", g_info_param.info.pf_info[pf_id].mac_id);
printf("\t%-16s %s\n", "mac type:",
- g_info_param.info.pf_info[pf_id].mac_type ? "ROH" : "ETH");
+ hikp_nic_info_get_mac_type(g_info_param.info.pf_info[pf_id].mac_type));
printf("\t%-16s %u\n", "func_num:", g_info_param.info.pf_info[pf_id].func_num);
printf("\t%-16s %u\n", "tqp_num:", g_info_param.info.pf_info[pf_id].tqp_num);
printf("\t%-16s 0x%x\n", "pf_cap_flag:", g_info_param.info.pf_info[pf_id].pf_cap_flag);
@@ -162,7 +169,7 @@ static void hikp_nic_info_print_cur_die(void)
printf("\n%-16s", "mac type:");
for (i = 0; i < g_info_param.info.pf_num; i++)
- printf("%s\t", g_info_param.info.pf_info[i].mac_type ? "ROH" : "ETH");
+ printf("%s\t", hikp_nic_info_get_mac_type(g_info_param.info.pf_info[i].mac_type));
printf("\n%-16s", "func num:");
for (i = 0; i < g_info_param.info.pf_num; i++)
diff --git a/net/nic/nic_info/hikp_nic_info.h b/net/nic/nic_info/hikp_nic_info.h
index 7419209..194146e 100644
--- a/net/nic/nic_info/hikp_nic_info.h
+++ b/net/nic/nic_info/hikp_nic_info.h
@@ -70,4 +70,11 @@ struct nic_info_param {
bool have_interface;
};
+enum nic_info_mac_type {
+ MAC_TYPE_ETH = 0,
+ MAC_TYPE_ROH,
+ MAC_TYPE_UB,
+ MAC_TYPE_MAX,
+};
+
#endif
--
2.30.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。