Compare commits
10 Commits
fbeb17c0f2
...
e9b9e6ae98
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e9b9e6ae98 | ||
|
|
5ff15d1ced | ||
|
|
1efdbc0f9f | ||
|
|
7ea81ef4da | ||
|
|
cd14962aa9 | ||
|
|
074f39e544 | ||
|
|
280b2273ba | ||
|
|
dc99219c2a | ||
|
|
9395fb04d6 | ||
|
|
9ce8b26b85 |
44
0005-fix-hikptool-rciep-rsp-filed-error-problem.patch
Normal file
44
0005-fix-hikptool-rciep-rsp-filed-error-problem.patch
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
From 436ab65e026ae1260b7e7cab905a23096bf7e1e5 Mon Sep 17 00:00:00 2001
|
||||||
|
From: veega2022 <zhuweijia@huawei.com>
|
||||||
|
Date: Wed, 10 May 2023 17:39:59 +0800
|
||||||
|
Subject: [PATCH 01/18] fix hikptool rciep rsp filed error problem
|
||||||
|
|
||||||
|
union hikp_space_rsp 0xF8h is reserved and 0xFCh is cpl_status
|
||||||
|
|
||||||
|
Signed-off-by: hesiyuan <hesiyuan4@huawei.com>
|
||||||
|
---
|
||||||
|
libhikptdev/src/rciep/hikpt_rciep.c | 2 +-
|
||||||
|
libhikptdev/src/rciep/hikpt_rciep.h | 4 ++--
|
||||||
|
2 files changed, 3 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/libhikptdev/src/rciep/hikpt_rciep.c b/libhikptdev/src/rciep/hikpt_rciep.c
|
||||||
|
index 9b7a82a..5c7e82f 100644
|
||||||
|
--- a/libhikptdev/src/rciep/hikpt_rciep.c
|
||||||
|
+++ b/libhikptdev/src/rciep/hikpt_rciep.c
|
||||||
|
@@ -97,7 +97,7 @@ static uint32_t hikp_wait_for_cpl_status(void)
|
||||||
|
uint32_t status;
|
||||||
|
|
||||||
|
do {
|
||||||
|
- status = g_hikp_req->field.cpl_status;
|
||||||
|
+ status = g_hikp_rsp->field.cpl_status;
|
||||||
|
if (status != HIKP_INIT_STAT)
|
||||||
|
return status;
|
||||||
|
count--;
|
||||||
|
diff --git a/libhikptdev/src/rciep/hikpt_rciep.h b/libhikptdev/src/rciep/hikpt_rciep.h
|
||||||
|
index 093724a..8fbb3c0 100644
|
||||||
|
--- a/libhikptdev/src/rciep/hikpt_rciep.h
|
||||||
|
+++ b/libhikptdev/src/rciep/hikpt_rciep.h
|
||||||
|
@@ -75,8 +75,8 @@ union hikp_space_rsp {
|
||||||
|
uint32_t version; /* 000h */
|
||||||
|
uint32_t rsp_para_num; /* 004h */
|
||||||
|
uint32_t data[HIKP_RSP_DATA_MAX]; /* 008h */
|
||||||
|
- uint32_t cpl_status; /* 0F8h */
|
||||||
|
- uint32_t pid_record; /* 0FCh */
|
||||||
|
+ uint32_t rsv; /* 0F8h */
|
||||||
|
+ uint32_t cpl_status; /* 0FCh */
|
||||||
|
struct iep_doorbell sw_db; /* 100h. Fixed and unmodifiable */
|
||||||
|
} field;
|
||||||
|
|
||||||
|
--
|
||||||
|
2.25.1
|
||||||
|
|
||||||
37
0006-fix-pcie_info-cmd-print-display-problem.patch
Normal file
37
0006-fix-pcie_info-cmd-print-display-problem.patch
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
From befc663ba761c1b334b50de138e57e2a00be4f32 Mon Sep 17 00:00:00 2001
|
||||||
|
From: veega2022 <zhuweijia@huawei.com>
|
||||||
|
Date: Wed, 10 May 2023 17:54:59 +0800
|
||||||
|
Subject: [PATCH 02/18] fix pcie_info cmd print display problem
|
||||||
|
|
||||||
|
The spelling of WITDH is incorrect. Change it to WIDTH.
|
||||||
|
|
||||||
|
Signed-off-by: hesiyuan <hesiyuan4@huawei.com>
|
||||||
|
---
|
||||||
|
pcie/func_lib/pcie_func/pcie_statistics.c | 4 ++--
|
||||||
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/pcie/func_lib/pcie_func/pcie_statistics.c b/pcie/func_lib/pcie_func/pcie_statistics.c
|
||||||
|
index f12660d..308a142 100644
|
||||||
|
--- a/pcie/func_lib/pcie_func/pcie_statistics.c
|
||||||
|
+++ b/pcie/func_lib/pcie_func/pcie_statistics.c
|
||||||
|
@@ -22,7 +22,7 @@
|
||||||
|
#include "pcie_statistics.h"
|
||||||
|
|
||||||
|
static const char *g_global_width_name[GLOBAL_WIDTH_TABLE_SIZE] = {
|
||||||
|
- "PCIE_WITDH_X1", "PCIE_WITDH_X2", "PCIE_WITDH_X4", "PCIE_WITDH_X8", "PCIE_WITDH_X16"
|
||||||
|
+ "PCIE_WIDTH_X1", "PCIE_WIDTH_X2", "PCIE_WIDTH_X4", "PCIE_WIDTH_X8", "PCIE_WIDTH_X16"
|
||||||
|
};
|
||||||
|
|
||||||
|
static int port_distribution_rsp_data_check(const struct hikp_cmd_ret *cmd_ret, uint32_t *port_num)
|
||||||
|
@@ -81,7 +81,7 @@ int pcie_port_distribution_get(uint32_t chip_id)
|
||||||
|
for (i = 0; i < pair_num; i++) {
|
||||||
|
if (port_info->info_pair[i].port_width >= HIKP_ARRAY_SIZE(g_global_width_name)) {
|
||||||
|
Info("PCIe Base", "port_id[%u] %s\n", port_info->info_pair[i].port_id,
|
||||||
|
- "UNKNOWN_WITDH");
|
||||||
|
+ "UNKNOWN_WIDTH");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
Info("PCIe Base", "port_id[%u] %s\n", port_info->info_pair[i].port_id,
|
||||||
|
--
|
||||||
|
2.25.1
|
||||||
|
|
||||||
123
0007-fix-signal-proc-func-api-modified-to-be-open-to-the-.patch
Normal file
123
0007-fix-signal-proc-func-api-modified-to-be-open-to-the-.patch
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
From e649f6245f73b99e5c2501f789a3b363c2a25554 Mon Sep 17 00:00:00 2001
|
||||||
|
From: veega2022 <zhuweijia@huawei.com>
|
||||||
|
Date: Wed, 10 May 2023 18:05:01 +0800
|
||||||
|
Subject: [PATCH 03/18] fix signal proc func api modified to be open to the
|
||||||
|
public
|
||||||
|
|
||||||
|
move sig_init api to op_logs public header file
|
||||||
|
|
||||||
|
Signed-off-by: wangkang <wangkang124@hisilicon.com>
|
||||||
|
---
|
||||||
|
hikp_init_main.c | 20 --------------------
|
||||||
|
libhikptdev/src/rciep/hikpt_rciep.h | 2 +-
|
||||||
|
tool_lib/op_logs.c | 23 ++++++++++++++++++++++-
|
||||||
|
tool_lib/op_logs.h | 3 ++-
|
||||||
|
4 files changed, 25 insertions(+), 23 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/hikp_init_main.c b/hikp_init_main.c
|
||||||
|
index 4102c69..4629b40 100644
|
||||||
|
--- a/hikp_init_main.c
|
||||||
|
+++ b/hikp_init_main.c
|
||||||
|
@@ -19,26 +19,6 @@
|
||||||
|
/* hikptool command adapter */
|
||||||
|
struct cmd_adapter g_tool = { 0 };
|
||||||
|
|
||||||
|
-static void _sig_ign_handle(int arg)
|
||||||
|
-{
|
||||||
|
- signal_op_log_write(arg);
|
||||||
|
- hikp_unlock();
|
||||||
|
- _exit(1);
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
-static void sig_init(void)
|
||||||
|
-{
|
||||||
|
- (void)signal(SIGINT, _sig_ign_handle); /* Quit process */
|
||||||
|
- (void)signal(SIGTERM, _sig_ign_handle);
|
||||||
|
- (void)signal(SIGQUIT, _sig_ign_handle);
|
||||||
|
- (void)signal(SIGHUP, _sig_ign_handle);
|
||||||
|
- (void)signal(SIGSEGV, _sig_ign_handle);
|
||||||
|
- (void)signal(SIGBUS, _sig_ign_handle);
|
||||||
|
- (void)signal(SIGFPE, _sig_ign_handle);
|
||||||
|
- (void)signal(SIGABRT, _sig_ign_handle);
|
||||||
|
- (void)signal(SIGTSTP, _sig_ign_handle); /* Stop process */
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
static void show_tool_version(const struct cmd_adapter *adapter)
|
||||||
|
{
|
||||||
|
printf("%s version %s Huawei\n", adapter->name, adapter->version);
|
||||||
|
diff --git a/libhikptdev/src/rciep/hikpt_rciep.h b/libhikptdev/src/rciep/hikpt_rciep.h
|
||||||
|
index 8fbb3c0..dd08759 100644
|
||||||
|
--- a/libhikptdev/src/rciep/hikpt_rciep.h
|
||||||
|
+++ b/libhikptdev/src/rciep/hikpt_rciep.h
|
||||||
|
@@ -40,7 +40,7 @@
|
||||||
|
#define MAX_LOCK_COUNT 5
|
||||||
|
#define LOCK_CHECK_GAP_US 1000
|
||||||
|
#define CPL_CHECK_GAP_US 1000
|
||||||
|
-#define WAIT_CPL_MAX_MS 5000
|
||||||
|
+#define WAIT_CPL_MAX_MS 8000
|
||||||
|
|
||||||
|
enum {
|
||||||
|
HIKP_RESOURCE_DIR,
|
||||||
|
diff --git a/tool_lib/op_logs.c b/tool_lib/op_logs.c
|
||||||
|
index d6082a3..069428d 100644
|
||||||
|
--- a/tool_lib/op_logs.c
|
||||||
|
+++ b/tool_lib/op_logs.c
|
||||||
|
@@ -14,7 +14,9 @@
|
||||||
|
#include <syslog.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
+#include <signal.h>
|
||||||
|
#include "tool_lib.h"
|
||||||
|
+#include "hikptdev_plug.h"
|
||||||
|
#include "op_logs.h"
|
||||||
|
|
||||||
|
static char g_op_log[OP_LOG_FILE_PATH_MAXLEN] = {0};
|
||||||
|
@@ -23,7 +25,6 @@ static bool g_record = true;
|
||||||
|
static bool g_log_info;
|
||||||
|
static char g_input_buf[OP_LOG_FILE_W_MAXSIZE + 1] = {0};
|
||||||
|
|
||||||
|
-
|
||||||
|
static void op_log_write(const char *log_data)
|
||||||
|
{
|
||||||
|
size_t w_size;
|
||||||
|
@@ -414,3 +415,23 @@ SIGNAL_LOG_OUT:
|
||||||
|
(void)close(fd);
|
||||||
|
(void)uda_unfcntl(&op_log_fd, UDA_FLOCK_BLOCK);
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+static void signal_handle(int arg)
|
||||||
|
+{
|
||||||
|
+ signal_op_log_write(arg);
|
||||||
|
+ hikp_unlock();
|
||||||
|
+ _exit(1);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void sig_init(void)
|
||||||
|
+{
|
||||||
|
+ (void)signal(SIGINT, signal_handle); /* Quit process */
|
||||||
|
+ (void)signal(SIGTERM, signal_handle);
|
||||||
|
+ (void)signal(SIGQUIT, signal_handle);
|
||||||
|
+ (void)signal(SIGHUP, signal_handle);
|
||||||
|
+ (void)signal(SIGSEGV, signal_handle);
|
||||||
|
+ (void)signal(SIGBUS, signal_handle);
|
||||||
|
+ (void)signal(SIGFPE, signal_handle);
|
||||||
|
+ (void)signal(SIGABRT, signal_handle);
|
||||||
|
+ (void)signal(SIGTSTP, signal_handle); /* Stop process */
|
||||||
|
+}
|
||||||
|
diff --git a/tool_lib/op_logs.h b/tool_lib/op_logs.h
|
||||||
|
index 597f063..6b6e421 100644
|
||||||
|
--- a/tool_lib/op_logs.h
|
||||||
|
+++ b/tool_lib/op_logs.h
|
||||||
|
@@ -45,7 +45,8 @@ struct op_log_print_t {
|
||||||
|
char *str;
|
||||||
|
};
|
||||||
|
|
||||||
|
-void signal_op_log_write(int signal_code);
|
||||||
|
+void sig_init(void);
|
||||||
|
+
|
||||||
|
void op_log_on(void);
|
||||||
|
void op_log_off(void);
|
||||||
|
int op_log_initialise(const char *log_dir);
|
||||||
|
--
|
||||||
|
2.25.1
|
||||||
|
|
||||||
28
0008-delete-pcie-AP_INT-module-for-dump-reg.patch
Normal file
28
0008-delete-pcie-AP_INT-module-for-dump-reg.patch
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
From b369c7bf28b576097b46470d509ac61116872958 Mon Sep 17 00:00:00 2001
|
||||||
|
From: veega2022 <zhuweijia@huawei.com>
|
||||||
|
Date: Wed, 10 May 2023 18:09:55 +0800
|
||||||
|
Subject: [PATCH 04/18] delete pcie AP_INT module for dump reg
|
||||||
|
|
||||||
|
the AP_INT module is abandoned, so deleted this module and do not dump
|
||||||
|
this module reg
|
||||||
|
|
||||||
|
Signed-off-by: hesiyuan <hesiyuan4@huawei.com>
|
||||||
|
---
|
||||||
|
pcie/func_lib/pcie_func/pcie_reg_read.c | 1 -
|
||||||
|
1 file changed, 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/pcie/func_lib/pcie_func/pcie_reg_read.c b/pcie/func_lib/pcie_func/pcie_reg_read.c
|
||||||
|
index 6ba4f07..b3d4643 100644
|
||||||
|
--- a/pcie/func_lib/pcie_func/pcie_reg_read.c
|
||||||
|
+++ b/pcie/func_lib/pcie_func/pcie_reg_read.c
|
||||||
|
@@ -30,7 +30,6 @@ static struct pcie_module_table g_module_table[] = {
|
||||||
|
{"PCIPC_REG", PCIPC_REG_ID},
|
||||||
|
{"AP_MCTP_REG", AP_MCTP_REG_ID},
|
||||||
|
{"AP_ENGINE_REG", AP_ENGINE_REG_ID},
|
||||||
|
- {"AP_INT_REG", AP_INT_REG_ID},
|
||||||
|
{"AP_DMA_REG", AP_DMA_REG_ID},
|
||||||
|
{"TOP_REG", TOP_REG_ID},
|
||||||
|
{"CORE_GLOBAL_REG", CORE_GLOBAL_REG_ID},
|
||||||
|
--
|
||||||
|
2.25.1
|
||||||
|
|
||||||
@ -0,0 +1,28 @@
|
|||||||
|
From 2b679f7b8023298c3942b424545a4eff8aebe683 Mon Sep 17 00:00:00 2001
|
||||||
|
From: veega2022 <zhuweijia@huawei.com>
|
||||||
|
Date: Wed, 10 May 2023 18:14:50 +0800
|
||||||
|
Subject: [PATCH 05/18] fix serdes module dump reg num is not enough problem
|
||||||
|
|
||||||
|
The number of new chip registers may increase. Therefore, increase the number of dump registers.
|
||||||
|
|
||||||
|
Signed-off-by: wangkang <wangkang124@hisilicon.com>
|
||||||
|
---
|
||||||
|
serdes/hikp_serdes.c | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/serdes/hikp_serdes.c b/serdes/hikp_serdes.c
|
||||||
|
index 89e66e1..dd9eee3 100644
|
||||||
|
--- a/serdes/hikp_serdes.c
|
||||||
|
+++ b/serdes/hikp_serdes.c
|
||||||
|
@@ -23,7 +23,7 @@
|
||||||
|
|
||||||
|
static struct cmd_serdes_param g_serdes_param = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
|
||||||
|
|
||||||
|
-#define SERDES_OUTPUT_MAX_SIZE 2048
|
||||||
|
+#define SERDES_OUTPUT_MAX_SIZE 2560
|
||||||
|
static char g_serdes_data_out_buf[SERDES_OUTPUT_MAX_SIZE] = {0};
|
||||||
|
|
||||||
|
static int cmd_serdes_maininfo_help(struct major_cmd_ctrl *self, const char *argv)
|
||||||
|
--
|
||||||
|
2.25.1
|
||||||
|
|
||||||
125
0010-fix-the-number-of-PCS-lane-registers-in-the-PCIe-dum.patch
Normal file
125
0010-fix-the-number-of-PCS-lane-registers-in-the-PCIe-dum.patch
Normal file
@ -0,0 +1,125 @@
|
|||||||
|
From 104dce7743c31c73a54095844d704272fa14de69 Mon Sep 17 00:00:00 2001
|
||||||
|
From: veega2022 <zhuweijia@huawei.com>
|
||||||
|
Date: Wed, 10 May 2023 18:20:58 +0800
|
||||||
|
Subject: [PATCH 06/18] fix the number of PCS lane registers in the PCIe
|
||||||
|
dumpreg
|
||||||
|
|
||||||
|
Traverse the PCS registers of all lanes under the current core.
|
||||||
|
|
||||||
|
Signed-off-by: hesiyuan <hesiyuan4@huawei.com>
|
||||||
|
---
|
||||||
|
pcie/func_lib/pcie_func/pcie_reg_dump.c | 36 +++++++++++-------------
|
||||||
|
pcie/func_lib/pcie_func/pcie_reg_dump.h | 10 +++++++
|
||||||
|
pcie/usr_cmd/interface/pcie_common_api.h | 4 +++
|
||||||
|
3 files changed, 31 insertions(+), 19 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/pcie/func_lib/pcie_func/pcie_reg_dump.c b/pcie/func_lib/pcie_func/pcie_reg_dump.c
|
||||||
|
index 7d91969..e10ff7e 100644
|
||||||
|
--- a/pcie/func_lib/pcie_func/pcie_reg_dump.c
|
||||||
|
+++ b/pcie/func_lib/pcie_func/pcie_reg_dump.c
|
||||||
|
@@ -108,13 +108,13 @@ struct pcie_dumpreg_info g_reg_table_mac[] = {
|
||||||
|
};
|
||||||
|
|
||||||
|
struct pcie_dumpreg_info g_reg_table_pcs[] = {
|
||||||
|
- {0, "SERDES_STATUS_RPT"},
|
||||||
|
- {0, "EBUF_STATUS"},
|
||||||
|
- {0, "GEN3_DEC_ENC_STATUS"},
|
||||||
|
- {0, "WAKE_STATUS"},
|
||||||
|
- {0, "RECV_DET_OR_PWR_CHAGE"},
|
||||||
|
- {0, "EQEVAL_STATUS"},
|
||||||
|
- {0, "LANE_INTR_STATUS"},
|
||||||
|
+ HIKP_PCIE_PCS_LANE_TBL_ENTRY(SERDES_STATUS_RPT),
|
||||||
|
+ HIKP_PCIE_PCS_LANE_TBL_ENTRY(EBUF_STATUS),
|
||||||
|
+ HIKP_PCIE_PCS_LANE_TBL_ENTRY(GEN3_DEC_ENC_STATUS),
|
||||||
|
+ HIKP_PCIE_PCS_LANE_TBL_ENTRY(WAKE_STATUS),
|
||||||
|
+ HIKP_PCIE_PCS_LANE_TBL_ENTRY(RECV_DET_OR_PWR_CHAGE),
|
||||||
|
+ HIKP_PCIE_PCS_LANE_TBL_ENTRY(EQEVAL_STATUS),
|
||||||
|
+ HIKP_PCIE_PCS_LANE_TBL_ENTRY(LANE_INTR_STATUS),
|
||||||
|
};
|
||||||
|
|
||||||
|
struct pcie_dumpreg_info g_reg_table_iob_tx[] = {
|
||||||
|
@@ -348,6 +348,13 @@ static void pcie_dumpreg_save_glb_analysis_log(const uint32_t *data, uint32_t da
|
||||||
|
pcie_dumpreg_write_value_to_file(g_reg_table_core_glb[item_i].name,
|
||||||
|
g_reg_table_core_glb[item_i].val);
|
||||||
|
}
|
||||||
|
+ /* PCS REG */
|
||||||
|
+ for (item_i = 0; item_i < HIKP_ARRAY_SIZE(g_reg_table_pcs) &&
|
||||||
|
+ data_i < data_num; item_i++, data_i++) {
|
||||||
|
+ g_reg_table_pcs[item_i].val = data[data_i];
|
||||||
|
+ pcie_dumpreg_write_value_to_file(g_reg_table_pcs[item_i].name,
|
||||||
|
+ g_reg_table_pcs[item_i].val);
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
static void pcie_dumpreg_save_port_analysis_log(uint32_t *data, uint32_t data_num)
|
||||||
|
@@ -376,13 +383,6 @@ static void pcie_dumpreg_save_port_analysis_log(uint32_t *data, uint32_t data_nu
|
||||||
|
pcie_dumpreg_write_value_to_file(g_reg_table_mac[item_i].name,
|
||||||
|
g_reg_table_mac[item_i].val);
|
||||||
|
}
|
||||||
|
- /* PCS REG */
|
||||||
|
- for (item_i = 0; item_i < HIKP_ARRAY_SIZE(g_reg_table_pcs) &&
|
||||||
|
- data_i < data_num; item_i++, data_i++) {
|
||||||
|
- g_reg_table_pcs[item_i].val = data[data_i];
|
||||||
|
- pcie_dumpreg_write_value_to_file(g_reg_table_pcs[item_i].name,
|
||||||
|
- g_reg_table_pcs[item_i].val);
|
||||||
|
- }
|
||||||
|
}
|
||||||
|
|
||||||
|
static int pcie_dumpreg_write_header_to_file(uint32_t version,
|
||||||
|
@@ -421,14 +421,12 @@ static int pcie_dumpreg_save_log(uint32_t *data, uint32_t data_num,
|
||||||
|
switch (req_data->level) {
|
||||||
|
case DUMP_GLOBAL_LEVEL:
|
||||||
|
expect_data_num = HIKP_ARRAY_SIZE(g_reg_table_iob_tx) +
|
||||||
|
- HIKP_ARRAY_SIZE(g_reg_table_iob_rx) + HIKP_ARRAY_SIZE(g_reg_table_ap_glb) +
|
||||||
|
- HIKP_ARRAY_SIZE(g_reg_table_core_glb);
|
||||||
|
+ HIKP_ARRAY_SIZE(g_reg_table_iob_rx) + HIKP_ARRAY_SIZE(g_reg_table_ap_glb) +
|
||||||
|
+ HIKP_ARRAY_SIZE(g_reg_table_core_glb) + HIKP_ARRAY_SIZE(g_reg_table_pcs);
|
||||||
|
break;
|
||||||
|
case DUMP_PORT_LEVEL:
|
||||||
|
expect_data_num = HIKP_ARRAY_SIZE(g_reg_table_tl) +
|
||||||
|
- HIKP_ARRAY_SIZE(g_reg_table_dl) +
|
||||||
|
- HIKP_ARRAY_SIZE(g_reg_table_mac) +
|
||||||
|
- HIKP_ARRAY_SIZE(g_reg_table_pcs);
|
||||||
|
+ HIKP_ARRAY_SIZE(g_reg_table_dl) + HIKP_ARRAY_SIZE(g_reg_table_mac);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
Err("PCIe DUMPREG", "check dump level failed.\n");
|
||||||
|
diff --git a/pcie/func_lib/pcie_func/pcie_reg_dump.h b/pcie/func_lib/pcie_func/pcie_reg_dump.h
|
||||||
|
index 1993c1f..4ec1909 100644
|
||||||
|
--- a/pcie/func_lib/pcie_func/pcie_reg_dump.h
|
||||||
|
+++ b/pcie/func_lib/pcie_func/pcie_reg_dump.h
|
||||||
|
@@ -20,6 +20,16 @@
|
||||||
|
#define MAX_STR_LEN 80
|
||||||
|
#define PCIE_DUMPREG_LOGFILE_NAME "pcie_dumpreg"
|
||||||
|
|
||||||
|
+#define HIKP_PCIE_PCS_LANE_TBL_ENTRY(name) \
|
||||||
|
+ {0, STR(CONTACT(name, _00))}, {0, STR(CONTACT(name, _01))}, \
|
||||||
|
+ {0, STR(CONTACT(name, _02))}, {0, STR(CONTACT(name, _03))}, \
|
||||||
|
+ {0, STR(CONTACT(name, _04))}, {0, STR(CONTACT(name, _05))}, \
|
||||||
|
+ {0, STR(CONTACT(name, _06))}, {0, STR(CONTACT(name, _07))}, \
|
||||||
|
+ {0, STR(CONTACT(name, _08))}, {0, STR(CONTACT(name, _09))}, \
|
||||||
|
+ {0, STR(CONTACT(name, _10))}, {0, STR(CONTACT(name, _11))}, \
|
||||||
|
+ {0, STR(CONTACT(name, _12))}, {0, STR(CONTACT(name, _13))}, \
|
||||||
|
+ {0, STR(CONTACT(name, _14))}, {0, STR(CONTACT(name, _15))}
|
||||||
|
+
|
||||||
|
enum pcie_dump_level {
|
||||||
|
DUMP_GLOBAL_LEVEL = 1,
|
||||||
|
DUMP_PORT_LEVEL = 2,
|
||||||
|
diff --git a/pcie/usr_cmd/interface/pcie_common_api.h b/pcie/usr_cmd/interface/pcie_common_api.h
|
||||||
|
index f6541bd..9809575 100644
|
||||||
|
--- a/pcie/usr_cmd/interface/pcie_common_api.h
|
||||||
|
+++ b/pcie/usr_cmd/interface/pcie_common_api.h
|
||||||
|
@@ -17,6 +17,10 @@
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
+#define CONTACT(x, y) x##y
|
||||||
|
+#define STR_INTER(x) #x
|
||||||
|
+#define STR(x) STR_INTER(x)
|
||||||
|
+
|
||||||
|
struct print_info {
|
||||||
|
char *buff;
|
||||||
|
size_t buff_size;
|
||||||
|
--
|
||||||
|
2.25.1
|
||||||
|
|
||||||
46
0011-optimize-the-nic_mac-dump-register.patch
Normal file
46
0011-optimize-the-nic_mac-dump-register.patch
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
From c0f8dd5ae8fe688825e77cf63ddb30d0cb27ecdf Mon Sep 17 00:00:00 2001
|
||||||
|
From: veega2022 <zhuweijia@huawei.com>
|
||||||
|
Date: Thu, 11 May 2023 08:54:09 +0800
|
||||||
|
Subject: [PATCH 08/18] optimize the nic_mac dump register
|
||||||
|
|
||||||
|
if reg dump block data num is 0, print not support dump and return.
|
||||||
|
hikptool version: 1.0.14
|
||||||
|
|
||||||
|
Signed-off-by: veega2022 <zhuweijia@huawei.com>
|
||||||
|
---
|
||||||
|
net/nic/nic_mac/hikp_nic_mac_dump.c | 5 +++++
|
||||||
|
tool_lib/tool_lib.h | 2 +-
|
||||||
|
2 files changed, 6 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/net/nic/nic_mac/hikp_nic_mac_dump.c b/net/nic/nic_mac/hikp_nic_mac_dump.c
|
||||||
|
index 6e856a8..3e818cd 100644
|
||||||
|
--- a/net/nic/nic_mac/hikp_nic_mac_dump.c
|
||||||
|
+++ b/net/nic/nic_mac/hikp_nic_mac_dump.c
|
||||||
|
@@ -64,6 +64,11 @@ static int mac_cmd_dump_mod(struct major_cmd_ctrl *self, const char *name,
|
||||||
|
uint32_t i;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
+ if (blk_num == 0) {
|
||||||
|
+ printf("%s module is not support dump.\n", name);
|
||||||
|
+ return 0;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
printf("============ %10s REG INFO ==============\n", name);
|
||||||
|
printf("\t %s :\t%10s\n", "offset", "value");
|
||||||
|
|
||||||
|
diff --git a/tool_lib/tool_lib.h b/tool_lib/tool_lib.h
|
||||||
|
index bf37465..9766a7e 100644
|
||||||
|
--- a/tool_lib/tool_lib.h
|
||||||
|
+++ b/tool_lib/tool_lib.h
|
||||||
|
@@ -18,7 +18,7 @@
|
||||||
|
|
||||||
|
#define TOOL_NAME "hikptool"
|
||||||
|
|
||||||
|
-#define TOOL_VER "1.0.13"
|
||||||
|
+#define TOOL_VER "1.0.14"
|
||||||
|
|
||||||
|
#define HI_GET_BITFIELD(value, start, mask) (((value) >> (start)) & (mask))
|
||||||
|
#define HI_SET_FIELD(origin, shift, val) ((origin) |= (val) << (shift))
|
||||||
|
--
|
||||||
|
2.25.1
|
||||||
|
|
||||||
@ -0,0 +1,53 @@
|
|||||||
|
From e51911b2c5daa7f9d650849aaa4f389291415255 Mon Sep 17 00:00:00 2001
|
||||||
|
From: veega2022 <zhuweijia@huawei.com>
|
||||||
|
Date: Thu, 11 May 2023 09:29:48 +0800
|
||||||
|
Subject: [PATCH 14/18] Fix a resource release bug in hikp_roh_get_cam_reg_num
|
||||||
|
|
||||||
|
Fix a resource release bug in hikp_roh_get_cam_reg_num
|
||||||
|
|
||||||
|
Signed-off-by: chenke chenke54@huawei.com
|
||||||
|
---
|
||||||
|
net/roh/hikp_roh_mac.c | 6 +++++-
|
||||||
|
net/roh/hikp_roh_show_bp.c | 2 +-
|
||||||
|
2 files changed, 6 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/net/roh/hikp_roh_mac.c b/net/roh/hikp_roh_mac.c
|
||||||
|
index 90708b1..43f954c 100644
|
||||||
|
--- a/net/roh/hikp_roh_mac.c
|
||||||
|
+++ b/net/roh/hikp_roh_mac.c
|
||||||
|
@@ -141,6 +141,7 @@ static int hikp_roh_get_cam_reg_num(struct major_cmd_ctrl *self)
|
||||||
|
struct roh_mac_req_para req_data = { 0 };
|
||||||
|
struct hikp_cmd_header req_header = { 0 };
|
||||||
|
struct hikp_cmd_ret *cmd_ret = NULL;
|
||||||
|
+ uint32_t cam_reg_num;
|
||||||
|
|
||||||
|
req_data.bdf = g_roh_mac_param.target.bdf;
|
||||||
|
hikp_cmd_init(&req_header, ROH_MOD, HIKP_ROH_MAC, CMD_GET_CAM_REG_NUM);
|
||||||
|
@@ -153,7 +154,10 @@ static int hikp_roh_get_cam_reg_num(struct major_cmd_ctrl *self)
|
||||||
|
return -EIO;
|
||||||
|
}
|
||||||
|
mac_rsp = (struct roh_mac_cam_reg_num *)(cmd_ret->rsp_data);
|
||||||
|
- return mac_rsp->cam_reg_num;
|
||||||
|
+ cam_reg_num = mac_rsp->cam_reg_num;
|
||||||
|
+ free(cmd_ret);
|
||||||
|
+ cmd_ret = NULL;
|
||||||
|
+ return cam_reg_num;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int hikp_roh_build_cam(struct major_cmd_ctrl *self, struct cam_table_entry_t *cam_table)
|
||||||
|
diff --git a/net/roh/hikp_roh_show_bp.c b/net/roh/hikp_roh_show_bp.c
|
||||||
|
index c89e98b..73a53d8 100644
|
||||||
|
--- a/net/roh/hikp_roh_show_bp.c
|
||||||
|
+++ b/net/roh/hikp_roh_show_bp.c
|
||||||
|
@@ -44,7 +44,7 @@ static int hikp_roh_show_bp(struct major_cmd_ctrl *self)
|
||||||
|
union bp_val res;
|
||||||
|
uint8_t flit_bp;
|
||||||
|
int mac_id;
|
||||||
|
- int ret;
|
||||||
|
+ int ret = 0;
|
||||||
|
|
||||||
|
struct hikp_cmd_ret *cmd_ret = NULL;
|
||||||
|
struct hikp_cmd_header req_header = { 0 };
|
||||||
|
--
|
||||||
|
2.25.1
|
||||||
|
|
||||||
28
0013-fix-missing-white-space-issue.patch
Normal file
28
0013-fix-missing-white-space-issue.patch
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
From 28283e9ab010f418846eaa00511721745927088f Mon Sep 17 00:00:00 2001
|
||||||
|
From: veega2022 <zhuweijia@huawei.com>
|
||||||
|
Date: Thu, 11 May 2023 09:36:38 +0800
|
||||||
|
Subject: [PATCH 15/18] fix missing white space issue
|
||||||
|
|
||||||
|
Add a space on the left and right of the "="
|
||||||
|
|
||||||
|
Signed-off-by: veega2022 <zhuweijia@huawei.com>
|
||||||
|
---
|
||||||
|
socip/hikp_socip_dumpreg.c | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/socip/hikp_socip_dumpreg.c b/socip/hikp_socip_dumpreg.c
|
||||||
|
index b74dac8..32325bb 100644
|
||||||
|
--- a/socip/hikp_socip_dumpreg.c
|
||||||
|
+++ b/socip/hikp_socip_dumpreg.c
|
||||||
|
@@ -142,7 +142,7 @@ static void hikp_socip_dumpreg_execute(struct major_cmd_ctrl *self)
|
||||||
|
hikp_cmd_init(&req_header, SOCIP_MOD, HIKP_SOCIP_CMD_DUMPREG, param[MODULE_ID_INDEX].val);
|
||||||
|
cmd_ret = hikp_cmd_alloc(&req_header, &req_data, sizeof(req_data));
|
||||||
|
if (!cmd_ret) {
|
||||||
|
- self->err_no=-EINVAL;
|
||||||
|
+ self->err_no = -EINVAL;
|
||||||
|
HIKP_ERROR_PRINT("hikp_cmd_alloc\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
--
|
||||||
|
2.25.1
|
||||||
|
|
||||||
86
0014-hikptool-fix-maininfo-detail-info-print-error.patch
Normal file
86
0014-hikptool-fix-maininfo-detail-info-print-error.patch
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
From 90c8f3c14e4d5cf1ea5fd8181810f07d33af4e9b Mon Sep 17 00:00:00 2001
|
||||||
|
From: huangguanhua <huangguanhua3@huawei.com>
|
||||||
|
Date: Thu, 18 May 2023 16:29:28 +0800
|
||||||
|
Subject: [PATCH 17/18] hikptool-fix-maininfo-detail-info-print-error
|
||||||
|
|
||||||
|
Signed-off-by: huangguanhua <huangguanhua3@huawei.com>
|
||||||
|
---
|
||||||
|
serdes/hikp_serdes.c | 12 ++++++++----
|
||||||
|
serdes/hikp_serdes.h | 3 ++-
|
||||||
|
tool_lib/op_logs.c | 6 +++---
|
||||||
|
3 files changed, 13 insertions(+), 8 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/serdes/hikp_serdes.c b/serdes/hikp_serdes.c
|
||||||
|
index dd9eee3..527fd53 100644
|
||||||
|
--- a/serdes/hikp_serdes.c
|
||||||
|
+++ b/serdes/hikp_serdes.c
|
||||||
|
@@ -184,21 +184,22 @@ static void hikp_serdes_brief_info_print(struct major_cmd_ctrl *self,
|
||||||
|
"Tap16,Tap17,Tap18,Tap19,Tap20]\n" \
|
||||||
|
"FWFourEye: It only takes effect when the firmware is running and " \
|
||||||
|
"continuous adaptation is turned on\n" \
|
||||||
|
+ "Snr: [SNR_METRIC,SNR_METRIC_HIS_MIN,SNR_CYCLES,HEH,SNR_METRIC_SW]\n" \
|
||||||
|
"-----------------------------------------------------" \
|
||||||
|
"------------------------------------------------" \
|
||||||
|
"-----------------------------------------------------" \
|
||||||
|
"------------------------------------------------" \
|
||||||
|
- "-------------------\n" \
|
||||||
|
+ "--------------------------------\n" \
|
||||||
|
" [ FFE ]" \
|
||||||
|
"[ CTLE ]" \
|
||||||
|
"[ " \
|
||||||
|
"DFE ]" \
|
||||||
|
- "[ FWFourEye ][ snr ]\n" \
|
||||||
|
+ "[ FWFourEye ][ Snr ]\n" \
|
||||||
|
"-----------------------------------------------------" \
|
||||||
|
"-------------------------------------------------" \
|
||||||
|
"-----------------------------------------------------" \
|
||||||
|
"-------------------------------------------------" \
|
||||||
|
- "------------------\n")
|
||||||
|
+ "--------------------------------\n")
|
||||||
|
|
||||||
|
static void hikp_serdes_detail_info_print(struct major_cmd_ctrl *self,
|
||||||
|
const struct hilink_detail_info *data,
|
||||||
|
@@ -233,7 +234,10 @@ static void hikp_serdes_detail_info_print(struct major_cmd_ctrl *self,
|
||||||
|
printf("][%4d,%4d,%4d,%4d]",
|
||||||
|
data[ds_id].eye_diagram.top, data[ds_id].eye_diagram.bottom,
|
||||||
|
data[ds_id].eye_diagram.left, data[ds_id].eye_diagram.right);
|
||||||
|
- printf("[%7d]\n", data[ds_id].snr);
|
||||||
|
+ /* 0: SNR_METRIC, 1:SNR_METRIC_HIS_MIN */
|
||||||
|
+ printf("[%3d,%3d,%3d,%3d,%3d]\n", data[ds_id].snr_para[0], data[ds_id].snr_para[1],
|
||||||
|
+ /* 2:SNR_CYCLES, 3:HEH, 4:SNR_METRIC_SW */
|
||||||
|
+ data[ds_id].snr_para[2], data[ds_id].snr_para[3], data[ds_id].snr_para[4]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/serdes/hikp_serdes.h b/serdes/hikp_serdes.h
|
||||||
|
index 99b9b15..83c28b8 100644
|
||||||
|
--- a/serdes/hikp_serdes.h
|
||||||
|
+++ b/serdes/hikp_serdes.h
|
||||||
|
@@ -192,7 +192,8 @@ struct hilink_detail_info {
|
||||||
|
struct hilink_rx_param rx_ctle_cfg;
|
||||||
|
struct hilink_serdes_rx_tap rx_tap_cfg;
|
||||||
|
struct hilink_4p_eye_result eye_diagram;
|
||||||
|
- uint32_t snr;
|
||||||
|
+ /* 5: (0: SNR_METRIC, 1:SNR_METRIC_HIS_MIN, 2:SNR_CYCLES, 3:HEH, 4:SNR_METRIC_SW) */
|
||||||
|
+ int32_t snr_para[5];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct hilink_brief_info {
|
||||||
|
diff --git a/tool_lib/op_logs.c b/tool_lib/op_logs.c
|
||||||
|
index 069428d..d91ddb0 100644
|
||||||
|
--- a/tool_lib/op_logs.c
|
||||||
|
+++ b/tool_lib/op_logs.c
|
||||||
|
@@ -431,7 +431,7 @@ void sig_init(void)
|
||||||
|
(void)signal(SIGHUP, signal_handle);
|
||||||
|
(void)signal(SIGSEGV, signal_handle);
|
||||||
|
(void)signal(SIGBUS, signal_handle);
|
||||||
|
- (void)signal(SIGFPE, signal_handle);
|
||||||
|
- (void)signal(SIGABRT, signal_handle);
|
||||||
|
- (void)signal(SIGTSTP, signal_handle); /* Stop process */
|
||||||
|
+ (void)signal(SIGFPE, signal_handle);
|
||||||
|
+ (void)signal(SIGABRT, signal_handle);
|
||||||
|
+ (void)signal(SIGTSTP, signal_handle); /* Stop process */
|
||||||
|
}
|
||||||
|
--
|
||||||
|
2.25.1
|
||||||
|
|
||||||
29
0015-hikptool-fix-print-sas_dqe-info-error-problem.patch
Normal file
29
0015-hikptool-fix-print-sas_dqe-info-error-problem.patch
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
From dc15df882b56ec2abff2a5bba45238309a02f5e9 Mon Sep 17 00:00:00 2001
|
||||||
|
From: FuJia Ni <nifujia1@hisilicon.com>
|
||||||
|
Date: Thu, 25 May 2023 09:36:39 +0800
|
||||||
|
Subject: [PATCH 18/18] hikptool: fix print sas_dqe info error problem
|
||||||
|
|
||||||
|
the volatile modifier is added because the O2 compilation optimization is enbaled.
|
||||||
|
As a result, the pointer data is not updated.
|
||||||
|
|
||||||
|
Signed-off-by: FuJia Ni <nifujia1@hisilicon.com>
|
||||||
|
---
|
||||||
|
sas/sas_func/sas_read_dqe.c | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/sas/sas_func/sas_read_dqe.c b/sas/sas_func/sas_read_dqe.c
|
||||||
|
index fc04682..2f653df 100644
|
||||||
|
--- a/sas/sas_func/sas_read_dqe.c
|
||||||
|
+++ b/sas/sas_func/sas_read_dqe.c
|
||||||
|
@@ -47,7 +47,7 @@ static int sas_get_dqe(const struct tool_sas_cmd *cmd, uint32_t *reg_save, uint3
|
||||||
|
|
||||||
|
static void print_dqe_info(const void *reg_save, uint32_t reg_num)
|
||||||
|
{
|
||||||
|
- struct hisi_sas_dq_info *dqe = (struct hisi_sas_dq_info *)(reg_save);
|
||||||
|
+ volatile struct hisi_sas_dq_info *dqe = (volatile struct hisi_sas_dq_info *)(reg_save);
|
||||||
|
|
||||||
|
printf("The dqe dw0 information as below:\n");
|
||||||
|
printf("abort_flag: %u\n", dqe->dw0.abort_flag);
|
||||||
|
--
|
||||||
|
2.25.1
|
||||||
|
|
||||||
@ -0,0 +1,30 @@
|
|||||||
|
From 834b2fe48984703a41aceb2307b8604b93d0e6e8 Mon Sep 17 00:00:00 2001
|
||||||
|
From: veega <zhuweijia@huawei.com>
|
||||||
|
Date: Thu, 1 Jun 2023 09:56:39 +0800
|
||||||
|
Subject: [PATCH] hikptool: fix compiling specifications check problem
|
||||||
|
|
||||||
|
delete -g option for release vesion and add compile option: -Wextra
|
||||||
|
-fno-common -std=gnu11 -Wfloat-equal
|
||||||
|
|
||||||
|
Signed-off-by: veega <zhuweijia@huawei.com>
|
||||||
|
---
|
||||||
|
CMakeLists.txt | 3 ++-
|
||||||
|
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||||
|
index 6a396e7..174dd8f 100644
|
||||||
|
--- a/CMakeLists.txt
|
||||||
|
+++ b/CMakeLists.txt
|
||||||
|
@@ -11,7 +11,8 @@
|
||||||
|
|
||||||
|
project(hikptool C)
|
||||||
|
|
||||||
|
-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O2 -fPIC -fPIE -Wall")
|
||||||
|
+set(CMAKE_C_FLAGS
|
||||||
|
+ "${CMAKE_C_FLAGS} -O2 -fPIC -fPIE -Wall -Wextra -fno-common -std=gnu11 -Wfloat-equal")
|
||||||
|
set(CMAKE_SKIP_RPATH TRUE)
|
||||||
|
|
||||||
|
macro(get_header_dir_recurse HEADER_DIR_LIST)
|
||||||
|
--
|
||||||
|
2.25.1
|
||||||
|
|
||||||
497
0017-Complete-the-developing-of-hikptool-ub_dfx-function.patch
Normal file
497
0017-Complete-the-developing-of-hikptool-ub_dfx-function.patch
Normal file
@ -0,0 +1,497 @@
|
|||||||
|
From 11887e073c584d64c800ac5183fee43f895fccb1 Mon Sep 17 00:00:00 2001
|
||||||
|
From: veega2022 <zhuweijia@huawei.com>
|
||||||
|
Date: Thu, 11 May 2023 08:52:35 +0800
|
||||||
|
Subject: [PATCH 07/15] Complete the developing of hikptool ub_dfx function
|
||||||
|
|
||||||
|
The hikptool ub_dfx command is submitted for the first time.
|
||||||
|
This command can be used to dump register information of the LRB, PFA, and PM modules.
|
||||||
|
|
||||||
|
Signed-off-by: Jianqiang Li <lijianqiang16@huawei.com>
|
||||||
|
---
|
||||||
|
libhikptdev/include/hikptdev_plug.h | 1 +
|
||||||
|
net/hikp_net_lib.h | 9 +
|
||||||
|
net/ub/ub_dfx/hikp_ub_dfx.c | 319 ++++++++++++++++++++++++++++
|
||||||
|
net/ub/ub_dfx/hikp_ub_dfx.h | 100 +++++++++
|
||||||
|
tool_lib/tool_lib.h | 2 +-
|
||||||
|
5 files changed, 430 insertions(+), 1 deletion(-)
|
||||||
|
create mode 100644 net/ub/ub_dfx/hikp_ub_dfx.c
|
||||||
|
create mode 100644 net/ub/ub_dfx/hikp_ub_dfx.h
|
||||||
|
|
||||||
|
diff --git a/libhikptdev/include/hikptdev_plug.h b/libhikptdev/include/hikptdev_plug.h
|
||||||
|
index 42bea6b..56cea78 100644
|
||||||
|
--- a/libhikptdev/include/hikptdev_plug.h
|
||||||
|
+++ b/libhikptdev/include/hikptdev_plug.h
|
||||||
|
@@ -43,6 +43,7 @@ enum cmd_module_type {
|
||||||
|
MAC_MOD = 8,
|
||||||
|
DPDK_MOD = 9,
|
||||||
|
CXL_MOD = 10,
|
||||||
|
+ UB_MOD = 11,
|
||||||
|
};
|
||||||
|
|
||||||
|
void hikp_unlock(void);
|
||||||
|
diff --git a/net/hikp_net_lib.h b/net/hikp_net_lib.h
|
||||||
|
index cc99d0c..af0a51d 100644
|
||||||
|
--- a/net/hikp_net_lib.h
|
||||||
|
+++ b/net/hikp_net_lib.h
|
||||||
|
@@ -98,6 +98,15 @@ enum roce_cmd_type {
|
||||||
|
GET_ROCEE_TSP_CMD,
|
||||||
|
};
|
||||||
|
|
||||||
|
+enum ub_cmd_type {
|
||||||
|
+ GET_UNIC_PPP_CMD = 0x1,
|
||||||
|
+ GET_UB_DFX_INFO_CMD,
|
||||||
|
+ GET_UB_LINK_INFO_CMD,
|
||||||
|
+ GET_UB_BP_INFO_CMD,
|
||||||
|
+ GET_UB_CRD_INFO_CMD,
|
||||||
|
+ GET_UB_BASIC_INFO_CMD,
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
#define HIKP_MAX_PF_NUM 8
|
||||||
|
#define HIKP_NIC_MAX_FUNC_NUM 256
|
||||||
|
|
||||||
|
diff --git a/net/ub/ub_dfx/hikp_ub_dfx.c b/net/ub/ub_dfx/hikp_ub_dfx.c
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..c50f555
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/net/ub/ub_dfx/hikp_ub_dfx.c
|
||||||
|
@@ -0,0 +1,319 @@
|
||||||
|
+/*
|
||||||
|
+ * Copyright (c) 2023 Hisilicon Technologies Co., Ltd.
|
||||||
|
+ * Hikptool is licensed under Mulan PSL v2.
|
||||||
|
+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||||
|
+ * You may obtain a copy of Mulan PSL v2 at:
|
||||||
|
+ * http://license.coscl.org.cn/MulanPSL2
|
||||||
|
+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||||
|
+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||||
|
+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||||
|
+ *
|
||||||
|
+ * See the Mulan PSL v2 for more details.
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+#include "tool_cmd.h"
|
||||||
|
+#include "hikp_net_lib.h"
|
||||||
|
+#include "hikp_ub_dfx.h"
|
||||||
|
+
|
||||||
|
+struct ub_dfx_param g_ub_dfx_param = { 0 };
|
||||||
|
+
|
||||||
|
+static const struct dfx_module_cmd g_ub_dfx_module_parse[] = {
|
||||||
|
+ {"LRB", LRB_DFX_REG_DUMP},
|
||||||
|
+ {"PFA", PFA_DFX_REG_DUMP},
|
||||||
|
+ {"PM", PM_DFX_REG_DUMP}
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+static const struct dfx_type_parse g_dfx_type_parse[] = {
|
||||||
|
+ {INCORRECT_REG_TYPE, WIDTH_32_BIT, "INCORRECT TYPE"},
|
||||||
|
+ {TYPE_32_STATS, WIDTH_32_BIT, "32 bit statistics"},
|
||||||
|
+ {TYPE_32_RUNNING_STATUS, WIDTH_32_BIT, "32 bit running status"},
|
||||||
|
+ {TYPE_64_STATS, WIDTH_64_BIT, "64 bit statistics"},
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+static void dfx_help_info(const struct major_cmd_ctrl *self)
|
||||||
|
+{
|
||||||
|
+ printf("\n Usage: %s %s\n", self->cmd_ptr->name, "-i <interface>\n");
|
||||||
|
+ printf("\n %s\n", self->cmd_ptr->help_info);
|
||||||
|
+ printf(" Options:\n\n");
|
||||||
|
+ printf(" %s, %-25s %s\n", "-h", "--help", "display this help and exit");
|
||||||
|
+ printf(" %s, %-25s %s\n", "-i", "--interface=<interface>",
|
||||||
|
+ "device target or bdf id, e.g. ubn0 or 0000:35:00.0");
|
||||||
|
+ printf(" %s\n", " [-m/--module LRB/PFA/PM] : this is necessary param\n");
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int hikp_ub_dfx_help(struct major_cmd_ctrl *self, const char *argv)
|
||||||
|
+{
|
||||||
|
+ dfx_help_info(self);
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int hikp_ub_dfx_target(struct major_cmd_ctrl *self, const char *argv)
|
||||||
|
+{
|
||||||
|
+ self->err_no = tool_check_and_get_valid_bdf_id(argv, &(g_ub_dfx_param.target));
|
||||||
|
+ if (self->err_no != 0) {
|
||||||
|
+ snprintf(self->err_str, sizeof(self->err_str), "Unknown device %s.", argv);
|
||||||
|
+ return self->err_no;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int hikp_ub_dfx_module_select(struct major_cmd_ctrl *self, const char *argv)
|
||||||
|
+{
|
||||||
|
+ size_t arr_size = HIKP_ARRAY_SIZE(g_ub_dfx_module_parse);
|
||||||
|
+ bool is_found;
|
||||||
|
+ size_t i;
|
||||||
|
+
|
||||||
|
+ for (i = 0; i < arr_size; i++) {
|
||||||
|
+ is_found = strncmp(argv, (const char *)g_ub_dfx_module_parse[i].module_name,
|
||||||
|
+ sizeof(g_ub_dfx_module_parse[i].module_name)) == 0;
|
||||||
|
+ if (is_found) {
|
||||||
|
+ g_ub_dfx_param.sub_cmd_code = g_ub_dfx_module_parse[i].sub_cmd_code;
|
||||||
|
+ g_ub_dfx_param.module_idx = i;
|
||||||
|
+ g_ub_dfx_param.flag |= MODULE_SET_FLAG;
|
||||||
|
+ return 0;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ dfx_help_info(self);
|
||||||
|
+ snprintf(self->err_str, sizeof(self->err_str), "-m/--module param error!!!");
|
||||||
|
+ self->err_no = -EINVAL;
|
||||||
|
+
|
||||||
|
+ return -EINVAL;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int hikp_ub_dfx_get_blk_data(struct hikp_cmd_ret **cmd_ret,
|
||||||
|
+ uint32_t blk_id, uint32_t sub_cmd_code)
|
||||||
|
+{
|
||||||
|
+ struct hikp_cmd_header req_header = { 0 };
|
||||||
|
+ struct ub_dfx_req_para req_data = { 0 };
|
||||||
|
+
|
||||||
|
+ req_data.bdf = g_ub_dfx_param.target.bdf;
|
||||||
|
+ req_data.block_id = blk_id;
|
||||||
|
+ hikp_cmd_init(&req_header, UB_MOD, GET_UB_DFX_INFO_CMD, sub_cmd_code);
|
||||||
|
+ *cmd_ret = hikp_cmd_alloc(&req_header, &req_data, sizeof(req_data));
|
||||||
|
+
|
||||||
|
+ return hikp_rsp_normal_check(*cmd_ret);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int hikp_ub_get_first_blk_dfx(struct ub_dfx_rsp_head *rsp_head, uint32_t **reg_data,
|
||||||
|
+ uint32_t *max_dfx_size, uint32_t *version)
|
||||||
|
+{
|
||||||
|
+ struct ub_dfx_rsp *dfx_rsp = NULL;
|
||||||
|
+ struct hikp_cmd_ret *cmd_ret;
|
||||||
|
+ int ret;
|
||||||
|
+
|
||||||
|
+ ret = hikp_ub_dfx_get_blk_data(&cmd_ret, 0, g_ub_dfx_param.sub_cmd_code);
|
||||||
|
+ if (ret < 0)
|
||||||
|
+ goto err_out;
|
||||||
|
+
|
||||||
|
+ dfx_rsp = (struct ub_dfx_rsp *)(cmd_ret->rsp_data);
|
||||||
|
+ *version = cmd_ret->version;
|
||||||
|
+ *rsp_head = dfx_rsp->rsp_head;
|
||||||
|
+ if (rsp_head->total_blk_num == 0) {
|
||||||
|
+ /* if total block number is zero, set total type number to zero anyway */
|
||||||
|
+ rsp_head->total_type_num = 0;
|
||||||
|
+ goto err_out;
|
||||||
|
+ }
|
||||||
|
+ *max_dfx_size = (uint32_t)(rsp_head->total_blk_num * MAX_DFX_DATA_NUM * sizeof(uint32_t));
|
||||||
|
+ *reg_data = (uint32_t *)calloc(1, *max_dfx_size);
|
||||||
|
+ if (*reg_data == NULL) {
|
||||||
|
+ HIKP_ERROR_PRINT("malloc log memory 0x%x failed.\n", *max_dfx_size);
|
||||||
|
+ ret = -ENOMEM;
|
||||||
|
+ goto err_out;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (rsp_head->cur_blk_size > *max_dfx_size) {
|
||||||
|
+ free(*reg_data);
|
||||||
|
+ *reg_data = NULL;
|
||||||
|
+ HIKP_ERROR_PRINT("blk0 reg_data copy size error, data size: 0x%x, max size: 0x%x\n",
|
||||||
|
+ rsp_head->cur_blk_size, *max_dfx_size);
|
||||||
|
+ ret = -EINVAL;
|
||||||
|
+ goto err_out;
|
||||||
|
+ }
|
||||||
|
+ memcpy(*reg_data, dfx_rsp->reg_data, rsp_head->cur_blk_size);
|
||||||
|
+
|
||||||
|
+ *max_dfx_size -= (uint32_t)rsp_head->cur_blk_size;
|
||||||
|
+err_out:
|
||||||
|
+ free(cmd_ret);
|
||||||
|
+ cmd_ret = NULL;
|
||||||
|
+
|
||||||
|
+ return ret;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int hikp_ub_get_blk_dfx(struct ub_dfx_rsp_head *rsp_head, uint32_t blk_id,
|
||||||
|
+ uint32_t *reg_data, uint32_t *max_dfx_size)
|
||||||
|
+{
|
||||||
|
+ struct ub_dfx_rsp *dfx_rsp = NULL;
|
||||||
|
+ struct hikp_cmd_ret *cmd_ret;
|
||||||
|
+ int ret;
|
||||||
|
+
|
||||||
|
+ ret = hikp_ub_dfx_get_blk_data(&cmd_ret, blk_id, g_ub_dfx_param.sub_cmd_code);
|
||||||
|
+ if (ret < 0)
|
||||||
|
+ goto err_out;
|
||||||
|
+
|
||||||
|
+ dfx_rsp = (struct ub_dfx_rsp *)(cmd_ret->rsp_data);
|
||||||
|
+ *rsp_head = dfx_rsp->rsp_head;
|
||||||
|
+ if (rsp_head->cur_blk_size > *max_dfx_size) {
|
||||||
|
+ HIKP_ERROR_PRINT("blk%u reg_data copy size error, "
|
||||||
|
+ "data size: 0x%x, max size: 0x%x\n",
|
||||||
|
+ blk_id, rsp_head->cur_blk_size, *max_dfx_size);
|
||||||
|
+ ret = -EINVAL;
|
||||||
|
+ goto err_out;
|
||||||
|
+ }
|
||||||
|
+ memcpy(reg_data, dfx_rsp->reg_data, rsp_head->cur_blk_size);
|
||||||
|
+ *max_dfx_size -= (uint32_t)rsp_head->cur_blk_size;
|
||||||
|
+
|
||||||
|
+err_out:
|
||||||
|
+ free(cmd_ret);
|
||||||
|
+ cmd_ret = NULL;
|
||||||
|
+
|
||||||
|
+ return ret;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static bool is_type_found(uint16_t type_id, uint32_t *index)
|
||||||
|
+{
|
||||||
|
+ size_t arr_size = HIKP_ARRAY_SIZE(g_dfx_type_parse);
|
||||||
|
+ size_t i;
|
||||||
|
+
|
||||||
|
+ for (i = 0; i < arr_size; i++) {
|
||||||
|
+ if (g_dfx_type_parse[i].type_id == type_id) {
|
||||||
|
+ *index = i;
|
||||||
|
+ return true;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return false;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void hikp_ub_dfx_print_type_head(uint8_t type_id, uint8_t *last_type_id)
|
||||||
|
+{
|
||||||
|
+ uint32_t index = 0;
|
||||||
|
+
|
||||||
|
+ if (type_id != *last_type_id) {
|
||||||
|
+ printf("-----------------------------------------------------\n");
|
||||||
|
+ if (is_type_found(type_id, &index))
|
||||||
|
+ printf("type name: %s\n\n", g_dfx_type_parse[index].type_name);
|
||||||
|
+ else
|
||||||
|
+ HIKP_WARN_PRINT("type name: unknown type, type id is %u\n\n", type_id);
|
||||||
|
+
|
||||||
|
+ *last_type_id = type_id;
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void hikp_ub_dfx_print_b32(uint32_t num, uint32_t *reg_data)
|
||||||
|
+{
|
||||||
|
+ uint32_t word_num = num * WORD_NUM_PER_REG;
|
||||||
|
+ uint16_t offset;
|
||||||
|
+ uint32_t value;
|
||||||
|
+ uint32_t index;
|
||||||
|
+ uint32_t i;
|
||||||
|
+
|
||||||
|
+ for (i = 0, index = 1; i < word_num; i = i + WORD_NUM_PER_REG, index++) {
|
||||||
|
+ offset = (uint16_t)HI_GET_BITFIELD(reg_data[i], 0, DFX_REG_ADDR_MASK);
|
||||||
|
+ value = reg_data[i + 1];
|
||||||
|
+ printf("%03u: 0x%04x\t0x%08x\n", index, offset, value);
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void hikp_ub_dfx_print_b64(uint32_t num, uint32_t *reg_data)
|
||||||
|
+{
|
||||||
|
+ uint32_t word_num = num * WORD_NUM_PER_REG;
|
||||||
|
+ uint16_t offset;
|
||||||
|
+ uint64_t value;
|
||||||
|
+ uint32_t index;
|
||||||
|
+ uint32_t i;
|
||||||
|
+
|
||||||
|
+ for (i = 0, index = 1; i < word_num; i = i + WORD_NUM_PER_REG, index++) {
|
||||||
|
+ offset = (uint16_t)HI_GET_BITFIELD(reg_data[i], 0, DFX_REG_ADDR_MASK);
|
||||||
|
+ value = (uint64_t)reg_data[i + 1] |
|
||||||
|
+ (HI_GET_BITFIELD((uint64_t)reg_data[i], DFX_REG_VALUE_OFF,
|
||||||
|
+ DFX_REG_VALUE_MASK) << BIT_NUM_OF_WORD);
|
||||||
|
+ printf("%03u: 0x%04x\t0x%016lx\n", index, offset, value);
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void hikp_ub_dfx_print(const struct ub_dfx_rsp_head *rsp_head, uint32_t *reg_data)
|
||||||
|
+{
|
||||||
|
+ struct ub_dfx_type_head *type_head;
|
||||||
|
+ uint8_t last_type_id = 0;
|
||||||
|
+ uint32_t *ptr = reg_data;
|
||||||
|
+ uint8_t i;
|
||||||
|
+
|
||||||
|
+ printf("****************** module %s reg dump start ********************\n",
|
||||||
|
+ g_ub_dfx_module_parse[g_ub_dfx_param.module_idx].module_name);
|
||||||
|
+ for (i = 0; i < rsp_head->total_type_num; i++) {
|
||||||
|
+ type_head = (struct ub_dfx_type_head *)ptr;
|
||||||
|
+ if (type_head->type_id == INCORRECT_REG_TYPE) {
|
||||||
|
+ HIKP_ERROR_PRINT("No.%u type is incorrect reg type\n", i + 1u);
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+ hikp_ub_dfx_print_type_head(type_head->type_id, &last_type_id);
|
||||||
|
+ ptr++;
|
||||||
|
+ if (type_head->bit_width == WIDTH_32_BIT) {
|
||||||
|
+ hikp_ub_dfx_print_b32((uint32_t)type_head->reg_num, ptr);
|
||||||
|
+ } else if (type_head->bit_width == WIDTH_64_BIT) {
|
||||||
|
+ hikp_ub_dfx_print_b64((uint32_t)type_head->reg_num, ptr);
|
||||||
|
+ } else {
|
||||||
|
+ HIKP_ERROR_PRINT("type%u's bit width error.\n", type_head->type_id);
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+ ptr += (uint32_t)type_head->reg_num * WORD_NUM_PER_REG;
|
||||||
|
+ }
|
||||||
|
+ printf("################### ====== dump end ====== ######################\n");
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void hikp_ub_dfx_execute(struct major_cmd_ctrl *self)
|
||||||
|
+{
|
||||||
|
+ struct ub_dfx_rsp_head rsp_head = { 0 };
|
||||||
|
+ struct ub_dfx_rsp_head tmp_head = { 0 };
|
||||||
|
+ uint32_t *reg_data = NULL;
|
||||||
|
+ uint32_t max_dfx_size = 0;
|
||||||
|
+ uint32_t real_reg_size;
|
||||||
|
+ uint32_t version;
|
||||||
|
+ uint32_t i;
|
||||||
|
+
|
||||||
|
+ if (!(g_ub_dfx_param.flag & MODULE_SET_FLAG)) {
|
||||||
|
+ self->err_no = -EINVAL;
|
||||||
|
+ snprintf(self->err_str, sizeof(self->err_str), "Please specify a module.");
|
||||||
|
+ dfx_help_info(self);
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ self->err_no = hikp_ub_get_first_blk_dfx(&rsp_head, ®_data, &max_dfx_size, &version);
|
||||||
|
+ if (self->err_no != 0) {
|
||||||
|
+ snprintf(self->err_str, sizeof(self->err_str), "get the first block dfx fail.");
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+ real_reg_size = (uint32_t)rsp_head.cur_blk_size;
|
||||||
|
+ for (i = 1; i < rsp_head.total_blk_num; i++) {
|
||||||
|
+ self->err_no = hikp_ub_get_blk_dfx(&tmp_head, i,
|
||||||
|
+ reg_data + (real_reg_size / sizeof(uint32_t)),
|
||||||
|
+ &max_dfx_size);
|
||||||
|
+ if (self->err_no != 0) {
|
||||||
|
+ snprintf(self->err_str, sizeof(self->err_str),
|
||||||
|
+ "getting block%u reg fail.", i);
|
||||||
|
+ free(reg_data);
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+ real_reg_size += (uint32_t)tmp_head.cur_blk_size;
|
||||||
|
+ memset(&tmp_head, 0, sizeof(struct ub_dfx_rsp_head));
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ printf("DFX cmd version: 0x%x\n\n", version);
|
||||||
|
+ hikp_ub_dfx_print((const struct ub_dfx_rsp_head *)&rsp_head, reg_data);
|
||||||
|
+ free(reg_data);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void cmd_ub_dfx_init(void)
|
||||||
|
+{
|
||||||
|
+ struct major_cmd_ctrl *major_cmd = get_major_cmd();
|
||||||
|
+
|
||||||
|
+ major_cmd->option_count = 0;
|
||||||
|
+ major_cmd->execute = hikp_ub_dfx_execute;
|
||||||
|
+
|
||||||
|
+ cmd_option_register("-h", "--help", false, hikp_ub_dfx_help);
|
||||||
|
+ cmd_option_register("-i", "--interface", true, hikp_ub_dfx_target);
|
||||||
|
+ cmd_option_register("-m", "--module", true, hikp_ub_dfx_module_select);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+HIKP_CMD_DECLARE("ub_dfx", "dump ub dfx info of hardware", cmd_ub_dfx_init);
|
||||||
|
diff --git a/net/ub/ub_dfx/hikp_ub_dfx.h b/net/ub/ub_dfx/hikp_ub_dfx.h
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..4ba37a1
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/net/ub/ub_dfx/hikp_ub_dfx.h
|
||||||
|
@@ -0,0 +1,100 @@
|
||||||
|
+/*
|
||||||
|
+ * Copyright (c) 2023 Hisilicon Technologies Co., Ltd.
|
||||||
|
+ * Hikptool is licensed under Mulan PSL v2.
|
||||||
|
+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||||
|
+ * You may obtain a copy of Mulan PSL v2 at:
|
||||||
|
+ * http://license.coscl.org.cn/MulanPSL2
|
||||||
|
+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||||
|
+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||||
|
+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||||
|
+ *
|
||||||
|
+ * See the Mulan PSL v2 for more details.
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+#ifndef HIKP_UB_DFX_H
|
||||||
|
+#define HIKP_UB_DFX_H
|
||||||
|
+
|
||||||
|
+#include "hikp_net_lib.h"
|
||||||
|
+
|
||||||
|
+#define MAX_DFX_DATA_NUM 59
|
||||||
|
+#define MODULE_SET_FLAG 0x1
|
||||||
|
+
|
||||||
|
+enum ub_dfx_cmd_type {
|
||||||
|
+ LRB_DFX_REG_DUMP = 0,
|
||||||
|
+ PFA_DFX_REG_DUMP = 1,
|
||||||
|
+ PM_DFX_REG_DUMP = 2,
|
||||||
|
+ INVALID_MODULE = 0xFFFFFFFF,
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+enum ub_dfx_reg_type {
|
||||||
|
+ INCORRECT_REG_TYPE = 0,
|
||||||
|
+ TYPE_32_STATS = 1,
|
||||||
|
+ TYPE_32_RUNNING_STATUS = 2,
|
||||||
|
+ TYPE_64_STATS = 3,
|
||||||
|
+ TYPE_INVALID = 255,
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+#define MAX_TYPE_NAME_LEN 40
|
||||||
|
+
|
||||||
|
+enum ub_dfx_reg_width {
|
||||||
|
+ WIDTH_32_BIT = 32,
|
||||||
|
+ WIDTH_64_BIT = 64,
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+struct dfx_type_parse {
|
||||||
|
+ uint8_t type_id;
|
||||||
|
+ uint8_t bit_width;
|
||||||
|
+ uint8_t type_name[MAX_TYPE_NAME_LEN];
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+struct ub_dfx_param {
|
||||||
|
+ struct tool_target target;
|
||||||
|
+ uint32_t sub_cmd_code;
|
||||||
|
+ uint8_t module_idx;
|
||||||
|
+ uint8_t flag;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+#define MAX_MODULE_NAME_LEN 20
|
||||||
|
+struct dfx_module_cmd {
|
||||||
|
+ uint8_t module_name[MAX_MODULE_NAME_LEN];
|
||||||
|
+ uint32_t sub_cmd_code;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+struct ub_dfx_req_para {
|
||||||
|
+ struct bdf_t bdf;
|
||||||
|
+ uint8_t block_id;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+struct ub_dfx_type_head {
|
||||||
|
+ uint8_t type_id;
|
||||||
|
+ uint8_t bit_width;
|
||||||
|
+ uint8_t reg_num;
|
||||||
|
+ uint8_t flag;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+struct ub_dfx_rsp_head {
|
||||||
|
+ uint8_t total_blk_num;
|
||||||
|
+ uint8_t total_type_num;
|
||||||
|
+ uint8_t cur_blk_size;
|
||||||
|
+ uint8_t rsvd;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+/*********************************************************
|
||||||
|
+ * All registers are returned as key-value pairs, and divided
|
||||||
|
+ * into three groups of data.
|
||||||
|
+ * 1. 32bit regs: R0 bit0~bit15: offset, R1 bit0~bit31: value
|
||||||
|
+ * 2. 64bit regs: R0 bit0~bit15: offset, R0 bit16~bit31 high16 value, R1 bit0~bit31: low32 value
|
||||||
|
+ *********************************************************/
|
||||||
|
+#define DFX_REG_VALUE_OFF 16
|
||||||
|
+#define DFX_REG_VALUE_MASK 0xFFFF
|
||||||
|
+#define DFX_REG_ADDR_MASK 0xFFFF
|
||||||
|
+
|
||||||
|
+#define WORD_NUM_PER_REG 2
|
||||||
|
+#define BIT_NUM_OF_WORD 32
|
||||||
|
+
|
||||||
|
+struct ub_dfx_rsp {
|
||||||
|
+ struct ub_dfx_rsp_head rsp_head;
|
||||||
|
+ uint32_t reg_data[MAX_DFX_DATA_NUM];
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+#endif /* HIKP_UB_DFX_H */
|
||||||
|
diff --git a/tool_lib/tool_lib.h b/tool_lib/tool_lib.h
|
||||||
|
index b211175..bf37465 100644
|
||||||
|
--- a/tool_lib/tool_lib.h
|
||||||
|
+++ b/tool_lib/tool_lib.h
|
||||||
|
@@ -18,7 +18,7 @@
|
||||||
|
|
||||||
|
#define TOOL_NAME "hikptool"
|
||||||
|
|
||||||
|
-#define TOOL_VER "1.0.14"
|
||||||
|
+#define TOOL_VER "1.0.15"
|
||||||
|
|
||||||
|
#define HI_GET_BITFIELD(value, start, mask) (((value) >> (start)) & (mask))
|
||||||
|
#define HI_SET_FIELD(origin, shift, val) ((origin) |= (val) << (shift))
|
||||||
|
--
|
||||||
|
2.36.1.windows.1
|
||||||
182
0018-Complete-the-developing-of-hikptool-ub_link-function.patch
Normal file
182
0018-Complete-the-developing-of-hikptool-ub_link-function.patch
Normal file
@ -0,0 +1,182 @@
|
|||||||
|
From a9a370cf2127f8317759ef3d963c4c7db89c499c Mon Sep 17 00:00:00 2001
|
||||||
|
From: veega2022 <zhuweijia@huawei.com>
|
||||||
|
Date: Thu, 11 May 2023 08:56:30 +0800
|
||||||
|
Subject: [PATCH 09/15] Complete the developing of hikptool ub_link function
|
||||||
|
|
||||||
|
The hikptool ub_link command is submitted for the first time.
|
||||||
|
This command can be used to query the link state machine and status statistics during link establishment.
|
||||||
|
|
||||||
|
Signed-off-by: Jianqiang Li <lijianqiang16@huawei.com>
|
||||||
|
---
|
||||||
|
net/ub/ub_link/hikp_ub_link.c | 98 +++++++++++++++++++++++++++++++++++
|
||||||
|
net/ub/ub_link/hikp_ub_link.h | 53 +++++++++++++++++++
|
||||||
|
2 files changed, 151 insertions(+)
|
||||||
|
create mode 100644 net/ub/ub_link/hikp_ub_link.c
|
||||||
|
create mode 100644 net/ub/ub_link/hikp_ub_link.h
|
||||||
|
|
||||||
|
diff --git a/net/ub/ub_link/hikp_ub_link.c b/net/ub/ub_link/hikp_ub_link.c
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..b6353f7
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/net/ub/ub_link/hikp_ub_link.c
|
||||||
|
@@ -0,0 +1,98 @@
|
||||||
|
+/*
|
||||||
|
+ * Copyright (c) 2023 Hisilicon Technologies Co., Ltd.
|
||||||
|
+ * Hikptool is licensed under Mulan PSL v2.
|
||||||
|
+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||||
|
+ * You may obtain a copy of Mulan PSL v2 at:
|
||||||
|
+ * http://license.coscl.org.cn/MulanPSL2
|
||||||
|
+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||||
|
+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||||
|
+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||||
|
+ *
|
||||||
|
+ * See the Mulan PSL v2 for more details.
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+#include "hikp_ub_link.h"
|
||||||
|
+
|
||||||
|
+static struct ub_link_param g_ub_link_param = { 0 };
|
||||||
|
+
|
||||||
|
+static int hikp_ub_link_help(struct major_cmd_ctrl *self, const char *argv)
|
||||||
|
+{
|
||||||
|
+ printf("\n Usage: %s %s\n", self->cmd_ptr->name, "-i <interface>\n");
|
||||||
|
+ printf("\n %s\n", self->cmd_ptr->help_info);
|
||||||
|
+ printf(" Options:\n\n");
|
||||||
|
+ printf(" %s, %-25s %s\n", "-h", "--help", "display this help and exit");
|
||||||
|
+ printf(" %s, %-25s %s\n", "-i", "--interface=<interface>",
|
||||||
|
+ "device target or bdf id, e.g. ubn0 or 0000:35:00.0");
|
||||||
|
+ printf("\n");
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int hikp_ub_link_target(struct major_cmd_ctrl *self, const char *argv)
|
||||||
|
+{
|
||||||
|
+ self->err_no = tool_check_and_get_valid_bdf_id(argv, &(g_ub_link_param.target));
|
||||||
|
+ if (self->err_no != 0) {
|
||||||
|
+ snprintf(self->err_str, sizeof(self->err_str), "Unknown device %s.", argv);
|
||||||
|
+ return self->err_no;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void hikp_ub_link_info_show(const struct ub_link_rsp *info)
|
||||||
|
+{
|
||||||
|
+ printf("%-32s %u\n", "mac id:", info->mac_id);
|
||||||
|
+ printf("%-32s %s\n", "hdlc link status:", info->hdlc_link ? "true" : "false");
|
||||||
|
+ printf("%-32s %s\n", "hpcs link status:", info->hpcs_link ? "true" : "false");
|
||||||
|
+ printf("%-32s 0x%08x\n", "hdlc_link_fsm register value:", info->hdlc_link_fsm);
|
||||||
|
+ printf("%-32s 0x%08x\n", "hpcs_link_fsm register value:", info->hpcs_link_fsm);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int hikp_ub_query_link_info(const struct bdf_t *bdf)
|
||||||
|
+{
|
||||||
|
+ struct hikp_cmd_header header = { 0 };
|
||||||
|
+ struct ub_link_req_paras req = { 0 };
|
||||||
|
+ struct hikp_cmd_ret *cmd_ret;
|
||||||
|
+ struct ub_link_rsp *rsp;
|
||||||
|
+
|
||||||
|
+ req.bdf = *bdf;
|
||||||
|
+ hikp_cmd_init(&header, UB_MOD, GET_UB_LINK_INFO_CMD, UB_LINK_INFO_DUMP);
|
||||||
|
+ cmd_ret = hikp_cmd_alloc(&header, &req, sizeof(req));
|
||||||
|
+ if (cmd_ret == NULL || cmd_ret->status != 0) {
|
||||||
|
+ free(cmd_ret);
|
||||||
|
+ cmd_ret = NULL;
|
||||||
|
+ return -EIO;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ rsp = (struct ub_link_rsp *)cmd_ret->rsp_data;
|
||||||
|
+ hikp_ub_link_info_show(rsp);
|
||||||
|
+
|
||||||
|
+ free(cmd_ret);
|
||||||
|
+ cmd_ret = NULL;
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void hikp_ub_link_cmd_execute(struct major_cmd_ctrl *self)
|
||||||
|
+{
|
||||||
|
+ struct bdf_t *bdf = &g_ub_link_param.target.bdf;
|
||||||
|
+ int ret;
|
||||||
|
+
|
||||||
|
+ ret = hikp_ub_query_link_info(bdf);
|
||||||
|
+ if (ret != 0) {
|
||||||
|
+ snprintf(self->err_str, sizeof(self->err_str), "fail to get link info.");
|
||||||
|
+ self->err_no = ret;
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void cmd_ub_link_init(void)
|
||||||
|
+{
|
||||||
|
+ struct major_cmd_ctrl *major_cmd = get_major_cmd();
|
||||||
|
+
|
||||||
|
+ major_cmd->option_count = 0;
|
||||||
|
+ major_cmd->execute = hikp_ub_link_cmd_execute;
|
||||||
|
+
|
||||||
|
+ cmd_option_register("-h", "--help", false, hikp_ub_link_help);
|
||||||
|
+ cmd_option_register("-i", "--interface", true, hikp_ub_link_target);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+HIKP_CMD_DECLARE("ub_link", "get ub link information", cmd_ub_link_init);
|
||||||
|
diff --git a/net/ub/ub_link/hikp_ub_link.h b/net/ub/ub_link/hikp_ub_link.h
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..dec5129
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/net/ub/ub_link/hikp_ub_link.h
|
||||||
|
@@ -0,0 +1,53 @@
|
||||||
|
+/*
|
||||||
|
+ * Copyright (c) 2023 Hisilicon Technologies Co., Ltd.
|
||||||
|
+ * Hikptool is licensed under Mulan PSL v2.
|
||||||
|
+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||||
|
+ * You may obtain a copy of Mulan PSL v2 at:
|
||||||
|
+ * http://license.coscl.org.cn/MulanPSL2
|
||||||
|
+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||||
|
+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||||
|
+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||||
|
+ *
|
||||||
|
+ * See the Mulan PSL v2 for more details.
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+/*
|
||||||
|
+ * Copyright (c) 2023 Hisilicon Technologies Co., Ltd.
|
||||||
|
+ * Hikptool is licensed under Mulan PSL v2.
|
||||||
|
+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||||
|
+ * You may obtain a copy of Mulan PSL v2 at:
|
||||||
|
+ * http://license.coscl.org.cn/MulanPSL2
|
||||||
|
+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||||
|
+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||||
|
+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||||
|
+ *
|
||||||
|
+ * See the Mulan PSL v2 for more details.
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+#ifndef HIKP_UB_LINK_H
|
||||||
|
+#define HIKP_UB_LINK_H
|
||||||
|
+
|
||||||
|
+#include "hikp_net_lib.h"
|
||||||
|
+
|
||||||
|
+enum ub_link_sub_cmd_type {
|
||||||
|
+ UB_LINK_INFO_DUMP = 0,
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+struct ub_link_param {
|
||||||
|
+ struct tool_target target;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+struct ub_link_req_paras {
|
||||||
|
+ struct bdf_t bdf;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+struct ub_link_rsp {
|
||||||
|
+ uint8_t mac_id;
|
||||||
|
+ uint8_t hdlc_link;
|
||||||
|
+ uint8_t hpcs_link;
|
||||||
|
+ uint8_t rsvd;
|
||||||
|
+ uint32_t hdlc_link_fsm;
|
||||||
|
+ uint32_t hpcs_link_fsm;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+#endif /* HIKP_UB_LINK_H */
|
||||||
|
--
|
||||||
|
2.36.1.windows.1
|
||||||
|
|
||||||
172
0019-Complete-the-developing-of-hikptool-ub_bp-function.patch
Normal file
172
0019-Complete-the-developing-of-hikptool-ub_bp-function.patch
Normal file
@ -0,0 +1,172 @@
|
|||||||
|
From 4e6d7c9e6614b3d7eaa83a513b06a53f93a23484 Mon Sep 17 00:00:00 2001
|
||||||
|
From: veega2022 <zhuweijia@huawei.com>
|
||||||
|
Date: Thu, 11 May 2023 08:58:01 +0800
|
||||||
|
Subject: [PATCH 10/15] Complete the developing of hikptool ub_bp function
|
||||||
|
|
||||||
|
The hikptool ub_bp command is submitted for the first time.
|
||||||
|
This command can be used to query the back pressure status of the VL in the UB-N.
|
||||||
|
|
||||||
|
Signed-off-by: Jianqiang Li <lijianqiang16@huawei.com>
|
||||||
|
---
|
||||||
|
net/ub/ub_bp/hikp_ub_bp.c | 102 ++++++++++++++++++++++++++++++++++++++
|
||||||
|
net/ub/ub_bp/hikp_ub_bp.h | 39 +++++++++++++++
|
||||||
|
2 files changed, 141 insertions(+)
|
||||||
|
create mode 100644 net/ub/ub_bp/hikp_ub_bp.c
|
||||||
|
create mode 100644 net/ub/ub_bp/hikp_ub_bp.h
|
||||||
|
|
||||||
|
diff --git a/net/ub/ub_bp/hikp_ub_bp.c b/net/ub/ub_bp/hikp_ub_bp.c
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..70a9a4b
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/net/ub/ub_bp/hikp_ub_bp.c
|
||||||
|
@@ -0,0 +1,102 @@
|
||||||
|
+/*
|
||||||
|
+ * Copyright (c) 2023 Hisilicon Technologies Co., Ltd.
|
||||||
|
+ * Hikptool is licensed under Mulan PSL v2.
|
||||||
|
+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||||
|
+ * You may obtain a copy of Mulan PSL v2 at:
|
||||||
|
+ * http://license.coscl.org.cn/MulanPSL2
|
||||||
|
+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||||
|
+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||||
|
+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||||
|
+ *
|
||||||
|
+ * See the Mulan PSL v2 for more details.
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+#include "hikp_ub_bp.h"
|
||||||
|
+
|
||||||
|
+static struct ub_bp_param g_ub_bp_param = { 0 };
|
||||||
|
+
|
||||||
|
+static int hikp_ub_bp_help(struct major_cmd_ctrl *self, const char *argv)
|
||||||
|
+{
|
||||||
|
+ printf("\n Usage: %s %s\n", self->cmd_ptr->name, "-i <interface>\n");
|
||||||
|
+ printf("\n %s\n", self->cmd_ptr->help_info);
|
||||||
|
+ printf(" Options:\n\n");
|
||||||
|
+ printf(" %s, %-25s %s\n", "-h", "--help", "display this help and exit");
|
||||||
|
+ printf(" %s, %-25s %s\n", "-i", "--interface=<interface>",
|
||||||
|
+ "device target or bdf id, e.g. ubn0 or 0000:35:00.0");
|
||||||
|
+ printf("\n");
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int hikp_ub_bp_target(struct major_cmd_ctrl *self, const char *argv)
|
||||||
|
+{
|
||||||
|
+ self->err_no = tool_check_and_get_valid_bdf_id(argv, &(g_ub_bp_param.target));
|
||||||
|
+ if (self->err_no) {
|
||||||
|
+ snprintf(self->err_str, sizeof(self->err_str), "Unknown device %s.", argv);
|
||||||
|
+ return self->err_no;
|
||||||
|
+ }
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void hikp_ub_bp_info_show(const struct ub_bp_rsp *info)
|
||||||
|
+{
|
||||||
|
+ int bp_val_offset;
|
||||||
|
+
|
||||||
|
+ printf("%-28s : %u\n", "mac id", info->mac_id);
|
||||||
|
+ printf("%-28s : ", "back pressure status");
|
||||||
|
+
|
||||||
|
+ for (bp_val_offset = MAX_VL_NUM; bp_val_offset >= 0; bp_val_offset--) {
|
||||||
|
+ printf("%d", HI_GETBIT(info->bp_val, bp_val_offset) ? 1 : 0);
|
||||||
|
+ }
|
||||||
|
+ printf("\n");
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+static int hikp_ub_query_bp(const struct bdf_t *bdf)
|
||||||
|
+{
|
||||||
|
+ struct hikp_cmd_header header = { 0 };
|
||||||
|
+ struct ub_bp_req_para req = { 0 };
|
||||||
|
+ struct hikp_cmd_ret *cmd_ret;
|
||||||
|
+ struct ub_bp_rsp *rsp;
|
||||||
|
+
|
||||||
|
+ req.bdf = *bdf;
|
||||||
|
+ hikp_cmd_init(&header, UB_MOD, GET_UB_BP_INFO_CMD, UB_BP_INFO_DUMP);
|
||||||
|
+ cmd_ret = hikp_cmd_alloc(&header, &req, sizeof(req));
|
||||||
|
+ if (cmd_ret == NULL || cmd_ret->status != 0) {
|
||||||
|
+ free(cmd_ret);
|
||||||
|
+ cmd_ret = NULL;
|
||||||
|
+ return -EIO;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ rsp = (struct ub_bp_rsp *)cmd_ret->rsp_data;
|
||||||
|
+ hikp_ub_bp_info_show(rsp);
|
||||||
|
+
|
||||||
|
+ free(cmd_ret);
|
||||||
|
+ cmd_ret = NULL;
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void hikp_ub_bp_cmd_execute(struct major_cmd_ctrl *self)
|
||||||
|
+{
|
||||||
|
+ struct bdf_t *bdf = &g_ub_bp_param.target.bdf;
|
||||||
|
+ int ret;
|
||||||
|
+
|
||||||
|
+ ret = hikp_ub_query_bp(bdf);
|
||||||
|
+ if (ret != 0) {
|
||||||
|
+ snprintf(self->err_str, sizeof(self->err_str), "fail to get ub bp info.");
|
||||||
|
+ self->err_no = ret;
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void cmd_ub_bp_init(void)
|
||||||
|
+{
|
||||||
|
+ struct major_cmd_ctrl *major_cmd = get_major_cmd();
|
||||||
|
+
|
||||||
|
+ major_cmd->option_count = 0;
|
||||||
|
+ major_cmd->execute = hikp_ub_bp_cmd_execute;
|
||||||
|
+
|
||||||
|
+ cmd_option_register("-h", "--help", false, hikp_ub_bp_help);
|
||||||
|
+ cmd_option_register("-i", "--interface", true, hikp_ub_bp_target);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+HIKP_CMD_DECLARE("ub_bp", "get ub bp information", cmd_ub_bp_init);
|
||||||
|
diff --git a/net/ub/ub_bp/hikp_ub_bp.h b/net/ub/ub_bp/hikp_ub_bp.h
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..0bd4740
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/net/ub/ub_bp/hikp_ub_bp.h
|
||||||
|
@@ -0,0 +1,39 @@
|
||||||
|
+/*
|
||||||
|
+ * Copyright (c) 2023 Hisilicon Technologies Co., Ltd.
|
||||||
|
+ * Hikptool is licensed under Mulan PSL v2.
|
||||||
|
+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||||
|
+ * You may obtain a copy of Mulan PSL v2 at:
|
||||||
|
+ * http://license.coscl.org.cn/MulanPSL2
|
||||||
|
+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||||
|
+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||||
|
+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||||
|
+ *
|
||||||
|
+ * See the Mulan PSL v2 for more details.
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+#ifndef HIKP_UB_BP_H
|
||||||
|
+#define HIKP_UB_BP_H
|
||||||
|
+
|
||||||
|
+#include "hikp_net_lib.h"
|
||||||
|
+
|
||||||
|
+#define MAX_VL_NUM 17
|
||||||
|
+
|
||||||
|
+enum ub_bp_sub_cmd_type {
|
||||||
|
+ UB_BP_INFO_DUMP = 0,
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+struct ub_bp_param {
|
||||||
|
+ struct tool_target target;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+struct ub_bp_req_para {
|
||||||
|
+ struct bdf_t bdf;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+struct ub_bp_rsp {
|
||||||
|
+ uint8_t mac_id;
|
||||||
|
+ uint8_t rsvd[3];
|
||||||
|
+ uint32_t bp_val;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+#endif /* HIKP_UB_BP_H */
|
||||||
|
--
|
||||||
|
2.36.1.windows.1
|
||||||
|
|
||||||
208
0020-Complete-the-developing-of-hikptool-ub_crd-function.patch
Normal file
208
0020-Complete-the-developing-of-hikptool-ub_crd-function.patch
Normal file
@ -0,0 +1,208 @@
|
|||||||
|
From 575dc2b31315c2ea0e9fe488f30f86135e9ea7bf Mon Sep 17 00:00:00 2001
|
||||||
|
From: veega2022 <zhuweijia@huawei.com>
|
||||||
|
Date: Thu, 11 May 2023 08:59:11 +0800
|
||||||
|
Subject: [PATCH 11/15] Complete the developing of hikptool ub_crd function
|
||||||
|
|
||||||
|
The hikptool ub_crd command is submitted for the first time.
|
||||||
|
This command is used to query the letter of credit status by reading the register value.
|
||||||
|
|
||||||
|
Signed-off-by: Jianqiang Li <lijianqiang16@huawei.com>
|
||||||
|
---
|
||||||
|
net/ub/ub_crd/hikp_ub_crd.c | 133 ++++++++++++++++++++++++++++++++++++
|
||||||
|
net/ub/ub_crd/hikp_ub_crd.h | 44 ++++++++++++
|
||||||
|
2 files changed, 177 insertions(+)
|
||||||
|
create mode 100644 net/ub/ub_crd/hikp_ub_crd.c
|
||||||
|
create mode 100644 net/ub/ub_crd/hikp_ub_crd.h
|
||||||
|
|
||||||
|
diff --git a/net/ub/ub_crd/hikp_ub_crd.c b/net/ub/ub_crd/hikp_ub_crd.c
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..d5d0015
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/net/ub/ub_crd/hikp_ub_crd.c
|
||||||
|
@@ -0,0 +1,133 @@
|
||||||
|
+/*
|
||||||
|
+ * Copyright (c) 2023 Hisilicon Technologies Co., Ltd.
|
||||||
|
+ * Hikptool is licensed under Mulan PSL v2.
|
||||||
|
+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||||
|
+ * You may obtain a copy of Mulan PSL v2 at:
|
||||||
|
+ * http://license.coscl.org.cn/MulanPSL2
|
||||||
|
+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||||
|
+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||||
|
+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||||
|
+ *
|
||||||
|
+ * See the Mulan PSL v2 for more details.
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+#include "hikp_ub_crd.h"
|
||||||
|
+
|
||||||
|
+static struct ub_crd_param g_ub_crd_param = { 0 };
|
||||||
|
+
|
||||||
|
+static int hikp_ub_crd_help(struct major_cmd_ctrl *self, const char *argv)
|
||||||
|
+{
|
||||||
|
+ printf("\n Usage: %s %s\n", self->cmd_ptr->name, "-i <interface>\n");
|
||||||
|
+ printf("\n %s\n", self->cmd_ptr->help_info);
|
||||||
|
+ printf(" Options:\n\n");
|
||||||
|
+ printf(" %s, %-25s %s\n", "-h", "--help", "display this help and exit");
|
||||||
|
+ printf(" %s, %-25s %s\n", "-i", "--interface=<interface>",
|
||||||
|
+ "device target or bdf id, e.g. ubn0 or 0000:35:00.0");
|
||||||
|
+ printf("\n");
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int hikp_ub_crd_target(struct major_cmd_ctrl *self, const char *argv)
|
||||||
|
+{
|
||||||
|
+ self->err_no = tool_check_and_get_valid_bdf_id(argv, &(g_ub_crd_param.target));
|
||||||
|
+ if (self->err_no) {
|
||||||
|
+ snprintf(self->err_str, sizeof(self->err_str), "Unknown device %s.", argv);
|
||||||
|
+ return self->err_no;
|
||||||
|
+ }
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int hikp_ub_show_crd(uint32_t off, struct ub_crd_rsp *crd_rsp, uint32_t num_rows,
|
||||||
|
+ char const *crds[][2])
|
||||||
|
+{
|
||||||
|
+ int reg_index;
|
||||||
|
+ int i;
|
||||||
|
+
|
||||||
|
+ for (i = 0; i < num_rows; i++) {
|
||||||
|
+ union cut_reg reg;
|
||||||
|
+
|
||||||
|
+ reg_index = off + i;
|
||||||
|
+ reg.value = crd_rsp->cut_reg_value[reg_index];
|
||||||
|
+ if (strcmp(crds[i][0], "NULL") != 0)
|
||||||
|
+ printf("%-28s : %#x\n", crds[i][0], reg.cut[0]);
|
||||||
|
+
|
||||||
|
+ if (strcmp(crds[i][1], "NULL") != 0)
|
||||||
|
+ printf("%-28s : %#x\n", crds[i][1], reg.cut[1]);
|
||||||
|
+ }
|
||||||
|
+ return off + num_rows;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int hikp_ub_query_crd(void)
|
||||||
|
+{
|
||||||
|
+ struct hikp_cmd_header req_header = { 0 };
|
||||||
|
+ struct ub_crd_req_para req_data = { 0 };
|
||||||
|
+ struct hikp_cmd_ret *cmd_ret = NULL;
|
||||||
|
+ struct ub_crd_rsp *crd_rsp = NULL;
|
||||||
|
+ int offset;
|
||||||
|
+ int ret;
|
||||||
|
+
|
||||||
|
+ char const *init_crds[][2] = {
|
||||||
|
+ {"CFG_REMOTE_ICRD", "CFG_REMOTE_LCRD"},
|
||||||
|
+ {"CFG_REMOTE_CRD_VL6", "CFG_REMOTE_CRD_VL7"},
|
||||||
|
+ {"CFG_REMOTE_CRD_VL4", "CFG_REMOTE_CRD_VL5"},
|
||||||
|
+ {"CFG_REMOTE_CRD_VL2", "CFG_REMOTE_CRD_VL3"},
|
||||||
|
+ {"CFG_REMOTE_CRD_VL0", "CFG_REMOTE_CRD_VL1"},
|
||||||
|
+ {"CFG_REMOTE_CRD_VL8", "NULL"} };
|
||||||
|
+
|
||||||
|
+ char const *temp_crds[][2] = {
|
||||||
|
+ {"TX_LCRD_VNA_EXIST_NUM", "NULL"}, {"TX_ICRD_VNA_EXIST_NUM", "NULL"},
|
||||||
|
+ {"TX_CRD_VN0_EXIST_NUM", "NULL"}, {"TX_CRD_VN1_EXIST_NUM", "NULL"},
|
||||||
|
+ {"TX_CRD_VN2_EXIST_NUM", "NULL"}, {"TX_CRD_VN3_EXIST_NUM", "NULL"},
|
||||||
|
+ {"TX_CRD_VN4_EXIST_NUM", "NULL"}, {"TX_CRD_VN5_EXIST_NUM", "NULL"},
|
||||||
|
+ {"TX_CRD_VN6_EXIST_NUM", "NULL"}, {"TX_CRD_VN7_EXIST_NUM", "NULL"},
|
||||||
|
+ {"TX_ACK_EXIST_NUM", "NULL"}, {"TX_ROH_LCRD_LOCAL_NUM", "NULL"} };
|
||||||
|
+
|
||||||
|
+ hikp_cmd_init(&req_header, UB_MOD, GET_UB_CRD_INFO_CMD, UB_CRD_INFO_DUMP);
|
||||||
|
+ req_data.bdf = g_ub_crd_param.target.bdf;
|
||||||
|
+ cmd_ret = hikp_cmd_alloc(&req_header, &req_data, sizeof(req_data));
|
||||||
|
+ if (cmd_ret == NULL || cmd_ret->status != 0) {
|
||||||
|
+ free(cmd_ret);
|
||||||
|
+ cmd_ret = NULL;
|
||||||
|
+ return -EIO;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ crd_rsp = (struct ub_crd_rsp *)(cmd_ret->rsp_data);
|
||||||
|
+
|
||||||
|
+ printf("******************** CREDIT CNT START ********************\n");
|
||||||
|
+ printf("------------------- INIT CREDIT START -----------------\n");
|
||||||
|
+ offset = hikp_ub_show_crd(0, crd_rsp, NUM_ROWS_INIT_CRDS, init_crds);
|
||||||
|
+ printf("------------------- INIT CREDIT END --------------------\n");
|
||||||
|
+ printf("------------------- TEMP CREDIT START ------------------\n");
|
||||||
|
+ offset = hikp_ub_show_crd(offset, crd_rsp, NUM_ROWS_TEMP_CRDS, temp_crds);
|
||||||
|
+ printf("------------------- TEMP CREDIT END --------------------\n");
|
||||||
|
+ printf("********************* CREDIT CNT END *********************\n");
|
||||||
|
+
|
||||||
|
+ free(cmd_ret);
|
||||||
|
+ cmd_ret = NULL;
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void hikp_ub_crd_cmd_execute(struct major_cmd_ctrl *self)
|
||||||
|
+{
|
||||||
|
+ int ret;
|
||||||
|
+
|
||||||
|
+ ret = hikp_ub_query_crd();
|
||||||
|
+ if (ret != 0) {
|
||||||
|
+ snprintf(self->err_str, sizeof(self->err_str), "fail to get ub crd info.");
|
||||||
|
+ self->err_no = ret;
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void cmd_ub_crd_init(void)
|
||||||
|
+{
|
||||||
|
+ struct major_cmd_ctrl *major_cmd = get_major_cmd();
|
||||||
|
+
|
||||||
|
+ major_cmd->option_count = 0;
|
||||||
|
+ major_cmd->execute = hikp_ub_crd_cmd_execute;
|
||||||
|
+
|
||||||
|
+ cmd_option_register("-h", "--help", false, hikp_ub_crd_help);
|
||||||
|
+ cmd_option_register("-i", "--interface", true, hikp_ub_crd_target);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+HIKP_CMD_DECLARE("ub_crd", "get ub crd information", cmd_ub_crd_init);
|
||||||
|
diff --git a/net/ub/ub_crd/hikp_ub_crd.h b/net/ub/ub_crd/hikp_ub_crd.h
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..5dfa38a
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/net/ub/ub_crd/hikp_ub_crd.h
|
||||||
|
@@ -0,0 +1,44 @@
|
||||||
|
+/*
|
||||||
|
+ * Copyright (c) 2023 Hisilicon Technologies Co., Ltd.
|
||||||
|
+ * Hikptool is licensed under Mulan PSL v2.
|
||||||
|
+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||||
|
+ * You may obtain a copy of Mulan PSL v2 at:
|
||||||
|
+ * http://license.coscl.org.cn/MulanPSL2
|
||||||
|
+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||||
|
+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||||
|
+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||||
|
+ *
|
||||||
|
+ * See the Mulan PSL v2 for more details.
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+#ifndef HIKP_UB_CRD_H
|
||||||
|
+#define HIKP_UB_CRD_H
|
||||||
|
+
|
||||||
|
+#include "hikp_net_lib.h"
|
||||||
|
+
|
||||||
|
+#define MAX_CRD_SIZE 20
|
||||||
|
+#define NUM_ROWS_INIT_CRDS 6
|
||||||
|
+#define NUM_ROWS_TEMP_CRDS 12
|
||||||
|
+
|
||||||
|
+enum ub_crd_sub_cmd_type {
|
||||||
|
+ UB_CRD_INFO_DUMP = 0,
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+union cut_reg {
|
||||||
|
+ uint32_t value;
|
||||||
|
+ uint16_t cut[2];
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+struct ub_crd_param {
|
||||||
|
+ struct tool_target target;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+struct ub_crd_req_para {
|
||||||
|
+ struct bdf_t bdf;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+struct ub_crd_rsp {
|
||||||
|
+ uint32_t cut_reg_value[MAX_CRD_SIZE];
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+#endif /* HIKP_UB_CRD_H */
|
||||||
|
--
|
||||||
|
2.36.1.windows.1
|
||||||
|
|
||||||
164
0021-Complete-the-developing-of-hikptool-ub_info-function.patch
Normal file
164
0021-Complete-the-developing-of-hikptool-ub_info-function.patch
Normal file
@ -0,0 +1,164 @@
|
|||||||
|
From 43db6b06b49696cb4fd9556c975b2cf67da4b86b Mon Sep 17 00:00:00 2001
|
||||||
|
From: veega2022 <zhuweijia@huawei.com>
|
||||||
|
Date: Thu, 11 May 2023 09:00:25 +0800
|
||||||
|
Subject: [PATCH 12/15] Complete the developing of hikptool ub_info function
|
||||||
|
|
||||||
|
The hikptool ub_info command is submitted for the first time.
|
||||||
|
This command is used to query whether the cloud attack defense function is enabled and query the single-port multi-stack working mode.
|
||||||
|
|
||||||
|
Signed-off-by: Jianqiang Li <lijianqiang16@huawei.com>
|
||||||
|
---
|
||||||
|
net/ub/ub_info/hikp_ub_info.c | 96 +++++++++++++++++++++++++++++++++++
|
||||||
|
net/ub/ub_info/hikp_ub_info.h | 37 ++++++++++++++
|
||||||
|
2 files changed, 133 insertions(+)
|
||||||
|
create mode 100644 net/ub/ub_info/hikp_ub_info.c
|
||||||
|
create mode 100644 net/ub/ub_info/hikp_ub_info.h
|
||||||
|
|
||||||
|
diff --git a/net/ub/ub_info/hikp_ub_info.c b/net/ub/ub_info/hikp_ub_info.c
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..3b354dd
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/net/ub/ub_info/hikp_ub_info.c
|
||||||
|
@@ -0,0 +1,96 @@
|
||||||
|
+/*
|
||||||
|
+ * Copyright (c) 2023 Hisilicon Technologies Co., Ltd.
|
||||||
|
+ * Hikptool is licensed under Mulan PSL v2.
|
||||||
|
+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||||
|
+ * You may obtain a copy of Mulan PSL v2 at:
|
||||||
|
+ * http://license.coscl.org.cn/MulanPSL2
|
||||||
|
+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||||
|
+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||||
|
+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||||
|
+ *
|
||||||
|
+ * See the Mulan PSL v2 for more details.
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+#include "hikp_ub_info.h"
|
||||||
|
+
|
||||||
|
+static struct ub_info_param g_ub_info_param = { 0 };
|
||||||
|
+
|
||||||
|
+static int hikp_ub_info_help(struct major_cmd_ctrl *self, const char *argv)
|
||||||
|
+{
|
||||||
|
+ printf("\n Usage: %s %s\n", self->cmd_ptr->name, "-i <interface>\n");
|
||||||
|
+ printf("\n %s\n", self->cmd_ptr->help_info);
|
||||||
|
+ printf(" Options:\n\n");
|
||||||
|
+ printf(" %s, %-25s %s\n", "-h", "--help", "display this help and exit");
|
||||||
|
+ printf(" %s, %-25s %s\n", "-i", "--interface=<interface>",
|
||||||
|
+ "device target or bdf id, e.g. ubn0 or 0000:35:00.0");
|
||||||
|
+ printf("\n");
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int hikp_ub_info_target(struct major_cmd_ctrl *self, const char *argv)
|
||||||
|
+{
|
||||||
|
+ self->err_no = tool_check_and_get_valid_bdf_id(argv, &(g_ub_info_param.target));
|
||||||
|
+ if (self->err_no != 0) {
|
||||||
|
+ snprintf(self->err_str, sizeof(self->err_str), "Unknown device %s.", argv);
|
||||||
|
+ return self->err_no;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void hikp_ub_basic_info_show(const struct ub_info_rsp *info)
|
||||||
|
+{
|
||||||
|
+ printf("%-32s : %s\n", "cloud-based attack defense", info->cloud_mode ? "YES" : "NO");
|
||||||
|
+ printf("%-32s : %s\n", "pf working mode", info->pf_drv_type ? "UB" : "RDMA");
|
||||||
|
+ printf("%-32s : %s\n", "vf working mode", info->vf_drv_type ? "UB" : "RDMA");
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int hikp_ub_query_basic_info(const struct bdf_t *bdf)
|
||||||
|
+{
|
||||||
|
+ struct hikp_cmd_header header = { 0 };
|
||||||
|
+ struct ub_info_req_para req = { 0 };
|
||||||
|
+ struct hikp_cmd_ret *cmd_ret;
|
||||||
|
+ struct ub_info_rsp *rsp;
|
||||||
|
+
|
||||||
|
+ req.bdf = *bdf;
|
||||||
|
+ hikp_cmd_init(&header, UB_MOD, GET_UB_BASIC_INFO_CMD, UB_BASIC_INFO_DUMP);
|
||||||
|
+ cmd_ret = hikp_cmd_alloc(&header, &req, sizeof(req));
|
||||||
|
+ if (cmd_ret == NULL || cmd_ret->status != 0) {
|
||||||
|
+ free(cmd_ret);
|
||||||
|
+ cmd_ret = NULL;
|
||||||
|
+ return -EIO;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ rsp = (struct ub_info_rsp *)cmd_ret->rsp_data;
|
||||||
|
+ hikp_ub_basic_info_show(rsp);
|
||||||
|
+
|
||||||
|
+ free(cmd_ret);
|
||||||
|
+ cmd_ret = NULL;
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void hikp_ub_info_cmd_execute(struct major_cmd_ctrl *self)
|
||||||
|
+{
|
||||||
|
+ struct bdf_t *bdf = &g_ub_info_param.target.bdf;
|
||||||
|
+ int ret;
|
||||||
|
+
|
||||||
|
+ ret = hikp_ub_query_basic_info(bdf);
|
||||||
|
+ if (ret != 0) {
|
||||||
|
+ snprintf(self->err_str, sizeof(self->err_str), "fail to get basic info.");
|
||||||
|
+ self->err_no = ret;
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void cmd_ub_info_init(void)
|
||||||
|
+{
|
||||||
|
+ struct major_cmd_ctrl *major_cmd = get_major_cmd();
|
||||||
|
+
|
||||||
|
+ major_cmd->option_count = 0;
|
||||||
|
+ major_cmd->execute = hikp_ub_info_cmd_execute;
|
||||||
|
+
|
||||||
|
+ cmd_option_register("-h", "--help", false, hikp_ub_info_help);
|
||||||
|
+ cmd_option_register("-i", "--interface", true, hikp_ub_info_target);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+HIKP_CMD_DECLARE("ub_info", "get ub basic information", cmd_ub_info_init);
|
||||||
|
diff --git a/net/ub/ub_info/hikp_ub_info.h b/net/ub/ub_info/hikp_ub_info.h
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..a9cb858
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/net/ub/ub_info/hikp_ub_info.h
|
||||||
|
@@ -0,0 +1,37 @@
|
||||||
|
+/*
|
||||||
|
+ * Copyright (c) 2023 Hisilicon Technologies Co., Ltd.
|
||||||
|
+ * Hikptool is licensed under Mulan PSL v2.
|
||||||
|
+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||||
|
+ * You may obtain a copy of Mulan PSL v2 at:
|
||||||
|
+ * http://license.coscl.org.cn/MulanPSL2
|
||||||
|
+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||||
|
+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||||
|
+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||||
|
+ *
|
||||||
|
+ * See the Mulan PSL v2 for more details.
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+#ifndef HIKP_UB_INFO_H
|
||||||
|
+#define HIKP_UB_INFO_H
|
||||||
|
+
|
||||||
|
+#include "hikp_net_lib.h"
|
||||||
|
+
|
||||||
|
+enum ub_info_sub_cmd_type {
|
||||||
|
+ UB_BASIC_INFO_DUMP = 0,
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+struct ub_info_param {
|
||||||
|
+ struct tool_target target;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+struct ub_info_req_para {
|
||||||
|
+ struct bdf_t bdf;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+struct ub_info_rsp {
|
||||||
|
+ uint32_t cloud_mode;
|
||||||
|
+ uint32_t pf_drv_type;
|
||||||
|
+ uint32_t vf_drv_type;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+#endif /* HIKP_UB_INFO_H */
|
||||||
|
--
|
||||||
|
2.36.1.windows.1
|
||||||
|
|
||||||
638
0022-add-support-query-ip-guid-entries.patch
Normal file
638
0022-add-support-query-ip-guid-entries.patch
Normal file
@ -0,0 +1,638 @@
|
|||||||
|
From b51c3b0cdb438a18a4db2e180b57c84c49dab011 Mon Sep 17 00:00:00 2001
|
||||||
|
From: veega2022 <zhuweijia@huawei.com>
|
||||||
|
Date: Thu, 11 May 2023 09:23:48 +0800
|
||||||
|
Subject: [PATCH 13/15] add support query ip/guid entries
|
||||||
|
|
||||||
|
The function of reading IP and guid entries through the imp command is added.
|
||||||
|
|
||||||
|
Signed-off-by: Jianqiang Li <lijianqiang16@huawei.com>
|
||||||
|
---
|
||||||
|
net/ub/ub_unic/hikp_unic_ppp.c | 468 +++++++++++++++++++++++++++++++++
|
||||||
|
net/ub/ub_unic/hikp_unic_ppp.h | 139 ++++++++++
|
||||||
|
2 files changed, 607 insertions(+)
|
||||||
|
create mode 100644 net/ub/ub_unic/hikp_unic_ppp.c
|
||||||
|
create mode 100644 net/ub/ub_unic/hikp_unic_ppp.h
|
||||||
|
|
||||||
|
diff --git a/net/ub/ub_unic/hikp_unic_ppp.c b/net/ub/ub_unic/hikp_unic_ppp.c
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..5325b03
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/net/ub/ub_unic/hikp_unic_ppp.c
|
||||||
|
@@ -0,0 +1,468 @@
|
||||||
|
+/*
|
||||||
|
+ * Copyright (c) 2023 Hisilicon Technologies Co., Ltd.
|
||||||
|
+ * Hikptool is licensed under Mulan PSL v2.
|
||||||
|
+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||||
|
+ * You may obtain a copy of Mulan PSL v2 at:
|
||||||
|
+ * http://license.coscl.org.cn/MulanPSL2
|
||||||
|
+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||||
|
+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||||
|
+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||||
|
+ *
|
||||||
|
+ * See the Mulan PSL v2 for more details.
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+#include <string.h>
|
||||||
|
+#include <stdio.h>
|
||||||
|
+#include <sys/types.h>
|
||||||
|
+#include <arpa/inet.h>
|
||||||
|
+#include <unistd.h>
|
||||||
|
+#include "hikp_unic_ppp.h"
|
||||||
|
+
|
||||||
|
+static struct hikp_unic_ppp_hw_resources g_unic_ppp_hw_res = { 0 };
|
||||||
|
+static struct unic_ppp_param g_unic_ppp_param = { 0 };
|
||||||
|
+
|
||||||
|
+static void hikp_unic_ppp_show_ip_tbl(const void *data);
|
||||||
|
+static void hikp_unic_ppp_show_guid_tbl(const void *data);
|
||||||
|
+
|
||||||
|
+static int hikp_unic_query_ppp_ip_tbl(struct hikp_cmd_header *req_header,
|
||||||
|
+ const struct bdf_t *bdf, void *data);
|
||||||
|
+static int hikp_unic_query_ppp_guid_tbl(struct hikp_cmd_header *req_header,
|
||||||
|
+ const struct bdf_t *bdf, void *data);
|
||||||
|
+
|
||||||
|
+static const struct unic_ppp_feature_cmd g_unic_ppp_feature_cmd[] = {
|
||||||
|
+ { UNIC_PPP_IP_TBL_NAME, UNIC_IP_TBL_DUMP, true,
|
||||||
|
+ hikp_unic_query_ppp_ip_tbl, hikp_unic_ppp_show_ip_tbl },
|
||||||
|
+ { UNIC_PPP_GUID_TBL_NAME, UNIC_GUID_TBL_DUMP, true,
|
||||||
|
+ hikp_unic_query_ppp_guid_tbl, hikp_unic_ppp_show_guid_tbl },
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+static int hikp_unic_ppp_cmd_help(struct major_cmd_ctrl *self, const char *argv)
|
||||||
|
+{
|
||||||
|
+ printf("\n Usage: %s %s\n", self->cmd_ptr->name, "-i <interface>");
|
||||||
|
+ printf("\n %s\n", self->cmd_ptr->help_info);
|
||||||
|
+ printf("\n Options:\n\n");
|
||||||
|
+ printf(" %s, %-25s %s\n", "-h", "--help", "display this help and exit");
|
||||||
|
+ printf(" %s, %-25s %s\n", "-i", "--interface=<interface>",
|
||||||
|
+ "device target or bdf id, e.g. ubn0 or 0000:35:00.0");
|
||||||
|
+ printf(" %s, %-24s %s\n", "-du", "--dump", "dump ip or guid table info.");
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int hikp_unic_cmd_get_ppp_target(struct major_cmd_ctrl *self, const char *argv)
|
||||||
|
+{
|
||||||
|
+ self->err_no = tool_check_and_get_valid_bdf_id(argv, &(g_unic_ppp_param.target));
|
||||||
|
+ if (self->err_no != 0) {
|
||||||
|
+ snprintf(self->err_str, sizeof(self->err_str), "unknown device!");
|
||||||
|
+ return self->err_no;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int hikp_unic_cmd_ppp_feature_select(struct major_cmd_ctrl *self, const char *argv)
|
||||||
|
+{
|
||||||
|
+ size_t feat_size = HIKP_ARRAY_SIZE(g_unic_ppp_feature_cmd);
|
||||||
|
+ size_t i;
|
||||||
|
+
|
||||||
|
+ for (i = 0; i < feat_size; i++) {
|
||||||
|
+ if (strncmp(argv, g_unic_ppp_feature_cmd[i].feature_name,
|
||||||
|
+ HIKP_UNIC_PPP_MAX_FEATURE_NAME_LEN) == 0) {
|
||||||
|
+ g_unic_ppp_param.feature_idx = i;
|
||||||
|
+ return 0;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ hikp_unic_ppp_cmd_help(self, NULL);
|
||||||
|
+ snprintf(self->err_str, sizeof(self->err_str), "please input valid dump type.");
|
||||||
|
+ self->err_no = -EINVAL;
|
||||||
|
+
|
||||||
|
+ return self->err_no;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int hikp_unic_ppp_get_blk(struct hikp_cmd_header *req_header,
|
||||||
|
+ const struct unic_ppp_req_para *req_data, void *buf,
|
||||||
|
+ size_t buf_len, struct unic_ppp_rsp_head *rsp_head)
|
||||||
|
+{
|
||||||
|
+ struct hikp_cmd_ret *cmd_ret;
|
||||||
|
+ struct unic_ppp_rsp *rsp;
|
||||||
|
+ int ret = 0;
|
||||||
|
+
|
||||||
|
+ cmd_ret = hikp_cmd_alloc(req_header, req_data, sizeof(*req_data));
|
||||||
|
+ if (cmd_ret == NULL || cmd_ret->status != 0) {
|
||||||
|
+ ret = -EIO;
|
||||||
|
+ goto out;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ rsp = (struct unic_ppp_rsp *)cmd_ret->rsp_data;
|
||||||
|
+ if (rsp->rsp_head.cur_blk_size > buf_len) {
|
||||||
|
+ HIKP_ERROR_PRINT("unic_ppp block context copy size error, "
|
||||||
|
+ "buffer size=%llu, data size=%u.\n",
|
||||||
|
+ buf_len, rsp->rsp_head.cur_blk_size);
|
||||||
|
+ ret = -EINVAL;
|
||||||
|
+ goto out;
|
||||||
|
+ }
|
||||||
|
+ memcpy(buf, rsp->rsp_data, rsp->rsp_head.cur_blk_size);
|
||||||
|
+ memcpy(rsp_head, &rsp->rsp_head, sizeof(struct unic_ppp_rsp_head));
|
||||||
|
+
|
||||||
|
+out:
|
||||||
|
+ free(cmd_ret);
|
||||||
|
+ return ret;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int hikp_unic_query_ppp_by_blkid(struct hikp_cmd_header *req_header, const struct bdf_t *bdf,
|
||||||
|
+ void *data, size_t len)
|
||||||
|
+{
|
||||||
|
+ struct unic_ppp_rsp_head rsp_head = { 0 };
|
||||||
|
+ struct unic_ppp_req_para req_data = { 0 };
|
||||||
|
+ uint32_t total_blk_size;
|
||||||
|
+ uint8_t blk_id = 0;
|
||||||
|
+ int ret = 0;
|
||||||
|
+
|
||||||
|
+ req_data.bdf = *bdf;
|
||||||
|
+ req_data.block_id = blk_id;
|
||||||
|
+ ret = hikp_unic_ppp_get_blk(req_header, &req_data, data, len, &rsp_head);
|
||||||
|
+ if (ret != 0) {
|
||||||
|
+ HIKP_ERROR_PRINT("Fail to get block-%u context.\n", blk_id);
|
||||||
|
+ return ret;
|
||||||
|
+ }
|
||||||
|
+ total_blk_size = rsp_head.cur_blk_size;
|
||||||
|
+
|
||||||
|
+ for (blk_id = 1; blk_id < rsp_head.total_blk_num; blk_id++) {
|
||||||
|
+ req_data.block_id = blk_id;
|
||||||
|
+ ret = hikp_unic_ppp_get_blk(req_header, &req_data, (uint8_t *)data + total_blk_size,
|
||||||
|
+ len - total_blk_size, &rsp_head);
|
||||||
|
+ if (ret != 0) {
|
||||||
|
+ HIKP_ERROR_PRINT("Fail to get block-%u context.\n", blk_id);
|
||||||
|
+ return ret;
|
||||||
|
+ }
|
||||||
|
+ total_blk_size += rsp_head.cur_blk_size;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return ret;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int hikp_unic_get_ppp_entry_hw_res(const struct bdf_t *bdf,
|
||||||
|
+ struct hikp_unic_ppp_hw_resources *hw_res)
|
||||||
|
+{
|
||||||
|
+ struct hikp_cmd_header req_header = { 0 };
|
||||||
|
+
|
||||||
|
+ hikp_cmd_init(&req_header, UB_MOD, GET_UNIC_PPP_CMD, UNIC_PPP_ENTRY_HW_SPEC_GET);
|
||||||
|
+ return hikp_unic_query_ppp_by_blkid(&req_header, bdf, hw_res,
|
||||||
|
+ sizeof(struct hikp_unic_ppp_hw_resources));
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int hikp_unic_ppp_alloc_ip_tbl_entry(const struct hikp_unic_ppp_hw_resources *hw_res,
|
||||||
|
+ struct unic_ip_tbl *ip_tbl)
|
||||||
|
+{
|
||||||
|
+ uint32_t max_ip_entry_size;
|
||||||
|
+
|
||||||
|
+ max_ip_entry_size = hw_res->ip_max_mem_size + hw_res->ip_overflow_size;
|
||||||
|
+ if (max_ip_entry_size == 0) {
|
||||||
|
+ HIKP_ERROR_PRINT("ip tbl query is not supported\n");
|
||||||
|
+ return -EIO;
|
||||||
|
+ }
|
||||||
|
+ ip_tbl->entry = (struct unic_ip_entry *)calloc(max_ip_entry_size,
|
||||||
|
+ sizeof(struct unic_ip_entry));
|
||||||
|
+ if (ip_tbl->entry == NULL) {
|
||||||
|
+ HIKP_ERROR_PRINT("fail to alloc ip_table_entry memory.\n");
|
||||||
|
+ return -ENOMEM;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int hikp_unic_ppp_alloc_guid_tbl_entry(const struct hikp_unic_ppp_hw_resources *hw_res,
|
||||||
|
+ struct unic_guid_tbl *guid_tbl)
|
||||||
|
+{
|
||||||
|
+ if (hw_res->uc_guid_tbl_size == 0 && hw_res->mc_guid_tbl_size == 0) {
|
||||||
|
+ HIKP_ERROR_PRINT("guid tbl query is not supported\n");
|
||||||
|
+ return -EIO;
|
||||||
|
+ }
|
||||||
|
+ guid_tbl->uc_tbl.entry = (struct unic_guid_uc_entry *)calloc(hw_res->uc_guid_tbl_size,
|
||||||
|
+ sizeof(struct unic_guid_uc_entry));
|
||||||
|
+ if (guid_tbl->uc_tbl.entry == NULL) {
|
||||||
|
+ HIKP_ERROR_PRINT("fail to alloc uc_guid_entry_table memory.\n");
|
||||||
|
+ return -ENOMEM;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ guid_tbl->mc_tbl.entry = (struct unic_guid_mc_entry *)calloc(hw_res->mc_guid_tbl_size,
|
||||||
|
+ sizeof(struct unic_guid_mc_entry));
|
||||||
|
+ if (guid_tbl->mc_tbl.entry == NULL) {
|
||||||
|
+ HIKP_ERROR_PRINT("fail to alloc mc_guid_entry_table memory.\n");
|
||||||
|
+ free(guid_tbl->uc_tbl.entry);
|
||||||
|
+ return -ENOMEM;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static union unic_ppp_feature_info*
|
||||||
|
+hikp_unic_ppp_data_alloc(const struct unic_ppp_feature_cmd *unic_ppp_cmd,
|
||||||
|
+ const struct hikp_unic_ppp_hw_resources *hw_res)
|
||||||
|
+{
|
||||||
|
+ union unic_ppp_feature_info *unic_ppp_data;
|
||||||
|
+ int ret = -1;
|
||||||
|
+
|
||||||
|
+ unic_ppp_data = (union unic_ppp_feature_info *)calloc(1,
|
||||||
|
+ sizeof(union unic_ppp_feature_info));
|
||||||
|
+ if (unic_ppp_data == NULL) {
|
||||||
|
+ HIKP_ERROR_PRINT("Fail to allocate unic_ppp_feature_info memory.\n");
|
||||||
|
+ return NULL;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (g_unic_ppp_param.feature_idx == UNIC_PPP_IP_FEATURE_IDX) {
|
||||||
|
+ ret = hikp_unic_ppp_alloc_ip_tbl_entry(hw_res, &unic_ppp_data->ip_tbl);
|
||||||
|
+ } else if (g_unic_ppp_param.feature_idx == UNIC_PPP_GUID_FEATURE_IDX) {
|
||||||
|
+ ret = hikp_unic_ppp_alloc_guid_tbl_entry(hw_res, &unic_ppp_data->guid_tbl);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (ret != 0) {
|
||||||
|
+ goto out;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return unic_ppp_data;
|
||||||
|
+out:
|
||||||
|
+ free(unic_ppp_data);
|
||||||
|
+ return NULL;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int hikp_unic_query_ppp_ip_tbl(struct hikp_cmd_header *req_header, const struct bdf_t *bdf,
|
||||||
|
+ void *data)
|
||||||
|
+{
|
||||||
|
+ struct unic_ip_tbl *ip_tbl = (struct unic_ip_tbl *)data;
|
||||||
|
+ struct unic_ppp_rsp_head unic_rsp_head = { 0 };
|
||||||
|
+ struct unic_ppp_req_para req_data = { 0 };
|
||||||
|
+ uint32_t max_ip_entry_size;
|
||||||
|
+ uint32_t entry_size = 0;
|
||||||
|
+ size_t left_buf_len = 0;
|
||||||
|
+ uint32_t index = 0;
|
||||||
|
+ int ret = -1;
|
||||||
|
+
|
||||||
|
+ max_ip_entry_size = g_unic_ppp_hw_res.ip_max_mem_size + g_unic_ppp_hw_res.ip_overflow_size;
|
||||||
|
+ req_data.bdf = *bdf;
|
||||||
|
+ while (index < max_ip_entry_size) {
|
||||||
|
+ req_data.cur_entry_idx = index;
|
||||||
|
+ left_buf_len = sizeof(struct unic_ip_entry) * (max_ip_entry_size - entry_size);
|
||||||
|
+ ret = hikp_unic_ppp_get_blk(req_header, &req_data, ip_tbl->entry + entry_size,
|
||||||
|
+ left_buf_len, &unic_rsp_head);
|
||||||
|
+ if (ret != 0) {
|
||||||
|
+ HIKP_ERROR_PRINT("Fail to get the ip entry after index=%u, ret=%d.\n",
|
||||||
|
+ index, ret);
|
||||||
|
+ return ret;
|
||||||
|
+ }
|
||||||
|
+ entry_size += unic_rsp_head.cur_blk_entry_cnt;
|
||||||
|
+ index = unic_rsp_head.next_entry_idx;
|
||||||
|
+ }
|
||||||
|
+ ip_tbl->entry_size = entry_size;
|
||||||
|
+
|
||||||
|
+ return ret;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int hikp_unic_query_ppp_guid_tbl(struct hikp_cmd_header *req_header,
|
||||||
|
+ const struct bdf_t *bdf, void *data)
|
||||||
|
+{
|
||||||
|
+ struct unic_guid_tbl *guid_tbl = (struct unic_guid_tbl*)data;
|
||||||
|
+ struct unic_ppp_rsp_head unic_rsp_head = { 0 };
|
||||||
|
+ struct unic_ppp_req_para req_data = { 0 };
|
||||||
|
+ uint32_t entry_size = 0;
|
||||||
|
+ size_t left_buf_len = 0;
|
||||||
|
+ uint32_t index = 0;
|
||||||
|
+ int ret = -1;
|
||||||
|
+
|
||||||
|
+ req_data.bdf = *bdf;
|
||||||
|
+ req_data.is_unicast = 1;
|
||||||
|
+ while (index < g_unic_ppp_hw_res.uc_guid_tbl_size) {
|
||||||
|
+ req_data.cur_entry_idx = index;
|
||||||
|
+ left_buf_len = sizeof(struct unic_guid_uc_entry) *
|
||||||
|
+ (g_unic_ppp_hw_res.uc_guid_tbl_size - entry_size);
|
||||||
|
+ ret = hikp_unic_ppp_get_blk(req_header, &req_data,
|
||||||
|
+ guid_tbl->uc_tbl.entry + entry_size,
|
||||||
|
+ left_buf_len, &unic_rsp_head);
|
||||||
|
+ if (ret != 0) {
|
||||||
|
+ HIKP_ERROR_PRINT("Fail to get the uc_guid entry after index=%u, ret=%d.\n",
|
||||||
|
+ index, ret);
|
||||||
|
+ return ret;
|
||||||
|
+ }
|
||||||
|
+ entry_size += unic_rsp_head.cur_blk_entry_cnt;
|
||||||
|
+ index = unic_rsp_head.next_entry_idx;
|
||||||
|
+ }
|
||||||
|
+ guid_tbl->uc_tbl.entry_size = entry_size;
|
||||||
|
+
|
||||||
|
+ left_buf_len = 0;
|
||||||
|
+ entry_size = 0;
|
||||||
|
+ index = 0;
|
||||||
|
+ req_data.is_unicast = 0;
|
||||||
|
+
|
||||||
|
+ while (index < g_unic_ppp_hw_res.mc_guid_tbl_size) {
|
||||||
|
+ req_data.cur_entry_idx = index;
|
||||||
|
+ left_buf_len = sizeof(struct unic_guid_mc_entry) *
|
||||||
|
+ (g_unic_ppp_hw_res.mc_guid_tbl_size - entry_size);
|
||||||
|
+ ret = hikp_unic_ppp_get_blk(req_header, &req_data,
|
||||||
|
+ guid_tbl->mc_tbl.entry + entry_size,
|
||||||
|
+ left_buf_len, &unic_rsp_head);
|
||||||
|
+ if (ret != 0) {
|
||||||
|
+ HIKP_ERROR_PRINT("Fail to get the mc_guid entry after index=%u, ret=%d.\n",
|
||||||
|
+ index, ret);
|
||||||
|
+ return ret;
|
||||||
|
+ }
|
||||||
|
+ entry_size += unic_rsp_head.cur_blk_entry_cnt;
|
||||||
|
+ index = unic_rsp_head.next_entry_idx;
|
||||||
|
+ }
|
||||||
|
+ guid_tbl->mc_tbl.entry_size = entry_size;
|
||||||
|
+
|
||||||
|
+ return ret;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void hikp_unic_ppp_show_ip_tbl(const void *data)
|
||||||
|
+{
|
||||||
|
+ struct unic_ip_tbl *ip_tbl = (struct unic_ip_tbl *)data;
|
||||||
|
+ struct unic_ip_entry *entry;
|
||||||
|
+ uint16_t *ip_addr_tbl_str;
|
||||||
|
+ int i, j;
|
||||||
|
+
|
||||||
|
+ printf("ip_table_size = %u\n", ip_tbl->entry_size);
|
||||||
|
+ printf("index\t| func_id\t| ip_addr\n");
|
||||||
|
+ for (i = 0; i < ip_tbl->entry_size; i++) {
|
||||||
|
+ entry = &ip_tbl->entry[i];
|
||||||
|
+ ip_addr_tbl_str = (uint16_t *)entry->ip_addr;
|
||||||
|
+ printf("%-4u\t| %-3u\t\t| ", entry->index, entry->function_id);
|
||||||
|
+ for (j = 0; j < IP_ADDR_TBL_LEN - 1; j++)
|
||||||
|
+ printf("%04x:" , ntohs(ip_addr_tbl_str[j]));
|
||||||
|
+ printf("%04x\n", ntohs(ip_addr_tbl_str[IP_ADDR_TBL_LEN - 1]));
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void hikp_unic_ppp_show_guid_tbl(const void *data)
|
||||||
|
+{
|
||||||
|
+ struct unic_guid_tbl *guid_tbl = (struct unic_guid_tbl *)data;
|
||||||
|
+ uint32_t cnt;
|
||||||
|
+ int i;
|
||||||
|
+
|
||||||
|
+ printf("unicast guid num : %u\n", guid_tbl->uc_tbl.entry_size);
|
||||||
|
+ if (guid_tbl->uc_tbl.entry_size > 0) {
|
||||||
|
+ printf("| num\t| func id | GUID \n");
|
||||||
|
+ for (cnt = 0; cnt < guid_tbl->uc_tbl.entry_size; cnt++) {
|
||||||
|
+ printf("| %3u\t| %7u | ", cnt, guid_tbl->uc_tbl.entry[cnt].function_id);
|
||||||
|
+ for (i = 0; i < HIKP_UNIC_GUID_ADDR_LEN - 1; i++) {
|
||||||
|
+ printf("%02x:", guid_tbl->uc_tbl.entry[cnt].guid_addr[i]);
|
||||||
|
+ }
|
||||||
|
+ printf("%02x\n",
|
||||||
|
+ guid_tbl->uc_tbl.entry[cnt].guid_addr[HIKP_UNIC_GUID_ADDR_LEN - 1]);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ printf("multicast guid num : %u\n", guid_tbl->mc_tbl.entry_size);
|
||||||
|
+ if (guid_tbl->mc_tbl.entry_size > 0) {
|
||||||
|
+ printf("| num\t| idx\t| %-48s\t| bitmap\n", "GUID");
|
||||||
|
+ for (cnt = 0; cnt < guid_tbl->mc_tbl.entry_size; cnt++) {
|
||||||
|
+ printf("| %3u\t| %4u\t| ", cnt, guid_tbl->mc_tbl.entry[cnt].idx);
|
||||||
|
+ for (i = 0; i < HIKP_UNIC_GUID_ADDR_LEN - 1; i++) {
|
||||||
|
+ printf("%02x:", guid_tbl->mc_tbl.entry[cnt].guid_addr[i]);
|
||||||
|
+ }
|
||||||
|
+ printf("%02x\t| ",
|
||||||
|
+ guid_tbl->mc_tbl.entry[cnt].guid_addr[HIKP_UNIC_GUID_ADDR_LEN - 1]);
|
||||||
|
+ for (i = HIKP_UNIC_GUID_BITMAP_LEN - 1; i > 0; i--) {
|
||||||
|
+ printf("%08x:", guid_tbl->mc_tbl.entry[cnt].function_bitmap[i]);
|
||||||
|
+ }
|
||||||
|
+ printf("%08x\n", guid_tbl->mc_tbl.entry[cnt].function_bitmap[0]);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int hikp_unic_ppp_check_input_param(struct major_cmd_ctrl *self,
|
||||||
|
+ const struct unic_ppp_param *ppp_param)
|
||||||
|
+{
|
||||||
|
+ const struct bdf_t *bdf = &ppp_param->target.bdf;
|
||||||
|
+
|
||||||
|
+ if (bdf->dev_id != 0) {
|
||||||
|
+ snprintf(self->err_str, sizeof(self->err_str), "VF does not support query!");
|
||||||
|
+ self->err_no = -EINVAL;
|
||||||
|
+ return self->err_no;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (ppp_param->feature_idx == UNIC_PPP_INIT_FEATURE_IDX) {
|
||||||
|
+ hikp_unic_ppp_cmd_help(self, NULL);
|
||||||
|
+ snprintf(self->err_str, sizeof(self->err_str), "-du/--dump parameter error!");
|
||||||
|
+ self->err_no = -EINVAL;
|
||||||
|
+ return self->err_no;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void hikp_unic_ppp_data_free(union unic_ppp_feature_info *unic_ppp_data)
|
||||||
|
+{
|
||||||
|
+ struct unic_guid_tbl *guid_tbl;
|
||||||
|
+ struct unic_ip_tbl *ip_tbl;
|
||||||
|
+
|
||||||
|
+ if (g_unic_ppp_param.feature_idx == UNIC_PPP_IP_FEATURE_IDX) {
|
||||||
|
+ ip_tbl = &unic_ppp_data->ip_tbl;
|
||||||
|
+ free(ip_tbl->entry);
|
||||||
|
+ } else if (g_unic_ppp_param.feature_idx == UNIC_PPP_GUID_FEATURE_IDX) {
|
||||||
|
+ guid_tbl = &unic_ppp_data->guid_tbl;
|
||||||
|
+ free(guid_tbl->uc_tbl.entry);
|
||||||
|
+ free(guid_tbl->mc_tbl.entry);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ free(unic_ppp_data);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void hikp_unic_ppp_cmd_execute(struct major_cmd_ctrl *self)
|
||||||
|
+{
|
||||||
|
+ const struct unic_ppp_feature_cmd *unic_ppp_cmd;
|
||||||
|
+ union unic_ppp_feature_info *unic_ppp_data;
|
||||||
|
+ struct hikp_cmd_header req_header = {0};
|
||||||
|
+ int ret;
|
||||||
|
+
|
||||||
|
+ ret = hikp_unic_ppp_check_input_param(self, &g_unic_ppp_param);
|
||||||
|
+ if (ret != 0)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ ret = hikp_unic_get_ppp_entry_hw_res(&g_unic_ppp_param.target.bdf, &g_unic_ppp_hw_res);
|
||||||
|
+ if (ret != 0) {
|
||||||
|
+ snprintf(self->err_str, sizeof(self->err_str),
|
||||||
|
+ "fail to obtain unic_ppp hardware resources.");
|
||||||
|
+ self->err_no = ret;
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ unic_ppp_cmd = &g_unic_ppp_feature_cmd[g_unic_ppp_param.feature_idx];
|
||||||
|
+ unic_ppp_data = hikp_unic_ppp_data_alloc(unic_ppp_cmd, &g_unic_ppp_hw_res);
|
||||||
|
+ if (unic_ppp_data == NULL) {
|
||||||
|
+ snprintf(self->err_str, sizeof(self->err_str),
|
||||||
|
+ "failed to allocate unic_ppp_data memory!");
|
||||||
|
+ self->err_no = -ENOMEM;
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ hikp_cmd_init(&req_header, UB_MOD, GET_UNIC_PPP_CMD, unic_ppp_cmd->sub_cmd_code);
|
||||||
|
+ ret = unic_ppp_cmd->query(&req_header, &g_unic_ppp_param.target.bdf, unic_ppp_data);
|
||||||
|
+ if (ret != 0) {
|
||||||
|
+ snprintf(self->err_str, sizeof(self->err_str),
|
||||||
|
+ "failed to query %s info, ret = %d.", unic_ppp_cmd->feature_name, ret);
|
||||||
|
+ self->err_no = ret;
|
||||||
|
+ goto out;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ printf("############## UNIC_PPP: %s info ############\n", unic_ppp_cmd->feature_name);
|
||||||
|
+ unic_ppp_cmd->show(unic_ppp_data);
|
||||||
|
+ printf("#################### END #######################\n");
|
||||||
|
+
|
||||||
|
+out:
|
||||||
|
+ hikp_unic_ppp_data_free(unic_ppp_data);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void cmd_unic_get_ppp_init(void)
|
||||||
|
+{
|
||||||
|
+ struct major_cmd_ctrl *major_cmd = get_major_cmd();
|
||||||
|
+
|
||||||
|
+ g_unic_ppp_param.feature_idx = UNIC_PPP_INIT_FEATURE_IDX;
|
||||||
|
+ major_cmd->execute = hikp_unic_ppp_cmd_execute;
|
||||||
|
+
|
||||||
|
+ cmd_option_register("-h", "--help", false, hikp_unic_ppp_cmd_help);
|
||||||
|
+ cmd_option_register("-i", "--interface", true, hikp_unic_cmd_get_ppp_target);
|
||||||
|
+ cmd_option_register("-du", "--dump", true, hikp_unic_cmd_ppp_feature_select);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+HIKP_CMD_DECLARE("unic_ppp", "dump ppp info of unic!", cmd_unic_get_ppp_init);
|
||||||
|
\ No newline at end of file
|
||||||
|
diff --git a/net/ub/ub_unic/hikp_unic_ppp.h b/net/ub/ub_unic/hikp_unic_ppp.h
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..c25fabd
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/net/ub/ub_unic/hikp_unic_ppp.h
|
||||||
|
@@ -0,0 +1,139 @@
|
||||||
|
+/*
|
||||||
|
+ * Copyright (c) 2023 Hisilicon Technologies Co., Ltd.
|
||||||
|
+ * Hikptool is licensed under Mulan PSL v2.
|
||||||
|
+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||||
|
+ * You may obtain a copy of Mulan PSL v2 at:
|
||||||
|
+ * http://license.coscl.org.cn/MulanPSL2
|
||||||
|
+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||||
|
+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||||
|
+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||||
|
+ *
|
||||||
|
+ * See the Mulan PSL v2 for more details.
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+#ifndef HIKP_UNIC_PPP_H
|
||||||
|
+#define HIKP_UNIC_PPP_H
|
||||||
|
+
|
||||||
|
+#include "hikp_net_lib.h"
|
||||||
|
+
|
||||||
|
+#define HIKP_UNIC_IP_ADDR_FMT_SIZE 50
|
||||||
|
+#define MAX_IP_ADDR_STR_LEN 50
|
||||||
|
+#define IP_ADDR_LEN 16
|
||||||
|
+#define IP_ADDR_TBL_LEN 8
|
||||||
|
+
|
||||||
|
+#define HIKP_UNIC_IP_ADDR_LEN 4
|
||||||
|
+#define HIKP_UNIC_GUID_BITMAP_LEN 8
|
||||||
|
+#define HIKP_UNIC_GUID_ADDR_LEN 16
|
||||||
|
+
|
||||||
|
+#define UNIC_PPP_MAX_RSP_DATA 57
|
||||||
|
+#define HIKP_UNIC_PPP_MAX_FEATURE_NAME_LEN 20
|
||||||
|
+
|
||||||
|
+#define UNIC_PPP_IP_TBL_NAME "ip"
|
||||||
|
+#define UNIC_PPP_GUID_TBL_NAME "guid"
|
||||||
|
+
|
||||||
|
+enum unic_ppp_sub_cmd_type {
|
||||||
|
+ UNIC_PPP_ENTRY_HW_SPEC_GET = 0,
|
||||||
|
+ UNIC_IP_TBL_DUMP,
|
||||||
|
+ UNIC_GUID_TBL_DUMP,
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+enum unic_ppp_feature_idx {
|
||||||
|
+ UNIC_PPP_IP_FEATURE_IDX = 0,
|
||||||
|
+ UNIC_PPP_GUID_FEATURE_IDX,
|
||||||
|
+ UNIC_PPP_INIT_FEATURE_IDX = -1,
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+struct hikp_unic_ppp_hw_resources {
|
||||||
|
+ uint16_t uc_guid_tbl_size;
|
||||||
|
+ uint16_t mc_guid_tbl_size;
|
||||||
|
+ uint32_t ip_max_mem_size;
|
||||||
|
+ uint32_t ip_overflow_size;
|
||||||
|
+ uint32_t rsv;
|
||||||
|
+ /* port information */
|
||||||
|
+ uint16_t total_func_num; /* contain PF and VF. */
|
||||||
|
+ uint16_t abs_func_id_base; /* The absolute func_id of the first VF in this port. */
|
||||||
|
+ uint32_t rsv1[11];
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+struct unic_ip_entry {
|
||||||
|
+ uint32_t index;
|
||||||
|
+ uint32_t function_id;
|
||||||
|
+ uint32_t ip_addr[HIKP_UNIC_IP_ADDR_LEN];
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+struct unic_ip_tbl {
|
||||||
|
+ uint32_t entry_size;
|
||||||
|
+ struct unic_ip_entry *entry;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+struct unic_guid_uc_entry {
|
||||||
|
+ uint32_t function_id;
|
||||||
|
+ uint8_t guid_addr[HIKP_UNIC_GUID_ADDR_LEN];
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+struct unic_guid_uc_tbl {
|
||||||
|
+ uint32_t entry_size;
|
||||||
|
+ struct unic_guid_uc_entry *entry;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+struct unic_guid_mc_entry {
|
||||||
|
+ uint32_t idx;
|
||||||
|
+ uint8_t guid_addr[HIKP_UNIC_GUID_ADDR_LEN];
|
||||||
|
+ uint32_t function_bitmap[8];
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+struct unic_guid_mc_tbl {
|
||||||
|
+ uint32_t entry_size;
|
||||||
|
+ struct unic_guid_mc_entry *entry;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+struct unic_guid_tbl {
|
||||||
|
+ struct unic_guid_uc_tbl uc_tbl;
|
||||||
|
+ struct unic_guid_mc_tbl mc_tbl;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+union unic_ppp_feature_info {
|
||||||
|
+ struct unic_guid_tbl guid_tbl;
|
||||||
|
+ struct unic_ip_tbl ip_tbl;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+struct unic_ppp_feature_cmd {
|
||||||
|
+ const char feature_name[HIKP_UNIC_PPP_MAX_FEATURE_NAME_LEN];
|
||||||
|
+ uint32_t sub_cmd_code;
|
||||||
|
+ bool need_query_hw_res;
|
||||||
|
+ int (*query)(struct hikp_cmd_header *req_header,
|
||||||
|
+ const struct bdf_t *bdf, void *data);
|
||||||
|
+ void (*show)(const void *data);
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+struct unic_ppp_param {
|
||||||
|
+ struct tool_target target;
|
||||||
|
+ int feature_idx;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+struct unic_ppp_req_para {
|
||||||
|
+ struct bdf_t bdf;
|
||||||
|
+ uint8_t block_id;
|
||||||
|
+ union {
|
||||||
|
+ uint8_t is_unicast; /* 1: uc GUID, 0: mc GUID. */
|
||||||
|
+ uint8_t rsv; /* firmware ignores it if isn't used to query GUID table. */
|
||||||
|
+ };
|
||||||
|
+ uint8_t rsv1[2];
|
||||||
|
+ uint32_t cur_entry_idx; /* firmware queries GUID/IP table from the value. */
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+struct unic_ppp_rsp_head {
|
||||||
|
+ uint8_t total_blk_num;
|
||||||
|
+ uint8_t cur_blk_size; /* real data size, not contain head size. */
|
||||||
|
+ uint16_t rsv;
|
||||||
|
+ /* firmware must set following fields when query GUID/IP table. */
|
||||||
|
+ uint32_t next_entry_idx;
|
||||||
|
+ uint32_t cur_blk_entry_cnt;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+typedef struct unic_ppp_rsp {
|
||||||
|
+ struct unic_ppp_rsp_head rsp_head; /* 12 Byte */
|
||||||
|
+ uint32_t rsp_data[UNIC_PPP_MAX_RSP_DATA];
|
||||||
|
+} unic_ppp_rsp_t;
|
||||||
|
+
|
||||||
|
+#endif /* HIKP_UNIC_PPP_H */
|
||||||
|
--
|
||||||
|
2.36.1.windows.1
|
||||||
|
|
||||||
53
0023-hikptool-delete-redundant-copyright-notices.patch
Normal file
53
0023-hikptool-delete-redundant-copyright-notices.patch
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
From a170acb3dc9203cd1d9708c9834640df0a916f72 Mon Sep 17 00:00:00 2001
|
||||||
|
From: veega <zhuweijia@huawei.com>
|
||||||
|
Date: Tue, 16 May 2023 10:39:39 +0800
|
||||||
|
Subject: [PATCH] hikptool: delete redundant copyright notices
|
||||||
|
|
||||||
|
Delete redundant copyright notices in hikp_ub_link.h
|
||||||
|
|
||||||
|
Signed-off-by: veega <zhuweijia@huawei.com>
|
||||||
|
---
|
||||||
|
net/ub/ub_link/hikp_ub_link.h | 13 -------------
|
||||||
|
tool_lib/tool_lib.h | 2 +-
|
||||||
|
2 files changed, 1 insertion(+), 14 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/net/ub/ub_link/hikp_ub_link.h b/net/ub/ub_link/hikp_ub_link.h
|
||||||
|
index 14ee912..7c71cb2 100644
|
||||||
|
--- a/net/ub/ub_link/hikp_ub_link.h
|
||||||
|
+++ b/net/ub/ub_link/hikp_ub_link.h
|
||||||
|
@@ -11,19 +11,6 @@
|
||||||
|
* See the Mulan PSL v2 for more details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
-/*
|
||||||
|
- * Copyright (c) 2023 Hisilicon Technologies Co., Ltd.
|
||||||
|
- * Hikptool is licensed under Mulan PSL v2.
|
||||||
|
- * You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||||
|
- * You may obtain a copy of Mulan PSL v2 at:
|
||||||
|
- * http://license.coscl.org.cn/MulanPSL2
|
||||||
|
- * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||||
|
- * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||||
|
- * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||||
|
- *
|
||||||
|
- * See the Mulan PSL v2 for more details.
|
||||||
|
- */
|
||||||
|
-
|
||||||
|
#ifndef HIKP_UB_LINK_H
|
||||||
|
#define HIKP_UB_LINK_H
|
||||||
|
|
||||||
|
diff --git a/tool_lib/tool_lib.h b/tool_lib/tool_lib.h
|
||||||
|
index 9766a7e..6548b57 100644
|
||||||
|
--- a/tool_lib/tool_lib.h
|
||||||
|
+++ b/tool_lib/tool_lib.h
|
||||||
|
@@ -18,7 +18,7 @@
|
||||||
|
|
||||||
|
#define TOOL_NAME "hikptool"
|
||||||
|
|
||||||
|
-#define TOOL_VER "1.0.15"
|
||||||
|
+#define TOOL_VER "1.0.16"
|
||||||
|
|
||||||
|
#define HI_GET_BITFIELD(value, start, mask) (((value) >> (start)) & (mask))
|
||||||
|
#define HI_SET_FIELD(origin, shift, val) ((origin) |= (val) << (shift))
|
||||||
|
--
|
||||||
|
2.36.1.windows.1
|
||||||
|
|
||||||
343
0024-hikptool-add-pm-trace.patch
Normal file
343
0024-hikptool-add-pm-trace.patch
Normal file
@ -0,0 +1,343 @@
|
|||||||
|
From c28cf6381c20a707a2898503677facf304896752 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Bingquan Mou <moubingquan@huawei.com>
|
||||||
|
Date: Wed, 28 Jun 2023 11:13:03 +0800
|
||||||
|
Subject: [PATCH] hikptool: the PM trace function is added to the PCIe module.
|
||||||
|
|
||||||
|
The pm trace function of the PCIe module is added to improve the DFX.
|
||||||
|
|
||||||
|
Signed-off-by: Bingquan Mou <moubingquan@huawei.com>
|
||||||
|
---
|
||||||
|
pcie/func_lib/pcie_func/pcie_common.h | 1 +
|
||||||
|
pcie/func_lib/pcie_func/pcie_link_ltssm.c | 180 +++++++++++++++++++++
|
||||||
|
pcie/func_lib/pcie_func/pcie_link_ltssm.h | 7 +
|
||||||
|
pcie/usr_cmd/cmd_analysis/pcie_cmd_trace.c | 17 +-
|
||||||
|
pcie/usr_cmd/interface/pcie_common_api.c | 1 +
|
||||||
|
pcie/usr_cmd/interface/pcie_common_api.h | 1 +
|
||||||
|
6 files changed, 205 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/pcie/func_lib/pcie_func/pcie_common.h b/pcie/func_lib/pcie_func/pcie_common.h
|
||||||
|
index 434b4ed..98d9e25 100644
|
||||||
|
--- a/pcie/func_lib/pcie_func/pcie_common.h
|
||||||
|
+++ b/pcie/func_lib/pcie_func/pcie_common.h
|
||||||
|
@@ -28,6 +28,7 @@ enum pcie_trace_cmd_type {
|
||||||
|
TRACE_CLEAR = 2,
|
||||||
|
TRACE_INFO = 3,
|
||||||
|
TRACE_MODE = 4,
|
||||||
|
+ TRACE_PM = 5,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum pcie_info_cmd_type {
|
||||||
|
diff --git a/pcie/func_lib/pcie_func/pcie_link_ltssm.c b/pcie/func_lib/pcie_func/pcie_link_ltssm.c
|
||||||
|
index d57688b..9c4b70c 100644
|
||||||
|
--- a/pcie/func_lib/pcie_func/pcie_link_ltssm.c
|
||||||
|
+++ b/pcie/func_lib/pcie_func/pcie_link_ltssm.c
|
||||||
|
@@ -43,6 +43,31 @@ union ltssm_state_reg {
|
||||||
|
uint64_t val;
|
||||||
|
};
|
||||||
|
|
||||||
|
+union pm_state_reg {
|
||||||
|
+ struct {
|
||||||
|
+ uint64_t pm_state : 6; /* [0:5] */
|
||||||
|
+ uint64_t pm_clock : 18; /* [6:23] */
|
||||||
|
+ uint64_t reserved1 : 8; /* [24:31] */
|
||||||
|
+ uint64_t refclk_stable_vld : 1; /* [32] */
|
||||||
|
+ uint64_t enter_l12_case : 1; /* [33] */
|
||||||
|
+ uint64_t pm_t_dl_l2_gnt_timeout : 1; /* [34] */
|
||||||
|
+ uint64_t pm_t_dl_l1_gnt_timeout : 1; /* [35] */
|
||||||
|
+ uint64_t pm_t_dl_l0s_gnt_timeout : 1; /* [36] */
|
||||||
|
+ uint64_t pm_t_dl_lastack_timeout : 1; /* [37] */
|
||||||
|
+ uint64_t pme_turn_off_vld_hold : 1; /* [38] */
|
||||||
|
+ uint64_t pm_blk_tlp_timeout : 1; /* [39] */
|
||||||
|
+ uint64_t aspm_nak_vld : 1; /* [40] */
|
||||||
|
+ uint64_t retrain_link_vld : 1; /* [41] */
|
||||||
|
+ uint64_t pending_dllp_vld : 1; /* [42] */
|
||||||
|
+ uint64_t pm_wakeup_tol0_en : 1; /* [43] */
|
||||||
|
+ uint64_t mac2pm_rx_data_vld : 1; /* [44] */
|
||||||
|
+ uint64_t dfe_req : 1; /* [45] */
|
||||||
|
+ uint64_t pm_t_dfe_time_meet : 1; /* [46] */
|
||||||
|
+ uint64_t reserved2 : 17; /* [47:63] */
|
||||||
|
+ } bits;
|
||||||
|
+ uint64_t val;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
static int pcie_get_ltssm_trace(uint32_t port_id, uint64_t *ltssm_status, uint32_t *ltssm_num)
|
||||||
|
{
|
||||||
|
struct hikp_cmd_header req_header;
|
||||||
|
@@ -280,3 +305,158 @@ free_cmd_ret:
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+static int pcie_get_pm_trace(uint32_t port_id, uint64_t *pm_status, uint32_t *pm_num)
|
||||||
|
+{
|
||||||
|
+ struct hikp_cmd_header req_header;
|
||||||
|
+ struct hikp_cmd_ret *cmd_ret = NULL;
|
||||||
|
+ struct pcie_trace_req_para req_data = { 0 };
|
||||||
|
+ size_t src_size, dst_size;
|
||||||
|
+ int ret;
|
||||||
|
+
|
||||||
|
+ req_data.port_id = port_id;
|
||||||
|
+ hikp_cmd_init(&req_header, PCIE_MOD, PCIE_TRACE, TRACE_PM);
|
||||||
|
+ cmd_ret = hikp_cmd_alloc(&req_header, &req_data, sizeof(req_data));
|
||||||
|
+ ret = hikp_rsp_normal_check(cmd_ret);
|
||||||
|
+ if (ret) {
|
||||||
|
+ Err("PCIe Base", "pcie pm trace cmd_ret check failed, ret: %d.\n", ret);
|
||||||
|
+ goto free_cmd_ret;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (cmd_ret->rsp_data_num == 0) {
|
||||||
|
+ Err("PCIe Base", "without rsp data.\n");
|
||||||
|
+ ret = -EINVAL;
|
||||||
|
+ goto free_cmd_ret;
|
||||||
|
+ }
|
||||||
|
+ /* 0: First uint32_t is pm trace num received from TF */
|
||||||
|
+ *pm_num = cmd_ret->rsp_data[0];
|
||||||
|
+
|
||||||
|
+ if ((cmd_ret->rsp_data_num - 1) * sizeof(uint32_t) != (*pm_num) * sizeof(uint64_t)) {
|
||||||
|
+ Err("PCIe Base", "rsp data number check failed, rsp_data_num: %u, pm_num: %u.\n",
|
||||||
|
+ cmd_ret->rsp_data_num, *pm_num);
|
||||||
|
+ ret = -EINVAL;
|
||||||
|
+ goto free_cmd_ret;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ src_size = (*pm_num) * sizeof(uint64_t);
|
||||||
|
+ dst_size = TRACER_DEPTH * sizeof(uint64_t);
|
||||||
|
+ if (src_size > dst_size) {
|
||||||
|
+ Err("PCIe Base", "size check failed, %u > %u.\n", src_size, dst_size);
|
||||||
|
+ ret = -EINVAL;
|
||||||
|
+ goto free_cmd_ret;
|
||||||
|
+ }
|
||||||
|
+ memcpy(pm_status, (cmd_ret->rsp_data + 1), src_size);
|
||||||
|
+
|
||||||
|
+free_cmd_ret:
|
||||||
|
+ free(cmd_ret);
|
||||||
|
+ return ret;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+struct pcie_pm_num_string g_pm_string_table[] = {
|
||||||
|
+ {0x0, "pm_pme_idle"},
|
||||||
|
+ {0x1, "pm_wait_dc_pme_msg_send_out"},
|
||||||
|
+ {0x2, "pm_wait_dc_tl_enter_l2"},
|
||||||
|
+ {0x3, "pm_wait_dc_dl_enter_l2"},
|
||||||
|
+ {0x4, "pm_wait_dc_mac_enter_l2"},
|
||||||
|
+ {0x5, "pm_dc_enter_l2"},
|
||||||
|
+ {0x6, "pm_wait_dc_tl_enter_pcipm_l1"},
|
||||||
|
+ {0x7, "pm_wait_dc_dl_enter_pcipm_l1"},
|
||||||
|
+ {0x8, "pm_wait_dc_tl_enter_aspm_l1"},
|
||||||
|
+ {0x9, "pm_wait_dc_dl_enter_aspm_l1"},
|
||||||
|
+ {0xa, "pm_wait_tl_enter_aspm_l0"},
|
||||||
|
+ {0xb, "pm_wait_dl_enter_aspm_l0"},
|
||||||
|
+ {0xc, "pm_wait_dc_mac_enter_l1"},
|
||||||
|
+ {0xd, "pm_wait_mac_enter_l0s"},
|
||||||
|
+ {0xe, "pm_device_in_l0s"},
|
||||||
|
+ {0xf, "pm_dc_device_in_l1"},
|
||||||
|
+ {0x10, "pm_wait_dc_enter_l0"},
|
||||||
|
+ {0x11, "pm_wait_uc_tl_enter_l2"},
|
||||||
|
+ {0x12, "pm_wait_uc_dl_enter_l2"},
|
||||||
|
+ {0x13, "pm_wait_uc_mac_enter_l2"},
|
||||||
|
+ {0x15, "pm_wait_uc_tl_enter_pcipm_l1"},
|
||||||
|
+ {0x17, "pm_wait_uc_dl_enter_aspm_l1"},
|
||||||
|
+ {0x18, "pm_wait_uc_tl_enter_aspm_l1"},
|
||||||
|
+ {0x1a, "pm_wait_uc_dl_enter_pcipm_l1"},
|
||||||
|
+ {0x1c, "pm_wait_uc_mac_enter_l1"},
|
||||||
|
+ {0x1d, "pm_wait_uc_pme_enter_l1_nak_sent_out"},
|
||||||
|
+ {0x1e, "pm_wait_uc_enter_l0"},
|
||||||
|
+ {0x20, "pm_device_will_enter_l1_substate"},
|
||||||
|
+ {0x21, "pm_device_in_l1_1"},
|
||||||
|
+ {0x22, "pm_device_will_exit_l1_substate"},
|
||||||
|
+ {0x23, "pm_device_in_l1_2_entry"},
|
||||||
|
+ {0x24, "pm_device_in_l1_2_idle"},
|
||||||
|
+ {0x25, "pm_device_in_l1_2_exit"},
|
||||||
|
+ {-1, "unknown"} /* end of array */
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+static char *hisi_pcie_pm_string_get(uint32_t pm)
|
||||||
|
+{
|
||||||
|
+ int i = 0;
|
||||||
|
+
|
||||||
|
+ while (g_pm_string_table[i].pm >= 0) {
|
||||||
|
+ if ((uint32_t)g_pm_string_table[i].pm != pm) {
|
||||||
|
+ i++;
|
||||||
|
+ continue;
|
||||||
|
+ }
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return g_pm_string_table[i].pm_c;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int pcie_print_pm_trace(const uint64_t *pm_status, uint32_t pm_num)
|
||||||
|
+{
|
||||||
|
+ uint32_t i;
|
||||||
|
+ char *pm_c = NULL;
|
||||||
|
+ union pm_state_reg pm_val;
|
||||||
|
+
|
||||||
|
+ if (pm_num > TRACER_DEPTH || pm_num == 0) {
|
||||||
|
+ Err("PCIe Base", "pm_num(%u) is over range or zero\n", pm_num);
|
||||||
|
+ return -EINVAL;
|
||||||
|
+ }
|
||||||
|
+ Info("PCIe Base", "pm tracer:\n");
|
||||||
|
+ Info("PCIe Base", "\ttrace state: %llx\n", pm_status[0]);
|
||||||
|
+ Info("PCIe Base",
|
||||||
|
+ "\tpm[ii]: BE8: 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 "
|
||||||
|
+ "BD8: 23:6 5:0 : pm state\n");
|
||||||
|
+ for (i = 1; i < pm_num; i++) {
|
||||||
|
+ pm_val.val = pm_status[i];
|
||||||
|
+ pm_c = hisi_pcie_pm_string_get((uint32_t)pm_val.bits.pm_state);
|
||||||
|
+ Info("PCIe Base",
|
||||||
|
+ "\tpm[%02u]:\t %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x 0x%06x 0x%02x %s\n",
|
||||||
|
+ i,
|
||||||
|
+ (uint32_t)pm_val.bits.pm_t_dfe_time_meet,
|
||||||
|
+ (uint32_t)pm_val.bits.dfe_req,
|
||||||
|
+ (uint32_t)pm_val.bits.mac2pm_rx_data_vld,
|
||||||
|
+ (uint32_t)pm_val.bits.pm_wakeup_tol0_en,
|
||||||
|
+ (uint32_t)pm_val.bits.pending_dllp_vld,
|
||||||
|
+ (uint32_t)pm_val.bits.retrain_link_vld,
|
||||||
|
+ (uint32_t)pm_val.bits.aspm_nak_vld,
|
||||||
|
+ (uint32_t)pm_val.bits.pm_blk_tlp_timeout,
|
||||||
|
+ (uint32_t)pm_val.bits.pme_turn_off_vld_hold,
|
||||||
|
+ (uint32_t)pm_val.bits.pm_t_dl_lastack_timeout,
|
||||||
|
+ (uint32_t)pm_val.bits.pm_t_dl_l0s_gnt_timeout,
|
||||||
|
+ (uint32_t)pm_val.bits.pm_t_dl_l1_gnt_timeout,
|
||||||
|
+ (uint32_t)pm_val.bits.pm_t_dl_l2_gnt_timeout,
|
||||||
|
+ (uint32_t)pm_val.bits.enter_l12_case,
|
||||||
|
+ (uint32_t)pm_val.bits.refclk_stable_vld,
|
||||||
|
+ (uint32_t)pm_val.bits.pm_clock,
|
||||||
|
+ (uint32_t)pm_val.bits.pm_state,
|
||||||
|
+ pm_c);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+int pcie_pm_trace(uint32_t port_id)
|
||||||
|
+{
|
||||||
|
+ int ret;
|
||||||
|
+ uint32_t pm_num = 0;
|
||||||
|
+ uint64_t pm_st_save[TRACER_DEPTH];
|
||||||
|
+
|
||||||
|
+ ret = pcie_get_pm_trace(port_id, pm_st_save, &pm_num);
|
||||||
|
+ if (ret)
|
||||||
|
+ return ret;
|
||||||
|
+
|
||||||
|
+ return pcie_print_pm_trace(pm_st_save, pm_num);
|
||||||
|
+}
|
||||||
|
\ No newline at end of file
|
||||||
|
diff --git a/pcie/func_lib/pcie_func/pcie_link_ltssm.h b/pcie/func_lib/pcie_func/pcie_link_ltssm.h
|
||||||
|
index eb57ead..8f3502b 100644
|
||||||
|
--- a/pcie/func_lib/pcie_func/pcie_link_ltssm.h
|
||||||
|
+++ b/pcie/func_lib/pcie_func/pcie_link_ltssm.h
|
||||||
|
@@ -18,12 +18,18 @@
|
||||||
|
|
||||||
|
#define TRACE_STR_NUM 0x20
|
||||||
|
#define TRACER_DEPTH 65
|
||||||
|
+#define PM_TRACE_STR_NUM 0x28
|
||||||
|
|
||||||
|
struct pcie_ltssm_num_string {
|
||||||
|
int ltssm;
|
||||||
|
char ltssm_c[TRACE_STR_NUM];
|
||||||
|
};
|
||||||
|
|
||||||
|
+struct pcie_pm_num_string {
|
||||||
|
+ int pm;
|
||||||
|
+ char pm_c[PM_TRACE_STR_NUM];
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
struct pcie_trace_req_para {
|
||||||
|
uint32_t port_id;
|
||||||
|
uint32_t trace_mode;
|
||||||
|
@@ -51,5 +57,6 @@ int pcie_ltssm_trace_show(uint32_t port_id);
|
||||||
|
int pcie_ltssm_trace_clear(uint32_t port_id);
|
||||||
|
int pcie_ltssm_trace_mode_set(uint32_t port_id, uint32_t mode);
|
||||||
|
int pcie_ltssm_link_status_get(uint32_t port_id);
|
||||||
|
+int pcie_pm_trace(uint32_t port_id);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
diff --git a/pcie/usr_cmd/cmd_analysis/pcie_cmd_trace.c b/pcie/usr_cmd/cmd_analysis/pcie_cmd_trace.c
|
||||||
|
index e50b434..8ceb85a 100644
|
||||||
|
--- a/pcie/usr_cmd/cmd_analysis/pcie_cmd_trace.c
|
||||||
|
+++ b/pcie/usr_cmd/cmd_analysis/pcie_cmd_trace.c
|
||||||
|
@@ -37,6 +37,7 @@ static int pcie_trace_help(struct major_cmd_ctrl *self, const char *argv)
|
||||||
|
printf(" %s, %-25s %s\n", "-m", "--mode",
|
||||||
|
"set ltssm trace mode val 1:recver_en 0:recver_dis\n");
|
||||||
|
printf(" %s, %-25s %s\n", "-f", "--information", "display link information\n");
|
||||||
|
+ printf(" %s, %-25s %s\n", "-pm", "--pm-state", "show pm status\n");
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
@@ -57,6 +58,13 @@ static int pcie_trace_show(struct major_cmd_ctrl *self, const char *argv)
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
+static int pcie_pm_show(struct major_cmd_ctrl *self, const char *argv)
|
||||||
|
+{
|
||||||
|
+ g_trace_cmd.cmd_type = TRACE_PM;
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static int pcie_trace_mode_set(struct major_cmd_ctrl *self, const char *argv)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
@@ -108,6 +116,8 @@ static int pcie_trace_excute_funs_call(int cmd_type)
|
||||||
|
return comm_api->ltssm_trace_mode_set(port_id, recover_en);
|
||||||
|
else if (cmd_type == TRACE_INFO)
|
||||||
|
return comm_api->ltssm_link_information_get(port_id);
|
||||||
|
+ else if (cmd_type == TRACE_PM)
|
||||||
|
+ return comm_api->pm_trace(port_id);
|
||||||
|
else
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
@@ -120,14 +130,16 @@ static void pcie_trace_execute(struct major_cmd_ctrl *self)
|
||||||
|
"pcie_trace_show success.",
|
||||||
|
"pcie_trace_clear success.",
|
||||||
|
"get mac link information success.",
|
||||||
|
- "pcie_trace_mode_set success."
|
||||||
|
+ "pcie_trace_mode_set success.",
|
||||||
|
+ "pcie_pm_trace success."
|
||||||
|
};
|
||||||
|
const char *err_msg[] = {
|
||||||
|
"pcie_trace sub command type error.",
|
||||||
|
"pcie_trace_show error.",
|
||||||
|
"pcie_trace_clear error.",
|
||||||
|
"get mac link information error.",
|
||||||
|
- "pcie_trace_mode_set error."
|
||||||
|
+ "pcie_trace_mode_set error.",
|
||||||
|
+ "pcie_pm_trace error"
|
||||||
|
};
|
||||||
|
|
||||||
|
ret = pcie_trace_excute_funs_call(g_trace_cmd.cmd_type);
|
||||||
|
@@ -153,6 +165,7 @@ static void cmd_pcie_trace_init(void)
|
||||||
|
cmd_option_register("-m", "--mode", true, pcie_trace_mode_set);
|
||||||
|
cmd_option_register("-f", "--information", false, pcie_link_information_get);
|
||||||
|
cmd_option_register("-i", "--interface", true, pcie_port_id_set);
|
||||||
|
+ cmd_option_register("-pm", "--pm-state", false, pcie_pm_show);
|
||||||
|
}
|
||||||
|
|
||||||
|
HIKP_CMD_DECLARE("pcie_trace", "pcie ltssm trace", cmd_pcie_trace_init);
|
||||||
|
diff --git a/pcie/usr_cmd/interface/pcie_common_api.c b/pcie/usr_cmd/interface/pcie_common_api.c
|
||||||
|
index 491daf2..8875481 100644
|
||||||
|
--- a/pcie/usr_cmd/interface/pcie_common_api.c
|
||||||
|
+++ b/pcie/usr_cmd/interface/pcie_common_api.c
|
||||||
|
@@ -27,6 +27,7 @@ struct pcie_comm_api g_tools_api = {
|
||||||
|
.err_status_clear = pcie_error_state_clear,
|
||||||
|
.reg_dump = pcie_dumpreg_do_dump,
|
||||||
|
.reg_read = pcie_reg_read,
|
||||||
|
+ .pm_trace = pcie_pm_trace,
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/pcie/usr_cmd/interface/pcie_common_api.h b/pcie/usr_cmd/interface/pcie_common_api.h
|
||||||
|
index 9809575..08d4403 100644
|
||||||
|
--- a/pcie/usr_cmd/interface/pcie_common_api.h
|
||||||
|
+++ b/pcie/usr_cmd/interface/pcie_common_api.h
|
||||||
|
@@ -37,6 +37,7 @@ struct pcie_comm_api {
|
||||||
|
int (*err_status_clear)(uint32_t port_id);
|
||||||
|
int (*reg_dump)(uint32_t port_id, uint32_t dump_level);
|
||||||
|
int (*reg_read)(uint32_t port_id, uint32_t moudle_id, uint32_t offset);
|
||||||
|
+ int (*pm_trace)(uint32_t port_id);
|
||||||
|
};
|
||||||
|
|
||||||
|
struct pcie_comm_api *pcie_get_comm_api(void);
|
||||||
|
--
|
||||||
|
2.33.0
|
||||||
53
0025-hikptool-add-The-security-compilation-options.patch
Normal file
53
0025-hikptool-add-The-security-compilation-options.patch
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
From 0dfd23227be058ce1618660fbf7e52d7ca6e5f10 Mon Sep 17 00:00:00 2001
|
||||||
|
From: veega <zhuweijia@huawei.com>
|
||||||
|
Date: Tue, 4 Jul 2023 21:14:47 +0800
|
||||||
|
Subject: [PATCH] hikptool: add The security compilation options
|
||||||
|
|
||||||
|
Add -fstack-protector-strong and -D_FORTIFY_SOURCE=2 compiler options
|
||||||
|
for SP and FS. add -s link options for Strip.
|
||||||
|
|
||||||
|
Signed-off-by: veega <zhuweijia@huawei.com>
|
||||||
|
---
|
||||||
|
CMakeLists.txt | 6 +++---
|
||||||
|
libhikptdev/src/rciep/CMakeLists.txt | 4 +++-
|
||||||
|
2 files changed, 6 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||||
|
index 174dd8f..cbd063c 100644
|
||||||
|
--- a/CMakeLists.txt
|
||||||
|
+++ b/CMakeLists.txt
|
||||||
|
@@ -11,8 +11,8 @@
|
||||||
|
|
||||||
|
project(hikptool C)
|
||||||
|
|
||||||
|
-set(CMAKE_C_FLAGS
|
||||||
|
- "${CMAKE_C_FLAGS} -O2 -fPIC -fPIE -Wall -Wextra -fno-common -std=gnu11 -Wfloat-equal")
|
||||||
|
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2 -fPIC -fPIE -Wall -Wextra -fno-common -std=gnu11")
|
||||||
|
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wfloat-equal -fstack-protector-strong -D_FORTIFY_SOURCE=2")
|
||||||
|
set(CMAKE_SKIP_RPATH TRUE)
|
||||||
|
|
||||||
|
macro(get_header_dir_recurse HEADER_DIR_LIST)
|
||||||
|
@@ -46,5 +46,5 @@ target_link_directories(hikptool PRIVATE ${CMAKE_INSTALL_PREFIX}/lib)
|
||||||
|
target_link_libraries(hikptool PRIVATE KPTDEV_SO)
|
||||||
|
target_link_options(hikptool PRIVATE
|
||||||
|
-Wl,-z,relro,-z,now -Wl,-z,noexecstack -fPIE -pie
|
||||||
|
- -g -lpthread -ldl -lm -lrt -T ${CMAKE_CURRENT_SOURCE_DIR}/hikp_register.ld)
|
||||||
|
+ -s -lpthread -ldl -lm -lrt -T ${CMAKE_CURRENT_SOURCE_DIR}/hikp_register.ld)
|
||||||
|
install(TARGETS hikptool RUNTIME DESTINATION bin OPTIONAL)
|
||||||
|
diff --git a/libhikptdev/src/rciep/CMakeLists.txt b/libhikptdev/src/rciep/CMakeLists.txt
|
||||||
|
index b96d621..5017f5b 100644
|
||||||
|
--- a/libhikptdev/src/rciep/CMakeLists.txt
|
||||||
|
+++ b/libhikptdev/src/rciep/CMakeLists.txt
|
||||||
|
@@ -17,5 +17,7 @@ add_library(KPTDEV_SO SHARED hikpt_rciep.c)
|
||||||
|
|
||||||
|
target_include_directories(KPTDEV_SO PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../../include)
|
||||||
|
|
||||||
|
+target_link_options(KPTDEV_SO PRIVATE -Wl,-z,relro,-z,now -Wl,-z,noexecstack -fPIE -pie -s)
|
||||||
|
+
|
||||||
|
set_target_properties(KPTDEV_SO PROPERTIES OUTPUT_NAME ${KPTDEV_SO_NAME} SOVERSION 1 VERSION 1.0.0)
|
||||||
|
-install(TARGETS KPTDEV_SO LIBRARY DESTINATION lib OPTIONAL)
|
||||||
|
\ No newline at end of file
|
||||||
|
+install(TARGETS KPTDEV_SO LIBRARY DESTINATION lib OPTIONAL)
|
||||||
|
--
|
||||||
|
2.36.1.windows.1
|
||||||
|
|
||||||
@ -0,0 +1,61 @@
|
|||||||
|
From a5b22e528f0fc0332d736b428e519c6b936e9766 Mon Sep 17 00:00:00 2001
|
||||||
|
From: veega <zhuweijia@huawei.com>
|
||||||
|
Date: Thu, 13 Jul 2023 12:06:13 +0800
|
||||||
|
Subject: [PATCH] hikptool: nic_port cmd add print arb info and phy info
|
||||||
|
|
||||||
|
Add arbitration information print in port ARB LINK INFO display area, and PHY
|
||||||
|
INFO display area for print PHY config and regs.
|
||||||
|
|
||||||
|
Signed-off-by: veega <zhuweijia@huawei.com>
|
||||||
|
---
|
||||||
|
net/nic/nic_mac/hikp_nic_port.c | 4 +++-
|
||||||
|
net/nic/nic_mac/hikp_nic_port.h | 4 ++++
|
||||||
|
2 files changed, 7 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/net/nic/nic_mac/hikp_nic_port.c b/net/nic/nic_mac/hikp_nic_port.c
|
||||||
|
index 1ff3569..22a6467 100644
|
||||||
|
--- a/net/nic/nic_mac/hikp_nic_port.c
|
||||||
|
+++ b/net/nic/nic_mac/hikp_nic_port.c
|
||||||
|
@@ -355,6 +355,7 @@ static void mac_cmd_disp_arb_info(const struct mac_cmd_arb_dfx *arb_dfx)
|
||||||
|
mac_cmd_disp_port_param("Default", &arb_dfx->default_cfg);
|
||||||
|
mac_cmd_disp_port_param("BIOS", &arb_dfx->bios_cfg);
|
||||||
|
mac_cmd_disp_port_param("TOOL", &arb_dfx->user_cfg);
|
||||||
|
+ mac_cmd_disp_port_param("ARB", &arb_dfx->arb_cfg);
|
||||||
|
mac_cmd_disp_port_param("Final", &arb_dfx->port_cfg);
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -443,7 +444,8 @@ static void mac_cmd_port_execute(struct major_cmd_ctrl *self)
|
||||||
|
}
|
||||||
|
|
||||||
|
port_hw = (struct mac_cmd_port_hardware *)(hw_cmd_ret->rsp_data);
|
||||||
|
- if (port_hw->port_type == 1)
|
||||||
|
+ if (port_hw->port_type == HIKP_PORT_TYPE_PHY ||
|
||||||
|
+ port_hw->port_type == HIKP_PORT_TYPE_PHY_SDS)
|
||||||
|
mask |= MAC_LSPORT_PHY;
|
||||||
|
|
||||||
|
mac_cmd_show_port_dfx(self, mask);
|
||||||
|
diff --git a/net/nic/nic_mac/hikp_nic_port.h b/net/nic/nic_mac/hikp_nic_port.h
|
||||||
|
index ac00f55..f6334d0 100644
|
||||||
|
--- a/net/nic/nic_mac/hikp_nic_port.h
|
||||||
|
+++ b/net/nic/nic_mac/hikp_nic_port.h
|
||||||
|
@@ -95,6 +95,9 @@ enum {
|
||||||
|
#define HIKP_MAC_PHY_ABI_PAUSE HI_BIT(13)
|
||||||
|
#define HIKP_MAC_PHY_ABI_ASYM_PAUSE HI_BIT(14)
|
||||||
|
|
||||||
|
+#define HIKP_PORT_TYPE_PHY 1
|
||||||
|
+#define HIKP_PORT_TYPE_PHY_SDS 3
|
||||||
|
+
|
||||||
|
struct mac_item {
|
||||||
|
uint32_t key;
|
||||||
|
const char *name;
|
||||||
|
@@ -151,6 +154,7 @@ struct mac_cmd_arb_dfx {
|
||||||
|
struct mac_port_param bios_cfg;
|
||||||
|
struct mac_port_param user_cfg;
|
||||||
|
struct mac_port_param port_cfg;
|
||||||
|
+ struct mac_port_param arb_cfg;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define MAC_PHY_DFX_REG_NUM 12
|
||||||
|
--
|
||||||
|
2.36.1.windows.1
|
||||||
|
|
||||||
399
0027-hikptool-add-pcie-new-dump.patch
Normal file
399
0027-hikptool-add-pcie-new-dump.patch
Normal file
@ -0,0 +1,399 @@
|
|||||||
|
From fd2d8a0b59f77d6783d85ac8f1f24e1cac9261e8 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Bingquan Mou <moubingquan@huawei.com>
|
||||||
|
Date: Fri, 21 Jul 2023 14:26:53 +0800
|
||||||
|
Subject: [PATCH] hikptool: some registers are added to the PCIe module.
|
||||||
|
|
||||||
|
To improve the DFX, some registers need to be dumped and new registers are added.
|
||||||
|
|
||||||
|
Signed-off-by: Bingquan Mou <moubingquan@huawei.com>
|
||||||
|
---
|
||||||
|
pcie/func_lib/pcie_func/pcie_link_ltssm.c | 41 ++--
|
||||||
|
pcie/func_lib/pcie_func/pcie_reg_dump.c | 235 +++++++++++++++-------
|
||||||
|
pcie/func_lib/pcie_func/pcie_reg_dump.h | 5 +
|
||||||
|
3 files changed, 189 insertions(+), 92 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/pcie/func_lib/pcie_func/pcie_link_ltssm.c b/pcie/func_lib/pcie_func/pcie_link_ltssm.c
|
||||||
|
index 9c4b70c..09d3b5e 100644
|
||||||
|
--- a/pcie/func_lib/pcie_func/pcie_link_ltssm.c
|
||||||
|
+++ b/pcie/func_lib/pcie_func/pcie_link_ltssm.c
|
||||||
|
@@ -45,25 +45,25 @@ union ltssm_state_reg {
|
||||||
|
|
||||||
|
union pm_state_reg {
|
||||||
|
struct {
|
||||||
|
- uint64_t pm_state : 6; /* [0:5] */
|
||||||
|
- uint64_t pm_clock : 18; /* [6:23] */
|
||||||
|
- uint64_t reserved1 : 8; /* [24:31] */
|
||||||
|
- uint64_t refclk_stable_vld : 1; /* [32] */
|
||||||
|
- uint64_t enter_l12_case : 1; /* [33] */
|
||||||
|
- uint64_t pm_t_dl_l2_gnt_timeout : 1; /* [34] */
|
||||||
|
- uint64_t pm_t_dl_l1_gnt_timeout : 1; /* [35] */
|
||||||
|
- uint64_t pm_t_dl_l0s_gnt_timeout : 1; /* [36] */
|
||||||
|
- uint64_t pm_t_dl_lastack_timeout : 1; /* [37] */
|
||||||
|
- uint64_t pme_turn_off_vld_hold : 1; /* [38] */
|
||||||
|
- uint64_t pm_blk_tlp_timeout : 1; /* [39] */
|
||||||
|
- uint64_t aspm_nak_vld : 1; /* [40] */
|
||||||
|
- uint64_t retrain_link_vld : 1; /* [41] */
|
||||||
|
- uint64_t pending_dllp_vld : 1; /* [42] */
|
||||||
|
- uint64_t pm_wakeup_tol0_en : 1; /* [43] */
|
||||||
|
- uint64_t mac2pm_rx_data_vld : 1; /* [44] */
|
||||||
|
- uint64_t dfe_req : 1; /* [45] */
|
||||||
|
- uint64_t pm_t_dfe_time_meet : 1; /* [46] */
|
||||||
|
- uint64_t reserved2 : 17; /* [47:63] */
|
||||||
|
+ uint64_t pm_state : 6; /* [0:5] */
|
||||||
|
+ uint64_t pm_clock : 18; /* [6:23] */
|
||||||
|
+ uint64_t reserved1 : 8; /* [24:31] */
|
||||||
|
+ uint64_t refclk_stable_vld : 1; /* [32] */
|
||||||
|
+ uint64_t enter_l12_case : 1; /* [33] */
|
||||||
|
+ uint64_t pm_t_dl_l2_gnt_timeout : 1; /* [34] */
|
||||||
|
+ uint64_t pm_t_dl_l1_gnt_timeout : 1; /* [35] */
|
||||||
|
+ uint64_t pm_t_dl_l0s_gnt_timeout : 1; /* [36] */
|
||||||
|
+ uint64_t pm_t_dl_lastack_timeout : 1; /* [37] */
|
||||||
|
+ uint64_t pme_turn_off_vld_hold : 1; /* [38] */
|
||||||
|
+ uint64_t pm_blk_tlp_timeout : 1; /* [39] */
|
||||||
|
+ uint64_t aspm_nak_vld : 1; /* [40] */
|
||||||
|
+ uint64_t retrain_link_vld : 1; /* [41] */
|
||||||
|
+ uint64_t pending_dllp_vld : 1; /* [42] */
|
||||||
|
+ uint64_t pm_wakeup_tol0_en : 1; /* [43] */
|
||||||
|
+ uint64_t mac2pm_rx_data_vld : 1; /* [44] */
|
||||||
|
+ uint64_t dfe_req : 1; /* [45] */
|
||||||
|
+ uint64_t pm_t_dfe_time_meet : 1; /* [46] */
|
||||||
|
+ uint64_t reserved2 : 17; /* [47:63] */
|
||||||
|
} bits;
|
||||||
|
uint64_t val;
|
||||||
|
};
|
||||||
|
@@ -423,7 +423,8 @@ static int pcie_print_pm_trace(const uint64_t *pm_status, uint32_t pm_num)
|
||||||
|
pm_val.val = pm_status[i];
|
||||||
|
pm_c = hisi_pcie_pm_string_get((uint32_t)pm_val.bits.pm_state);
|
||||||
|
Info("PCIe Base",
|
||||||
|
- "\tpm[%02u]:\t %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x 0x%06x 0x%02x %s\n",
|
||||||
|
+ "\tpm[%02u]:\t %x %x %x %x %x %x %x %x %x %x %x "
|
||||||
|
+ "%x %x %x %x 0x%06x 0x%02x %s\n",
|
||||||
|
i,
|
||||||
|
(uint32_t)pm_val.bits.pm_t_dfe_time_meet,
|
||||||
|
(uint32_t)pm_val.bits.dfe_req,
|
||||||
|
diff --git a/pcie/func_lib/pcie_func/pcie_reg_dump.c b/pcie/func_lib/pcie_func/pcie_reg_dump.c
|
||||||
|
index e10ff7e..aac3843 100644
|
||||||
|
--- a/pcie/func_lib/pcie_func/pcie_reg_dump.c
|
||||||
|
+++ b/pcie/func_lib/pcie_func/pcie_reg_dump.c
|
||||||
|
@@ -66,6 +66,8 @@ struct pcie_dumpreg_info g_reg_table_tl[] = {
|
||||||
|
{0, "TL_RX_LOC_TLP_CNT"},
|
||||||
|
{0, "TL_RX_ERR_STATUS"},
|
||||||
|
{0, "TL_CFGSPACE_BDF"},
|
||||||
|
+ {0, "TL_TX_UR_CNT"},
|
||||||
|
+ {0, "TL_RX_ERR_STATUS"},
|
||||||
|
};
|
||||||
|
|
||||||
|
struct pcie_dumpreg_info g_reg_table_dl[] = {
|
||||||
|
@@ -105,6 +107,28 @@ struct pcie_dumpreg_info g_reg_table_mac[] = {
|
||||||
|
{0, "MAC_REG_FE_INT_RO"},
|
||||||
|
{0, "MAC_REG_CE_INT_RO"},
|
||||||
|
{0, "MAC_REG_NFE_INT_RO"},
|
||||||
|
+ {0, "MAC_REG_EQ_FIX_LP_TX_PRESET"},
|
||||||
|
+ {0, "MAC_REG_ESM_32G_EQ_FIX_LP_TX_PRESET"},
|
||||||
|
+ {0, "MAC_REG_ADJ_HILINK_MODE_EN"},
|
||||||
|
+ {0, "MAC_REG_EQ_OPT_TX_PRESET_1"},
|
||||||
|
+ {0, "MAC_REG_LP_GEN3_TX_PRESET_P1_2"},
|
||||||
|
+ {0, "MAC_REG_GEN3_EQ_OPT_TX_PRESET_2"},
|
||||||
|
+ {0, "MAC_REG_GEN4_EQ_OPT_TX_PRESET_1"},
|
||||||
|
+ {0, "MAC_REG_GEN4_EQ_OPT_TX_PRESET_2"},
|
||||||
|
+ {0, "MAC_REG_LP_GEN4_TX_PRESET_P1_1"},
|
||||||
|
+ {0, "MAC_REG_LP_GEN4_TX_PRESET_P1_2"},
|
||||||
|
+ {0, "MAC_REG_DEBUG_PIPE1"},
|
||||||
|
+ {0, "MAC_REG_DEBUG_PIPE2"},
|
||||||
|
+ {0, "MAC_REG_DEBUG_PIPE3"},
|
||||||
|
+ {0, "MAC_REG_DEBUG_PIPE5"},
|
||||||
|
+ {0, "MAC_REG_DEBUG_PIPE7"},
|
||||||
|
+ {0, "MAC_REG_DEBUG_PIPE8"},
|
||||||
|
+ {0, "MAC_REG_DEBUG_PIPE9"},
|
||||||
|
+ {0, "MAC_REG_DEBUG_PIPE10"},
|
||||||
|
+ {0, "MAC_REG_DEBUG_PIPE11"},
|
||||||
|
+ {0, "MAC_LEAVE_L0_INFO"},
|
||||||
|
+ {0, "DFX_APB_LANE_ERROR_STATUS_0"},
|
||||||
|
+ {0, "DFX_APB_LANE_ERROR_STATUS_1"},
|
||||||
|
};
|
||||||
|
|
||||||
|
struct pcie_dumpreg_info g_reg_table_pcs[] = {
|
||||||
|
@@ -115,6 +139,8 @@ struct pcie_dumpreg_info g_reg_table_pcs[] = {
|
||||||
|
HIKP_PCIE_PCS_LANE_TBL_ENTRY(RECV_DET_OR_PWR_CHAGE),
|
||||||
|
HIKP_PCIE_PCS_LANE_TBL_ENTRY(EQEVAL_STATUS),
|
||||||
|
HIKP_PCIE_PCS_LANE_TBL_ENTRY(LANE_INTR_STATUS),
|
||||||
|
+ HIKP_PCIE_PCS_LANE_TBL_ENTRY(M_PCS_RPT_REG),
|
||||||
|
+ HIKP_PCIE_PCS_LANE_TBL_ENTRY(MSG_BUS_DFX),
|
||||||
|
};
|
||||||
|
|
||||||
|
struct pcie_dumpreg_info g_reg_table_iob_tx[] = {
|
||||||
|
@@ -141,6 +167,71 @@ struct pcie_dumpreg_info g_reg_table_iob_tx[] = {
|
||||||
|
{0, "IOB_TX_INT_SEVERITY3"},
|
||||||
|
{0, "IOB_TX_INT_SEVERITY4"},
|
||||||
|
{0, "IOB_TX_INT_SEVERITY5"},
|
||||||
|
+ {0, "IOB_TX_TCS_DEC_ERR_INFO_L"},
|
||||||
|
+ {0, "IOB_TX_TCS_DEC_ERR_INFO_H"},
|
||||||
|
+ {0, "DFX_IOB_TX_P_CNT_0"},
|
||||||
|
+ {0, "DFX_IOB_TX_P_CNT_1"},
|
||||||
|
+ {0, "DFX_IOB_TX_P_CNT_2"},
|
||||||
|
+ {0, "DFX_IOB_TX_P_CNT_3"},
|
||||||
|
+ {0, "DFX_IOB_TX_P_CNT_4"},
|
||||||
|
+ {0, "DFX_IOB_TX_NP_CNT_0"},
|
||||||
|
+ {0, "DFX_IOB_TX_NP_CNT_1"},
|
||||||
|
+ {0, "DFX_IOB_TX_NP_CNT_2"},
|
||||||
|
+ {0, "DFX_IOB_TX_NP_CNT_3"},
|
||||||
|
+ {0, "DFX_IOB_TX_NP_CNT_4"},
|
||||||
|
+ {0, "DFX_IOB_TX_NP_CNT_5"},
|
||||||
|
+ {0, "DFX_IOB_TX_NP_CNT_6"},
|
||||||
|
+ {0, "DFX_IOB_TX_NP_CNT_7"},
|
||||||
|
+ {0, "DFX_IOB_TX_NP_CNT_8"},
|
||||||
|
+ {0, "DFX_IOB_TX_NP_CNT_9"},
|
||||||
|
+ {0, "DFX_IOB_TX_NP_CNT_10"},
|
||||||
|
+ {0, "DFX_IOB_TX_NP_CNT_11"},
|
||||||
|
+ {0, "DFX_IOB_TX_CPL_CNT_0"},
|
||||||
|
+ {0, "DFX_IOB_TX_CPL_CNT_1"},
|
||||||
|
+ {0, "DFX_IOB_TX_CPL_CNT_2"},
|
||||||
|
+ {0, "DFX_IOB_TX_REQ_CNT"},
|
||||||
|
+ {0, "DFX_IOB_TX_STATUS0"},
|
||||||
|
+ {0, "DFX_IOB_TX_STATUS1"},
|
||||||
|
+ {0, "DFX_IOB_TX_STATUS2"},
|
||||||
|
+ {0, "DFX_IOB_TX_STATUS3"},
|
||||||
|
+ {0, "DFX_IOB_TX_STATUS4"},
|
||||||
|
+ {0, "DFX_IOB_TX_STATUS5"},
|
||||||
|
+ {0, "DFX_IOB_TX_ABNORMAL_CNT_0"},
|
||||||
|
+ {0, "DFX_IOB_TX_ABNORMAL_CNT_1"},
|
||||||
|
+ {0, "DFX_IOB_TX_ABNORMAL_CNT_2"},
|
||||||
|
+ {0, "DFX_IOB_TX_ABNORMAL_CNT_3"},
|
||||||
|
+ {0, "DFX_IOB_TX_ERROR0"},
|
||||||
|
+ {0, "DFX_IOB_TX_ERROR1"},
|
||||||
|
+ {0, "DFX_IOB_TX_TCS_NORMAL_CNT_0"},
|
||||||
|
+ {0, "DFX_IOB_TX_TCS_NORMAL_CNT_1"},
|
||||||
|
+ {0, "DFX_IOB_TX_TCS_NORMAL_CNT_2"},
|
||||||
|
+ {0, "DFX_IOB_TX_TCS_NORMAL_CNT_3"},
|
||||||
|
+ {0, "DFX_IOB_TX_TCS_NORMAL_CNT_4"},
|
||||||
|
+ {0, "DFX_IOB_TX_TCS_NORMAL_CNT_5"},
|
||||||
|
+ {0, "DFX_IOB_TX_TCS_NORMAL_CNT_6"},
|
||||||
|
+ {0, "DFX_IOB_TX_TCS_NORMAL_CNT_7"},
|
||||||
|
+ {0, "DFX_IOB_TX_TCS_NORMAL_CNT_8"},
|
||||||
|
+ {0, "DFX_IOB_TX_TCS_NORMAL_CNT_9"},
|
||||||
|
+ {0, "DFX_IOB_TX_TCS_NORMAL_CNT_10"},
|
||||||
|
+ {0, "DFX_IOB_TX_TCS_NORMAL_CNT_11"},
|
||||||
|
+ {0, "DFX_IOB_TX_TCS_NORMAL_CNT_12"},
|
||||||
|
+ {0, "DFX_IOB_TX_TCS_NORMAL_CNT_13"},
|
||||||
|
+ {0, "DFX_IOB_TX_TCS_NORMAL_CNT_14"},
|
||||||
|
+ {0, "DFX_IOB_TX_TCS_NORMAL_CNT_15"},
|
||||||
|
+ {0, "DFX_IOB_TX_TCS_P2P_CNT_0"},
|
||||||
|
+ {0, "DFX_IOB_TX_TCS_P2P_CNT_1"},
|
||||||
|
+ {0, "DFX_IOB_TX_TCS_P2P_CNT_2"},
|
||||||
|
+ {0, "DFX_IOB_TX_TCS_P2P_CNT_3"},
|
||||||
|
+ {0, "DFX_IOB_TX_TCS_P2P_CNT_4"},
|
||||||
|
+ {0, "DFX_IOB_TX_TCS_P2P_CNT_5"},
|
||||||
|
+ {0, "DFX_IOB_TX_TCS_P2P_CNT_6"},
|
||||||
|
+ {0, "DFX_IOB_TX_TCS_P2P_CNT_7"},
|
||||||
|
+ {0, "DFX_IOB_TX_TCS_ARNORAML_CNT_0"},
|
||||||
|
+ {0, "DFX_IOB_TX_TCS_ARNORAML_CNT_1"},
|
||||||
|
+ {0, "DFX_IOB_TX_TCS_STATUS0"},
|
||||||
|
+ {0, "DFX_IOB_TX_TCS_STATUS1"},
|
||||||
|
+ {0, "DFX_IOB_TX_TCS_STATUS2"},
|
||||||
|
+ {0, "DFX_IOB_TX_TCS_IDLE"},
|
||||||
|
};
|
||||||
|
|
||||||
|
struct pcie_dumpreg_info g_reg_table_iob_rx[] = {
|
||||||
|
@@ -150,6 +241,19 @@ struct pcie_dumpreg_info g_reg_table_iob_rx[] = {
|
||||||
|
{0, "IOB_RX_MSI_MSIX_CTRL_0"},
|
||||||
|
{0, "IOB_RX_MSI_MSIX_ADDR_HIGH_0"},
|
||||||
|
{0, "IOB_RX_MSI_MSIX_ADDR_LOW_0"},
|
||||||
|
+ {0, "DFX_IOB_RX_CNT_RX_REQ"},
|
||||||
|
+ {0, "DFX_IOB_RX_CNT_LOC_REQ"},
|
||||||
|
+ {0, "DFX_IOB_RX_CNT_SEND_AM"},
|
||||||
|
+ {0, "DFX_IOB_RX_CNT_SEND_LOC"},
|
||||||
|
+ {0, "DFX_IOB_RX_CNT_RESP_RX"},
|
||||||
|
+ {0, "DFX_IOB_RX_CNT_RESP_LOC"},
|
||||||
|
+ {0, "DFX_IOB_RX_CNT_RESP_RECV"},
|
||||||
|
+ {0, "IOB_RX_INT_STATUS"},
|
||||||
|
+ {0, "DFX_IOB_RX_AMB_WR_CNT_0"},
|
||||||
|
+ {0, "DFX_IOB_RX_AMB_WR_CNT_1"},
|
||||||
|
+ {0, "DFX_IOB_RX_AMB_RD_CNT_0"},
|
||||||
|
+ {0, "DFX_IOB_RX_AMB_RD_CNT_1"},
|
||||||
|
+ {0, "DFX_IOB_RX_AMB_INT_NUM"},
|
||||||
|
};
|
||||||
|
|
||||||
|
struct pcie_dumpreg_info g_reg_table_ap_glb[] = {
|
||||||
|
@@ -256,6 +360,30 @@ struct pcie_dumpreg_info g_reg_table_core_glb[] = {
|
||||||
|
{0, "CORE_INT_FE_MSK_2"},
|
||||||
|
{0, "CORE_INT_FE_STATUS_2"},
|
||||||
|
{0, "CORE_INT_FE_RO_2"},
|
||||||
|
+ {0, "PORT07_LINK_MODE"},
|
||||||
|
+ {0, "PORT815_LINK_MODE"},
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+struct pcie_dumpreg_info g_reg_table_core_tl[] = {
|
||||||
|
+ {0, "TL_PM_AUTO_EXIT_TIME_VALUE"},
|
||||||
|
+ {0, "TL_DFX_PM_CORE_FUNC_EN"},
|
||||||
|
+ {0, "TL_PM_DFE_TIME_VALUE"},
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+struct pcie_dumpreg_info g_reg_table_dfx_core_tl[] = {
|
||||||
|
+ {0, "TL_TX_ASYN_FIFO_ST"},
|
||||||
|
+ {0, "TL_TX_INGRESS_CNT"},
|
||||||
|
+ {0, "TL_TX_CTRL_EGRESS_CNT"},
|
||||||
|
+ {0, "TL_TX_CFG_CNT"},
|
||||||
|
+ {0, "TL_TX_MEM_RD_CNT"},
|
||||||
|
+ {0, "TL_TX_MEM_WR_CNT"},
|
||||||
|
+ {0, "TL_TX_IO_RD_CNT"},
|
||||||
|
+ {0, "TL_TX_IO_WR_CNT"},
|
||||||
|
+ {0, "TL_TX_MSG_CNT"},
|
||||||
|
+ {0, "TL_TX_CPL_CNT"},
|
||||||
|
+ {0, "TL_TX_ATOMIC_CNT"},
|
||||||
|
+ {0, "TL_TX_CFG_TX_CNT"},
|
||||||
|
+ {0, "TL_TX_GEN_CPL_CNT"},
|
||||||
|
};
|
||||||
|
|
||||||
|
static int pcie_create_dumpreg_log_file(uint32_t port_id, uint32_t dump_level)
|
||||||
|
@@ -315,73 +443,33 @@ static void pcie_dumpreg_write_value_to_file(const char *reg_name, uint32_t val)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
-static void pcie_dumpreg_save_glb_analysis_log(const uint32_t *data, uint32_t data_num)
|
||||||
|
-{
|
||||||
|
- uint32_t item_i, data_i;
|
||||||
|
-
|
||||||
|
- data_i = 0;
|
||||||
|
- /* IOB_TX REG */
|
||||||
|
- for (item_i = 0; item_i < HIKP_ARRAY_SIZE(g_reg_table_iob_tx) &&
|
||||||
|
- data_i < data_num; item_i++, data_i++) {
|
||||||
|
- g_reg_table_iob_tx[item_i].val = data[data_i];
|
||||||
|
- pcie_dumpreg_write_value_to_file(g_reg_table_iob_tx[item_i].name,
|
||||||
|
- g_reg_table_iob_tx[item_i].val);
|
||||||
|
- }
|
||||||
|
- /* IOB_RX REG */
|
||||||
|
- for (item_i = 0; item_i < HIKP_ARRAY_SIZE(g_reg_table_iob_rx) &&
|
||||||
|
- data_i < data_num; item_i++, data_i++) {
|
||||||
|
- g_reg_table_iob_rx[item_i].val = data[data_i];
|
||||||
|
- pcie_dumpreg_write_value_to_file(g_reg_table_iob_rx[item_i].name,
|
||||||
|
- g_reg_table_iob_rx[item_i].val);
|
||||||
|
- }
|
||||||
|
- /* AP_GLB REG */
|
||||||
|
- for (item_i = 0; item_i < HIKP_ARRAY_SIZE(g_reg_table_ap_glb) &&
|
||||||
|
- data_i < data_num; item_i++, data_i++) {
|
||||||
|
- g_reg_table_ap_glb[item_i].val = data[data_i];
|
||||||
|
- pcie_dumpreg_write_value_to_file(g_reg_table_ap_glb[item_i].name,
|
||||||
|
- g_reg_table_ap_glb[item_i].val);
|
||||||
|
- }
|
||||||
|
- /* CORE_GLB REG */
|
||||||
|
- for (item_i = 0; item_i < HIKP_ARRAY_SIZE(g_reg_table_core_glb) &&
|
||||||
|
- data_i < data_num; item_i++, data_i++) {
|
||||||
|
- g_reg_table_core_glb[item_i].val = data[data_i];
|
||||||
|
- pcie_dumpreg_write_value_to_file(g_reg_table_core_glb[item_i].name,
|
||||||
|
- g_reg_table_core_glb[item_i].val);
|
||||||
|
- }
|
||||||
|
- /* PCS REG */
|
||||||
|
- for (item_i = 0; item_i < HIKP_ARRAY_SIZE(g_reg_table_pcs) &&
|
||||||
|
- data_i < data_num; item_i++, data_i++) {
|
||||||
|
- g_reg_table_pcs[item_i].val = data[data_i];
|
||||||
|
- pcie_dumpreg_write_value_to_file(g_reg_table_pcs[item_i].name,
|
||||||
|
- g_reg_table_pcs[item_i].val);
|
||||||
|
- }
|
||||||
|
-}
|
||||||
|
+struct pcie_dumpreg_table g_dump_info_glb[] = {
|
||||||
|
+ {HIKP_ARRAY_SIZE(g_reg_table_iob_tx), g_reg_table_iob_tx},
|
||||||
|
+ {HIKP_ARRAY_SIZE(g_reg_table_iob_rx), g_reg_table_iob_rx},
|
||||||
|
+ {HIKP_ARRAY_SIZE(g_reg_table_ap_glb), g_reg_table_ap_glb},
|
||||||
|
+ {HIKP_ARRAY_SIZE(g_reg_table_core_glb), g_reg_table_core_glb},
|
||||||
|
+ {HIKP_ARRAY_SIZE(g_reg_table_pcs), g_reg_table_pcs},
|
||||||
|
+ {HIKP_ARRAY_SIZE(g_reg_table_core_tl), g_reg_table_core_tl},
|
||||||
|
+ {HIKP_ARRAY_SIZE(g_reg_table_dfx_core_tl), g_reg_table_dfx_core_tl},
|
||||||
|
+};
|
||||||
|
|
||||||
|
-static void pcie_dumpreg_save_port_analysis_log(uint32_t *data, uint32_t data_num)
|
||||||
|
+struct pcie_dumpreg_table g_dump_info_port[] = {
|
||||||
|
+ {HIKP_ARRAY_SIZE(g_reg_table_tl), g_reg_table_tl},
|
||||||
|
+ {HIKP_ARRAY_SIZE(g_reg_table_dl), g_reg_table_dl},
|
||||||
|
+ {HIKP_ARRAY_SIZE(g_reg_table_mac), g_reg_table_mac},
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+static void pcie_dumpreg_save_analysis_log(const uint32_t *data, uint32_t data_num,
|
||||||
|
+ struct pcie_dumpreg_table *table, uint32_t size)
|
||||||
|
{
|
||||||
|
- uint32_t item_i, data_i;
|
||||||
|
-
|
||||||
|
- data_i = 0;
|
||||||
|
- /* TL REG */
|
||||||
|
- for (item_i = 0; item_i < HIKP_ARRAY_SIZE(g_reg_table_tl) &&
|
||||||
|
- data_i < data_num; item_i++, data_i++) {
|
||||||
|
- g_reg_table_tl[item_i].val = data[data_i];
|
||||||
|
- pcie_dumpreg_write_value_to_file(g_reg_table_tl[item_i].name,
|
||||||
|
- g_reg_table_tl[item_i].val);
|
||||||
|
- }
|
||||||
|
- /* DL REG */
|
||||||
|
- for (item_i = 0; item_i < HIKP_ARRAY_SIZE(g_reg_table_dl) &&
|
||||||
|
- data_i < data_num; item_i++, data_i++) {
|
||||||
|
- g_reg_table_dl[item_i].val = data[data_i];
|
||||||
|
- pcie_dumpreg_write_value_to_file(g_reg_table_dl[item_i].name,
|
||||||
|
- g_reg_table_dl[item_i].val);
|
||||||
|
- }
|
||||||
|
- /* MAC REG */
|
||||||
|
- for (item_i = 0; item_i < HIKP_ARRAY_SIZE(g_reg_table_mac) &&
|
||||||
|
- data_i < data_num; item_i++, data_i++) {
|
||||||
|
- g_reg_table_mac[item_i].val = data[data_i];
|
||||||
|
- pcie_dumpreg_write_value_to_file(g_reg_table_mac[item_i].name,
|
||||||
|
- g_reg_table_mac[item_i].val);
|
||||||
|
+ uint32_t i, j, data_i = 0;
|
||||||
|
+
|
||||||
|
+ for (i = 0; i < size; i++) {
|
||||||
|
+ struct pcie_dumpreg_info *info = table[i].dump_info;
|
||||||
|
+ for (j = 0; j < table[i].size && data_i < data_num; j++, data_i++) {
|
||||||
|
+ info[j].val = data[data_i];
|
||||||
|
+ pcie_dumpreg_write_value_to_file(info[j].name, info[j].val);
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -420,13 +508,14 @@ static int pcie_dumpreg_save_log(uint32_t *data, uint32_t data_num,
|
||||||
|
|
||||||
|
switch (req_data->level) {
|
||||||
|
case DUMP_GLOBAL_LEVEL:
|
||||||
|
- expect_data_num = HIKP_ARRAY_SIZE(g_reg_table_iob_tx) +
|
||||||
|
- HIKP_ARRAY_SIZE(g_reg_table_iob_rx) + HIKP_ARRAY_SIZE(g_reg_table_ap_glb) +
|
||||||
|
- HIKP_ARRAY_SIZE(g_reg_table_core_glb) + HIKP_ARRAY_SIZE(g_reg_table_pcs);
|
||||||
|
+ for (i = 0; i < HIKP_ARRAY_SIZE(g_dump_info_glb); i++) {
|
||||||
|
+ expect_data_num += g_dump_info_glb[i].size;
|
||||||
|
+ }
|
||||||
|
break;
|
||||||
|
case DUMP_PORT_LEVEL:
|
||||||
|
- expect_data_num = HIKP_ARRAY_SIZE(g_reg_table_tl) +
|
||||||
|
- HIKP_ARRAY_SIZE(g_reg_table_dl) + HIKP_ARRAY_SIZE(g_reg_table_mac);
|
||||||
|
+ for (i = 0; i < HIKP_ARRAY_SIZE(g_dump_info_port); i++) {
|
||||||
|
+ expect_data_num += g_dump_info_port[i].size;
|
||||||
|
+ }
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
Err("PCIe DUMPREG", "check dump level failed.\n");
|
||||||
|
@@ -441,9 +530,11 @@ static int pcie_dumpreg_save_log(uint32_t *data, uint32_t data_num,
|
||||||
|
pcie_dumpreg_write_value_to_file(reg_name, data[i]);
|
||||||
|
}
|
||||||
|
} else if (req_data->level == DUMP_GLOBAL_LEVEL) {
|
||||||
|
- pcie_dumpreg_save_glb_analysis_log(data, data_num);
|
||||||
|
+ pcie_dumpreg_save_analysis_log(data, data_num,
|
||||||
|
+ g_dump_info_glb, HIKP_ARRAY_SIZE(g_dump_info_glb));
|
||||||
|
} else {
|
||||||
|
- pcie_dumpreg_save_port_analysis_log(data, data_num);
|
||||||
|
+ pcie_dumpreg_save_analysis_log(data, data_num,
|
||||||
|
+ g_dump_info_port, HIKP_ARRAY_SIZE(g_dump_info_port));
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
diff --git a/pcie/func_lib/pcie_func/pcie_reg_dump.h b/pcie/func_lib/pcie_func/pcie_reg_dump.h
|
||||||
|
index 4ec1909..cbea2f6 100644
|
||||||
|
--- a/pcie/func_lib/pcie_func/pcie_reg_dump.h
|
||||||
|
+++ b/pcie/func_lib/pcie_func/pcie_reg_dump.h
|
||||||
|
@@ -49,6 +49,11 @@ struct pcie_dump_req_para {
|
||||||
|
uint32_t level;
|
||||||
|
};
|
||||||
|
|
||||||
|
+struct pcie_dumpreg_table {
|
||||||
|
+ uint32_t size;
|
||||||
|
+ struct pcie_dumpreg_info *dump_info;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
int pcie_dumpreg_do_dump(uint32_t port_id, uint32_t dump_level);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
--
|
||||||
|
2.33.0
|
||||||
|
|
||||||
201
0028-hikptool-add-show-CDR-DFX-info-in-nic_port-cmd.patch
Normal file
201
0028-hikptool-add-show-CDR-DFX-info-in-nic_port-cmd.patch
Normal file
@ -0,0 +1,201 @@
|
|||||||
|
From c3a11cf422c8edfe07146395c1084fdc45d44486 Mon Sep 17 00:00:00 2001
|
||||||
|
From: veega <zhuweijia@huawei.com>
|
||||||
|
Date: Wed, 26 Jul 2023 17:35:06 +0800
|
||||||
|
Subject: [PATCH] hikptool: add show CDR DFX info in nic_port cmd
|
||||||
|
|
||||||
|
If the port contains CDRs, the nic_port command displays the hardware information of the CDRs, which helps locate port link setup faults.
|
||||||
|
|
||||||
|
Signed-off-by: veega <zhuweijia@huawei.com>
|
||||||
|
---
|
||||||
|
net/nic/nic_mac/hikp_mac_cmd.h | 1 +
|
||||||
|
net/nic/nic_mac/hikp_nic_port.c | 72 ++++++++++++++++++++++++++++++++-
|
||||||
|
net/nic/nic_mac/hikp_nic_port.h | 49 +++++++++++++++++++---
|
||||||
|
3 files changed, 116 insertions(+), 6 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/net/nic/nic_mac/hikp_mac_cmd.h b/net/nic/nic_mac/hikp_mac_cmd.h
|
||||||
|
index 5f0450a..adaadf4 100644
|
||||||
|
--- a/net/nic/nic_mac/hikp_mac_cmd.h
|
||||||
|
+++ b/net/nic/nic_mac/hikp_mac_cmd.h
|
||||||
|
@@ -30,6 +30,7 @@ enum mac_port_sub_cmd {
|
||||||
|
QUERY_PORT_ADAPT_DFX,
|
||||||
|
QUERY_PORT_PHY_DFX,
|
||||||
|
QUERY_HOT_PLUG_CARD_DFX,
|
||||||
|
+ QUERY_PORT_CDR_DFX,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum mac_dump_reg_sub_cmd {
|
||||||
|
diff --git a/net/nic/nic_mac/hikp_nic_port.c b/net/nic/nic_mac/hikp_nic_port.c
|
||||||
|
index 22a6467..c9f46fc 100644
|
||||||
|
--- a/net/nic/nic_mac/hikp_nic_port.c
|
||||||
|
+++ b/net/nic/nic_mac/hikp_nic_port.c
|
||||||
|
@@ -405,6 +405,73 @@ static void mac_cmd_show_hot_plug_card(struct major_cmd_ctrl *self)
|
||||||
|
free(cmd_ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
+static void mac_cmd_print_cdr_dfx(struct mac_cmd_cdr_dfx *cdr_dfx, struct mac_port_cdr_dfx *info)
|
||||||
|
+{
|
||||||
|
+ struct mac_item type_table[] = {
|
||||||
|
+ {PORT_CDR_TYPE_A, "cdr_a"}, {PORT_CDR_TYPE_B, "cdr_b"},
|
||||||
|
+ };
|
||||||
|
+ struct mac_item cdr_a_mode[] = {
|
||||||
|
+ {CDR_A_MODE_2PLL, "2pll"}, {CDR_A_MODE_FASTPI, "fastpi"},
|
||||||
|
+ };
|
||||||
|
+ struct mac_item cdr_b_mode[] = {
|
||||||
|
+ {CDR_B_MODE_PCS, "pcs"}, {CDR_B_MODE_CDR, "cdr"},
|
||||||
|
+ };
|
||||||
|
+ struct mac_item status_table[] = {
|
||||||
|
+ {CDR_STATUS_NORMAL, "normal"}, {CDR_STATUS_ERROR, "error"},
|
||||||
|
+ };
|
||||||
|
+ const char *type_str = mac_get_str(cdr_dfx->cdr_type,
|
||||||
|
+ type_table, HIKP_ARRAY_SIZE(type_table), "unknown");
|
||||||
|
+ const char *mode_str = "NA";
|
||||||
|
+
|
||||||
|
+ for (uint32_t i = 0; i < cdr_dfx->cdr_num; i++) {
|
||||||
|
+ if (cdr_dfx->cdr_type == PORT_CDR_TYPE_A) {
|
||||||
|
+ mode_str = mac_get_str(info->dfx[i].cdr_mode, cdr_a_mode,
|
||||||
|
+ HIKP_ARRAY_SIZE(cdr_a_mode), "unknown");
|
||||||
|
+ } else if (cdr_dfx->cdr_type == PORT_CDR_TYPE_B) {
|
||||||
|
+ mode_str = mac_get_str(info->dfx[i].cdr_mode, cdr_b_mode,
|
||||||
|
+ HIKP_ARRAY_SIZE(cdr_b_mode), "unknown");
|
||||||
|
+ }
|
||||||
|
+ printf("\t|0x%-8x%-9u%-10s%-10s%-10s\n", info->dfx[i].cdr_addr,
|
||||||
|
+ info->dfx[i].cdr_start_lane, type_str, mode_str,
|
||||||
|
+ mac_get_str(info->dfx[i].cdr_err,
|
||||||
|
+ status_table, HIKP_ARRAY_SIZE(status_table), "unknown"));
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void mac_cmd_disp_cdr_info(struct mac_cmd_cdr_dfx *cdr_dfx)
|
||||||
|
+{
|
||||||
|
+ if (!cdr_dfx->cdr_num)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ printf("\n======================== PORT CDR INFO =======================\n");
|
||||||
|
+ printf("direct\t|addr |lane |type |mode |status \n");
|
||||||
|
+ printf("----------------------------------------------------------------------------\n");
|
||||||
|
+
|
||||||
|
+ printf("WIRE");
|
||||||
|
+ mac_cmd_print_cdr_dfx(cdr_dfx, &cdr_dfx->wire_cdr);
|
||||||
|
+
|
||||||
|
+ printf("HOST");
|
||||||
|
+ mac_cmd_print_cdr_dfx(cdr_dfx, &cdr_dfx->host_cdr);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void mac_cmd_show_cdr(struct major_cmd_ctrl *self)
|
||||||
|
+{
|
||||||
|
+ struct mac_cmd_cdr_dfx *cdr_dfx = NULL;
|
||||||
|
+ struct hikp_cmd_ret *cmd_ret = NULL;
|
||||||
|
+ int ret;
|
||||||
|
+
|
||||||
|
+ ret = mac_cmd_get_dfx_cfg(QUERY_PORT_CDR_DFX, &cmd_ret);
|
||||||
|
+ if (ret != 0) {
|
||||||
|
+ self->err_no = -ENOSPC;
|
||||||
|
+ snprintf(self->err_str, sizeof(self->err_str), "mac get cdr dfx failed.");
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ cdr_dfx = (struct mac_cmd_cdr_dfx *)(cmd_ret->rsp_data);
|
||||||
|
+ mac_cmd_disp_cdr_info(cdr_dfx);
|
||||||
|
+ free(cmd_ret);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static void mac_cmd_show_port_dfx(struct major_cmd_ctrl *self, uint32_t mask)
|
||||||
|
{
|
||||||
|
struct mac_cmd_dfx_callback dfx_cb[] = {
|
||||||
|
@@ -413,6 +480,7 @@ static void mac_cmd_show_port_dfx(struct major_cmd_ctrl *self, uint32_t mask)
|
||||||
|
{MAC_LSPORT_PHY, mac_cmd_show_phy},
|
||||||
|
{MAC_LSPORT_ARB, mac_cmd_show_arb},
|
||||||
|
{MAC_HOT_PLUG_CARD, mac_cmd_show_hot_plug_card},
|
||||||
|
+ {MAC_LSPORT_CDR, mac_cmd_show_cdr}
|
||||||
|
};
|
||||||
|
size_t size = HIKP_ARRAY_SIZE(dfx_cb);
|
||||||
|
size_t i;
|
||||||
|
@@ -425,9 +493,9 @@ static void mac_cmd_show_port_dfx(struct major_cmd_ctrl *self, uint32_t mask)
|
||||||
|
|
||||||
|
static void mac_cmd_port_execute(struct major_cmd_ctrl *self)
|
||||||
|
{
|
||||||
|
- uint32_t mask = MAC_LSPORT_LINK | MAC_LSPORT_MAC | MAC_LSPORT_ARB | MAC_HOT_PLUG_CARD;
|
||||||
|
struct mac_cmd_port_hardware *port_hw = NULL;
|
||||||
|
struct hikp_cmd_ret *hw_cmd_ret = NULL;
|
||||||
|
+ uint32_t mask;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
if (!g_port_info.port_flag) {
|
||||||
|
@@ -443,6 +511,8 @@ static void mac_cmd_port_execute(struct major_cmd_ctrl *self)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ mask = MAC_LSPORT_LINK | MAC_LSPORT_MAC |
|
||||||
|
+ MAC_LSPORT_ARB | MAC_HOT_PLUG_CARD | MAC_LSPORT_CDR;
|
||||||
|
port_hw = (struct mac_cmd_port_hardware *)(hw_cmd_ret->rsp_data);
|
||||||
|
if (port_hw->port_type == HIKP_PORT_TYPE_PHY ||
|
||||||
|
port_hw->port_type == HIKP_PORT_TYPE_PHY_SDS)
|
||||||
|
diff --git a/net/nic/nic_mac/hikp_nic_port.h b/net/nic/nic_mac/hikp_nic_port.h
|
||||||
|
index f6334d0..42ab3f9 100644
|
||||||
|
--- a/net/nic/nic_mac/hikp_nic_port.h
|
||||||
|
+++ b/net/nic/nic_mac/hikp_nic_port.h
|
||||||
|
@@ -16,11 +16,12 @@
|
||||||
|
|
||||||
|
#include "hikp_net_lib.h"
|
||||||
|
|
||||||
|
-#define MAC_LSPORT_LINK HI_BIT(0)
|
||||||
|
-#define MAC_LSPORT_MAC HI_BIT(1)
|
||||||
|
-#define MAC_LSPORT_PHY HI_BIT(2)
|
||||||
|
-#define MAC_LSPORT_ARB HI_BIT(3)
|
||||||
|
-#define MAC_HOT_PLUG_CARD HI_BIT(4)
|
||||||
|
+#define MAC_LSPORT_LINK HI_BIT(0)
|
||||||
|
+#define MAC_LSPORT_MAC HI_BIT(1)
|
||||||
|
+#define MAC_LSPORT_PHY HI_BIT(2)
|
||||||
|
+#define MAC_LSPORT_ARB HI_BIT(3)
|
||||||
|
+#define MAC_HOT_PLUG_CARD HI_BIT(4)
|
||||||
|
+#define MAC_LSPORT_CDR HI_BIT(5)
|
||||||
|
|
||||||
|
enum {
|
||||||
|
PORT_CFG_NOT_SET = 0,
|
||||||
|
@@ -186,6 +187,44 @@ struct mac_cmd_phy_info {
|
||||||
|
struct mac_cmd_phy_dfx phy_dfx;
|
||||||
|
};
|
||||||
|
|
||||||
|
+enum {
|
||||||
|
+ PORT_CDR_TYPE_A = 0,
|
||||||
|
+ PORT_CDR_TYPE_B,
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+enum {
|
||||||
|
+ CDR_A_MODE_2PLL = 0,
|
||||||
|
+ CDR_A_MODE_FASTPI,
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+enum {
|
||||||
|
+ CDR_B_MODE_PCS = 0,
|
||||||
|
+ CDR_B_MODE_CDR,
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+enum {
|
||||||
|
+ CDR_STATUS_NORMAL = 0,
|
||||||
|
+ CDR_STATUS_ERROR,
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+struct cdr_dfx_info {
|
||||||
|
+ uint8_t cdr_mode;
|
||||||
|
+ uint8_t cdr_addr;
|
||||||
|
+ uint8_t cdr_start_lane;
|
||||||
|
+ uint8_t cdr_err; /* 0:normal, 1:error */
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+struct mac_port_cdr_dfx {
|
||||||
|
+ struct cdr_dfx_info dfx[2]; /* one side reserved max 2 cdr */
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+struct mac_cmd_cdr_dfx {
|
||||||
|
+ uint8_t cdr_num;
|
||||||
|
+ uint8_t cdr_type;
|
||||||
|
+ struct mac_port_cdr_dfx wire_cdr;
|
||||||
|
+ struct mac_port_cdr_dfx host_cdr;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
struct mac_cmd_dfx_callback {
|
||||||
|
uint32_t mask;
|
||||||
|
void (*show_dfx)(struct major_cmd_ctrl *self);
|
||||||
|
--
|
||||||
|
2.36.1.windows.1
|
||||||
227
0029-hikptool-add-new-cmd-support-query-ncsi-dfx-info.patch
Normal file
227
0029-hikptool-add-new-cmd-support-query-ncsi-dfx-info.patch
Normal file
@ -0,0 +1,227 @@
|
|||||||
|
From 1ba7b82d8f933550dd1552143b77d077b7e4f40a Mon Sep 17 00:00:00 2001
|
||||||
|
From: veega <zhuweijia@huawei.com>
|
||||||
|
Date: Wed, 9 Aug 2023 20:04:27 +0800
|
||||||
|
Subject: [PATCH] hikptool: add new cmd support query ncsi dfx info
|
||||||
|
|
||||||
|
Add nic_ncsi cmd for query nic port number of NCSI packets processed by software.
|
||||||
|
|
||||||
|
Signed-off-by: veega <zhuweijia@huawei.com>
|
||||||
|
---
|
||||||
|
net/hikp_net_lib.h | 5 ++
|
||||||
|
net/nic/nic_ncsi/hikp_nic_ncsi.c | 116 +++++++++++++++++++++++++++++++
|
||||||
|
net/nic/nic_ncsi/hikp_nic_ncsi.h | 57 +++++++++++++++
|
||||||
|
3 files changed, 178 insertions(+)
|
||||||
|
create mode 100644 net/nic/nic_ncsi/hikp_nic_ncsi.c
|
||||||
|
create mode 100644 net/nic/nic_ncsi/hikp_nic_ncsi.h
|
||||||
|
|
||||||
|
diff --git a/net/hikp_net_lib.h b/net/hikp_net_lib.h
|
||||||
|
index af0a51d..ed984ce 100644
|
||||||
|
--- a/net/hikp_net_lib.h
|
||||||
|
+++ b/net/hikp_net_lib.h
|
||||||
|
@@ -78,6 +78,7 @@ enum nic_cmd_type {
|
||||||
|
GET_FD_INFO_CMD,
|
||||||
|
GET_FEC_INFO_CMD,
|
||||||
|
GET_GRO_INFO_CMD,
|
||||||
|
+ GET_NCSI_INFO_CMD,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum roh_cmd_type {
|
||||||
|
@@ -107,6 +108,10 @@ enum ub_cmd_type {
|
||||||
|
GET_UB_BASIC_INFO_CMD,
|
||||||
|
};
|
||||||
|
|
||||||
|
+enum nic_get_ncsi_sub_cmd {
|
||||||
|
+ NIC_NCSI_GET_DFX_INFO,
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
#define HIKP_MAX_PF_NUM 8
|
||||||
|
#define HIKP_NIC_MAX_FUNC_NUM 256
|
||||||
|
|
||||||
|
diff --git a/net/nic/nic_ncsi/hikp_nic_ncsi.c b/net/nic/nic_ncsi/hikp_nic_ncsi.c
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..d09e16f
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/net/nic/nic_ncsi/hikp_nic_ncsi.c
|
||||||
|
@@ -0,0 +1,116 @@
|
||||||
|
+/*
|
||||||
|
+ * Copyright (c) 2022 Hisilicon Technologies Co., Ltd.
|
||||||
|
+ * Hikptool is licensed under Mulan PSL v2.
|
||||||
|
+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||||
|
+ * You may obtain a copy of Mulan PSL v2 at:
|
||||||
|
+ * http://license.coscl.org.cn/MulanPSL2
|
||||||
|
+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||||
|
+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||||
|
+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||||
|
+ *
|
||||||
|
+ * See the Mulan PSL v2 for more details.
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+#include <unistd.h>
|
||||||
|
+#include "tool_cmd.h"
|
||||||
|
+#include "hikp_net_lib.h"
|
||||||
|
+#include "hikptdev_plug.h"
|
||||||
|
+#include "hikp_nic_ncsi.h"
|
||||||
|
+
|
||||||
|
+static struct nic_ncsi_cmd_info g_ncsi_cmd_info = {0};
|
||||||
|
+
|
||||||
|
+static void nic_ncsi_cmd_print_dfx_info(struct nic_ncsi_cmd_resp *ncsi_info)
|
||||||
|
+{
|
||||||
|
+ printf("port ncsi: %s\n", ncsi_info->ncsi_en ? "enable" : "disable");
|
||||||
|
+ if (!ncsi_info->ncsi_en)
|
||||||
|
+ return; /* ncsi not enable do not print dfx info */
|
||||||
|
+
|
||||||
|
+ printf("processing packet statistics\n");
|
||||||
|
+ printf("\tncsi_control_total: %u\n", ncsi_info->ncsi_dfx.ncsi_control_total);
|
||||||
|
+ printf("\tncsi_eth_to_ub_total: %u\n", ncsi_info->ncsi_dfx.ncsi_eth_to_ub_total);
|
||||||
|
+ printf("\tncsi_ub_to_eth_total: %u\n", ncsi_info->ncsi_dfx.ncsi_ub_to_eth_total);
|
||||||
|
+ printf("\tncsi_control_good: %u\n", ncsi_info->ncsi_dfx.ncsi_control_good);
|
||||||
|
+ printf("\tncsi_eth_to_ub_good: %u\n", ncsi_info->ncsi_dfx.ncsi_eth_to_ub_good);
|
||||||
|
+ printf("\tncsi_ub_to_eth_good: %u\n", ncsi_info->ncsi_dfx.ncsi_ub_to_eth_good);
|
||||||
|
+
|
||||||
|
+ printf("\tncsi_eth_to_ub_arp: %u\n", ncsi_info->ncsi_dfx.ncsi_eth_to_ub_arp);
|
||||||
|
+ printf("\tncsi_eth_to_ub_free_arp: %u\n", ncsi_info->ncsi_dfx.ncsi_eth_to_ub_free_arp);
|
||||||
|
+ printf("\tncsi_eth_to_ub_ipv6_ra: %u\n", ncsi_info->ncsi_dfx.ncsi_eth_to_ub_ipv6_ra);
|
||||||
|
+ printf("\tncsi_eth_to_ub_dhcpv4: %u\n", ncsi_info->ncsi_dfx.ncsi_eth_to_ub_dhcpv4);
|
||||||
|
+ printf("\tncsi_eth_to_ub_dhcpv6: %u\n", ncsi_info->ncsi_dfx.ncsi_eth_to_ub_dhcpv6);
|
||||||
|
+ printf("\tncsi_eth_to_ub_lldp: %u\n", ncsi_info->ncsi_dfx.ncsi_eth_to_ub_lldp);
|
||||||
|
+
|
||||||
|
+ printf("\tncsi_ub_to_eth_ipv4: %u\n", ncsi_info->ncsi_dfx.ncsi_ub_to_eth_ipv4);
|
||||||
|
+ printf("\tncsi_ub_to_eth_ipv6: %u\n", ncsi_info->ncsi_dfx.ncsi_ub_to_eth_ipv6);
|
||||||
|
+ printf("\tncsi_ub_to_eth_ipnotify: %u\n", ncsi_info->ncsi_dfx.ncsi_ub_to_eth_ipnotify);
|
||||||
|
+ printf("\tncsi_ub_to_eth_dhcpv4: %u\n", ncsi_info->ncsi_dfx.ncsi_ub_to_eth_dhcpv4);
|
||||||
|
+ printf("\tncsi_ub_to_eth_dhcpv6: %u\n", ncsi_info->ncsi_dfx.ncsi_ub_to_eth_dhcpv6);
|
||||||
|
+ printf("\tncsi_ub_to_eth_lldp: %u\n", ncsi_info->ncsi_dfx.ncsi_ub_to_eth_lldp);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void nic_ncsi_cmd_execute(struct major_cmd_ctrl *self)
|
||||||
|
+{
|
||||||
|
+ struct hikp_cmd_ret *cmd_resp = NULL;
|
||||||
|
+ struct hikp_cmd_header req_header = {0};
|
||||||
|
+ struct nic_ncsi_cmd_req ncsi_req = {0};
|
||||||
|
+
|
||||||
|
+ if (!g_ncsi_cmd_info.port_flag) {
|
||||||
|
+ self->err_no = -EINVAL;
|
||||||
|
+ snprintf(self->err_str, sizeof(self->err_str), "Need port id.");
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ memcpy(&ncsi_req.bdf, &g_ncsi_cmd_info.target.bdf, sizeof(ncsi_req.bdf));
|
||||||
|
+ hikp_cmd_init(&req_header, NIC_MOD, GET_NCSI_INFO_CMD, NIC_NCSI_GET_DFX_INFO);
|
||||||
|
+ cmd_resp = hikp_cmd_alloc(&req_header, &ncsi_req, sizeof(ncsi_req));
|
||||||
|
+ self->err_no = hikp_rsp_normal_check(cmd_resp);
|
||||||
|
+ if (self->err_no) {
|
||||||
|
+ snprintf(self->err_str, sizeof(self->err_str), "Get ncsi dfx info failed.");
|
||||||
|
+ goto ERR_OUT;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ nic_ncsi_cmd_print_dfx_info((struct nic_ncsi_cmd_resp *)cmd_resp->rsp_data);
|
||||||
|
+
|
||||||
|
+ERR_OUT:
|
||||||
|
+ free(cmd_resp);
|
||||||
|
+ cmd_resp = NULL;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int nic_ncsi_cmd_get_port_info(struct major_cmd_ctrl *self, const char *argv)
|
||||||
|
+{
|
||||||
|
+ self->err_no = tool_check_and_get_valid_bdf_id(argv, &g_ncsi_cmd_info.target);
|
||||||
|
+ if (self->err_no) {
|
||||||
|
+ snprintf(self->err_str, sizeof(self->err_str), "Unknown device %s.", argv);
|
||||||
|
+ return self->err_no;
|
||||||
|
+ }
|
||||||
|
+ g_ncsi_cmd_info.port_flag = true;
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int nic_ncsi_cmd_show_help(struct major_cmd_ctrl *self, const char *argv)
|
||||||
|
+{
|
||||||
|
+ printf("\n Usage: %s %s\n", self->cmd_ptr->name, "-i <interface>");
|
||||||
|
+ printf("\n %s\n", self->cmd_ptr->help_info);
|
||||||
|
+ printf("\n Options:\n\n");
|
||||||
|
+ printf(" %s, %-25s %s\n", "-h", "--help", "display this help and exit");
|
||||||
|
+ printf(" %s, %-25s %s\n", "-i", "--interface=<interface>",
|
||||||
|
+ "device target or bdf id, e.g. eth0~3 or 0000:35:00.0");
|
||||||
|
+ printf("\n");
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void cmd_nic_get_ncsi_init(void)
|
||||||
|
+{
|
||||||
|
+ struct major_cmd_ctrl *major_cmd = get_major_cmd();
|
||||||
|
+
|
||||||
|
+ g_ncsi_cmd_info.port_flag = false;
|
||||||
|
+ major_cmd->option_count = 0;
|
||||||
|
+ major_cmd->execute = nic_ncsi_cmd_execute;
|
||||||
|
+
|
||||||
|
+ cmd_option_register("-h", "--help", false, nic_ncsi_cmd_show_help);
|
||||||
|
+ cmd_option_register("-i", "--interface", true, nic_ncsi_cmd_get_port_info);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+HIKP_CMD_DECLARE("nic_ncsi", "query nic port ncsi information", cmd_nic_get_ncsi_init);
|
||||||
|
diff --git a/net/nic/nic_ncsi/hikp_nic_ncsi.h b/net/nic/nic_ncsi/hikp_nic_ncsi.h
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..a391d20
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/net/nic/nic_ncsi/hikp_nic_ncsi.h
|
||||||
|
@@ -0,0 +1,57 @@
|
||||||
|
+/*
|
||||||
|
+ * Copyright (c) 2022 Hisilicon Technologies Co., Ltd.
|
||||||
|
+ * Hikptool is licensed under Mulan PSL v2.
|
||||||
|
+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||||
|
+ * You may obtain a copy of Mulan PSL v2 at:
|
||||||
|
+ * http://license.coscl.org.cn/MulanPSL2
|
||||||
|
+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||||
|
+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||||
|
+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||||
|
+ *
|
||||||
|
+ * See the Mulan PSL v2 for more details.
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+#ifndef HIKP_NIC_NCSI_H
|
||||||
|
+#define HIKP_NIC_NCSI_H
|
||||||
|
+
|
||||||
|
+#include "hikp_net_lib.h"
|
||||||
|
+
|
||||||
|
+struct nic_ncsi_dfx_info {
|
||||||
|
+ uint16_t ncsi_control_total;
|
||||||
|
+ uint16_t ncsi_eth_to_ub_total;
|
||||||
|
+ uint16_t ncsi_ub_to_eth_total;
|
||||||
|
+ uint16_t ncsi_control_good;
|
||||||
|
+ uint16_t ncsi_eth_to_ub_good;
|
||||||
|
+ uint16_t ncsi_ub_to_eth_good;
|
||||||
|
+ uint16_t ncsi_eth_to_ub_arp;
|
||||||
|
+ uint16_t ncsi_eth_to_ub_free_arp;
|
||||||
|
+ uint16_t ncsi_eth_to_ub_ipv6_ra;
|
||||||
|
+ uint16_t ncsi_eth_to_ub_dhcpv4;
|
||||||
|
+ uint16_t ncsi_eth_to_ub_dhcpv6;
|
||||||
|
+ uint16_t ncsi_eth_to_ub_lldp;
|
||||||
|
+ uint16_t ncsi_ub_to_eth_ipv4;
|
||||||
|
+ uint16_t ncsi_ub_to_eth_ipv6;
|
||||||
|
+ uint16_t ncsi_ub_to_eth_ipnotify;
|
||||||
|
+ uint16_t ncsi_ub_to_eth_dhcpv4;
|
||||||
|
+ uint16_t ncsi_ub_to_eth_dhcpv6;
|
||||||
|
+ uint16_t ncsi_ub_to_eth_lldp;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+struct nic_ncsi_cmd_resp {
|
||||||
|
+ uint8_t ncsi_en;
|
||||||
|
+ uint8_t rsv0[3];
|
||||||
|
+ struct nic_ncsi_dfx_info ncsi_dfx;
|
||||||
|
+ uint32_t rsv1[50]; /* max resp data: 240 Bytes */
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+struct nic_ncsi_cmd_req {
|
||||||
|
+ struct bdf_t bdf;
|
||||||
|
+ uint32_t rsv0[30]; /* max req data: 128 Bytes */
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+struct nic_ncsi_cmd_info {
|
||||||
|
+ struct tool_target target;
|
||||||
|
+ bool port_flag;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+#endif /* HIKP_NIC_NCSI_H */
|
||||||
|
--
|
||||||
|
2.36.1.windows.1
|
||||||
|
|
||||||
30
0030-hikptool-Don-t-show-gen5.patch
Normal file
30
0030-hikptool-Don-t-show-gen5.patch
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
From cd294fef2bb22262bb43d912cb2eedea7c986f77 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Bingquan Mou <moubingquan@huawei.com>
|
||||||
|
Date: Sat, 26 Aug 2023 11:10:51 +0800
|
||||||
|
Subject: [PATCH] hikptool: fix don`t show gen5 problem
|
||||||
|
|
||||||
|
The mac_rate field does not support displaying the GEN5 rate.
|
||||||
|
Therefore, the rxl0s_st field is added to determine the rate together with the mac_rate field.
|
||||||
|
|
||||||
|
Signed-off-by: Bingquan Mou <moubingquan@huawei.com>
|
||||||
|
---
|
||||||
|
pcie/func_lib/pcie_func/pcie_link_ltssm.c | 3 ++-
|
||||||
|
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/pcie/func_lib/pcie_func/pcie_link_ltssm.c b/pcie/func_lib/pcie_func/pcie_link_ltssm.c
|
||||||
|
index 09d3b5e..156f4be 100644
|
||||||
|
--- a/pcie/func_lib/pcie_func/pcie_link_ltssm.c
|
||||||
|
+++ b/pcie/func_lib/pcie_func/pcie_link_ltssm.c
|
||||||
|
@@ -213,7 +213,8 @@ static int pcie_print_ltssm_trace(const uint64_t *ltssm_input, uint32_t ltssm_nu
|
||||||
|
(uint32_t)ltssm_val.bits.any_change_pipe_req,
|
||||||
|
(uint32_t)ltssm_val.bits.rxl0s_st,
|
||||||
|
(uint32_t)ltssm_val.bits.train_bit_map1,
|
||||||
|
- (uint32_t)ltssm_val.bits.mac_rate,
|
||||||
|
+ (((uint32_t)ltssm_val.bits.rxl0s_st) << 2) |
|
||||||
|
+ ((uint32_t)ltssm_val.bits.mac_rate),
|
||||||
|
(uint32_t)ltssm_val.bits.duration_counter,
|
||||||
|
(uint32_t)ltssm_val.bits.ltssm_state,
|
||||||
|
ltssm_c);
|
||||||
|
--
|
||||||
|
2.33.0
|
||||||
|
|
||||||
@ -0,0 +1,50 @@
|
|||||||
|
From 074af28f22f7e3dff9637a6366ad0a1ad1dd2852 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Junxian Huang <huangjunxian6@hisilicon.com>
|
||||||
|
Date: Wed, 30 Aug 2023 09:24:49 +0800
|
||||||
|
Subject: hikptool/RDMA: Fix the missing bank ID in roce_trp GEN_AC
|
||||||
|
|
||||||
|
Upstream: Yes
|
||||||
|
|
||||||
|
Currently hikptool only accepts bank ID 0 and 1 for roce_trp GEN_AC.
|
||||||
|
The firmware then multiplies the bank ID received from hikptool by 2
|
||||||
|
and converts it to 0 and 2. But actually there are 4 banks in GEN_AC
|
||||||
|
and each of them is independent.
|
||||||
|
|
||||||
|
To fix the problem, both hikptool and firmware should be modified.
|
||||||
|
This patch modifies the bank ID limit form 2 to 4 in hikptool.
|
||||||
|
|
||||||
|
Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com>
|
||||||
|
---
|
||||||
|
net/roce/roce_trp/hikp_roce_trp.c | 2 +-
|
||||||
|
net/roce/roce_trp/hikp_roce_trp.h | 2 +-
|
||||||
|
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/net/roce/roce_trp/hikp_roce_trp.c b/net/roce/roce_trp/hikp_roce_trp.c
|
||||||
|
index 8befb06..bf22484 100644
|
||||||
|
--- a/net/roce/roce_trp/hikp_roce_trp.c
|
||||||
|
+++ b/net/roce/roce_trp/hikp_roce_trp.c
|
||||||
|
@@ -32,7 +32,7 @@ static int hikp_roce_trp_help(struct major_cmd_ctrl *self, const char *argv)
|
||||||
|
"this is necessary param COMMON/TRP_RX/GEN_AC/PAYL");
|
||||||
|
printf(" %s, %-25s %s\n", "-b", "--bank=<bank>",
|
||||||
|
"[option]set which bank to read. (default 0) "
|
||||||
|
- "COMMON : 0~3\n PAYL: 0~1\n GEN_AC : 0~1\n ");
|
||||||
|
+ "COMMON : 0~3\n PAYL: 0~1\n GEN_AC : 0~3\n ");
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
diff --git a/net/roce/roce_trp/hikp_roce_trp.h b/net/roce/roce_trp/hikp_roce_trp.h
|
||||||
|
index db58216..80d28af 100644
|
||||||
|
--- a/net/roce/roce_trp/hikp_roce_trp.h
|
||||||
|
+++ b/net/roce/roce_trp/hikp_roce_trp.h
|
||||||
|
@@ -25,7 +25,7 @@
|
||||||
|
}
|
||||||
|
#define TRP_MAX_BANK_NUM 0x3
|
||||||
|
#define PAYL_MAX_BANK_NUM 0x1
|
||||||
|
-#define GAC_MAX_BANK_NUM 0x1
|
||||||
|
+#define GAC_MAX_BANK_NUM 0x3
|
||||||
|
#define PER_TRP_DATA_NUM 2
|
||||||
|
|
||||||
|
struct roce_trp_req_param {
|
||||||
|
--
|
||||||
|
2.30.0
|
||||||
|
|
||||||
486
0032-hikptool-fix-the-memory-leak-risk-problem.patch
Normal file
486
0032-hikptool-fix-the-memory-leak-risk-problem.patch
Normal file
@ -0,0 +1,486 @@
|
|||||||
|
From a5efd8daf63f13196ea38e2a2cd9e41c3d4be82b Mon Sep 17 00:00:00 2001
|
||||||
|
From: veega <zhuweijia@huawei.com>
|
||||||
|
Date: Wed, 6 Sep 2023 12:01:21 +0800
|
||||||
|
Subject: [PATCH] hikptool: fix the memory leak risk problem
|
||||||
|
|
||||||
|
After the framework fails to apply for memory, the memory needs to be released. The framework returns a processing failure message. The module needs to exit and release the memory.
|
||||||
|
|
||||||
|
Signed-off-by: veega <zhuweijia@huawei.com>
|
||||||
|
---
|
||||||
|
net/nic/nic_dfx/hikp_nic_dfx.c | 17 +++++++++--------
|
||||||
|
net/nic/nic_fd/hikp_nic_fd.c | 6 ++++--
|
||||||
|
net/nic/nic_info/hikp_nic_info.c | 4 +++-
|
||||||
|
net/nic/nic_log/hikp_nic_log.c | 8 ++++----
|
||||||
|
net/nic/nic_ppp/hikp_nic_ppp.c | 5 +++--
|
||||||
|
net/nic/nic_qos/hikp_nic_qos.c | 5 +++--
|
||||||
|
net/nic/nic_queue/hikp_nic_queue.c | 5 +++--
|
||||||
|
net/nic/nic_rss/hikp_nic_rss.c | 5 +++--
|
||||||
|
net/roce/roce_pkt/hikp_roce_pkt.c | 11 +++++++----
|
||||||
|
net/roce/roce_scc/hikp_roce_scc.c | 11 +++++++----
|
||||||
|
net/roce/roce_trp/hikp_roce_trp.c | 11 +++++++----
|
||||||
|
net/roce/roce_tsp/hikp_roce_tsp.c | 11 +++++++----
|
||||||
|
sas/sas_func/sas_analy_queue.c | 3 ++-
|
||||||
|
sas/sas_func/sas_dump_reg.c | 3 ++-
|
||||||
|
sas/sas_func/sas_read_dev.c | 3 ++-
|
||||||
|
sas/sas_func/sas_read_dqe.c | 3 ++-
|
||||||
|
sas/sas_func/sas_read_errcode.c | 3 ++-
|
||||||
|
sata/sata_func/sata_dump_reg.c | 3 ++-
|
||||||
|
serdes/hikp_serdes.c | 8 ++++----
|
||||||
|
socip/hikp_socip_dumpreg.c | 4 +++-
|
||||||
|
20 files changed, 79 insertions(+), 50 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/net/nic/nic_dfx/hikp_nic_dfx.c b/net/nic/nic_dfx/hikp_nic_dfx.c
|
||||||
|
index 3584493..c734ce0 100644
|
||||||
|
--- a/net/nic/nic_dfx/hikp_nic_dfx.c
|
||||||
|
+++ b/net/nic/nic_dfx/hikp_nic_dfx.c
|
||||||
|
@@ -123,12 +123,12 @@ static int hikp_nic_get_first_blk_dfx(struct nic_dfx_rsp_head_t *rsp_head, uint3
|
||||||
|
uint32_t *max_dfx_size, uint32_t *version)
|
||||||
|
{
|
||||||
|
struct nic_dfx_rsp_t *dfx_rsp = NULL;
|
||||||
|
- struct hikp_cmd_ret *cmd_ret;
|
||||||
|
+ struct hikp_cmd_ret *cmd_ret = NULL;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ret = hikp_nic_dfx_get_blk(&cmd_ret, 0, g_dfx_param.sub_cmd_code);
|
||||||
|
if (ret < 0)
|
||||||
|
- return ret;
|
||||||
|
+ goto err_out;
|
||||||
|
|
||||||
|
dfx_rsp = (struct nic_dfx_rsp_t *)(cmd_ret->rsp_data);
|
||||||
|
*version = cmd_ret->version;
|
||||||
|
@@ -168,12 +168,12 @@ static int hikp_nic_get_blk_dfx(struct nic_dfx_rsp_head_t *rsp_head, uint32_t bl
|
||||||
|
uint32_t *reg_data, uint32_t *max_dfx_size)
|
||||||
|
{
|
||||||
|
struct nic_dfx_rsp_t *dfx_rsp = NULL;
|
||||||
|
- struct hikp_cmd_ret *cmd_ret;
|
||||||
|
+ struct hikp_cmd_ret *cmd_ret = NULL;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ret = hikp_nic_dfx_get_blk(&cmd_ret, blk_id, g_dfx_param.sub_cmd_code);
|
||||||
|
if (ret < 0)
|
||||||
|
- return ret;
|
||||||
|
+ goto err_out;
|
||||||
|
|
||||||
|
dfx_rsp = (struct nic_dfx_rsp_t *)(cmd_ret->rsp_data);
|
||||||
|
*rsp_head = dfx_rsp->rsp_head;
|
||||||
|
@@ -181,16 +181,17 @@ static int hikp_nic_get_blk_dfx(struct nic_dfx_rsp_head_t *rsp_head, uint32_t bl
|
||||||
|
HIKP_ERROR_PRINT("blk%u reg_data copy size error, "
|
||||||
|
"data size: 0x%x, max size: 0x%x\n",
|
||||||
|
blk_id, rsp_head->cur_blk_size, *max_dfx_size);
|
||||||
|
- free(cmd_ret);
|
||||||
|
- cmd_ret = NULL;
|
||||||
|
- return -EINVAL;
|
||||||
|
+ ret = -EINVAL;
|
||||||
|
+ goto err_out;
|
||||||
|
}
|
||||||
|
memcpy(reg_data, dfx_rsp->reg_data, rsp_head->cur_blk_size);
|
||||||
|
*max_dfx_size -= (uint32_t)rsp_head->cur_blk_size;
|
||||||
|
+
|
||||||
|
+err_out:
|
||||||
|
free(cmd_ret);
|
||||||
|
cmd_ret = NULL;
|
||||||
|
|
||||||
|
- return 0;
|
||||||
|
+ return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int cmd_dfx_module_select(struct major_cmd_ctrl *self, const char *argv)
|
||||||
|
diff --git a/net/nic/nic_fd/hikp_nic_fd.c b/net/nic/nic_fd/hikp_nic_fd.c
|
||||||
|
index 5a87c30..57bc94b 100644
|
||||||
|
--- a/net/nic/nic_fd/hikp_nic_fd.c
|
||||||
|
+++ b/net/nic/nic_fd/hikp_nic_fd.c
|
||||||
|
@@ -558,8 +558,10 @@ static int hikp_nic_fd_get_blk(struct hikp_cmd_header *req_header,
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
|
cmd_ret = hikp_cmd_alloc(req_header, req_data, sizeof(*req_data));
|
||||||
|
- if (cmd_ret == NULL)
|
||||||
|
- return -EIO;
|
||||||
|
+ if (hikp_rsp_normal_check(cmd_ret)) {
|
||||||
|
+ ret = -EIO;
|
||||||
|
+ goto out;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
rsp = (struct nic_fd_rsp *)cmd_ret->rsp_data;
|
||||||
|
if (rsp->rsp_head.cur_blk_size > buf_len) {
|
||||||
|
diff --git a/net/nic/nic_info/hikp_nic_info.c b/net/nic/nic_info/hikp_nic_info.c
|
||||||
|
index 1853d95..d84ca18 100644
|
||||||
|
--- a/net/nic/nic_info/hikp_nic_info.c
|
||||||
|
+++ b/net/nic/nic_info/hikp_nic_info.c
|
||||||
|
@@ -64,12 +64,14 @@ static int hikp_nic_get_hw_info(struct hikp_cmd_ret **cmd_ret)
|
||||||
|
static int hikp_nic_get_curr_die_info(void)
|
||||||
|
{
|
||||||
|
struct nic_info_rsp_t *info_rsp = NULL;
|
||||||
|
- struct hikp_cmd_ret *cmd_ret;
|
||||||
|
+ struct hikp_cmd_ret *cmd_ret = NULL;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ret = hikp_nic_get_hw_info(&cmd_ret);
|
||||||
|
if (ret != 0) {
|
||||||
|
HIKP_ERROR_PRINT("Get chip info fail.\n");
|
||||||
|
+ free(cmd_ret);
|
||||||
|
+ cmd_ret = NULL;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
info_rsp = (struct nic_info_rsp_t *)(cmd_ret->rsp_data);
|
||||||
|
diff --git a/net/nic/nic_log/hikp_nic_log.c b/net/nic/nic_log/hikp_nic_log.c
|
||||||
|
index 527f9e9..5cafe4e 100644
|
||||||
|
--- a/net/nic/nic_log/hikp_nic_log.c
|
||||||
|
+++ b/net/nic/nic_log/hikp_nic_log.c
|
||||||
|
@@ -96,13 +96,13 @@ static int hikp_nic_get_first_blk_info(uint32_t *total_blk_num,
|
||||||
|
uint32_t *cur_blk_size, uint8_t **log_data)
|
||||||
|
{
|
||||||
|
struct nic_log_rsp_data *log_rsp = NULL;
|
||||||
|
- struct hikp_cmd_ret *cmd_ret;
|
||||||
|
+ struct hikp_cmd_ret *cmd_ret = NULL;
|
||||||
|
uint32_t log_size;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ret = hikp_nic_get_blk_log(&cmd_ret, 0);
|
||||||
|
if (ret < 0)
|
||||||
|
- return ret;
|
||||||
|
+ goto err_out;
|
||||||
|
|
||||||
|
log_rsp = (struct nic_log_rsp_data *)(cmd_ret->rsp_data);
|
||||||
|
log_size = (uint32_t)(log_rsp->total_blk_num * MAX_LOG_DATA_NUM * sizeof(uint32_t));
|
||||||
|
@@ -132,12 +132,12 @@ static int hikp_nic_get_log_info(uint32_t blk_id, uint32_t *cur_blk_size, uint8_
|
||||||
|
uint32_t max_log_size, uint32_t *blk_num)
|
||||||
|
{
|
||||||
|
struct nic_log_rsp_data *log_rsp = NULL;
|
||||||
|
- struct hikp_cmd_ret *cmd_ret;
|
||||||
|
+ struct hikp_cmd_ret *cmd_ret = NULL;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ret = hikp_nic_get_blk_log(&cmd_ret, blk_id);
|
||||||
|
if (ret)
|
||||||
|
- return ret;
|
||||||
|
+ goto err_out;
|
||||||
|
|
||||||
|
log_rsp = (struct nic_log_rsp_data *)(cmd_ret->rsp_data);
|
||||||
|
*cur_blk_size = (uint32_t)log_rsp->cur_blk_size;
|
||||||
|
diff --git a/net/nic/nic_ppp/hikp_nic_ppp.c b/net/nic/nic_ppp/hikp_nic_ppp.c
|
||||||
|
index 28c867d..b71fc48 100644
|
||||||
|
--- a/net/nic/nic_ppp/hikp_nic_ppp.c
|
||||||
|
+++ b/net/nic/nic_ppp/hikp_nic_ppp.c
|
||||||
|
@@ -482,8 +482,9 @@ static int hikp_nic_ppp_get_blk(struct hikp_cmd_header *req_header,
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
|
cmd_ret = hikp_cmd_alloc(req_header, req_data, sizeof(*req_data));
|
||||||
|
- if (cmd_ret == NULL)
|
||||||
|
- return -EIO;
|
||||||
|
+ ret = hikp_rsp_normal_check(cmd_ret);
|
||||||
|
+ if (ret)
|
||||||
|
+ goto out;
|
||||||
|
|
||||||
|
rsp = (struct nic_ppp_rsp *)cmd_ret->rsp_data;
|
||||||
|
if (rsp->rsp_head.cur_blk_size > buf_len) {
|
||||||
|
diff --git a/net/nic/nic_qos/hikp_nic_qos.c b/net/nic/nic_qos/hikp_nic_qos.c
|
||||||
|
index 2d55e45..6c2db1d 100644
|
||||||
|
--- a/net/nic/nic_qos/hikp_nic_qos.c
|
||||||
|
+++ b/net/nic/nic_qos/hikp_nic_qos.c
|
||||||
|
@@ -143,9 +143,10 @@ static int hikp_nic_qos_get_blk(struct hikp_cmd_header *req_header,
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
|
cmd_ret = hikp_cmd_alloc(req_header, req_data, sizeof(*req_data));
|
||||||
|
- if (cmd_ret == NULL) {
|
||||||
|
+ ret = hikp_rsp_normal_check(cmd_ret);
|
||||||
|
+ if (ret) {
|
||||||
|
HIKP_ERROR_PRINT("failed to get block-%u context.\n", req_data->block_id);
|
||||||
|
- return -EIO;
|
||||||
|
+ goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
rsp = (struct nic_qos_rsp *)cmd_ret->rsp_data;
|
||||||
|
diff --git a/net/nic/nic_queue/hikp_nic_queue.c b/net/nic/nic_queue/hikp_nic_queue.c
|
||||||
|
index 37460c0..f229e09 100644
|
||||||
|
--- a/net/nic/nic_queue/hikp_nic_queue.c
|
||||||
|
+++ b/net/nic/nic_queue/hikp_nic_queue.c
|
||||||
|
@@ -239,9 +239,10 @@ static int hikp_nic_queue_get_blk(struct hikp_cmd_header *req_header,
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
|
cmd_ret = hikp_cmd_alloc(req_header, req_data, sizeof(*req_data));
|
||||||
|
- if (cmd_ret == NULL) {
|
||||||
|
+ ret = hikp_rsp_normal_check(cmd_ret);
|
||||||
|
+ if (ret) {
|
||||||
|
HIKP_ERROR_PRINT("failed to get block-%u context.\n", req_data->block_id);
|
||||||
|
- return -EIO;
|
||||||
|
+ goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
rsp = (struct nic_queue_rsp *)cmd_ret->rsp_data;
|
||||||
|
diff --git a/net/nic/nic_rss/hikp_nic_rss.c b/net/nic/nic_rss/hikp_nic_rss.c
|
||||||
|
index b785ba4..5e4d261 100644
|
||||||
|
--- a/net/nic/nic_rss/hikp_nic_rss.c
|
||||||
|
+++ b/net/nic/nic_rss/hikp_nic_rss.c
|
||||||
|
@@ -357,9 +357,10 @@ static int hikp_nic_rss_get_blk(struct hikp_cmd_header *req_header,
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
|
cmd_ret = hikp_cmd_alloc(req_header, req_data, sizeof(*req_data));
|
||||||
|
- if (cmd_ret == NULL) {
|
||||||
|
+ ret = hikp_rsp_normal_check(cmd_ret);
|
||||||
|
+ if (ret) {
|
||||||
|
HIKP_ERROR_PRINT("failed to get block-%u context.\n", req_data->block_id);
|
||||||
|
- return -EIO;
|
||||||
|
+ goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
rsp = (struct nic_rss_rsp *)cmd_ret->rsp_data;
|
||||||
|
diff --git a/net/roce/roce_pkt/hikp_roce_pkt.c b/net/roce/roce_pkt/hikp_roce_pkt.c
|
||||||
|
index abfc526..d3bf885 100644
|
||||||
|
--- a/net/roce/roce_pkt/hikp_roce_pkt.c
|
||||||
|
+++ b/net/roce/roce_pkt/hikp_roce_pkt.c
|
||||||
|
@@ -48,15 +48,18 @@ static int hikp_roce_pkt_clear_set(struct major_cmd_ctrl *self, const char *argv
|
||||||
|
static int hikp_roce_pkt_get_data(struct hikp_cmd_ret **cmd_ret, struct roce_pkt_req_param req_data)
|
||||||
|
{
|
||||||
|
struct hikp_cmd_header req_header = { 0 };
|
||||||
|
+ int ret;
|
||||||
|
|
||||||
|
hikp_cmd_init(&req_header, ROCE_MOD, GET_ROCEE_PKT_CMD, 0);
|
||||||
|
*cmd_ret = hikp_cmd_alloc(&req_header, &req_data, sizeof(req_data));
|
||||||
|
- if (*cmd_ret == NULL) {
|
||||||
|
- printf("hikptool roce_pkt cmd_ret malloc failed\n");
|
||||||
|
- return -EIO;
|
||||||
|
+ ret = hikp_rsp_normal_check(*cmd_ret);
|
||||||
|
+ if (ret) {
|
||||||
|
+ printf("hikptool roce_pkt get cmd data failed, ret: %d\n", ret);
|
||||||
|
+ free(*cmd_ret);
|
||||||
|
+ *cmd_ret = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
- return 0;
|
||||||
|
+ return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void hikp_roce_pkt_print(uint32_t total_block_num,
|
||||||
|
diff --git a/net/roce/roce_scc/hikp_roce_scc.c b/net/roce/roce_scc/hikp_roce_scc.c
|
||||||
|
index 1011814..e8e166d 100644
|
||||||
|
--- a/net/roce/roce_scc/hikp_roce_scc.c
|
||||||
|
+++ b/net/roce/roce_scc/hikp_roce_scc.c
|
||||||
|
@@ -88,6 +88,7 @@ static int hikp_roce_scc_get_data(struct hikp_cmd_ret **cmd_ret, const uint32_t
|
||||||
|
{
|
||||||
|
struct roce_scc_req_param req_data = { 0 };
|
||||||
|
struct hikp_cmd_header req_header = { 0 };
|
||||||
|
+ int ret;
|
||||||
|
|
||||||
|
req_data.block_id = *block_id;
|
||||||
|
req_data.bdf = g_roce_scc_param_t.target.bdf;
|
||||||
|
@@ -99,12 +100,14 @@ static int hikp_roce_scc_get_data(struct hikp_cmd_ret **cmd_ret, const uint32_t
|
||||||
|
|
||||||
|
hikp_cmd_init(&req_header, ROCE_MOD, GET_ROCEE_SCC_CMD, g_roce_scc_param_t.sub_cmd);
|
||||||
|
*cmd_ret = hikp_cmd_alloc(&req_header, &req_data, sizeof(req_data));
|
||||||
|
- if (*cmd_ret == NULL) {
|
||||||
|
- printf("hikptool roce_scc cmd_ret malloc failed\n");
|
||||||
|
- return -EIO;
|
||||||
|
+ ret = hikp_rsp_normal_check(*cmd_ret);
|
||||||
|
+ if (ret) {
|
||||||
|
+ printf("hikptool roce_scc get cmd data failed, ret: %d\n", ret);
|
||||||
|
+ free(*cmd_ret);
|
||||||
|
+ *cmd_ret = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
- return 0;
|
||||||
|
+ return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void hikp_roce_scc_reg_data_free(uint32_t **offset, uint32_t **data)
|
||||||
|
diff --git a/net/roce/roce_trp/hikp_roce_trp.c b/net/roce/roce_trp/hikp_roce_trp.c
|
||||||
|
index bf22484..4591a47 100644
|
||||||
|
--- a/net/roce/roce_trp/hikp_roce_trp.c
|
||||||
|
+++ b/net/roce/roce_trp/hikp_roce_trp.c
|
||||||
|
@@ -112,6 +112,7 @@ static int hikp_roce_trp_get_data(struct hikp_cmd_ret **cmd_ret, const uint32_t
|
||||||
|
{
|
||||||
|
struct roce_trp_req_param req_data = { 0 };
|
||||||
|
struct hikp_cmd_header req_header = { 0 };
|
||||||
|
+ int ret;
|
||||||
|
|
||||||
|
req_data.block_id = *block_id;
|
||||||
|
req_data.bdf = g_roce_trp_param_t.target.bdf;
|
||||||
|
@@ -122,12 +123,14 @@ static int hikp_roce_trp_get_data(struct hikp_cmd_ret **cmd_ret, const uint32_t
|
||||||
|
}
|
||||||
|
hikp_cmd_init(&req_header, ROCE_MOD, GET_ROCEE_TRP_CMD, g_roce_trp_param_t.sub_cmd);
|
||||||
|
*cmd_ret = hikp_cmd_alloc(&req_header, &req_data, sizeof(req_data));
|
||||||
|
- if (*cmd_ret == NULL) {
|
||||||
|
- printf("hikptool roce_trp cmd_ret malloc failed\n");
|
||||||
|
- return -EIO;
|
||||||
|
+ ret = hikp_rsp_normal_check(*cmd_ret);
|
||||||
|
+ if (ret) {
|
||||||
|
+ printf("hikptool roce_trp get cmd data failed, ret: %d\n", ret);
|
||||||
|
+ free(*cmd_ret);
|
||||||
|
+ *cmd_ret = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
- return 0;
|
||||||
|
+ return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void hikp_roce_trp_reg_data_free(uint32_t **offset, uint32_t **data)
|
||||||
|
diff --git a/net/roce/roce_tsp/hikp_roce_tsp.c b/net/roce/roce_tsp/hikp_roce_tsp.c
|
||||||
|
index 5d06ede..ca3126b 100644
|
||||||
|
--- a/net/roce/roce_tsp/hikp_roce_tsp.c
|
||||||
|
+++ b/net/roce/roce_tsp/hikp_roce_tsp.c
|
||||||
|
@@ -122,6 +122,7 @@ static int hikp_roce_tsp_get_data(struct hikp_cmd_ret **cmd_ret,
|
||||||
|
struct roce_tsp_req_param req_data, uint32_t sub_cmd_code)
|
||||||
|
{
|
||||||
|
struct hikp_cmd_header req_header = { 0 };
|
||||||
|
+ int ret;
|
||||||
|
|
||||||
|
if (g_roce_tsp_param_t.sub_cmd_code == 0) {
|
||||||
|
printf("please enter module name: -m/--modlue\n");
|
||||||
|
@@ -129,12 +130,14 @@ static int hikp_roce_tsp_get_data(struct hikp_cmd_ret **cmd_ret,
|
||||||
|
}
|
||||||
|
hikp_cmd_init(&req_header, ROCE_MOD, GET_ROCEE_TSP_CMD, sub_cmd_code);
|
||||||
|
*cmd_ret = hikp_cmd_alloc(&req_header, &req_data, sizeof(req_data));
|
||||||
|
- if (*cmd_ret == NULL) {
|
||||||
|
- printf("hikptool roce_tsp cmd_ret malloc failed\n");
|
||||||
|
- return -EIO;
|
||||||
|
+ ret = hikp_rsp_normal_check(*cmd_ret);
|
||||||
|
+ if (ret) {
|
||||||
|
+ printf("hikptool roce_tsp get cmd data failed, ret: %d\n", ret);
|
||||||
|
+ free(*cmd_ret);
|
||||||
|
+ *cmd_ret = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
- return 0;
|
||||||
|
+ return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void hikp_roce_tsp_print(uint32_t total_block_num,
|
||||||
|
diff --git a/sas/sas_func/sas_analy_queue.c b/sas/sas_func/sas_analy_queue.c
|
||||||
|
index ce886b9..8fca197 100644
|
||||||
|
--- a/sas/sas_func/sas_analy_queue.c
|
||||||
|
+++ b/sas/sas_func/sas_analy_queue.c
|
||||||
|
@@ -40,8 +40,9 @@ static int sas_get_res(const struct tool_sas_cmd *cmd, uint32_t *reg_save, uint3
|
||||||
|
hikp_cmd_init(&req_header, SAS_MOD, SAS_ANACQ, ANACQ_PRT);
|
||||||
|
|
||||||
|
cmd_ret = hikp_cmd_alloc(&req_header, &req_data, sizeof(req_data));
|
||||||
|
- if (cmd_ret == NULL) {
|
||||||
|
+ if (cmd_ret == NULL || cmd_ret->status != 0) {
|
||||||
|
printf("sas_analy excutes hikp_cmd_alloc err\n");
|
||||||
|
+ free(cmd_ret);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
*reg_num = cmd_ret->rsp_data_num;
|
||||||
|
diff --git a/sas/sas_func/sas_dump_reg.c b/sas/sas_func/sas_dump_reg.c
|
||||||
|
index d012aa1..5736726 100644
|
||||||
|
--- a/sas/sas_func/sas_dump_reg.c
|
||||||
|
+++ b/sas/sas_func/sas_dump_reg.c
|
||||||
|
@@ -32,8 +32,9 @@ static int sas_get_reg(const struct tool_sas_cmd *cmd, uint32_t *reg_save, uint3
|
||||||
|
|
||||||
|
hikp_cmd_init(&req_header, SAS_MOD, SAS_DUMP, cmd->sas_cmd_type);
|
||||||
|
cmd_ret = hikp_cmd_alloc(&req_header, &req_data, sizeof(req_data));
|
||||||
|
- if (cmd_ret == NULL) {
|
||||||
|
+ if (cmd_ret == NULL || cmd_ret->status != 0) {
|
||||||
|
printf("sas_dump excutes hikp_cmd_alloc err\n");
|
||||||
|
+ free(cmd_ret);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
*reg_num = cmd_ret->rsp_data_num;
|
||||||
|
diff --git a/sas/sas_func/sas_read_dev.c b/sas/sas_func/sas_read_dev.c
|
||||||
|
index d01f95f..8b9b58d 100644
|
||||||
|
--- a/sas/sas_func/sas_read_dev.c
|
||||||
|
+++ b/sas/sas_func/sas_read_dev.c
|
||||||
|
@@ -33,8 +33,9 @@ static int sas_get_dev(const struct tool_sas_cmd *cmd, uint32_t *reg_save, uint3
|
||||||
|
|
||||||
|
hikp_cmd_init(&req_header, SAS_MOD, SAS_DEV, cmd->sas_cmd_type);
|
||||||
|
cmd_ret = hikp_cmd_alloc(&req_header, &req_data, sizeof(req_data));
|
||||||
|
- if (cmd_ret == NULL) {
|
||||||
|
+ if (cmd_ret == NULL || cmd_ret->status != 0) {
|
||||||
|
printf("sas_dqe excutes hikp_cmd_alloc err\n");
|
||||||
|
+ free(cmd_ret);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
*reg_num = cmd_ret->rsp_data_num;
|
||||||
|
diff --git a/sas/sas_func/sas_read_dqe.c b/sas/sas_func/sas_read_dqe.c
|
||||||
|
index 2f653df..dbd30f3 100644
|
||||||
|
--- a/sas/sas_func/sas_read_dqe.c
|
||||||
|
+++ b/sas/sas_func/sas_read_dqe.c
|
||||||
|
@@ -33,8 +33,9 @@ static int sas_get_dqe(const struct tool_sas_cmd *cmd, uint32_t *reg_save, uint3
|
||||||
|
|
||||||
|
hikp_cmd_init(&req_header, SAS_MOD, SAS_DQE, cmd->sas_cmd_type);
|
||||||
|
cmd_ret = hikp_cmd_alloc(&req_header, &req_data, sizeof(req_data));
|
||||||
|
- if (cmd_ret == NULL) {
|
||||||
|
+ if (cmd_ret == NULL || cmd_ret->status != 0) {
|
||||||
|
printf("sas_dqe excutes hikp_cmd_alloc err\n");
|
||||||
|
+ free(cmd_ret);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
*reg_num = cmd_ret->rsp_data_num;
|
||||||
|
diff --git a/sas/sas_func/sas_read_errcode.c b/sas/sas_func/sas_read_errcode.c
|
||||||
|
index 4f89bda..6c7850e 100644
|
||||||
|
--- a/sas/sas_func/sas_read_errcode.c
|
||||||
|
+++ b/sas/sas_func/sas_read_errcode.c
|
||||||
|
@@ -31,8 +31,9 @@ static int sas_get_errcode(const struct tool_sas_cmd *cmd, uint32_t *reg_save, u
|
||||||
|
|
||||||
|
hikp_cmd_init(&req_header, SAS_MOD, SAS_ERRCODE, cmd->sas_cmd_type);
|
||||||
|
cmd_ret = hikp_cmd_alloc(&req_header, &req_data, sizeof(req_data));
|
||||||
|
- if (cmd_ret == NULL) {
|
||||||
|
+ if (cmd_ret == NULL || cmd_ret->status != 0) {
|
||||||
|
printf("sas_errcode excutes hikp_cmd_alloc err\n");
|
||||||
|
+ free(cmd_ret);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
*reg_num = cmd_ret->rsp_data_num;
|
||||||
|
diff --git a/sata/sata_func/sata_dump_reg.c b/sata/sata_func/sata_dump_reg.c
|
||||||
|
index 86f6760..b4ff35f 100644
|
||||||
|
--- a/sata/sata_func/sata_dump_reg.c
|
||||||
|
+++ b/sata/sata_func/sata_dump_reg.c
|
||||||
|
@@ -33,8 +33,9 @@ static int sata_get_reg(const struct tool_sata_cmd *cmd, uint32_t *reg_save, uin
|
||||||
|
|
||||||
|
hikp_cmd_init(&req_header, SATA_MOD, SATA_DUMP, cmd->sata_cmd_type);
|
||||||
|
cmd_ret = hikp_cmd_alloc(&req_header, &req_data, sizeof(req_data));
|
||||||
|
- if (cmd_ret == NULL) {
|
||||||
|
+ if (cmd_ret == NULL || cmd_ret->status != 0) {
|
||||||
|
printf("hikp_data_proc err\n");
|
||||||
|
+ free(cmd_ret);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
*reg_num = cmd_ret->rsp_data_num;
|
||||||
|
diff --git a/serdes/hikp_serdes.c b/serdes/hikp_serdes.c
|
||||||
|
index 527fd53..320ded2 100644
|
||||||
|
--- a/serdes/hikp_serdes.c
|
||||||
|
+++ b/serdes/hikp_serdes.c
|
||||||
|
@@ -309,10 +309,10 @@ static void hikp_serdes_info_cmd_execute(struct major_cmd_ctrl *self)
|
||||||
|
|
||||||
|
hikp_cmd_init(&req_header, SERDES_MOD, SERDES_KEY_INFO, g_serdes_param.sub_cmd);
|
||||||
|
cmd_ret = hikp_cmd_alloc(&req_header, &hilink_cmd, sizeof(hilink_cmd));
|
||||||
|
- if (cmd_ret == NULL) {
|
||||||
|
+ if (cmd_ret == NULL || cmd_ret->status != 0) {
|
||||||
|
snprintf(self->err_str, sizeof(self->err_str), "hikp_cmd_alloc err.");
|
||||||
|
self->err_no = -EINVAL;
|
||||||
|
- return;
|
||||||
|
+ goto err_out;
|
||||||
|
}
|
||||||
|
out_out_header_size = sizeof(out_put.str_len) + sizeof(out_put.result_offset) +
|
||||||
|
sizeof(out_put.type) + sizeof(out_put.ret_val);
|
||||||
|
@@ -467,10 +467,10 @@ static void hikp_serdes_dump_cmd_execute(struct major_cmd_ctrl *self)
|
||||||
|
|
||||||
|
hikp_cmd_init(&req_header, SERDES_MOD, SERDES_DUMP_REG, g_serdes_param.sub_cmd);
|
||||||
|
cmd_ret = hikp_cmd_alloc(&req_header, &hilink_cmd, sizeof(hilink_cmd));
|
||||||
|
- if (cmd_ret == NULL) {
|
||||||
|
+ if (cmd_ret == NULL || cmd_ret->status != 0) {
|
||||||
|
self->err_no = -EINVAL;
|
||||||
|
snprintf(self->err_str, sizeof(self->err_str), "hikp_cmd_alloc err.");
|
||||||
|
- return;
|
||||||
|
+ goto err_out;
|
||||||
|
}
|
||||||
|
out_out_header_size = sizeof(out_put.str_len) + sizeof(out_put.result_offset) +
|
||||||
|
sizeof(out_put.type) + sizeof(out_put.ret_val);
|
||||||
|
diff --git a/socip/hikp_socip_dumpreg.c b/socip/hikp_socip_dumpreg.c
|
||||||
|
index 32325bb..0153dd9 100644
|
||||||
|
--- a/socip/hikp_socip_dumpreg.c
|
||||||
|
+++ b/socip/hikp_socip_dumpreg.c
|
||||||
|
@@ -141,9 +141,11 @@ static void hikp_socip_dumpreg_execute(struct major_cmd_ctrl *self)
|
||||||
|
req_data.controller_id = param[CONTROLLER_ID_INDEX].val;
|
||||||
|
hikp_cmd_init(&req_header, SOCIP_MOD, HIKP_SOCIP_CMD_DUMPREG, param[MODULE_ID_INDEX].val);
|
||||||
|
cmd_ret = hikp_cmd_alloc(&req_header, &req_data, sizeof(req_data));
|
||||||
|
- if (!cmd_ret) {
|
||||||
|
+ if (!cmd_ret || cmd_ret->status != 0) {
|
||||||
|
self->err_no = -EINVAL;
|
||||||
|
HIKP_ERROR_PRINT("hikp_cmd_alloc\n");
|
||||||
|
+ free(cmd_ret);
|
||||||
|
+ cmd_ret = NULL;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
--
|
||||||
|
2.36.1.windows.1
|
||||||
|
|
||||||
223
0033-hikptool-add-new-cmd-support-query-fault-notify-pkt-.patch
Normal file
223
0033-hikptool-add-new-cmd-support-query-fault-notify-pkt-.patch
Normal file
@ -0,0 +1,223 @@
|
|||||||
|
From b593a7e393147a0b9cf87640066d5f4932f8cd3c Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jijie Shao <shaojijie@huawei.com>
|
||||||
|
Date: Thu, 7 Sep 2023 14:40:42 +0800
|
||||||
|
Subject: [PATCH] hikptool: add new cmd support query fault notify pkt info
|
||||||
|
|
||||||
|
Add nic_notify_pkt cmd for query fault notify pkt info
|
||||||
|
|
||||||
|
Bugfix or Feature: Feature
|
||||||
|
|
||||||
|
Signed-off-by: Jijie Shao <shaojijie@huawei.com>
|
||||||
|
---
|
||||||
|
net/hikp_net_lib.h | 1 +
|
||||||
|
net/nic/nic_notify_pkt/hikp_nic_notify_pkt.c | 126 +++++++++++++++++++
|
||||||
|
net/nic/nic_notify_pkt/hikp_nic_notify_pkt.h | 52 ++++++++
|
||||||
|
3 files changed, 179 insertions(+)
|
||||||
|
create mode 100644 net/nic/nic_notify_pkt/hikp_nic_notify_pkt.c
|
||||||
|
create mode 100644 net/nic/nic_notify_pkt/hikp_nic_notify_pkt.h
|
||||||
|
|
||||||
|
diff --git a/net/hikp_net_lib.h b/net/hikp_net_lib.h
|
||||||
|
index ed984ce..06ae598 100644
|
||||||
|
--- a/net/hikp_net_lib.h
|
||||||
|
+++ b/net/hikp_net_lib.h
|
||||||
|
@@ -79,6 +79,7 @@ enum nic_cmd_type {
|
||||||
|
GET_FEC_INFO_CMD,
|
||||||
|
GET_GRO_INFO_CMD,
|
||||||
|
GET_NCSI_INFO_CMD,
|
||||||
|
+ GET_NOTIFY_PKT_CMD,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum roh_cmd_type {
|
||||||
|
diff --git a/net/nic/nic_notify_pkt/hikp_nic_notify_pkt.c b/net/nic/nic_notify_pkt/hikp_nic_notify_pkt.c
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..307d336
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/net/nic/nic_notify_pkt/hikp_nic_notify_pkt.c
|
||||||
|
@@ -0,0 +1,126 @@
|
||||||
|
+/*
|
||||||
|
+ * Copyright (c) 2023 Hisilicon Technologies Co., Ltd.
|
||||||
|
+ * Hikptool is licensed under Mulan PSL v2.
|
||||||
|
+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||||
|
+ * You may obtain a copy of Mulan PSL v2 at:
|
||||||
|
+ * http://license.coscl.org.cn/MulanPSL2
|
||||||
|
+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||||
|
+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||||
|
+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||||
|
+ *
|
||||||
|
+ * See the Mulan PSL v2 for more details.
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+#include <stdio.h>
|
||||||
|
+#include <string.h>
|
||||||
|
+#include <sys/types.h>
|
||||||
|
+#include <unistd.h>
|
||||||
|
+#include "hikp_nic_notify_pkt.h"
|
||||||
|
+
|
||||||
|
+static struct tool_target g_notify_pkt_target;
|
||||||
|
+
|
||||||
|
+static int hikp_nic_notify_pkt_query(struct major_cmd_ctrl *self, const struct bdf_t *bdf,
|
||||||
|
+ struct nic_notify_pkt_info *info)
|
||||||
|
+{
|
||||||
|
+ struct nic_notify_pkt_req_para req = { 0 };
|
||||||
|
+ struct hikp_cmd_header header = { 0 };
|
||||||
|
+ struct nic_notify_pkt_rsp *rsp;
|
||||||
|
+ struct hikp_cmd_ret *cmd_resp;
|
||||||
|
+
|
||||||
|
+ req.bdf = *bdf;
|
||||||
|
+ hikp_cmd_init(&header, NIC_MOD, GET_NOTIFY_PKT_CMD, GET_NOTIFY_PKT_CMD);
|
||||||
|
+ cmd_resp = hikp_cmd_alloc(&header, &req, sizeof(req));
|
||||||
|
+ self->err_no = hikp_rsp_normal_check(cmd_resp);
|
||||||
|
+ if (self->err_no) {
|
||||||
|
+ snprintf(self->err_str, sizeof(self->err_str), "get notify pkt failed.");
|
||||||
|
+ if (cmd_resp)
|
||||||
|
+ free(cmd_resp);
|
||||||
|
+ return self->err_no;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ rsp = (struct nic_notify_pkt_rsp *)cmd_resp->rsp_data;
|
||||||
|
+ *info = *(struct nic_notify_pkt_info *)rsp->data;
|
||||||
|
+ free(cmd_resp);
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void hikp_nic_notify_pkt_show(const struct nic_notify_pkt_info *info)
|
||||||
|
+{
|
||||||
|
+#define HIKP_NIC_NOFITY_PKT_DATA_PEER_LINE_MAX_CNT 16
|
||||||
|
+
|
||||||
|
+ uint32_t pkt_start_en = hikp_get_bit(info->cfg, HIKP_NOTIFY_PKT_CFG_START_EN);
|
||||||
|
+ uint32_t pkt_num = hikp_get_field(info->cfg, HIKP_NOTIFY_PKT_CFG_PKT_NUM_M,
|
||||||
|
+ HIKP_NOTIFY_PKT_CFG_PKT_NUM_S);
|
||||||
|
+ uint32_t pkt_en = hikp_get_bit(info->cfg, HIKP_NOTIFY_PKT_CFG_PKT_EN);
|
||||||
|
+ uint32_t i;
|
||||||
|
+
|
||||||
|
+ printf("################ NIC notify pkt info ##################\n");
|
||||||
|
+ printf("pkt_en : %u\n", pkt_en);
|
||||||
|
+ printf("pkt_start_en : %u\n", pkt_start_en);
|
||||||
|
+ printf("pkt_num : %u\n", pkt_num);
|
||||||
|
+ printf("pkt_ipg : %u %s\n", info->ipg, info->ipg > 1 ?
|
||||||
|
+ "clock cycles" : "clock cycle");
|
||||||
|
+
|
||||||
|
+ printf("pkt_data:\n");
|
||||||
|
+ for (i = 1; i <= NIC_NOTIFY_PKT_DATA_LEN; i++) {
|
||||||
|
+ printf("%02x ", info->data[i - 1]);
|
||||||
|
+ if (i % HIKP_NIC_NOFITY_PKT_DATA_PEER_LINE_MAX_CNT == 0)
|
||||||
|
+ printf("\n");
|
||||||
|
+ }
|
||||||
|
+ printf("####################### END ###########################\n");
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void hikp_nic_notify_pkt_cmd_execute(struct major_cmd_ctrl *self)
|
||||||
|
+{
|
||||||
|
+ struct bdf_t *bdf = &g_notify_pkt_target.bdf;
|
||||||
|
+ struct nic_notify_pkt_info info;
|
||||||
|
+
|
||||||
|
+ self->err_no = hikp_nic_notify_pkt_query(self, bdf, &info);
|
||||||
|
+ if (self->err_no)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ hikp_nic_notify_pkt_show(&info);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int hikp_nic_notify_pkt_cmd_help(struct major_cmd_ctrl *self, const char *argv)
|
||||||
|
+{
|
||||||
|
+ printf("\n Usage: %s %s\n", self->cmd_ptr->name, "-i <device>");
|
||||||
|
+ printf("\n %s\n", self->cmd_ptr->help_info);
|
||||||
|
+ printf("\n Options:\n\n");
|
||||||
|
+ printf(" %s, %-25s %s\n", "-h", "--help", "display this help and exit");
|
||||||
|
+ printf(" %s, %-25s %s\n", "-i", "--interface=<interface>",
|
||||||
|
+ "device target or bdf id, e.g. eth0~7 or 0000:35:00.0");
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int hikp_nic_notify_pkt_get_target(struct major_cmd_ctrl *self, const char *argv)
|
||||||
|
+{
|
||||||
|
+ self->err_no = tool_check_and_get_valid_bdf_id(argv, &g_notify_pkt_target);
|
||||||
|
+ if (self->err_no != 0) {
|
||||||
|
+ snprintf(self->err_str, sizeof(self->err_str), "unknown device!");
|
||||||
|
+ return self->err_no;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (g_notify_pkt_target.bdf.dev_id != 0) {
|
||||||
|
+ snprintf(self->err_str, sizeof(self->err_str), "VF does not support query!");
|
||||||
|
+ self->err_no = -EOPNOTSUPP;
|
||||||
|
+ return self->err_no;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void cmd_nic_notify_pkt_init(void)
|
||||||
|
+{
|
||||||
|
+ struct major_cmd_ctrl *major_cmd = get_major_cmd();
|
||||||
|
+
|
||||||
|
+ major_cmd->option_count = 0;
|
||||||
|
+ major_cmd->execute = hikp_nic_notify_pkt_cmd_execute;
|
||||||
|
+
|
||||||
|
+ cmd_option_register("-h", "--help", false, hikp_nic_notify_pkt_cmd_help);
|
||||||
|
+ cmd_option_register("-i", "--interface", true, hikp_nic_notify_pkt_get_target);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+HIKP_CMD_DECLARE("nic_notify_pkt", "dump notify pkt info of nic!", cmd_nic_notify_pkt_init);
|
||||||
|
diff --git a/net/nic/nic_notify_pkt/hikp_nic_notify_pkt.h b/net/nic/nic_notify_pkt/hikp_nic_notify_pkt.h
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..8bdb795
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/net/nic/nic_notify_pkt/hikp_nic_notify_pkt.h
|
||||||
|
@@ -0,0 +1,52 @@
|
||||||
|
+/*
|
||||||
|
+ * Copyright (c) 2023 Hisilicon Technologies Co., Ltd.
|
||||||
|
+ * Hikptool is licensed under Mulan PSL v2.
|
||||||
|
+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||||
|
+ * You may obtain a copy of Mulan PSL v2 at:
|
||||||
|
+ * http://license.coscl.org.cn/MulanPSL2
|
||||||
|
+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||||
|
+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||||
|
+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||||
|
+ *
|
||||||
|
+ * See the Mulan PSL v2 for more details.
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+#ifndef HIKP_NIC_NOTIFY_PKT_H
|
||||||
|
+#define HIKP_NIC_NOTIFY_PKT_H
|
||||||
|
+
|
||||||
|
+#include "hikp_net_lib.h"
|
||||||
|
+
|
||||||
|
+enum nic_notify_pkt_sub_cmd_type {
|
||||||
|
+ NIC_NOTIFY_PKT_DUMP = 0,
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+struct nic_notify_pkt_req_para {
|
||||||
|
+ struct bdf_t bdf;
|
||||||
|
+ uint32_t block_id;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+struct nic_notify_pkt_rsp_head {
|
||||||
|
+ uint8_t total_blk_num;
|
||||||
|
+ uint8_t curr_blk_size; /* real data size, not contain head size. */
|
||||||
|
+ uint16_t rsv;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+#define NIC_NOTIFY_PKT_MAX_RSP_DATA 18
|
||||||
|
+struct nic_notify_pkt_rsp {
|
||||||
|
+ struct nic_notify_pkt_rsp_head head;
|
||||||
|
+ uint32_t data[NIC_NOTIFY_PKT_MAX_RSP_DATA];
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+#define NIC_NOTIFY_PKT_DATA_LEN 64
|
||||||
|
+struct nic_notify_pkt_info {
|
||||||
|
+ uint32_t cfg;
|
||||||
|
+ uint32_t ipg;
|
||||||
|
+ uint8_t data[NIC_NOTIFY_PKT_DATA_LEN];
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+#define HIKP_NOTIFY_PKT_CFG_PKT_EN 0
|
||||||
|
+#define HIKP_NOTIFY_PKT_CFG_START_EN 1
|
||||||
|
+#define HIKP_NOTIFY_PKT_CFG_PKT_NUM_M GENMASK(5, 2)
|
||||||
|
+#define HIKP_NOTIFY_PKT_CFG_PKT_NUM_S 2
|
||||||
|
+
|
||||||
|
+#endif /* HIKP_NIC_NOTIFY_PKT_H */
|
||||||
|
--
|
||||||
|
2.30.0
|
||||||
|
|
||||||
238
0034-hikptool-add-new-cmd-to-support-query-port-fault-inf.patch
Normal file
238
0034-hikptool-add-new-cmd-to-support-query-port-fault-inf.patch
Normal file
@ -0,0 +1,238 @@
|
|||||||
|
From 84d1e8a09e69ffe3809f0e4fa27d586c7ef8c706 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jie Wang <wangjie125@huawei.com>
|
||||||
|
Date: Mon, 28 Aug 2023 10:35:19 +0800
|
||||||
|
Subject: [PATCH] hikptool: add new cmd to support query port fault info
|
||||||
|
|
||||||
|
Add nic port fault cmd for query nic port fault status.
|
||||||
|
|
||||||
|
Bugfix or Feature: Feature
|
||||||
|
|
||||||
|
Signed-off-by: Jie Wang <wangjie125@huawei.com>
|
||||||
|
---
|
||||||
|
net/hikp_net_lib.h | 1 +
|
||||||
|
net/nic/nic_ft/hikp_nic_port_fault.c | 139 +++++++++++++++++++++++++++
|
||||||
|
net/nic/nic_ft/hikp_nic_port_fault.h | 54 +++++++++++
|
||||||
|
3 files changed, 194 insertions(+)
|
||||||
|
create mode 100644 net/nic/nic_ft/hikp_nic_port_fault.c
|
||||||
|
create mode 100644 net/nic/nic_ft/hikp_nic_port_fault.h
|
||||||
|
|
||||||
|
diff --git a/net/hikp_net_lib.h b/net/hikp_net_lib.h
|
||||||
|
index 06ae598..cb537ff 100644
|
||||||
|
--- a/net/hikp_net_lib.h
|
||||||
|
+++ b/net/hikp_net_lib.h
|
||||||
|
@@ -80,6 +80,7 @@ enum nic_cmd_type {
|
||||||
|
GET_GRO_INFO_CMD,
|
||||||
|
GET_NCSI_INFO_CMD,
|
||||||
|
GET_NOTIFY_PKT_CMD,
|
||||||
|
+ GET_PORT_FAULT_STATUS = 0xE,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum roh_cmd_type {
|
||||||
|
diff --git a/net/nic/nic_ft/hikp_nic_port_fault.c b/net/nic/nic_ft/hikp_nic_port_fault.c
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..fd94214
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/net/nic/nic_ft/hikp_nic_port_fault.c
|
||||||
|
@@ -0,0 +1,139 @@
|
||||||
|
+/*
|
||||||
|
+ * Copyright (c) 2023 Hisilicon Technologies Co., Ltd.
|
||||||
|
+ * Hikptool is licensed under Mulan PSL v2.
|
||||||
|
+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||||
|
+ * You may obtain a copy of Mulan PSL v2 at:
|
||||||
|
+ * http://license.coscl.org.cn/MulanPSL2
|
||||||
|
+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||||
|
+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||||
|
+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||||
|
+ *
|
||||||
|
+ * See the Mulan PSL v2 for more details.
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+#include <stdio.h>
|
||||||
|
+#include <string.h>
|
||||||
|
+#include <sys/types.h>
|
||||||
|
+#include <unistd.h>
|
||||||
|
+#include "hikp_nic_port_fault.h"
|
||||||
|
+
|
||||||
|
+static struct tool_target g_port_fault_target;
|
||||||
|
+
|
||||||
|
+static int hikp_nic_port_fault_query(const struct bdf_t *bdf,
|
||||||
|
+ struct nic_port_fault_status *info)
|
||||||
|
+{
|
||||||
|
+ struct nic_port_fault_req_para req = { 0 };
|
||||||
|
+ struct hikp_cmd_header header = { 0 };
|
||||||
|
+ struct nic_port_fault_rsp *rsp;
|
||||||
|
+ struct hikp_cmd_ret *cmd_ret;
|
||||||
|
+
|
||||||
|
+ req.bdf = *bdf;
|
||||||
|
+ hikp_cmd_init(&header, NIC_MOD, GET_PORT_FAULT_STATUS,
|
||||||
|
+ NIC_PORT_FAULT_INFO_DUMP);
|
||||||
|
+ cmd_ret = hikp_cmd_alloc(&header, &req, sizeof(req));
|
||||||
|
+ if (cmd_ret == NULL || cmd_ret->status != 0) {
|
||||||
|
+ HIKP_ERROR_PRINT("fail to get port fault, retcode: %u\n",
|
||||||
|
+ cmd_ret ? cmd_ret->status : EIO);
|
||||||
|
+ if (cmd_ret != NULL)
|
||||||
|
+ free(cmd_ret);
|
||||||
|
+
|
||||||
|
+ return -EIO;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ rsp = (struct nic_port_fault_rsp *)cmd_ret->rsp_data;
|
||||||
|
+ *info = *(struct nic_port_fault_status *)rsp->data;
|
||||||
|
+ free(cmd_ret);
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void hikp_nic_format_port_fault_info(struct nic_port_fault_status *info)
|
||||||
|
+{
|
||||||
|
+ if (info->cdr_core_status > NIC_PORT_FAULT_INVALID)
|
||||||
|
+ info->cdr_core_status = NIC_PORT_FAULT_INVALID;
|
||||||
|
+
|
||||||
|
+ if (info->cdr_flash_status > NIC_PORT_FAULT_INVALID)
|
||||||
|
+ info->cdr_flash_status = NIC_PORT_FAULT_INVALID;
|
||||||
|
+
|
||||||
|
+ if (info->fault_9545_status > NIC_PORT_FAULT_INVALID)
|
||||||
|
+ info->fault_9545_status = NIC_PORT_FAULT_INVALID;
|
||||||
|
+
|
||||||
|
+ if (info->hilink_ref_status > NIC_PORT_FAULT_INVALID)
|
||||||
|
+ info->hilink_ref_status = NIC_PORT_FAULT_INVALID;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void hikp_nic_port_fault_show(struct nic_port_fault_status *info)
|
||||||
|
+{
|
||||||
|
+ const char *port_fault_info[] = {
|
||||||
|
+ "OK",
|
||||||
|
+ "Device error",
|
||||||
|
+ "Device not support",
|
||||||
|
+ "Invalid"
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ hikp_nic_format_port_fault_info(info);
|
||||||
|
+ printf("############ NIC port fault status ###############\n");
|
||||||
|
+ printf("cdr flash : %s.\n", port_fault_info[info->cdr_flash_status]);
|
||||||
|
+ printf("cdr core : %s.\n", port_fault_info[info->cdr_core_status]);
|
||||||
|
+ printf("9545 fault: %s.\n", port_fault_info[info->fault_9545_status]);
|
||||||
|
+ printf("hilink ref: %s.\n", port_fault_info[info->hilink_ref_status]);
|
||||||
|
+ printf("#################### END #######################\n");
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void hikp_nic_port_fault_cmd_execute(struct major_cmd_ctrl *self)
|
||||||
|
+{
|
||||||
|
+ struct bdf_t *bdf = &g_port_fault_target.bdf;
|
||||||
|
+ struct nic_port_fault_status info;
|
||||||
|
+ int ret;
|
||||||
|
+
|
||||||
|
+ ret = hikp_nic_port_fault_query(bdf, &info);
|
||||||
|
+ if (ret != 0) {
|
||||||
|
+ snprintf(self->err_str, sizeof(self->err_str), "fail to get fault info.");
|
||||||
|
+ self->err_no = ret;
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ hikp_nic_port_fault_show(&info);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int hikp_nic_port_fault_cmd_help(struct major_cmd_ctrl *self, const char *argv)
|
||||||
|
+{
|
||||||
|
+ printf("\n Usage: %s %s\n", self->cmd_ptr->name, "-i <device>");
|
||||||
|
+ printf("\n %s\n", self->cmd_ptr->help_info);
|
||||||
|
+ printf("\n Options:\n\n");
|
||||||
|
+ printf(" %s, %-25s %s\n", "-h", "--help", "display this help and exit");
|
||||||
|
+ printf(" %s, %-25s %s\n", "-i", "--interface=<interface>",
|
||||||
|
+ "device target or bdf id, e.g. eth0~7 or 0000:35:00.0");
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int hikp_nic_port_fault_get_target(struct major_cmd_ctrl *self, const char *argv)
|
||||||
|
+{
|
||||||
|
+ self->err_no = tool_check_and_get_valid_bdf_id(argv, &g_port_fault_target);
|
||||||
|
+ if (self->err_no != 0) {
|
||||||
|
+ snprintf(self->err_str, sizeof(self->err_str), "unknown device!");
|
||||||
|
+ return self->err_no;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (g_port_fault_target.bdf.dev_id != 0) {
|
||||||
|
+ snprintf(self->err_str, sizeof(self->err_str), "VF is not supported!");
|
||||||
|
+ self->err_no = -EOPNOTSUPP;
|
||||||
|
+ return self->err_no;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void cmd_nic_port_fault_init(void)
|
||||||
|
+{
|
||||||
|
+ struct major_cmd_ctrl *major_cmd = get_major_cmd();
|
||||||
|
+
|
||||||
|
+ major_cmd->option_count = 0;
|
||||||
|
+ major_cmd->execute = hikp_nic_port_fault_cmd_execute;
|
||||||
|
+
|
||||||
|
+ cmd_option_register("-h", "--help", false, hikp_nic_port_fault_cmd_help);
|
||||||
|
+ cmd_option_register("-i", "--interface", true, hikp_nic_port_fault_get_target);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+HIKP_CMD_DECLARE("nic_port_fault", "dump port fault of nic!", cmd_nic_port_fault_init);
|
||||||
|
diff --git a/net/nic/nic_ft/hikp_nic_port_fault.h b/net/nic/nic_ft/hikp_nic_port_fault.h
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..7db54f7
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/net/nic/nic_ft/hikp_nic_port_fault.h
|
||||||
|
@@ -0,0 +1,54 @@
|
||||||
|
+/*
|
||||||
|
+ * Copyright (c) 2023 Hisilicon Technologies Co., Ltd.
|
||||||
|
+ * Hikptool is licensed under Mulan PSL v2.
|
||||||
|
+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||||
|
+ * You may obtain a copy of Mulan PSL v2 at:
|
||||||
|
+ * http://license.coscl.org.cn/MulanPSL2
|
||||||
|
+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||||
|
+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||||
|
+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||||
|
+ *
|
||||||
|
+ * See the Mulan PSL v2 for more details.
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+#ifndef HIKP_NIC_PORT_FAULT_H
|
||||||
|
+#define HIKP_NIC_PORT_FAULT_H
|
||||||
|
+
|
||||||
|
+#include "hikp_net_lib.h"
|
||||||
|
+
|
||||||
|
+enum nic_port_fault_sub_cmd_type {
|
||||||
|
+ NIC_PORT_FAULT_INFO_DUMP,
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+enum nic_port_fault_info_type {
|
||||||
|
+ NIC_PORT_FAULT_OK,
|
||||||
|
+ NIC_PORT_FAULT_ERR,
|
||||||
|
+ NIC_PORT_FAULT_NOTSUP,
|
||||||
|
+ NIC_PORT_FAULT_INVALID
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+struct nic_port_fault_req_para {
|
||||||
|
+ struct bdf_t bdf;
|
||||||
|
+ uint8_t block_id;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+struct nic_port_fault_rsp_head {
|
||||||
|
+ uint8_t total_blk_num;
|
||||||
|
+ uint8_t curr_blk_size;
|
||||||
|
+ uint16_t rsv;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+#define NIC_PORT_FAULT_MAX_RSP_DATA 1
|
||||||
|
+struct nic_port_fault_rsp {
|
||||||
|
+ struct nic_port_fault_rsp_head head;
|
||||||
|
+ uint32_t data[NIC_PORT_FAULT_MAX_RSP_DATA];
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+struct nic_port_fault_status {
|
||||||
|
+ uint8_t cdr_flash_status;
|
||||||
|
+ uint8_t fault_9545_status;
|
||||||
|
+ uint8_t cdr_core_status;
|
||||||
|
+ uint8_t hilink_ref_status;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+#endif /* HIKP_NIC_PORT_FAULT_H */
|
||||||
|
--
|
||||||
|
2.30.0
|
||||||
|
|
||||||
240
0035-hikptool-support-to-query-pfc-storm-parameters.patch
Normal file
240
0035-hikptool-support-to-query-pfc-storm-parameters.patch
Normal file
@ -0,0 +1,240 @@
|
|||||||
|
From 134f0a4dbcc5bc7636bcc5d9553c147b0eac99aa Mon Sep 17 00:00:00 2001
|
||||||
|
From: Peiyang Wang <wangpeiyang1@huawei.com>
|
||||||
|
Date: Mon, 11 Sep 2023 19:04:48 +0800
|
||||||
|
Subject: [PATCH] hikptool: support to query pfc storm parameters
|
||||||
|
|
||||||
|
Add new feature in nic_qos to support query pfc storm parameters info.
|
||||||
|
|
||||||
|
Bugfix or Feature: Feature
|
||||||
|
|
||||||
|
Signed-off-by: Peiyang Wang <wangpeiyang1@huawei.com>
|
||||||
|
---
|
||||||
|
net/nic/nic_qos/hikp_nic_qos.c | 72 ++++++++++++++++++++++++++++++++--
|
||||||
|
net/nic/nic_qos/hikp_nic_qos.h | 20 ++++++++++
|
||||||
|
2 files changed, 89 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/net/nic/nic_qos/hikp_nic_qos.c b/net/nic/nic_qos/hikp_nic_qos.c
|
||||||
|
index 6c2db1d..e3f0e9c 100644
|
||||||
|
--- a/net/nic/nic_qos/hikp_nic_qos.c
|
||||||
|
+++ b/net/nic/nic_qos/hikp_nic_qos.c
|
||||||
|
@@ -17,17 +17,21 @@
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include "hikp_nic_qos.h"
|
||||||
|
+#include "hikpt_rciep.h"
|
||||||
|
|
||||||
|
static struct nic_qos_param g_qos_param = { 0 };
|
||||||
|
|
||||||
|
static void hikp_nic_qos_show_pkt_buf(const void *data);
|
||||||
|
static void hikp_nic_qos_show_dcb_info(const void *data);
|
||||||
|
static void hikp_nic_qos_show_pause_info(const void *data);
|
||||||
|
+static void hikp_nic_qos_show_pfc_storm_para(const void *data);
|
||||||
|
|
||||||
|
static const struct qos_feature_cmd g_qos_feature_cmd[] = {
|
||||||
|
{"pkt_buf", NIC_PACKET_BUFFER_DUMP, hikp_nic_qos_show_pkt_buf},
|
||||||
|
{"dcb", NIC_DCB_DUMP, hikp_nic_qos_show_dcb_info},
|
||||||
|
{"pause", NIC_PAUSE_DUMP, hikp_nic_qos_show_pause_info},
|
||||||
|
+ {"pfc_storm_para", NIC_PFC_STORM_PARA_DUMP,
|
||||||
|
+ hikp_nic_qos_show_pfc_storm_para},
|
||||||
|
};
|
||||||
|
|
||||||
|
static int hikp_nic_qos_cmd_help(struct major_cmd_ctrl *self, const char *argv)
|
||||||
|
@@ -42,8 +46,12 @@ static int hikp_nic_qos_cmd_help(struct major_cmd_ctrl *self, const char *argv)
|
||||||
|
"[-g/--get <options>]\n"
|
||||||
|
" pkt_buf : get nic packet buffer.\n"
|
||||||
|
" dcb : get dcb information.\n"
|
||||||
|
- " pause : get pause information\n");
|
||||||
|
-
|
||||||
|
+ " pause : get pause information\n"
|
||||||
|
+ " pfc_storm_para : get pfc storm configuration parameters\n");
|
||||||
|
+ printf(" %s\n",
|
||||||
|
+ "[-d/--dir <options>]\n"
|
||||||
|
+ " tx : transmit.\n"
|
||||||
|
+ " rx : receive.\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -134,6 +142,22 @@ static void hikp_nic_qos_show_pause_info(const void *data)
|
||||||
|
printf("pause gap: 0x%x\n", pause->pause_gap);
|
||||||
|
}
|
||||||
|
|
||||||
|
+static void hikp_nic_qos_show_pfc_storm_para(const void *data)
|
||||||
|
+{
|
||||||
|
+ struct nic_pfc_storm_para *pfc_storm_para =
|
||||||
|
+ (struct nic_pfc_storm_para *)data;
|
||||||
|
+
|
||||||
|
+ printf("PFC STORM Information:\n");
|
||||||
|
+ printf("direction: %s\n", pfc_storm_para->dir ? "tx" : "rx");
|
||||||
|
+ printf("enabled: %s\n", pfc_storm_para->enable ? "on" : "off");
|
||||||
|
+ printf("period: %ums\n", pfc_storm_para->period_ms);
|
||||||
|
+ strncmp(g_qos_param.revision_id, HIKP_IEP_REVISION,
|
||||||
|
+ MAX_PCI_REVISION_LEN) ?
|
||||||
|
+ printf("check times: %u\n", pfc_storm_para->times) :
|
||||||
|
+ printf("pfc threshold: %ums\n", pfc_storm_para->times);
|
||||||
|
+ printf("recovery period: %ums\n", pfc_storm_para->recovery_period_ms);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static int hikp_nic_qos_get_blk(struct hikp_cmd_header *req_header,
|
||||||
|
const struct nic_qos_req_para *req_data,
|
||||||
|
void *buf, size_t buf_len, struct nic_qos_rsp_head *rsp_head)
|
||||||
|
@@ -181,6 +205,8 @@ static int hikp_nic_query_qos_feature(struct hikp_cmd_header *req_header, const
|
||||||
|
req_data.bdf = *bdf;
|
||||||
|
|
||||||
|
req_data.block_id = blk_id;
|
||||||
|
+ req_data.dir = g_qos_param.dir;
|
||||||
|
+
|
||||||
|
ret = hikp_nic_qos_get_blk(req_header, &req_data, data, buf_len, &rsp_head);
|
||||||
|
if (ret != 0)
|
||||||
|
return ret;
|
||||||
|
@@ -191,6 +217,8 @@ static int hikp_nic_query_qos_feature(struct hikp_cmd_header *req_header, const
|
||||||
|
/* Copy the remaining block content if total block number is greater than 1. */
|
||||||
|
for (blk_id = 1; blk_id < total_blk_num; blk_id++) {
|
||||||
|
req_data.block_id = blk_id;
|
||||||
|
+ req_data.dir = g_qos_param.dir;
|
||||||
|
+
|
||||||
|
ret = hikp_nic_qos_get_blk(req_header, &req_data,
|
||||||
|
(uint8_t *)data + total_blk_size,
|
||||||
|
buf_len - total_blk_size, &rsp_head);
|
||||||
|
@@ -204,10 +232,11 @@ static int hikp_nic_query_qos_feature(struct hikp_cmd_header *req_header, const
|
||||||
|
|
||||||
|
static void hikp_nic_qos_cmd_execute(struct major_cmd_ctrl *self)
|
||||||
|
{
|
||||||
|
+ char *revision_id = g_qos_param.revision_id;
|
||||||
|
struct bdf_t *bdf = &g_qos_param.target.bdf;
|
||||||
|
union nic_qos_feature_info qos_data = {0};
|
||||||
|
- const struct qos_feature_cmd *qos_cmd;
|
||||||
|
struct hikp_cmd_header req_header = {0};
|
||||||
|
+ const struct qos_feature_cmd *qos_cmd;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
if (bdf->dev_id != 0) {
|
||||||
|
@@ -223,6 +252,15 @@ static void hikp_nic_qos_cmd_execute(struct major_cmd_ctrl *self)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ if (g_qos_param.feature_idx == NIC_PFC_STORM_PARA_DUMP &&
|
||||||
|
+ g_qos_param.dir == NIC_QUEUE_DIR_NONE) {
|
||||||
|
+ hikp_nic_qos_cmd_help(self, NULL);
|
||||||
|
+ snprintf(self->err_str, sizeof(self->err_str),
|
||||||
|
+ "-d/--dir param error!");
|
||||||
|
+ self->err_no = -EINVAL;
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
qos_cmd = &g_qos_feature_cmd[g_qos_param.feature_idx];
|
||||||
|
hikp_cmd_init(&req_header, NIC_MOD, GET_QOS_INFO_CMD, qos_cmd->sub_cmd_code);
|
||||||
|
ret = hikp_nic_query_qos_feature(&req_header, &g_qos_param.target.bdf, &qos_data);
|
||||||
|
@@ -233,6 +271,13 @@ static void hikp_nic_qos_cmd_execute(struct major_cmd_ctrl *self)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ memset(revision_id, 0, MAX_PCI_ID_LEN + 1);
|
||||||
|
+ ret = get_revision_id_by_bdf(bdf, revision_id);
|
||||||
|
+ // show pfc threshold as default if get revision_id error
|
||||||
|
+ if (ret)
|
||||||
|
+ strncpy(g_qos_param.revision_id, HIKP_IEP_REVISION,
|
||||||
|
+ MAX_PCI_REVISION_LEN);
|
||||||
|
+
|
||||||
|
printf("############## NIC QOS: %s info ############\n", qos_cmd->feature_name);
|
||||||
|
qos_cmd->show(&qos_data);
|
||||||
|
printf("#################### END #######################\n");
|
||||||
|
@@ -268,11 +313,31 @@ static int hikp_nic_cmd_qos_feature_select(struct major_cmd_ctrl *self, const ch
|
||||||
|
return self->err_no;
|
||||||
|
}
|
||||||
|
|
||||||
|
+static int hikp_nic_cmd_qos_direct(struct major_cmd_ctrl *self,
|
||||||
|
+ const char *argv)
|
||||||
|
+{
|
||||||
|
+ if (strcmp(argv, "rx") == 0) {
|
||||||
|
+ g_qos_param.dir = NIC_RX_QUEUE;
|
||||||
|
+ return 0;
|
||||||
|
+ }
|
||||||
|
+ if (strcmp(argv, "tx") == 0) {
|
||||||
|
+ g_qos_param.dir = NIC_TX_QUEUE;
|
||||||
|
+ return 0;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ snprintf(self->err_str, sizeof(self->err_str),
|
||||||
|
+ "-d/--dir option is invalid.");
|
||||||
|
+ self->err_no = -EINVAL;
|
||||||
|
+
|
||||||
|
+ return self->err_no;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static void cmd_nic_get_qos_init(void)
|
||||||
|
{
|
||||||
|
struct major_cmd_ctrl *major_cmd = get_major_cmd();
|
||||||
|
|
||||||
|
g_qos_param.feature_idx = -1;
|
||||||
|
+ g_qos_param.dir = NIC_QUEUE_DIR_NONE;
|
||||||
|
|
||||||
|
major_cmd->option_count = 0;
|
||||||
|
major_cmd->execute = hikp_nic_qos_cmd_execute;
|
||||||
|
@@ -280,6 +345,7 @@ static void cmd_nic_get_qos_init(void)
|
||||||
|
cmd_option_register("-h", "--help", false, hikp_nic_qos_cmd_help);
|
||||||
|
cmd_option_register("-i", "--interface", true, hikp_nic_cmd_get_qos_target);
|
||||||
|
cmd_option_register("-g", "--get", true, hikp_nic_cmd_qos_feature_select);
|
||||||
|
+ cmd_option_register("-d", "--dir", true, hikp_nic_cmd_qos_direct);
|
||||||
|
}
|
||||||
|
|
||||||
|
HIKP_CMD_DECLARE("nic_qos", "show qos info of nic!", cmd_nic_get_qos_init);
|
||||||
|
diff --git a/net/nic/nic_qos/hikp_nic_qos.h b/net/nic/nic_qos/hikp_nic_qos.h
|
||||||
|
index b5481f5..d55970a 100644
|
||||||
|
--- a/net/nic/nic_qos/hikp_nic_qos.h
|
||||||
|
+++ b/net/nic/nic_qos/hikp_nic_qos.h
|
||||||
|
@@ -20,6 +20,7 @@ enum nic_qos_sub_cmd_type {
|
||||||
|
NIC_PACKET_BUFFER_DUMP = 0,
|
||||||
|
NIC_DCB_DUMP,
|
||||||
|
NIC_PAUSE_DUMP,
|
||||||
|
+ NIC_PFC_STORM_PARA_DUMP,
|
||||||
|
};
|
||||||
|
|
||||||
|
struct nic_buf_waterline {
|
||||||
|
@@ -50,6 +51,14 @@ struct nic_pfc_info {
|
||||||
|
uint8_t rsv[2];
|
||||||
|
};
|
||||||
|
|
||||||
|
+struct nic_pfc_storm_para {
|
||||||
|
+ uint32_t dir;
|
||||||
|
+ uint32_t enable;
|
||||||
|
+ uint32_t period_ms;
|
||||||
|
+ uint32_t times;
|
||||||
|
+ uint32_t recovery_period_ms;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
struct nic_ets_info {
|
||||||
|
uint8_t prio_tc[HIKP_NIC_MAX_USER_PRIO_NUM];
|
||||||
|
uint8_t tc_bw[HIKP_NIC_MAX_TC_NUM];
|
||||||
|
@@ -82,6 +91,7 @@ union nic_qos_feature_info {
|
||||||
|
struct nic_pkt_buf_info pkt_buf;
|
||||||
|
struct nic_dcb_info dcb;
|
||||||
|
struct nic_pause_info pause;
|
||||||
|
+ struct nic_pfc_storm_para pfc_storm_para;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct nic_qos_rsp_head {
|
||||||
|
@@ -99,11 +109,21 @@ struct nic_qos_rsp {
|
||||||
|
struct nic_qos_req_para {
|
||||||
|
struct bdf_t bdf;
|
||||||
|
uint8_t block_id;
|
||||||
|
+ uint8_t dir;
|
||||||
|
+ uint8_t rsv[2];
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+enum nic_pfc_dir {
|
||||||
|
+ NIC_RX_QUEUE = 0,
|
||||||
|
+ NIC_TX_QUEUE,
|
||||||
|
+ NIC_QUEUE_DIR_NONE,
|
||||||
|
};
|
||||||
|
|
||||||
|
struct nic_qos_param {
|
||||||
|
struct tool_target target;
|
||||||
|
int feature_idx;
|
||||||
|
+ enum nic_pfc_dir dir;
|
||||||
|
+ char revision_id[MAX_PCI_ID_LEN + 1];
|
||||||
|
};
|
||||||
|
|
||||||
|
#define HIKP_QOS_MAX_FEATURE_NAME_LEN 20
|
||||||
|
--
|
||||||
|
2.33.0
|
||||||
|
|
||||||
310
0036-hikptool-add-sub-cmd-nic_torus-support.patch
Normal file
310
0036-hikptool-add-sub-cmd-nic_torus-support.patch
Normal file
@ -0,0 +1,310 @@
|
|||||||
|
From 01b5303ea6a533e956481a94a449e18bc86d01d2 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Hao Chen <chenhao418@huawei.com>
|
||||||
|
Date: Tue, 12 Sep 2023 19:58:38 +0800
|
||||||
|
Subject: [PATCH] hikptool: add sub cmd nic_torus support
|
||||||
|
|
||||||
|
Add nic_torus cmd for query 1D torus setting info
|
||||||
|
|
||||||
|
Bugfix or Feature: Feature
|
||||||
|
|
||||||
|
Signed-off-by: Hao Chen <chenhao418@huawei.com>
|
||||||
|
---
|
||||||
|
net/hikp_net_lib.h | 1 +
|
||||||
|
net/nic/nic_torus/hikp_nic_torus.c | 189 +++++++++++++++++++++++++++++
|
||||||
|
net/nic/nic_torus/hikp_nic_torus.h | 76 ++++++++++++
|
||||||
|
3 files changed, 266 insertions(+)
|
||||||
|
create mode 100644 net/nic/nic_torus/hikp_nic_torus.c
|
||||||
|
create mode 100644 net/nic/nic_torus/hikp_nic_torus.h
|
||||||
|
|
||||||
|
diff --git a/net/hikp_net_lib.h b/net/hikp_net_lib.h
|
||||||
|
index cb537ff..21b5357 100644
|
||||||
|
--- a/net/hikp_net_lib.h
|
||||||
|
+++ b/net/hikp_net_lib.h
|
||||||
|
@@ -80,6 +80,7 @@ enum nic_cmd_type {
|
||||||
|
GET_GRO_INFO_CMD,
|
||||||
|
GET_NCSI_INFO_CMD,
|
||||||
|
GET_NOTIFY_PKT_CMD,
|
||||||
|
+ GET_TORUS_INFO_CMD = 0xD,
|
||||||
|
GET_PORT_FAULT_STATUS = 0xE,
|
||||||
|
};
|
||||||
|
|
||||||
|
diff --git a/net/nic/nic_torus/hikp_nic_torus.c b/net/nic/nic_torus/hikp_nic_torus.c
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..4baede6
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/net/nic/nic_torus/hikp_nic_torus.c
|
||||||
|
@@ -0,0 +1,189 @@
|
||||||
|
+/*
|
||||||
|
+ * Copyright (c) 2023 Hisilicon Technologies Co., Ltd.
|
||||||
|
+ * Hikptool is licensed under Mulan PSL v2.
|
||||||
|
+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||||
|
+ * You may obtain a copy of Mulan PSL v2 at:
|
||||||
|
+ * http://license.coscl.org.cn/MulanPSL2
|
||||||
|
+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||||
|
+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||||
|
+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||||
|
+ *
|
||||||
|
+ * See the Mulan PSL v2 for more details.
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+#include <stdio.h>
|
||||||
|
+#include <string.h>
|
||||||
|
+#include <sys/types.h>
|
||||||
|
+#include <unistd.h>
|
||||||
|
+
|
||||||
|
+#include "hikp_nic_torus.h"
|
||||||
|
+
|
||||||
|
+static struct tool_target g_torus_target;
|
||||||
|
+
|
||||||
|
+static int hikp_nic_torus_query(const struct bdf_t *bdf,
|
||||||
|
+ struct nic_torus_info *info)
|
||||||
|
+{
|
||||||
|
+ struct nic_torus_req_para req = { 0 };
|
||||||
|
+ struct hikp_cmd_header header = { 0 };
|
||||||
|
+ struct hikp_cmd_ret *cmd_ret;
|
||||||
|
+ struct nic_torus_rsp *rsp;
|
||||||
|
+
|
||||||
|
+ req.bdf = *bdf;
|
||||||
|
+ hikp_cmd_init(&header, NIC_MOD, GET_TORUS_INFO_CMD, NIC_TORUS_INFO_DUMP);
|
||||||
|
+ cmd_ret = hikp_cmd_alloc(&header, &req, sizeof(req));
|
||||||
|
+ if (cmd_ret == NULL || cmd_ret->status != 0) {
|
||||||
|
+ HIKP_ERROR_PRINT("fail to get torus info, retcode: %u\n",
|
||||||
|
+ cmd_ret ? cmd_ret->status : EIO);
|
||||||
|
+ if (cmd_ret)
|
||||||
|
+ free(cmd_ret);
|
||||||
|
+ return -EIO;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ rsp = (struct nic_torus_rsp *)cmd_ret->rsp_data;
|
||||||
|
+ *info = *(struct nic_torus_info *)rsp->data;
|
||||||
|
+ free(cmd_ret);
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void hikp_nic_torus_lan_prt_pair_show(const struct nic_torus_info *info)
|
||||||
|
+{
|
||||||
|
+ uint32_t mac_id = hikp_get_field(info->lan_prt_pair, NIC_TORUS_MAC_ID_M,
|
||||||
|
+ NIC_TORUS_MAC_ID_S);
|
||||||
|
+ uint32_t uc_lan_pair_en = hikp_get_bit(info->lan_prt_pair,
|
||||||
|
+ NIC_TORUS_UC_LAN_PAIR_EN);
|
||||||
|
+ uint32_t mc_bc_lan_pair_en = hikp_get_bit(info->lan_prt_pair,
|
||||||
|
+ NIC_TORUS_MC_BC_LAN_PAIR_EN);
|
||||||
|
+ uint32_t lldp_lan_pair_en = hikp_get_bit(info->lan_prt_pair,
|
||||||
|
+ NIC_TORUS_LLDP_LAN_PAIR_EN);
|
||||||
|
+ uint32_t tc2vlanpri_mapping_en = hikp_get_bit(info->lan_prt_pair,
|
||||||
|
+ NIC_TORUS_TC2VLANPRI_MAPPING_EN);
|
||||||
|
+ uint32_t torus_lpbk_drop_en = hikp_get_bit(info->lan_prt_pair,
|
||||||
|
+ NIC_TORUS_LPBK_DROP_EN);
|
||||||
|
+
|
||||||
|
+ printf("dst mac id: %u\n", mac_id);
|
||||||
|
+ printf("uc_lan_pair_en: %u\n", uc_lan_pair_en);
|
||||||
|
+ printf("mc_bc_lan_pair_en: %u\n", mc_bc_lan_pair_en);
|
||||||
|
+ printf("lldp_lan_pair_en: %u\n", lldp_lan_pair_en);
|
||||||
|
+ printf("tc2vlanpri_mapping_en: %u\n", tc2vlanpri_mapping_en);
|
||||||
|
+ printf("torus_lpbk_drop_en: %u\n", torus_lpbk_drop_en);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void hikp_nic_torus_lan_fwd_tc_cfg_show(const struct nic_torus_info *info)
|
||||||
|
+{
|
||||||
|
+ uint32_t tc0_map_tc = hikp_get_field(info->lan_fwd_tc_cfg,
|
||||||
|
+ NIC_TORUS_TC0_MAP_TC_M,
|
||||||
|
+ NIC_TORUS_TC0_MAP_TC_S);
|
||||||
|
+ uint32_t tc1_map_tc = hikp_get_field(info->lan_fwd_tc_cfg,
|
||||||
|
+ NIC_TORUS_TC1_MAP_TC_M,
|
||||||
|
+ NIC_TORUS_TC1_MAP_TC_S);
|
||||||
|
+ uint32_t tc2_map_tc = hikp_get_field(info->lan_fwd_tc_cfg,
|
||||||
|
+ NIC_TORUS_TC2_MAP_TC_M,
|
||||||
|
+ NIC_TORUS_TC2_MAP_TC_S);
|
||||||
|
+ uint32_t tc3_map_tc = hikp_get_field(info->lan_fwd_tc_cfg,
|
||||||
|
+ NIC_TORUS_TC3_MAP_TC_M,
|
||||||
|
+ NIC_TORUS_TC3_MAP_TC_S);
|
||||||
|
+
|
||||||
|
+ printf("tc0_map_tc : %u\n", tc0_map_tc);
|
||||||
|
+ printf("tc1_map_tc : %u\n", tc1_map_tc);
|
||||||
|
+ printf("tc2_map_tc : %u\n", tc2_map_tc);
|
||||||
|
+ printf("tc3_map_tc : %u\n", tc3_map_tc);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void hikp_nic_torus_switch_param_show(const struct nic_torus_info *info)
|
||||||
|
+{
|
||||||
|
+ printf("nic_mac_anti_spoof_en: %s\n", info->nic_switch_param &
|
||||||
|
+ NIC_TORUS_MAC_ANTI_SPOOF_EN_MASK ? "enable" : "disable");
|
||||||
|
+ printf("nic_alw_lpbk: %s\n", info->nic_switch_param &
|
||||||
|
+ NIC_TORUS_ALW_LPBK_MASK ? "enable" : "disable");
|
||||||
|
+ printf("nic_alw_lcl_lpbk: %s\n", info->nic_switch_param &
|
||||||
|
+ NIC_TORUS_ALW_LCL_LPBK_MASK ? "enable" : "disable");
|
||||||
|
+ printf("nic_alw_dst_ovrd: %s\n", info->nic_switch_param &
|
||||||
|
+ NIC_TORUS_ALW_DST_OVRD_MASK ? "enable" : "disable");
|
||||||
|
+ printf("roce_mac_anti_spoof_en: %s\n", info->roce_switch_param &
|
||||||
|
+ NIC_TORUS_MAC_ANTI_SPOOF_EN_MASK ? "enable" : "disable");
|
||||||
|
+ printf("roce_alw_lpbk: %s\n", info->roce_switch_param &
|
||||||
|
+ NIC_TORUS_ALW_LPBK_MASK ? "enable" : "disable");
|
||||||
|
+ printf("roce_alw_lcl_lpbk: %s\n", info->roce_switch_param &
|
||||||
|
+ NIC_TORUS_ALW_LCL_LPBK_MASK ? "enable" : "disable");
|
||||||
|
+ printf("roce_alw_dst_ovrd: %s\n", info->roce_switch_param &
|
||||||
|
+ NIC_TORUS_ALW_DST_OVRD_MASK ? "enable" : "disable");
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void hikp_nic_torus_show(const struct nic_torus_info *info)
|
||||||
|
+{
|
||||||
|
+ printf("################ NIC TORUS info ##################\n");
|
||||||
|
+ printf("enable: %s\n", info->enable ? "true" : "false");
|
||||||
|
+
|
||||||
|
+ hikp_nic_torus_lan_prt_pair_show(info);
|
||||||
|
+
|
||||||
|
+ hikp_nic_torus_lan_fwd_tc_cfg_show(info);
|
||||||
|
+
|
||||||
|
+ printf("ssu_pause_time_out: %uus\n", info->pause_time_out);
|
||||||
|
+ printf("ssu_pause_time_out_en: %u\n", info->pause_time_out_en);
|
||||||
|
+ printf("vlan_fe: 0x%x (for port vlan)\n", info->vlan_fe);
|
||||||
|
+ printf("ets_tcg0_mapping: 0x%x\n", info->ets_tcg0_mapping);
|
||||||
|
+ printf("ets_tcg0_mapping is showed as 0xff if ncl_config forward bit is setted to 1\n");
|
||||||
|
+
|
||||||
|
+ hikp_nic_torus_switch_param_show(info);
|
||||||
|
+
|
||||||
|
+ printf("#################### END ##########################\n");
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void hikp_nic_torus_cmd_execute(struct major_cmd_ctrl *self)
|
||||||
|
+{
|
||||||
|
+ struct bdf_t *bdf = &g_torus_target.bdf;
|
||||||
|
+ struct nic_torus_info info;
|
||||||
|
+ int ret;
|
||||||
|
+
|
||||||
|
+ ret = hikp_nic_torus_query(bdf, &info);
|
||||||
|
+ if (ret != 0) {
|
||||||
|
+ snprintf(self->err_str, sizeof(self->err_str), "fail to obtain torus info.");
|
||||||
|
+ self->err_no = ret;
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ hikp_nic_torus_show(&info);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int hikp_nic_torus_cmd_help(struct major_cmd_ctrl *self, const char *argv)
|
||||||
|
+{
|
||||||
|
+ printf("\n Usage: %s %s\n", self->cmd_ptr->name, "-i <device>");
|
||||||
|
+ printf("\n %s\n", self->cmd_ptr->help_info);
|
||||||
|
+ printf("\n Options:\n\n");
|
||||||
|
+ printf(" %s, %-25s %s\n", "-h", "--help", "display this help and exit");
|
||||||
|
+ printf(" %s, %-25s %s\n", "-i", "--interface=<interface>",
|
||||||
|
+ "device target or bdf id, e.g. eth0~7 or 0000:35:00.0");
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int hikp_nic_torus_get_target(struct major_cmd_ctrl *self, const char *argv)
|
||||||
|
+{
|
||||||
|
+ self->err_no = tool_check_and_get_valid_bdf_id(argv, &g_torus_target);
|
||||||
|
+ if (self->err_no != 0) {
|
||||||
|
+ snprintf(self->err_str, sizeof(self->err_str), "unknown device!");
|
||||||
|
+ return self->err_no;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (g_torus_target.bdf.dev_id != 0) {
|
||||||
|
+ snprintf(self->err_str, sizeof(self->err_str), "VF does not support query!");
|
||||||
|
+ self->err_no = -EOPNOTSUPP;
|
||||||
|
+ return self->err_no;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void cmd_nic_torus_init(void)
|
||||||
|
+{
|
||||||
|
+ struct major_cmd_ctrl *major_cmd = get_major_cmd();
|
||||||
|
+
|
||||||
|
+ major_cmd->option_count = 0;
|
||||||
|
+ major_cmd->execute = hikp_nic_torus_cmd_execute;
|
||||||
|
+
|
||||||
|
+ cmd_option_register("-h", "--help", false, hikp_nic_torus_cmd_help);
|
||||||
|
+ cmd_option_register("-i", "--interface", true, hikp_nic_torus_get_target);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+HIKP_CMD_DECLARE("nic_torus", "dump torus info of nic!", cmd_nic_torus_init);
|
||||||
|
diff --git a/net/nic/nic_torus/hikp_nic_torus.h b/net/nic/nic_torus/hikp_nic_torus.h
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..e6b6552
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/net/nic/nic_torus/hikp_nic_torus.h
|
||||||
|
@@ -0,0 +1,76 @@
|
||||||
|
+/*
|
||||||
|
+ * Copyright (c) 2023 Hisilicon Technologies Co., Ltd.
|
||||||
|
+ * Hikptool is licensed under Mulan PSL v2.
|
||||||
|
+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||||
|
+ * You may obtain a copy of Mulan PSL v2 at:
|
||||||
|
+ * http://license.coscl.org.cn/MulanPSL2
|
||||||
|
+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||||
|
+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||||
|
+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||||
|
+ *
|
||||||
|
+ * See the Mulan PSL v2 for more details.
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+#ifndef HIKP_NIC_TORUS_H
|
||||||
|
+#define HIKP_NIC_TORUS_H
|
||||||
|
+
|
||||||
|
+#include "hikp_net_lib.h"
|
||||||
|
+
|
||||||
|
+#define NIC_TORUS_MAC_ANTI_SPOOF_EN_MASK 0x1
|
||||||
|
+#define NIC_TORUS_ALW_LPBK_MASK 0x2
|
||||||
|
+#define NIC_TORUS_ALW_LCL_LPBK_MASK 0x4
|
||||||
|
+#define NIC_TORUS_ALW_DST_OVRD_MASK 0x8
|
||||||
|
+
|
||||||
|
+#define NIC_TORUS_UC_LAN_PAIR_EN 16
|
||||||
|
+#define NIC_TORUS_MC_BC_LAN_PAIR_EN 17
|
||||||
|
+#define NIC_TORUS_LLDP_LAN_PAIR_EN 18
|
||||||
|
+#define NIC_TORUS_TC2VLANPRI_MAPPING_EN 19
|
||||||
|
+#define NIC_TORUS_LPBK_DROP_EN 20
|
||||||
|
+
|
||||||
|
+#define NIC_TORUS_MAC_ID_M GENMASK(1, 0)
|
||||||
|
+#define NIC_TORUS_MAC_ID_S 0
|
||||||
|
+
|
||||||
|
+#define NIC_TORUS_TC0_MAP_TC_M GENMASK(2, 0)
|
||||||
|
+#define NIC_TORUS_TC0_MAP_TC_S 0
|
||||||
|
+#define NIC_TORUS_TC1_MAP_TC_M GENMASK(8, 6)
|
||||||
|
+#define NIC_TORUS_TC1_MAP_TC_S 6
|
||||||
|
+#define NIC_TORUS_TC2_MAP_TC_M GENMASK(14, 12)
|
||||||
|
+#define NIC_TORUS_TC2_MAP_TC_S 12
|
||||||
|
+#define NIC_TORUS_TC3_MAP_TC_M GENMASK(20, 18)
|
||||||
|
+#define NIC_TORUS_TC3_MAP_TC_S 18
|
||||||
|
+
|
||||||
|
+enum nic_torus_sub_cmd_type {
|
||||||
|
+ NIC_TORUS_INFO_DUMP,
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+struct nic_torus_req_para {
|
||||||
|
+ struct bdf_t bdf;
|
||||||
|
+ uint8_t block_id;
|
||||||
|
+ uint8_t rsv[3];
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+struct nic_torus_rsp_head {
|
||||||
|
+ uint8_t total_blk_num;
|
||||||
|
+ uint8_t curr_blk_size; /* real data size, not contain head size. */
|
||||||
|
+ uint16_t rsv;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+#define NIC_TORUS_MAX_RSP_DATA 6
|
||||||
|
+struct nic_torus_rsp {
|
||||||
|
+ struct nic_torus_rsp_head head;
|
||||||
|
+ uint32_t data[NIC_TORUS_MAX_RSP_DATA];
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+struct nic_torus_info {
|
||||||
|
+ uint32_t enable;
|
||||||
|
+ uint32_t lan_prt_pair;
|
||||||
|
+ uint32_t lan_fwd_tc_cfg;
|
||||||
|
+ uint32_t pause_time_out;
|
||||||
|
+ uint8_t pause_time_out_en;
|
||||||
|
+ uint8_t vlan_fe;
|
||||||
|
+ uint8_t nic_switch_param;
|
||||||
|
+ uint8_t roce_switch_param;
|
||||||
|
+ uint32_t ets_tcg0_mapping;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+#endif /* HIKP_NIC_TORUS_H */
|
||||||
|
--
|
||||||
|
2.30.0
|
||||||
|
|
||||||
140
0037-hikptool-optimized-display-the-hot-plug-card-info-in.patch
Normal file
140
0037-hikptool-optimized-display-the-hot-plug-card-info-in.patch
Normal file
@ -0,0 +1,140 @@
|
|||||||
|
From 16154c431d5c694707b12cdb3ab3b52207d9c44d Mon Sep 17 00:00:00 2001
|
||||||
|
From: veega <zhuweijia@huawei.com>
|
||||||
|
Date: Fri, 15 Sep 2023 09:32:33 +0800
|
||||||
|
Subject: [PATCH] hikptool: optimized display the hot-plug card info in
|
||||||
|
nic_port cmd
|
||||||
|
|
||||||
|
A command word was added to query the port information display capability.
|
||||||
|
If a port does not support a flexible card, the card information is not displayed.
|
||||||
|
|
||||||
|
Signed-off-by: veega <zhuweijia@huawei.com>
|
||||||
|
---
|
||||||
|
net/nic/nic_mac/hikp_mac_cmd.h | 1 +
|
||||||
|
net/nic/nic_mac/hikp_nic_port.c | 81 +++++++++++++++++++++------------
|
||||||
|
net/nic/nic_mac/hikp_nic_port.h | 17 ++++---
|
||||||
|
3 files changed, 65 insertions(+), 34 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/net/nic/nic_mac/hikp_mac_cmd.h b/net/nic/nic_mac/hikp_mac_cmd.h
|
||||||
|
index adaadf4..f74fd2a 100644
|
||||||
|
--- a/net/nic/nic_mac/hikp_mac_cmd.h
|
||||||
|
+++ b/net/nic/nic_mac/hikp_mac_cmd.h
|
||||||
|
@@ -31,6 +31,7 @@ enum mac_port_sub_cmd {
|
||||||
|
QUERY_PORT_PHY_DFX,
|
||||||
|
QUERY_HOT_PLUG_CARD_DFX,
|
||||||
|
QUERY_PORT_CDR_DFX,
|
||||||
|
+ QUERY_PORT_INFO_DFX_CAP,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum mac_dump_reg_sub_cmd {
|
||||||
|
diff --git a/net/nic/nic_mac/hikp_nic_port.c b/net/nic/nic_mac/hikp_nic_port.c
|
||||||
|
index c9f46fc..5ba6927 100644
|
||||||
|
--- a/net/nic/nic_mac/hikp_nic_port.c
|
||||||
|
+++ b/net/nic/nic_mac/hikp_nic_port.c
|
||||||
|
@@ -361,11 +361,12 @@ static void mac_cmd_disp_arb_info(const struct mac_cmd_arb_dfx *arb_dfx)
|
||||||
|
|
||||||
|
static void mac_cmd_disp_hot_plug_card_info(const struct cmd_hot_plug_card_info *hpc_dfx)
|
||||||
|
{
|
||||||
|
- printf("\n======================== HOT PLUG CARD INFO =======================\n");
|
||||||
|
+ printf("\n===================== HOT PLUG CARD INFO =====================\n");
|
||||||
|
|
||||||
|
printf("hot plug card in position: 0x%x\n", hpc_dfx->in_pos);
|
||||||
|
printf("support type: 0x%x\n", hpc_dfx->support_type);
|
||||||
|
- printf("current type: 0x%x\n", hpc_dfx->cur_type);
|
||||||
|
+ if (hpc_dfx->in_pos)
|
||||||
|
+ printf("current type: 0x%x\n", hpc_dfx->cur_type);
|
||||||
|
printf("----------------------------------------------------------------------------\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -491,35 +492,59 @@ static void mac_cmd_show_port_dfx(struct major_cmd_ctrl *self, uint32_t mask)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
-static void mac_cmd_port_execute(struct major_cmd_ctrl *self)
|
||||||
|
+static int mac_cmd_get_port_dfx_cap(uint32_t *cap)
|
||||||
|
{
|
||||||
|
struct mac_cmd_port_hardware *port_hw = NULL;
|
||||||
|
+ struct mac_cmd_port_dfx_cap *dfx_cap = NULL;
|
||||||
|
+ struct hikp_cmd_ret *dfx_cap_resp = NULL;
|
||||||
|
struct hikp_cmd_ret *hw_cmd_ret = NULL;
|
||||||
|
- uint32_t mask;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
- if (!g_port_info.port_flag) {
|
||||||
|
- self->err_no = -EINVAL;
|
||||||
|
- snprintf(self->err_str, sizeof(self->err_str), "Need port id.");
|
||||||
|
- return;
|
||||||
|
+ ret = mac_cmd_get_dfx_cfg(QUERY_PORT_INFO_DFX_CAP, &dfx_cap_resp);
|
||||||
|
+ if (ret == 0) {
|
||||||
|
+ dfx_cap = (struct mac_cmd_port_dfx_cap *)dfx_cap_resp->rsp_data;
|
||||||
|
+ *cap = dfx_cap->cap_bit_map;
|
||||||
|
+ free(dfx_cap_resp);
|
||||||
|
+ dfx_cap_resp = NULL;
|
||||||
|
+ return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ /* not support get capability, so use old process */
|
||||||
|
ret = mac_cmd_get_dfx_cfg(QUERY_PORT_HARDWARE, &hw_cmd_ret);
|
||||||
|
- if (ret != 0) {
|
||||||
|
- printf("hikp_data_proc get port hw failed.\n");
|
||||||
|
- self->err_no = -ENOSPC;
|
||||||
|
- return;
|
||||||
|
- }
|
||||||
|
+ if (ret)
|
||||||
|
+ return ret;
|
||||||
|
|
||||||
|
- mask = MAC_LSPORT_LINK | MAC_LSPORT_MAC |
|
||||||
|
- MAC_LSPORT_ARB | MAC_HOT_PLUG_CARD | MAC_LSPORT_CDR;
|
||||||
|
+ *cap = MAC_LSPORT_LINK | MAC_LSPORT_MAC | MAC_LSPORT_ARB |
|
||||||
|
+ MAC_HOT_PLUG_CARD | MAC_LSPORT_CDR;
|
||||||
|
port_hw = (struct mac_cmd_port_hardware *)(hw_cmd_ret->rsp_data);
|
||||||
|
if (port_hw->port_type == HIKP_PORT_TYPE_PHY ||
|
||||||
|
port_hw->port_type == HIKP_PORT_TYPE_PHY_SDS)
|
||||||
|
- mask |= MAC_LSPORT_PHY;
|
||||||
|
+ *cap |= MAC_LSPORT_PHY;
|
||||||
|
|
||||||
|
- mac_cmd_show_port_dfx(self, mask);
|
||||||
|
free(hw_cmd_ret);
|
||||||
|
+ hw_cmd_ret = NULL;
|
||||||
|
+ return ret;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void mac_cmd_port_execute(struct major_cmd_ctrl *self)
|
||||||
|
+{
|
||||||
|
+ uint32_t dfx_cap;
|
||||||
|
+ int ret;
|
||||||
|
+
|
||||||
|
+ if (!g_port_info.port_flag) {
|
||||||
|
+ self->err_no = -EINVAL;
|
||||||
|
+ snprintf(self->err_str, sizeof(self->err_str), "Need port id.");
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ ret = mac_cmd_get_port_dfx_cap(&dfx_cap);
|
||||||
|
+ if (ret) {
|
||||||
|
+ self->err_no = ret;
|
||||||
|
+ snprintf(self->err_str, sizeof(self->err_str), "Get DFX capability failed.");
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ mac_cmd_show_port_dfx(self, dfx_cap);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int mac_cmd_get_port_target(struct major_cmd_ctrl *self, const char *argv)
|
||||||
|
diff --git a/net/nic/nic_mac/hikp_nic_port.h b/net/nic/nic_mac/hikp_nic_port.h
|
||||||
|
index 42ab3f9..78928b3 100644
|
||||||
|
--- a/net/nic/nic_mac/hikp_nic_port.h
|
||||||
|
+++ b/net/nic/nic_mac/hikp_nic_port.h
|
||||||
|
@@ -225,6 +225,11 @@ struct mac_cmd_cdr_dfx {
|
||||||
|
struct mac_port_cdr_dfx host_cdr;
|
||||||
|
};
|
||||||
|
|
||||||
|
+struct mac_cmd_port_dfx_cap {
|
||||||
|
+ uint32_t cap_bit_map;
|
||||||
|
+ uint32_t rsvd[3];
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
struct mac_cmd_dfx_callback {
|
||||||
|
uint32_t mask;
|
||||||
|
void (*show_dfx)(struct major_cmd_ctrl *self);
|
||||||
|
--
|
||||||
|
2.36.1.windows.1
|
||||||
28
0038-hikptool-Update-the-tool-version-number-to-1.1.0.patch
Normal file
28
0038-hikptool-Update-the-tool-version-number-to-1.1.0.patch
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
From 6a571cd63eab0a5b8e6496964d6e3916b793b9bf Mon Sep 17 00:00:00 2001
|
||||||
|
From: veega2022 <zhuweijia@huawei.com>
|
||||||
|
Date: Fri, 20 Oct 2023 21:30:31 +0800
|
||||||
|
Subject: [PATCH] hikptool: Update the tool version number to 1.1.0
|
||||||
|
|
||||||
|
Update the tool version number to 1.1.0, the first SP3 release version
|
||||||
|
|
||||||
|
Signed-off-by: veega2022 <zhuweijia@huawei.com>
|
||||||
|
---
|
||||||
|
tool_lib/tool_lib.h | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/tool_lib/tool_lib.h b/tool_lib/tool_lib.h
|
||||||
|
index 6548b57..14b3db5 100644
|
||||||
|
--- a/tool_lib/tool_lib.h
|
||||||
|
+++ b/tool_lib/tool_lib.h
|
||||||
|
@@ -18,7 +18,7 @@
|
||||||
|
|
||||||
|
#define TOOL_NAME "hikptool"
|
||||||
|
|
||||||
|
-#define TOOL_VER "1.0.16"
|
||||||
|
+#define TOOL_VER "1.1.0"
|
||||||
|
|
||||||
|
#define HI_GET_BITFIELD(value, start, mask) (((value) >> (start)) & (mask))
|
||||||
|
#define HI_SET_FIELD(origin, shift, val) ((origin) |= (val) << (shift))
|
||||||
|
--
|
||||||
|
2.38.1.windows.1
|
||||||
|
|
||||||
386
0039-hikptool-roce-Add-a-common-frame-for-hikptool-roce-r.patch
Normal file
386
0039-hikptool-roce-Add-a-common-frame-for-hikptool-roce-r.patch
Normal file
@ -0,0 +1,386 @@
|
|||||||
|
From 8b3b68347165b602cded484d090509426f88cc75 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Junxian Huang <huangjunxian6@hisilicon.com>
|
||||||
|
Date: Mon, 31 Jul 2023 21:19:46 +0800
|
||||||
|
Subject: hikptool/roce: Add a common frame for hikptool roce register query
|
||||||
|
|
||||||
|
Add a common frame for hikptool roce register query.
|
||||||
|
|
||||||
|
Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com>
|
||||||
|
---
|
||||||
|
net/roce/roce_caep/hikp_roce_caep.h | 2 +-
|
||||||
|
.../roce_ext_common/hikp_roce_ext_common.c | 178 ++++++++++++++++++
|
||||||
|
.../roce_ext_common/hikp_roce_ext_common.h | 52 +++++
|
||||||
|
net/roce/roce_gmv/hikp_roce_gmv.h | 2 +-
|
||||||
|
net/roce/roce_mdb/hikp_roce_mdb.h | 2 +-
|
||||||
|
net/roce/roce_pkt/hikp_roce_pkt.h | 2 +-
|
||||||
|
net/roce/roce_qmm/hikp_roce_qmm.h | 2 +-
|
||||||
|
net/roce/roce_scc/hikp_roce_scc.h | 2 +-
|
||||||
|
net/roce/roce_timer/hikp_roce_timer.h | 2 +-
|
||||||
|
net/roce/roce_trp/hikp_roce_trp.h | 2 +-
|
||||||
|
net/roce/roce_tsp/hikp_roce_tsp.h | 2 +-
|
||||||
|
11 files changed, 239 insertions(+), 9 deletions(-)
|
||||||
|
create mode 100644 net/roce/roce_ext_common/hikp_roce_ext_common.c
|
||||||
|
create mode 100644 net/roce/roce_ext_common/hikp_roce_ext_common.h
|
||||||
|
|
||||||
|
diff --git a/net/roce/roce_caep/hikp_roce_caep.h b/net/roce/roce_caep/hikp_roce_caep.h
|
||||||
|
index 3c494b1..804d2df 100644
|
||||||
|
--- a/net/roce/roce_caep/hikp_roce_caep.h
|
||||||
|
+++ b/net/roce/roce_caep/hikp_roce_caep.h
|
||||||
|
@@ -14,7 +14,7 @@
|
||||||
|
#ifndef __HIKP_ROCE_CAEP_H__
|
||||||
|
#define __HIKP_ROCE_CAEP_H__
|
||||||
|
|
||||||
|
-#include "hikp_net_lib.h"
|
||||||
|
+#include "hikp_roce_ext_common.h"
|
||||||
|
|
||||||
|
#define ROCE_HIKP_CAEP_REG_NUM 29
|
||||||
|
#define PER_REG_NUM 2
|
||||||
|
diff --git a/net/roce/roce_ext_common/hikp_roce_ext_common.c b/net/roce/roce_ext_common/hikp_roce_ext_common.c
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..ec47dce
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/net/roce/roce_ext_common/hikp_roce_ext_common.c
|
||||||
|
@@ -0,0 +1,178 @@
|
||||||
|
+/*
|
||||||
|
+ * Copyright (c) 2023 Hisilicon Technologies Co., Ltd.
|
||||||
|
+ * Hikptool is licensed under Mulan PSL v2.
|
||||||
|
+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||||
|
+ * You may obtain a copy of Mulan PSL v2 at:
|
||||||
|
+ * http://license.coscl.org.cn/MulanPSL2
|
||||||
|
+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||||
|
+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||||
|
+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||||
|
+ *
|
||||||
|
+ * See the Mulan PSL v2 for more details.
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+#include "hikp_roce_ext_common.h"
|
||||||
|
+
|
||||||
|
+static void hikp_roce_ext_reg_data_free(struct reg_data *reg)
|
||||||
|
+{
|
||||||
|
+ if (reg->offset)
|
||||||
|
+ free(reg->offset);
|
||||||
|
+
|
||||||
|
+ if (reg->data)
|
||||||
|
+ free(reg->data);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void hikp_roce_ext_cmd_ret_free(struct hikp_cmd_ret *cmd_ret)
|
||||||
|
+{
|
||||||
|
+ if (cmd_ret)
|
||||||
|
+ free(cmd_ret);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static const struct cmd_type_info {
|
||||||
|
+ enum roce_cmd_type cmd_type;
|
||||||
|
+ const char *cmd_name;
|
||||||
|
+ uint8_t reg_array_length;
|
||||||
|
+} cmd_info_table[] = {
|
||||||
|
+ {GET_ROCEE_MDB_CMD, "MDB", ROCE_HIKP_MDB_REG_NUM_EXT},
|
||||||
|
+ {GET_ROCEE_GMV_CMD, "GMV", ROCE_HIKP_GMV_REG_NUM_EXT},
|
||||||
|
+ {GET_ROCEE_CAEP_CMD, "CAEP", ROCE_HIKP_CAEP_REG_NUM_EXT},
|
||||||
|
+ {GET_ROCEE_PKT_CMD, "PKT", ROCE_HIKP_PKT_REG_NUM_EXT},
|
||||||
|
+ {GET_ROCEE_SCC_CMD, "SCC", ROCE_HIKP_SCC_REG_NUM_EXT},
|
||||||
|
+ {GET_ROCEE_QMM_CMD, "QMM", ROCE_HIKP_QMM_REG_NUM_EXT},
|
||||||
|
+ {GET_ROCEE_TIMER_CMD, "TIMER", ROCE_HIKP_TIMER_REG_NUM_EXT},
|
||||||
|
+ {GET_ROCEE_TRP_CMD, "TRP", ROCE_HIKP_TRP_REG_NUM_EXT},
|
||||||
|
+ {GET_ROCEE_TSP_CMD, "TSP", ROCE_HIKP_TSP_REG_NUM_EXT},
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+static int get_cmd_info_table_idx(enum roce_cmd_type cmd_type)
|
||||||
|
+{
|
||||||
|
+ int array_size = sizeof(cmd_info_table) / sizeof(struct cmd_type_info);
|
||||||
|
+ int i;
|
||||||
|
+
|
||||||
|
+ for (i = 0; i < array_size; i++)
|
||||||
|
+ if (cmd_type == cmd_info_table[i].cmd_type)
|
||||||
|
+ return i;
|
||||||
|
+
|
||||||
|
+ return -ENOENT;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static const char *get_cmd_name(enum roce_cmd_type cmd_type)
|
||||||
|
+{
|
||||||
|
+ int idx;
|
||||||
|
+
|
||||||
|
+ idx = get_cmd_info_table_idx(cmd_type);
|
||||||
|
+ if (idx >= 0)
|
||||||
|
+ return cmd_info_table[idx].cmd_name;
|
||||||
|
+
|
||||||
|
+ printf("Failed to get cmd name, cmd_type = %d\n", cmd_type);
|
||||||
|
+ return NULL;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int get_cmd_reg_array_length(enum roce_cmd_type cmd_type)
|
||||||
|
+{
|
||||||
|
+ int idx;
|
||||||
|
+
|
||||||
|
+ idx = get_cmd_info_table_idx(cmd_type);
|
||||||
|
+ if (idx >= 0)
|
||||||
|
+ return cmd_info_table[idx].reg_array_length;
|
||||||
|
+
|
||||||
|
+ printf("Failed to get cmd reg array length, cmd_type = %d\n", cmd_type);
|
||||||
|
+ return idx;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int hikp_roce_ext_get_res(enum roce_cmd_type cmd_type,
|
||||||
|
+ uint32_t block_id,
|
||||||
|
+ struct roce_ext_head *res_head,
|
||||||
|
+ struct reg_data *reg,
|
||||||
|
+ int (*get_data)(struct hikp_cmd_ret **cmd_ret,
|
||||||
|
+ uint32_t block_id))
|
||||||
|
+{
|
||||||
|
+ int reg_array_length = get_cmd_reg_array_length(cmd_type);
|
||||||
|
+ const char *cmd_name = get_cmd_name(cmd_type);
|
||||||
|
+ struct roce_ext_res_param *roce_ext_res;
|
||||||
|
+ struct hikp_cmd_ret *cmd_ret;
|
||||||
|
+ size_t max_size;
|
||||||
|
+ size_t cur_size;
|
||||||
|
+ int ret;
|
||||||
|
+
|
||||||
|
+ /* reg_array_length greater than or equal to 0 ensures that cmd_name
|
||||||
|
+ * is not NULL, so cmd_name does not need to be checked.
|
||||||
|
+ */
|
||||||
|
+ if (reg_array_length < 0)
|
||||||
|
+ return reg_array_length;
|
||||||
|
+
|
||||||
|
+ ret = get_data(&cmd_ret, block_id);
|
||||||
|
+ if (ret) {
|
||||||
|
+ printf("hikptool roce_%s get data failed!\n", cmd_name);
|
||||||
|
+ goto get_data_error;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ roce_ext_res = (struct roce_ext_res_param *)cmd_ret->rsp_data;
|
||||||
|
+ *res_head = roce_ext_res->head;
|
||||||
|
+ max_size = res_head->total_block_num * sizeof(uint32_t);
|
||||||
|
+
|
||||||
|
+ if (block_id == 0) {
|
||||||
|
+ reg->offset = (uint32_t *)malloc(max_size);
|
||||||
|
+ reg->data = (uint32_t *)malloc(max_size);
|
||||||
|
+ if ((reg->offset == NULL) || (reg->data == NULL)) {
|
||||||
|
+ printf("hikptool roce_%s alloc log memmory 0x%x failed!\n",
|
||||||
|
+ cmd_name, max_size);
|
||||||
|
+ ret = -ENOMEM;
|
||||||
|
+ hikp_roce_ext_reg_data_free(reg);
|
||||||
|
+ goto get_data_error;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ cur_size = res_head->cur_block_num * sizeof(uint32_t);
|
||||||
|
+ if (cur_size > max_size) {
|
||||||
|
+ printf("hikptool roce_%s log data copy size error, data size: 0x%x, max size: 0x%x\n",
|
||||||
|
+ cmd_name, cur_size, max_size);
|
||||||
|
+ ret = -EINVAL;
|
||||||
|
+ hikp_roce_ext_reg_data_free(reg);
|
||||||
|
+ goto get_data_error;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ memcpy(reg->offset + block_id,
|
||||||
|
+ (uint32_t *)&roce_ext_res->reg_data, cur_size);
|
||||||
|
+ memcpy(reg->data + block_id,
|
||||||
|
+ (uint32_t *)&roce_ext_res->reg_data + reg_array_length, cur_size);
|
||||||
|
+
|
||||||
|
+get_data_error:
|
||||||
|
+ hikp_roce_ext_cmd_ret_free(cmd_ret);
|
||||||
|
+ return ret;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void hikp_roce_ext_print(const char *cmd_name, uint32_t total_block_num,
|
||||||
|
+ const uint32_t *offset, const uint32_t *data)
|
||||||
|
+{
|
||||||
|
+ int i;
|
||||||
|
+
|
||||||
|
+ printf("**************%s INFO*************\n", cmd_name);
|
||||||
|
+ for (i = 0; i < total_block_num; i++)
|
||||||
|
+ printf("[0x%08X] : 0x%08X\n", offset[i], data[i]);
|
||||||
|
+ printf("************************************\n");
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void hikp_roce_ext_execute(struct major_cmd_ctrl *self,
|
||||||
|
+ enum roce_cmd_type cmd_type,
|
||||||
|
+ int (*get_data)(struct hikp_cmd_ret **cmd_ret,
|
||||||
|
+ uint32_t block_id))
|
||||||
|
+{
|
||||||
|
+ uint32_t queried_block_id = 0;
|
||||||
|
+ struct roce_ext_head res_head;
|
||||||
|
+ struct reg_data reg = { 0 };
|
||||||
|
+
|
||||||
|
+ do {
|
||||||
|
+ self->err_no = hikp_roce_ext_get_res(cmd_type, queried_block_id,
|
||||||
|
+ &res_head, ®, get_data);
|
||||||
|
+ if (self->err_no)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ queried_block_id += res_head.cur_block_num;
|
||||||
|
+ } while (queried_block_id < res_head.total_block_num);
|
||||||
|
+
|
||||||
|
+ hikp_roce_ext_print(get_cmd_name(cmd_type), res_head.total_block_num,
|
||||||
|
+ reg.offset, reg.data);
|
||||||
|
+
|
||||||
|
+ hikp_roce_ext_reg_data_free(®);
|
||||||
|
+}
|
||||||
|
diff --git a/net/roce/roce_ext_common/hikp_roce_ext_common.h b/net/roce/roce_ext_common/hikp_roce_ext_common.h
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..1e8063d
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/net/roce/roce_ext_common/hikp_roce_ext_common.h
|
||||||
|
@@ -0,0 +1,52 @@
|
||||||
|
+/*
|
||||||
|
+ * Copyright (c) 2023 Hisilicon Technologies Co., Ltd.
|
||||||
|
+ * Hikptool is licensed under Mulan PSL v2.
|
||||||
|
+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||||
|
+ * You may obtain a copy of Mulan PSL v2 at:
|
||||||
|
+ * http://license.coscl.org.cn/MulanPSL2
|
||||||
|
+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||||
|
+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||||
|
+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||||
|
+ *
|
||||||
|
+ * See the Mulan PSL v2 for more details.
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+#ifndef __HIKP_ROCE_EXT_COMMON_H__
|
||||||
|
+#define __HIKP_ROCE_EXT_COMMON_H__
|
||||||
|
+
|
||||||
|
+#include "hikp_net_lib.h"
|
||||||
|
+
|
||||||
|
+#define ROCE_MAX_REG_NUM (NET_MAX_REQ_DATA_NUM - 1)
|
||||||
|
+
|
||||||
|
+#define ROCE_HIKP_CAEP_REG_NUM_EXT ROCE_MAX_REG_NUM
|
||||||
|
+#define ROCE_HIKP_GMV_REG_NUM_EXT ROCE_MAX_REG_NUM
|
||||||
|
+#define ROCE_HIKP_MDB_REG_NUM_EXT ROCE_MAX_REG_NUM
|
||||||
|
+#define ROCE_HIKP_PKT_REG_NUM_EXT ROCE_MAX_REG_NUM
|
||||||
|
+#define ROCE_HIKP_QMM_REG_NUM_EXT ROCE_MAX_REG_NUM
|
||||||
|
+#define ROCE_HIKP_SCC_REG_NUM_EXT ROCE_MAX_REG_NUM
|
||||||
|
+#define ROCE_HIKP_TIMER_REG_NUM_EXT ROCE_MAX_REG_NUM
|
||||||
|
+#define ROCE_HIKP_TRP_REG_NUM_EXT ROCE_MAX_REG_NUM
|
||||||
|
+#define ROCE_HIKP_TSP_REG_NUM_EXT ROCE_MAX_REG_NUM
|
||||||
|
+
|
||||||
|
+struct roce_ext_head {
|
||||||
|
+ uint8_t total_block_num;
|
||||||
|
+ uint8_t cur_block_num;
|
||||||
|
+ uint16_t reserved;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+struct roce_ext_res_param {
|
||||||
|
+ struct roce_ext_head head;
|
||||||
|
+ uint32_t reg_data[0];
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+struct reg_data {
|
||||||
|
+ uint32_t *offset;
|
||||||
|
+ uint32_t *data;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+void hikp_roce_ext_execute(struct major_cmd_ctrl *self,
|
||||||
|
+ enum roce_cmd_type cmd_type,
|
||||||
|
+ int (*get_data)(struct hikp_cmd_ret **cmd_ret,
|
||||||
|
+ uint32_t block_id));
|
||||||
|
+
|
||||||
|
+#endif /* __HIKP_ROCE_EXT_COMMON_H__ */
|
||||||
|
diff --git a/net/roce/roce_gmv/hikp_roce_gmv.h b/net/roce/roce_gmv/hikp_roce_gmv.h
|
||||||
|
index 30f37fb..1ef5b93 100644
|
||||||
|
--- a/net/roce/roce_gmv/hikp_roce_gmv.h
|
||||||
|
+++ b/net/roce/roce_gmv/hikp_roce_gmv.h
|
||||||
|
@@ -14,7 +14,7 @@
|
||||||
|
#ifndef __HIKP_ROCE_GMV_H__
|
||||||
|
#define __HIKP_ROCE_GMV_H__
|
||||||
|
|
||||||
|
-#include "hikp_net_lib.h"
|
||||||
|
+#include "hikp_roce_ext_common.h"
|
||||||
|
|
||||||
|
#define ROCE_HIKP_GMV_REG_NUM 7
|
||||||
|
#define ROCE_HIKP_GMV_REG_SWICTH 2
|
||||||
|
diff --git a/net/roce/roce_mdb/hikp_roce_mdb.h b/net/roce/roce_mdb/hikp_roce_mdb.h
|
||||||
|
index 8e7da03..7643dff 100644
|
||||||
|
--- a/net/roce/roce_mdb/hikp_roce_mdb.h
|
||||||
|
+++ b/net/roce/roce_mdb/hikp_roce_mdb.h
|
||||||
|
@@ -14,7 +14,7 @@
|
||||||
|
#ifndef __HIKP_ROCE_MDB_H__
|
||||||
|
#define __HIKP_ROCE_MDB_H__
|
||||||
|
|
||||||
|
-#include "hikp_net_lib.h"
|
||||||
|
+#include "hikp_roce_ext_common.h"
|
||||||
|
|
||||||
|
#define ROCE_HIKP_MDB_REG_NUM 22
|
||||||
|
#define ROCE_HIKP_REG_SWICTH 2
|
||||||
|
diff --git a/net/roce/roce_pkt/hikp_roce_pkt.h b/net/roce/roce_pkt/hikp_roce_pkt.h
|
||||||
|
index 5f438b7..0200c44 100644
|
||||||
|
--- a/net/roce/roce_pkt/hikp_roce_pkt.h
|
||||||
|
+++ b/net/roce/roce_pkt/hikp_roce_pkt.h
|
||||||
|
@@ -14,7 +14,7 @@
|
||||||
|
#ifndef __HIKP_ROCE_PKT_H__
|
||||||
|
#define __HIKP_ROCE_PKT_H__
|
||||||
|
|
||||||
|
-#include "hikp_net_lib.h"
|
||||||
|
+#include "hikp_roce_ext_common.h"
|
||||||
|
|
||||||
|
#define ROCE_HIKP_PKT_REG_NUM 29
|
||||||
|
#define PKT_PER_REG_NUM 2
|
||||||
|
diff --git a/net/roce/roce_qmm/hikp_roce_qmm.h b/net/roce/roce_qmm/hikp_roce_qmm.h
|
||||||
|
index 08cb5d2..0645ab3 100644
|
||||||
|
--- a/net/roce/roce_qmm/hikp_roce_qmm.h
|
||||||
|
+++ b/net/roce/roce_qmm/hikp_roce_qmm.h
|
||||||
|
@@ -14,7 +14,7 @@
|
||||||
|
#ifndef __HIKP_ROCE_QMM_H__
|
||||||
|
#define __HIKP_ROCE_QMM_H__
|
||||||
|
|
||||||
|
-#include "hikp_net_lib.h"
|
||||||
|
+#include "hikp_roce_ext_common.h"
|
||||||
|
|
||||||
|
#define ROCE_HIKP_QMM_REG_NUM 36
|
||||||
|
#define QMM_BANK_NUM 0x7
|
||||||
|
diff --git a/net/roce/roce_scc/hikp_roce_scc.h b/net/roce/roce_scc/hikp_roce_scc.h
|
||||||
|
index de8772e..5d37a11 100644
|
||||||
|
--- a/net/roce/roce_scc/hikp_roce_scc.h
|
||||||
|
+++ b/net/roce/roce_scc/hikp_roce_scc.h
|
||||||
|
@@ -14,7 +14,7 @@
|
||||||
|
#ifndef __HIKP_ROCE_SCC_H__
|
||||||
|
#define __HIKP_ROCE_SCC_H__
|
||||||
|
|
||||||
|
-#include "hikp_net_lib.h"
|
||||||
|
+#include "hikp_roce_ext_common.h"
|
||||||
|
|
||||||
|
#define ROCE_HIKP_SCC_REG_NUM 29
|
||||||
|
#define MAX_SCC_MODULE_NAME_LEN 20
|
||||||
|
diff --git a/net/roce/roce_timer/hikp_roce_timer.h b/net/roce/roce_timer/hikp_roce_timer.h
|
||||||
|
index a4a32b1..7f7deb6 100644
|
||||||
|
--- a/net/roce/roce_timer/hikp_roce_timer.h
|
||||||
|
+++ b/net/roce/roce_timer/hikp_roce_timer.h
|
||||||
|
@@ -14,7 +14,7 @@
|
||||||
|
#ifndef __HIKP_ROCE_TIMER_H__
|
||||||
|
#define __HIKP_ROCE_TIMER_H__
|
||||||
|
|
||||||
|
-#include "hikp_net_lib.h"
|
||||||
|
+#include "hikp_roce_ext_common.h"
|
||||||
|
|
||||||
|
#define ROCE_HIKP_TIMER_REG_NUM 25
|
||||||
|
#define ROCE_TIMER_CMD_CLEAR (1 << 0)
|
||||||
|
diff --git a/net/roce/roce_trp/hikp_roce_trp.h b/net/roce/roce_trp/hikp_roce_trp.h
|
||||||
|
index 80d28af..97f1838 100644
|
||||||
|
--- a/net/roce/roce_trp/hikp_roce_trp.h
|
||||||
|
+++ b/net/roce/roce_trp/hikp_roce_trp.h
|
||||||
|
@@ -14,7 +14,7 @@
|
||||||
|
#ifndef __HIKP_ROCE_TRP_H__
|
||||||
|
#define __HIKP_ROCE_TRP_H__
|
||||||
|
|
||||||
|
-#include "hikp_net_lib.h"
|
||||||
|
+#include "hikp_roce_ext_common.h"
|
||||||
|
|
||||||
|
#define TRP_DIV_NUM_T 4
|
||||||
|
#define ROCE_HIKP_TRP_REG_NUM 29
|
||||||
|
diff --git a/net/roce/roce_tsp/hikp_roce_tsp.h b/net/roce/roce_tsp/hikp_roce_tsp.h
|
||||||
|
index ae864ba..43d0d0d 100644
|
||||||
|
--- a/net/roce/roce_tsp/hikp_roce_tsp.h
|
||||||
|
+++ b/net/roce/roce_tsp/hikp_roce_tsp.h
|
||||||
|
@@ -14,7 +14,7 @@
|
||||||
|
#ifndef __HIKP_ROCE_TSP_H__
|
||||||
|
#define __HIKP_ROCE_TSP_H__
|
||||||
|
|
||||||
|
-#include "hikp_net_lib.h"
|
||||||
|
+#include "hikp_roce_ext_common.h"
|
||||||
|
|
||||||
|
#define ROCE_HIKP_TSP_REG_NUM 29
|
||||||
|
#define TSP_PER_REG_NUM 2
|
||||||
|
--
|
||||||
|
2.30.0
|
||||||
|
|
||||||
179
0040-hikptool-roce-Add-roce_rst-cmd-for-reset-signal-regi.patch
Normal file
179
0040-hikptool-roce-Add-roce_rst-cmd-for-reset-signal-regi.patch
Normal file
@ -0,0 +1,179 @@
|
|||||||
|
From a0ac3e3cd5e94657ee1a58c74037aa6898898c75 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Junxian Huang <huangjunxian6@hisilicon.com>
|
||||||
|
Date: Fri, 4 Aug 2023 17:25:53 +0800
|
||||||
|
Subject: hikptool/roce: Add roce_rst cmd for reset signal registers query
|
||||||
|
|
||||||
|
Add roce_rst cmd for reset signal registers query.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
hikptool roce_rst -i eth1
|
||||||
|
|
||||||
|
Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com>
|
||||||
|
---
|
||||||
|
net/hikp_net_lib.h | 1 +
|
||||||
|
.../roce_ext_common/hikp_roce_ext_common.c | 1 +
|
||||||
|
.../roce_ext_common/hikp_roce_ext_common.h | 1 +
|
||||||
|
net/roce/roce_rst/hikp_roce_rst.c | 78 +++++++++++++++++++
|
||||||
|
net/roce/roce_rst/hikp_roce_rst.h | 29 +++++++
|
||||||
|
5 files changed, 110 insertions(+)
|
||||||
|
create mode 100644 net/roce/roce_rst/hikp_roce_rst.c
|
||||||
|
create mode 100644 net/roce/roce_rst/hikp_roce_rst.h
|
||||||
|
|
||||||
|
diff --git a/net/hikp_net_lib.h b/net/hikp_net_lib.h
|
||||||
|
index 21b5357..e60fc15 100644
|
||||||
|
--- a/net/hikp_net_lib.h
|
||||||
|
+++ b/net/hikp_net_lib.h
|
||||||
|
@@ -100,6 +100,7 @@ enum roce_cmd_type {
|
||||||
|
GET_ROCEE_TIMER_CMD,
|
||||||
|
GET_ROCEE_TRP_CMD,
|
||||||
|
GET_ROCEE_TSP_CMD,
|
||||||
|
+ GET_ROCEE_RST_CMD,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum ub_cmd_type {
|
||||||
|
diff --git a/net/roce/roce_ext_common/hikp_roce_ext_common.c b/net/roce/roce_ext_common/hikp_roce_ext_common.c
|
||||||
|
index ec47dce..01dded5 100644
|
||||||
|
--- a/net/roce/roce_ext_common/hikp_roce_ext_common.c
|
||||||
|
+++ b/net/roce/roce_ext_common/hikp_roce_ext_common.c
|
||||||
|
@@ -42,6 +42,7 @@ static const struct cmd_type_info {
|
||||||
|
{GET_ROCEE_TIMER_CMD, "TIMER", ROCE_HIKP_TIMER_REG_NUM_EXT},
|
||||||
|
{GET_ROCEE_TRP_CMD, "TRP", ROCE_HIKP_TRP_REG_NUM_EXT},
|
||||||
|
{GET_ROCEE_TSP_CMD, "TSP", ROCE_HIKP_TSP_REG_NUM_EXT},
|
||||||
|
+ {GET_ROCEE_RST_CMD, "RST", ROCE_HIKP_RST_REG_NUM},
|
||||||
|
};
|
||||||
|
|
||||||
|
static int get_cmd_info_table_idx(enum roce_cmd_type cmd_type)
|
||||||
|
diff --git a/net/roce/roce_ext_common/hikp_roce_ext_common.h b/net/roce/roce_ext_common/hikp_roce_ext_common.h
|
||||||
|
index 1e8063d..918712f 100644
|
||||||
|
--- a/net/roce/roce_ext_common/hikp_roce_ext_common.h
|
||||||
|
+++ b/net/roce/roce_ext_common/hikp_roce_ext_common.h
|
||||||
|
@@ -27,6 +27,7 @@
|
||||||
|
#define ROCE_HIKP_TIMER_REG_NUM_EXT ROCE_MAX_REG_NUM
|
||||||
|
#define ROCE_HIKP_TRP_REG_NUM_EXT ROCE_MAX_REG_NUM
|
||||||
|
#define ROCE_HIKP_TSP_REG_NUM_EXT ROCE_MAX_REG_NUM
|
||||||
|
+#define ROCE_HIKP_RST_REG_NUM ROCE_MAX_REG_NUM
|
||||||
|
|
||||||
|
struct roce_ext_head {
|
||||||
|
uint8_t total_block_num;
|
||||||
|
diff --git a/net/roce/roce_rst/hikp_roce_rst.c b/net/roce/roce_rst/hikp_roce_rst.c
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..ad4dd0c
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/net/roce/roce_rst/hikp_roce_rst.c
|
||||||
|
@@ -0,0 +1,78 @@
|
||||||
|
+/*
|
||||||
|
+ * Copyright (c) 2023 Hisilicon Technologies Co., Ltd.
|
||||||
|
+ * Hikptool is licensed under Mulan PSL v2.
|
||||||
|
+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||||
|
+ * You may obtain a copy of Mulan PSL v2 at:
|
||||||
|
+ * http://license.coscl.org.cn/MulanPSL2
|
||||||
|
+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||||
|
+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||||
|
+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||||
|
+ *
|
||||||
|
+ * See the Mulan PSL v2 for more details.
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+#include "hikp_roce_rst.h"
|
||||||
|
+
|
||||||
|
+static struct cmd_roce_rst_param g_roce_rst_param = { 0 };
|
||||||
|
+
|
||||||
|
+static int hikp_roce_rst_help(struct major_cmd_ctrl *self, const char *argv)
|
||||||
|
+{
|
||||||
|
+ printf("\n Usage: %s %s\n", self->cmd_ptr->name, "-i <interface>\n");
|
||||||
|
+ printf("\n %s\n", self->cmd_ptr->help_info);
|
||||||
|
+ printf(" Options:\n\n");
|
||||||
|
+ printf(" %s, %-25s %s\n", "-h", "--help", "display this help and exit");
|
||||||
|
+ printf(" %s, %-25s %s\n", "-i", "--interface=<interface>", "device target, e.g. eth0");
|
||||||
|
+ printf("\n");
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int hikp_roce_rst_target(struct major_cmd_ctrl *self, const char *argv)
|
||||||
|
+{
|
||||||
|
+ self->err_no = tool_check_and_get_valid_bdf_id(argv, &(g_roce_rst_param.target));
|
||||||
|
+ if (self->err_no)
|
||||||
|
+ snprintf(self->err_str, sizeof(self->err_str), "Unknown device %s.\n", argv);
|
||||||
|
+
|
||||||
|
+ return self->err_no;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int hikp_roce_rst_get_data(struct hikp_cmd_ret **cmd_ret,
|
||||||
|
+ uint32_t block_id)
|
||||||
|
+{
|
||||||
|
+ struct hikp_cmd_header req_header = { 0 };
|
||||||
|
+ struct roce_rst_req_param req_data;
|
||||||
|
+ uint32_t req_size;
|
||||||
|
+ int ret;
|
||||||
|
+
|
||||||
|
+ req_data.bdf = g_roce_rst_param.target.bdf;
|
||||||
|
+ req_data.block_id = block_id;
|
||||||
|
+
|
||||||
|
+ req_size = sizeof(struct roce_rst_req_param);
|
||||||
|
+ hikp_cmd_init(&req_header, ROCE_MOD, GET_ROCEE_RST_CMD,
|
||||||
|
+ g_roce_rst_param.sub_cmd);
|
||||||
|
+ *cmd_ret = hikp_cmd_alloc(&req_header, &req_data, req_size);
|
||||||
|
+ ret = hikp_rsp_normal_check(*cmd_ret);
|
||||||
|
+ if (ret)
|
||||||
|
+ printf("hikptool roce_rst cmd_ret malloc failed, sub_cmd = %u, ret = %d.\n",
|
||||||
|
+ g_roce_rst_param.sub_cmd, ret);
|
||||||
|
+
|
||||||
|
+ return ret;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void hikp_roce_rst_execute(struct major_cmd_ctrl *self)
|
||||||
|
+{
|
||||||
|
+ hikp_roce_ext_execute(self, GET_ROCEE_RST_CMD, hikp_roce_rst_get_data);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void cmd_roce_rst_init(void)
|
||||||
|
+{
|
||||||
|
+ struct major_cmd_ctrl *major_cmd = get_major_cmd();
|
||||||
|
+
|
||||||
|
+ major_cmd->option_count = 0;
|
||||||
|
+ major_cmd->execute = hikp_roce_rst_execute;
|
||||||
|
+
|
||||||
|
+ cmd_option_register("-h", "--help", false, hikp_roce_rst_help);
|
||||||
|
+ cmd_option_register("-i", "--interface", true, hikp_roce_rst_target);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+HIKP_CMD_DECLARE("roce_rst", "get roce_rst registers information", cmd_roce_rst_init);
|
||||||
|
diff --git a/net/roce/roce_rst/hikp_roce_rst.h b/net/roce/roce_rst/hikp_roce_rst.h
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..731effc
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/net/roce/roce_rst/hikp_roce_rst.h
|
||||||
|
@@ -0,0 +1,29 @@
|
||||||
|
+/*
|
||||||
|
+ * Copyright (c) 2023 Hisilicon Technologies Co., Ltd.
|
||||||
|
+ * Hikptool is licensed under Mulan PSL v2.
|
||||||
|
+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||||
|
+ * You may obtain a copy of Mulan PSL v2 at:
|
||||||
|
+ * http://license.coscl.org.cn/MulanPSL2
|
||||||
|
+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||||
|
+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||||
|
+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||||
|
+ *
|
||||||
|
+ * See the Mulan PSL v2 for more details.
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+#ifndef __HIKP_ROCE_RST_H__
|
||||||
|
+#define __HIKP_ROCE_RST_H__
|
||||||
|
+
|
||||||
|
+#include "hikp_roce_ext_common.h"
|
||||||
|
+
|
||||||
|
+struct cmd_roce_rst_param {
|
||||||
|
+ struct tool_target target;
|
||||||
|
+ uint32_t sub_cmd;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+struct roce_rst_req_param {
|
||||||
|
+ struct bdf_t bdf;
|
||||||
|
+ uint32_t block_id;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+#endif /* __HIKP_ROCE_RST_H__ */
|
||||||
|
--
|
||||||
|
2.30.0
|
||||||
|
|
||||||
210
0041-hikptool-roce-Add-roce_global_cfg-cmd-for-global-con.patch
Normal file
210
0041-hikptool-roce-Add-roce_global_cfg-cmd-for-global-con.patch
Normal file
@ -0,0 +1,210 @@
|
|||||||
|
From 36ba114387e6b262d5a55b397a47e63fd0e75d0a Mon Sep 17 00:00:00 2001
|
||||||
|
From: Junxian Huang <huangjunxian6@hisilicon.com>
|
||||||
|
Date: Wed, 2 Aug 2023 16:12:49 +0800
|
||||||
|
Subject: hikptool/roce: Add roce_global_cfg cmd for global config registers
|
||||||
|
query
|
||||||
|
|
||||||
|
Add roce_global_cfg cmd for global config registers query
|
||||||
|
|
||||||
|
Example:
|
||||||
|
hikptool roce_global_cfg -i eth1
|
||||||
|
|
||||||
|
Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com>
|
||||||
|
---
|
||||||
|
net/hikp_net_lib.h | 1 +
|
||||||
|
.../roce_ext_common/hikp_roce_ext_common.c | 1 +
|
||||||
|
.../roce_ext_common/hikp_roce_ext_common.h | 1 +
|
||||||
|
.../roce_global_cfg/hikp_roce_global_cfg.c | 97 +++++++++++++++++++
|
||||||
|
.../roce_global_cfg/hikp_roce_global_cfg.h | 40 ++++++++
|
||||||
|
5 files changed, 140 insertions(+)
|
||||||
|
create mode 100644 net/roce/roce_global_cfg/hikp_roce_global_cfg.c
|
||||||
|
create mode 100644 net/roce/roce_global_cfg/hikp_roce_global_cfg.h
|
||||||
|
|
||||||
|
diff --git a/net/hikp_net_lib.h b/net/hikp_net_lib.h
|
||||||
|
index e60fc15..bdaacb1 100644
|
||||||
|
--- a/net/hikp_net_lib.h
|
||||||
|
+++ b/net/hikp_net_lib.h
|
||||||
|
@@ -101,6 +101,7 @@ enum roce_cmd_type {
|
||||||
|
GET_ROCEE_TRP_CMD,
|
||||||
|
GET_ROCEE_TSP_CMD,
|
||||||
|
GET_ROCEE_RST_CMD,
|
||||||
|
+ GET_ROCEE_GLOBAL_CFG_CMD,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum ub_cmd_type {
|
||||||
|
diff --git a/net/roce/roce_ext_common/hikp_roce_ext_common.c b/net/roce/roce_ext_common/hikp_roce_ext_common.c
|
||||||
|
index 01dded5..0ff07dc 100644
|
||||||
|
--- a/net/roce/roce_ext_common/hikp_roce_ext_common.c
|
||||||
|
+++ b/net/roce/roce_ext_common/hikp_roce_ext_common.c
|
||||||
|
@@ -43,6 +43,7 @@ static const struct cmd_type_info {
|
||||||
|
{GET_ROCEE_TRP_CMD, "TRP", ROCE_HIKP_TRP_REG_NUM_EXT},
|
||||||
|
{GET_ROCEE_TSP_CMD, "TSP", ROCE_HIKP_TSP_REG_NUM_EXT},
|
||||||
|
{GET_ROCEE_RST_CMD, "RST", ROCE_HIKP_RST_REG_NUM},
|
||||||
|
+ {GET_ROCEE_GLOBAL_CFG_CMD, "GLOBAL_CFG", ROCE_HIKP_GLOBAL_CFG_REG_NUM},
|
||||||
|
};
|
||||||
|
|
||||||
|
static int get_cmd_info_table_idx(enum roce_cmd_type cmd_type)
|
||||||
|
diff --git a/net/roce/roce_ext_common/hikp_roce_ext_common.h b/net/roce/roce_ext_common/hikp_roce_ext_common.h
|
||||||
|
index 918712f..870a361 100644
|
||||||
|
--- a/net/roce/roce_ext_common/hikp_roce_ext_common.h
|
||||||
|
+++ b/net/roce/roce_ext_common/hikp_roce_ext_common.h
|
||||||
|
@@ -28,6 +28,7 @@
|
||||||
|
#define ROCE_HIKP_TRP_REG_NUM_EXT ROCE_MAX_REG_NUM
|
||||||
|
#define ROCE_HIKP_TSP_REG_NUM_EXT ROCE_MAX_REG_NUM
|
||||||
|
#define ROCE_HIKP_RST_REG_NUM ROCE_MAX_REG_NUM
|
||||||
|
+#define ROCE_HIKP_GLOBAL_CFG_REG_NUM ROCE_MAX_REG_NUM
|
||||||
|
|
||||||
|
struct roce_ext_head {
|
||||||
|
uint8_t total_block_num;
|
||||||
|
diff --git a/net/roce/roce_global_cfg/hikp_roce_global_cfg.c b/net/roce/roce_global_cfg/hikp_roce_global_cfg.c
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..49a4a2c
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/net/roce/roce_global_cfg/hikp_roce_global_cfg.c
|
||||||
|
@@ -0,0 +1,97 @@
|
||||||
|
+/*
|
||||||
|
+ * Copyright (c) 2023 Hisilicon Technologies Co., Ltd.
|
||||||
|
+ * Hikptool is licensed under Mulan PSL v2.
|
||||||
|
+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||||
|
+ * You may obtain a copy of Mulan PSL v2 at:
|
||||||
|
+ * http://license.coscl.org.cn/MulanPSL2
|
||||||
|
+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||||
|
+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||||
|
+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||||
|
+ *
|
||||||
|
+ * See the Mulan PSL v2 for more details.
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+#include "hikp_roce_global_cfg.h"
|
||||||
|
+
|
||||||
|
+static struct cmd_roce_global_cfg_param g_roce_global_cfg_param = { 0 };
|
||||||
|
+
|
||||||
|
+static int hikp_roce_global_cfg_help(struct major_cmd_ctrl *self,
|
||||||
|
+ const char *argv)
|
||||||
|
+{
|
||||||
|
+ printf("\n Usage: %s %s\n", self->cmd_ptr->name, "-i <interface>\n");
|
||||||
|
+ printf("\n %s\n", self->cmd_ptr->help_info);
|
||||||
|
+ printf(" Options:\n\n");
|
||||||
|
+ printf(" %s, %-25s %s\n", "-h", "--help", "display this help and exit");
|
||||||
|
+ printf(" %s, %-25s %s\n", "-i", "--interface=<interface>", "device target, e.g. eth0");
|
||||||
|
+ printf("\n");
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int hikp_roce_global_cfg_target(struct major_cmd_ctrl *self,
|
||||||
|
+ const char *argv)
|
||||||
|
+{
|
||||||
|
+ self->err_no = tool_check_and_get_valid_bdf_id(argv, &(g_roce_global_cfg_param.target));
|
||||||
|
+ if (self->err_no)
|
||||||
|
+ snprintf(self->err_str, sizeof(self->err_str),
|
||||||
|
+ "Unknown device %s.\n", argv);
|
||||||
|
+
|
||||||
|
+ return self->err_no;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int hikp_roce_global_cfg_get_data(struct hikp_cmd_ret **cmd_ret,
|
||||||
|
+ uint32_t block_id)
|
||||||
|
+{
|
||||||
|
+ struct hikp_cmd_header req_header = { 0 };
|
||||||
|
+ struct roce_global_cfg_req_param req_data;
|
||||||
|
+ uint32_t req_size;
|
||||||
|
+ int ret;
|
||||||
|
+
|
||||||
|
+ req_data.bdf = g_roce_global_cfg_param.target.bdf;
|
||||||
|
+ req_data.block_id = block_id;
|
||||||
|
+
|
||||||
|
+ req_size = sizeof(struct roce_global_cfg_req_param);
|
||||||
|
+ hikp_cmd_init(&req_header, ROCE_MOD, GET_ROCEE_GLOBAL_CFG_CMD,
|
||||||
|
+ g_roce_global_cfg_param.sub_cmd);
|
||||||
|
+ *cmd_ret = hikp_cmd_alloc(&req_header, &req_data, req_size);
|
||||||
|
+ ret = hikp_rsp_normal_check(*cmd_ret);
|
||||||
|
+ if (ret)
|
||||||
|
+ printf("hikptool roce_global_cfg cmd_ret malloc failed, sub_cmd = %u, ret = %d.\n",
|
||||||
|
+ g_roce_global_cfg_param.sub_cmd, ret);
|
||||||
|
+
|
||||||
|
+ return ret;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void hikp_roce_global_cfg_execute(struct major_cmd_ctrl *self)
|
||||||
|
+{
|
||||||
|
+ enum roce_global_cfg_cmd_type sub_cmds[] = {
|
||||||
|
+ ROCE_GLB_GENAC,
|
||||||
|
+ ROCE_GLB_TRP_BANK,
|
||||||
|
+ ROCE_GLB_TRP_RX,
|
||||||
|
+ ROCE_GLB_TPP_M,
|
||||||
|
+ ROCE_GLB_QMM,
|
||||||
|
+ ROCE_GLB_TGP_TMP,
|
||||||
|
+ ROCE_GLB_TDP_M,
|
||||||
|
+ ROCE_GLB_NICL,
|
||||||
|
+ };
|
||||||
|
+ int i;
|
||||||
|
+
|
||||||
|
+ for (i = 0; i < HIKP_ARRAY_SIZE(sub_cmds); i++) {
|
||||||
|
+ g_roce_global_cfg_param.sub_cmd = sub_cmds[i];
|
||||||
|
+ hikp_roce_ext_execute(self, GET_ROCEE_GLOBAL_CFG_CMD,
|
||||||
|
+ hikp_roce_global_cfg_get_data);
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void cmd_roce_global_cfg_init(void)
|
||||||
|
+{
|
||||||
|
+ struct major_cmd_ctrl *major_cmd = get_major_cmd();
|
||||||
|
+
|
||||||
|
+ major_cmd->option_count = 0;
|
||||||
|
+ major_cmd->execute = hikp_roce_global_cfg_execute;
|
||||||
|
+
|
||||||
|
+ cmd_option_register("-h", "--help", false, hikp_roce_global_cfg_help);
|
||||||
|
+ cmd_option_register("-i", "--interface", true, hikp_roce_global_cfg_target);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+HIKP_CMD_DECLARE("roce_global_cfg", "get roce_global_cfg registers information", cmd_roce_global_cfg_init);
|
||||||
|
diff --git a/net/roce/roce_global_cfg/hikp_roce_global_cfg.h b/net/roce/roce_global_cfg/hikp_roce_global_cfg.h
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..66e7fb8
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/net/roce/roce_global_cfg/hikp_roce_global_cfg.h
|
||||||
|
@@ -0,0 +1,40 @@
|
||||||
|
+/*
|
||||||
|
+ * Copyright (c) 2023 Hisilicon Technologies Co., Ltd.
|
||||||
|
+ * Hikptool is licensed under Mulan PSL v2.
|
||||||
|
+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||||
|
+ * You may obtain a copy of Mulan PSL v2 at:
|
||||||
|
+ * http://license.coscl.org.cn/MulanPSL2
|
||||||
|
+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||||
|
+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||||
|
+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||||
|
+ *
|
||||||
|
+ * See the Mulan PSL v2 for more details.
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+#ifndef __HIKP_ROCE_GLOBAL_CFG_H__
|
||||||
|
+#define __HIKP_ROCE_GLOBAL_CFG_H__
|
||||||
|
+
|
||||||
|
+#include "hikp_roce_ext_common.h"
|
||||||
|
+
|
||||||
|
+struct cmd_roce_global_cfg_param {
|
||||||
|
+ struct tool_target target;
|
||||||
|
+ uint32_t sub_cmd;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+struct roce_global_cfg_req_param {
|
||||||
|
+ struct bdf_t bdf;
|
||||||
|
+ uint32_t block_id;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+enum roce_global_cfg_cmd_type {
|
||||||
|
+ ROCE_GLB_GENAC = 0,
|
||||||
|
+ ROCE_GLB_TRP_BANK,
|
||||||
|
+ ROCE_GLB_TRP_RX,
|
||||||
|
+ ROCE_GLB_TPP_M,
|
||||||
|
+ ROCE_GLB_QMM,
|
||||||
|
+ ROCE_GLB_TGP_TMP,
|
||||||
|
+ ROCE_GLB_TDP_M,
|
||||||
|
+ ROCE_GLB_NICL,
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+#endif /* __HIKP_ROCE_GLOBAL_CFG_H__ */
|
||||||
|
--
|
||||||
|
2.30.0
|
||||||
|
|
||||||
179
0042-hikptool-roce-Add-roce_bond-cmd-for-bond-registers-q.patch
Normal file
179
0042-hikptool-roce-Add-roce_bond-cmd-for-bond-registers-q.patch
Normal file
@ -0,0 +1,179 @@
|
|||||||
|
From 7f0a2e3f2dff9b49ce5be8b07835fa7c791cdce1 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Junxian Huang <huangjunxian6@hisilicon.com>
|
||||||
|
Date: Wed, 2 Aug 2023 16:17:40 +0800
|
||||||
|
Subject: hikptool/roce: Add roce_bond cmd for bond registers query
|
||||||
|
|
||||||
|
Add roce_bond cmd for bond registers query.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
hikptool roce_bond -i eth1
|
||||||
|
|
||||||
|
Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com>
|
||||||
|
---
|
||||||
|
net/hikp_net_lib.h | 1 +
|
||||||
|
net/roce/roce_bond/hikp_roce_bond.c | 78 +++++++++++++++++++
|
||||||
|
net/roce/roce_bond/hikp_roce_bond.h | 29 +++++++
|
||||||
|
.../roce_ext_common/hikp_roce_ext_common.c | 1 +
|
||||||
|
.../roce_ext_common/hikp_roce_ext_common.h | 1 +
|
||||||
|
5 files changed, 110 insertions(+)
|
||||||
|
create mode 100644 net/roce/roce_bond/hikp_roce_bond.c
|
||||||
|
create mode 100644 net/roce/roce_bond/hikp_roce_bond.h
|
||||||
|
|
||||||
|
diff --git a/net/hikp_net_lib.h b/net/hikp_net_lib.h
|
||||||
|
index bdaacb1..ad9e7e4 100644
|
||||||
|
--- a/net/hikp_net_lib.h
|
||||||
|
+++ b/net/hikp_net_lib.h
|
||||||
|
@@ -102,6 +102,7 @@ enum roce_cmd_type {
|
||||||
|
GET_ROCEE_TSP_CMD,
|
||||||
|
GET_ROCEE_RST_CMD,
|
||||||
|
GET_ROCEE_GLOBAL_CFG_CMD,
|
||||||
|
+ GET_ROCEE_BOND_CMD,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum ub_cmd_type {
|
||||||
|
diff --git a/net/roce/roce_bond/hikp_roce_bond.c b/net/roce/roce_bond/hikp_roce_bond.c
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..89f8bab
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/net/roce/roce_bond/hikp_roce_bond.c
|
||||||
|
@@ -0,0 +1,78 @@
|
||||||
|
+/*
|
||||||
|
+ * Copyright (c) 2023 Hisilicon Technologies Co., Ltd.
|
||||||
|
+ * Hikptool is licensed under Mulan PSL v2.
|
||||||
|
+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||||
|
+ * You may obtain a copy of Mulan PSL v2 at:
|
||||||
|
+ * http://license.coscl.org.cn/MulanPSL2
|
||||||
|
+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||||
|
+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||||
|
+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||||
|
+ *
|
||||||
|
+ * See the Mulan PSL v2 for more details.
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+#include "hikp_roce_bond.h"
|
||||||
|
+
|
||||||
|
+static struct cmd_roce_bond_param g_roce_bond_param = { 0 };
|
||||||
|
+
|
||||||
|
+static int hikp_roce_bond_help(struct major_cmd_ctrl *self, const char *argv)
|
||||||
|
+{
|
||||||
|
+ printf("\n Usage: %s %s\n", self->cmd_ptr->name, "-i <interface>\n");
|
||||||
|
+ printf("\n %s\n", self->cmd_ptr->help_info);
|
||||||
|
+ printf(" Options:\n\n");
|
||||||
|
+ printf(" %s, %-25s %s\n", "-h", "--help", "display this help and exit");
|
||||||
|
+ printf(" %s, %-25s %s\n", "-i", "--interface=<interface>", "device target, e.g. eth0");
|
||||||
|
+ printf("\n");
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int hikp_roce_bond_target(struct major_cmd_ctrl *self, const char *argv)
|
||||||
|
+{
|
||||||
|
+ self->err_no = tool_check_and_get_valid_bdf_id(argv, &(g_roce_bond_param.target));
|
||||||
|
+ if (self->err_no)
|
||||||
|
+ snprintf(self->err_str, sizeof(self->err_str), "Unknown device %s.\n", argv);
|
||||||
|
+
|
||||||
|
+ return self->err_no;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int hikp_roce_bond_get_data(struct hikp_cmd_ret **cmd_ret,
|
||||||
|
+ uint32_t block_id)
|
||||||
|
+{
|
||||||
|
+ struct hikp_cmd_header req_header = { 0 };
|
||||||
|
+ struct roce_bond_req_param req_data;
|
||||||
|
+ uint32_t req_size;
|
||||||
|
+ int ret;
|
||||||
|
+
|
||||||
|
+ req_data.bdf = g_roce_bond_param.target.bdf;
|
||||||
|
+ req_data.block_id = block_id;
|
||||||
|
+
|
||||||
|
+ req_size = sizeof(struct roce_bond_req_param);
|
||||||
|
+ hikp_cmd_init(&req_header, ROCE_MOD, GET_ROCEE_BOND_CMD,
|
||||||
|
+ g_roce_bond_param.sub_cmd);
|
||||||
|
+ *cmd_ret = hikp_cmd_alloc(&req_header, &req_data, req_size);
|
||||||
|
+ ret = hikp_rsp_normal_check(*cmd_ret);
|
||||||
|
+ if (ret)
|
||||||
|
+ printf("hikptool roce_bond cmd_ret malloc failed, sub_cmd = %u, ret = %d.\n",
|
||||||
|
+ g_roce_bond_param.sub_cmd, ret);
|
||||||
|
+
|
||||||
|
+ return ret;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void hikp_roce_bond_execute(struct major_cmd_ctrl *self)
|
||||||
|
+{
|
||||||
|
+ hikp_roce_ext_execute(self, GET_ROCEE_BOND_CMD, hikp_roce_bond_get_data);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void cmd_roce_bond_init(void)
|
||||||
|
+{
|
||||||
|
+ struct major_cmd_ctrl *major_cmd = get_major_cmd();
|
||||||
|
+
|
||||||
|
+ major_cmd->option_count = 0;
|
||||||
|
+ major_cmd->execute = hikp_roce_bond_execute;
|
||||||
|
+
|
||||||
|
+ cmd_option_register("-h", "--help", false, hikp_roce_bond_help);
|
||||||
|
+ cmd_option_register("-i", "--interface", true, hikp_roce_bond_target);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+HIKP_CMD_DECLARE("roce_bond", "get roce_bond registers information", cmd_roce_bond_init);
|
||||||
|
diff --git a/net/roce/roce_bond/hikp_roce_bond.h b/net/roce/roce_bond/hikp_roce_bond.h
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..14bd233
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/net/roce/roce_bond/hikp_roce_bond.h
|
||||||
|
@@ -0,0 +1,29 @@
|
||||||
|
+/*
|
||||||
|
+ * Copyright (c) 2023 Hisilicon Technologies Co., Ltd.
|
||||||
|
+ * Hikptool is licensed under Mulan PSL v2.
|
||||||
|
+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||||
|
+ * You may obtain a copy of Mulan PSL v2 at:
|
||||||
|
+ * http://license.coscl.org.cn/MulanPSL2
|
||||||
|
+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||||
|
+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||||
|
+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||||
|
+ *
|
||||||
|
+ * See the Mulan PSL v2 for more details.
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+#ifndef __HIKP_ROCE_BOND_H__
|
||||||
|
+#define __HIKP_ROCE_BOND_H__
|
||||||
|
+
|
||||||
|
+#include "hikp_roce_ext_common.h"
|
||||||
|
+
|
||||||
|
+struct cmd_roce_bond_param {
|
||||||
|
+ struct tool_target target;
|
||||||
|
+ uint32_t sub_cmd;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+struct roce_bond_req_param {
|
||||||
|
+ struct bdf_t bdf;
|
||||||
|
+ uint32_t block_id;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+#endif /* __HIKP_ROCE_BOND_H__ */
|
||||||
|
diff --git a/net/roce/roce_ext_common/hikp_roce_ext_common.c b/net/roce/roce_ext_common/hikp_roce_ext_common.c
|
||||||
|
index 0ff07dc..d0fae69 100644
|
||||||
|
--- a/net/roce/roce_ext_common/hikp_roce_ext_common.c
|
||||||
|
+++ b/net/roce/roce_ext_common/hikp_roce_ext_common.c
|
||||||
|
@@ -44,6 +44,7 @@ static const struct cmd_type_info {
|
||||||
|
{GET_ROCEE_TSP_CMD, "TSP", ROCE_HIKP_TSP_REG_NUM_EXT},
|
||||||
|
{GET_ROCEE_RST_CMD, "RST", ROCE_HIKP_RST_REG_NUM},
|
||||||
|
{GET_ROCEE_GLOBAL_CFG_CMD, "GLOBAL_CFG", ROCE_HIKP_GLOBAL_CFG_REG_NUM},
|
||||||
|
+ {GET_ROCEE_BOND_CMD, "BOND", ROCE_HIKP_BOND_REG_NUM},
|
||||||
|
};
|
||||||
|
|
||||||
|
static int get_cmd_info_table_idx(enum roce_cmd_type cmd_type)
|
||||||
|
diff --git a/net/roce/roce_ext_common/hikp_roce_ext_common.h b/net/roce/roce_ext_common/hikp_roce_ext_common.h
|
||||||
|
index 870a361..a600449 100644
|
||||||
|
--- a/net/roce/roce_ext_common/hikp_roce_ext_common.h
|
||||||
|
+++ b/net/roce/roce_ext_common/hikp_roce_ext_common.h
|
||||||
|
@@ -29,6 +29,7 @@
|
||||||
|
#define ROCE_HIKP_TSP_REG_NUM_EXT ROCE_MAX_REG_NUM
|
||||||
|
#define ROCE_HIKP_RST_REG_NUM ROCE_MAX_REG_NUM
|
||||||
|
#define ROCE_HIKP_GLOBAL_CFG_REG_NUM ROCE_MAX_REG_NUM
|
||||||
|
+#define ROCE_HIKP_BOND_REG_NUM ROCE_MAX_REG_NUM
|
||||||
|
|
||||||
|
struct roce_ext_head {
|
||||||
|
uint8_t total_block_num;
|
||||||
|
--
|
||||||
|
2.30.0
|
||||||
|
|
||||||
174
0043-hikptool-roce-Add-ext-query-for-roce_caep-cmd.patch
Normal file
174
0043-hikptool-roce-Add-ext-query-for-roce_caep-cmd.patch
Normal file
@ -0,0 +1,174 @@
|
|||||||
|
From 80d9d76b7d5af23e58d13569bd1898604c8e2456 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Junxian Huang <huangjunxian6@hisilicon.com>
|
||||||
|
Date: Tue, 1 Aug 2023 17:41:24 +0800
|
||||||
|
Subject: hikptool/roce: Add ext query for roce_caep cmd
|
||||||
|
|
||||||
|
Add ext query for roce_caep cmd. To query these ext registers, add
|
||||||
|
-e to the query cmd.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
hikptool roce_caep -i eth1 -e
|
||||||
|
|
||||||
|
Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com>
|
||||||
|
---
|
||||||
|
net/roce/roce_caep/hikp_roce_caep.c | 69 +++++++++++++++++++----------
|
||||||
|
net/roce/roce_caep/hikp_roce_caep.h | 11 +++++
|
||||||
|
2 files changed, 57 insertions(+), 23 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/net/roce/roce_caep/hikp_roce_caep.c b/net/roce/roce_caep/hikp_roce_caep.c
|
||||||
|
index 69a4742..6c92ea1 100644
|
||||||
|
--- a/net/roce/roce_caep/hikp_roce_caep.c
|
||||||
|
+++ b/net/roce/roce_caep/hikp_roce_caep.c
|
||||||
|
@@ -22,6 +22,7 @@ static int hikp_roce_caep_help(struct major_cmd_ctrl *self, const char *argv)
|
||||||
|
printf(" Options:\n\n");
|
||||||
|
printf(" %s, %-25s %s\n", "-h", "--help", "display this help and exit");
|
||||||
|
printf(" %s, %-25s %s\n", "-i", "--interface=<interface>", "device target, e.g. eth0");
|
||||||
|
+ printf(" %s, %-25s %s\n", "-e", "--extend", "query extend caep registers");
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
@@ -31,7 +32,7 @@ static int hikp_roce_caep_target(struct major_cmd_ctrl *self, const char *argv)
|
||||||
|
{
|
||||||
|
self->err_no = tool_check_and_get_valid_bdf_id(argv, &(g_roce_caep_param_t.target));
|
||||||
|
if (self->err_no != 0) {
|
||||||
|
- snprintf(self->err_str, sizeof(self->err_str), "Unknown device %s.", argv);
|
||||||
|
+ snprintf(self->err_str, sizeof(self->err_str), "Unknown device %s.\n", argv);
|
||||||
|
return self->err_no;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -39,18 +40,28 @@ static int hikp_roce_caep_target(struct major_cmd_ctrl *self, const char *argv)
|
||||||
|
}
|
||||||
|
|
||||||
|
static int hikp_roce_caep_get_data(struct hikp_cmd_ret **cmd_ret,
|
||||||
|
- struct roce_caep_req_param req_data)
|
||||||
|
+ uint32_t block_id)
|
||||||
|
{
|
||||||
|
+ struct roce_caep_req_param_ext req_data_ext;
|
||||||
|
struct hikp_cmd_header req_header = { 0 };
|
||||||
|
+ uint32_t req_size;
|
||||||
|
+ int ret;
|
||||||
|
|
||||||
|
- hikp_cmd_init(&req_header, ROCE_MOD, GET_ROCEE_CAEP_CMD, 0);
|
||||||
|
- *cmd_ret = hikp_cmd_alloc(&req_header, &req_data, sizeof(req_data));
|
||||||
|
- if (*cmd_ret == NULL) {
|
||||||
|
- printf("hikptool roce_caep cmd_ret malloc failed\n");
|
||||||
|
- return -EIO;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- return 0;
|
||||||
|
+ req_data_ext.origin_param.bdf = g_roce_caep_param_t.target.bdf;
|
||||||
|
+ req_data_ext.block_id = block_id;
|
||||||
|
+
|
||||||
|
+ req_size = (g_roce_caep_param_t.sub_cmd == CAEP_ORIGIN) ?
|
||||||
|
+ sizeof(struct roce_caep_req_param) :
|
||||||
|
+ sizeof(struct roce_caep_req_param_ext);
|
||||||
|
+ hikp_cmd_init(&req_header, ROCE_MOD, GET_ROCEE_CAEP_CMD,
|
||||||
|
+ g_roce_caep_param_t.sub_cmd);
|
||||||
|
+ *cmd_ret = hikp_cmd_alloc(&req_header, &req_data_ext, req_size);
|
||||||
|
+ ret = hikp_rsp_normal_check(*cmd_ret);
|
||||||
|
+ if (ret)
|
||||||
|
+ printf("hikptool roce_caep cmd_ret malloc failed, sub_cmd = %u, ret = %d.\n",
|
||||||
|
+ g_roce_caep_param_t.sub_cmd, ret);
|
||||||
|
+
|
||||||
|
+ return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void hikp_roce_caep_print(uint32_t total_block_num,
|
||||||
|
@@ -64,29 +75,40 @@ static void hikp_roce_caep_print(uint32_t total_block_num,
|
||||||
|
printf("************************************\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
-static void hikp_roce_caep_execute(struct major_cmd_ctrl *self)
|
||||||
|
+static void hikp_roce_caep_execute_origin(struct major_cmd_ctrl *self)
|
||||||
|
{
|
||||||
|
struct roce_caep_res_param *roce_caep_res;
|
||||||
|
- struct roce_caep_req_param req_data;
|
||||||
|
struct hikp_cmd_ret *cmd_ret;
|
||||||
|
- int ret;
|
||||||
|
|
||||||
|
- req_data.bdf = g_roce_caep_param_t.target.bdf;
|
||||||
|
- ret = hikp_roce_caep_get_data(&cmd_ret, req_data);
|
||||||
|
- if (ret < 0) {
|
||||||
|
- self->err_no = ret;
|
||||||
|
- return;
|
||||||
|
- } else if (cmd_ret->status != 0) {
|
||||||
|
- printf("hikptool roce_caep read data failed\n");
|
||||||
|
+ self->err_no = hikp_roce_caep_get_data(&cmd_ret, 0);
|
||||||
|
+ if (self->err_no) {
|
||||||
|
+ printf("hikptool roce_caep get data failed.\n");
|
||||||
|
goto exec_error;
|
||||||
|
}
|
||||||
|
roce_caep_res = (struct roce_caep_res_param *)cmd_ret->rsp_data;
|
||||||
|
hikp_roce_caep_print(roce_caep_res->total_block_num,
|
||||||
|
- roce_caep_res->reg_data.offset, roce_caep_res->reg_data.data);
|
||||||
|
+ roce_caep_res->reg_data.offset,
|
||||||
|
+ roce_caep_res->reg_data.data);
|
||||||
|
|
||||||
|
exec_error:
|
||||||
|
- free(cmd_ret);
|
||||||
|
- cmd_ret = NULL;
|
||||||
|
+ if (cmd_ret)
|
||||||
|
+ free(cmd_ret);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void hikp_roce_caep_execute(struct major_cmd_ctrl *self)
|
||||||
|
+{
|
||||||
|
+ if (g_roce_caep_param_t.sub_cmd == CAEP_ORIGIN)
|
||||||
|
+ hikp_roce_caep_execute_origin(self);
|
||||||
|
+ else
|
||||||
|
+ hikp_roce_ext_execute(self, GET_ROCEE_CAEP_CMD,
|
||||||
|
+ hikp_roce_caep_get_data);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int hikp_roce_caep_ext_set(struct major_cmd_ctrl *self, const char *argv)
|
||||||
|
+{
|
||||||
|
+ g_roce_caep_param_t.sub_cmd = CAEP_EXT;
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void cmd_roce_caep_init(void)
|
||||||
|
@@ -98,6 +120,7 @@ static void cmd_roce_caep_init(void)
|
||||||
|
|
||||||
|
cmd_option_register("-h", "--help", false, hikp_roce_caep_help);
|
||||||
|
cmd_option_register("-i", "--interface", true, hikp_roce_caep_target);
|
||||||
|
+ cmd_option_register("-e", "--extend", false, hikp_roce_caep_ext_set);
|
||||||
|
}
|
||||||
|
|
||||||
|
HIKP_CMD_DECLARE("roce_caep", "get roce_caep registers information", cmd_roce_caep_init);
|
||||||
|
diff --git a/net/roce/roce_caep/hikp_roce_caep.h b/net/roce/roce_caep/hikp_roce_caep.h
|
||||||
|
index 804d2df..547a4d6 100644
|
||||||
|
--- a/net/roce/roce_caep/hikp_roce_caep.h
|
||||||
|
+++ b/net/roce/roce_caep/hikp_roce_caep.h
|
||||||
|
@@ -21,12 +21,18 @@
|
||||||
|
|
||||||
|
struct cmd_roce_caep_param_t {
|
||||||
|
struct tool_target target;
|
||||||
|
+ uint32_t sub_cmd;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct roce_caep_req_param {
|
||||||
|
struct bdf_t bdf;
|
||||||
|
};
|
||||||
|
|
||||||
|
+struct roce_caep_req_param_ext {
|
||||||
|
+ struct roce_caep_req_param origin_param;
|
||||||
|
+ uint32_t block_id;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
struct roce_caep_res {
|
||||||
|
uint32_t offset[ROCE_HIKP_CAEP_REG_NUM];
|
||||||
|
uint32_t data[ROCE_HIKP_CAEP_REG_NUM];
|
||||||
|
@@ -37,4 +43,9 @@ struct roce_caep_res_param {
|
||||||
|
struct roce_caep_res reg_data;
|
||||||
|
};
|
||||||
|
|
||||||
|
+enum roce_caep_cmd_type {
|
||||||
|
+ CAEP_ORIGIN = 0,
|
||||||
|
+ CAEP_EXT,
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
#endif /* __HIKP_ROCE_CAEP_H__ */
|
||||||
|
--
|
||||||
|
2.30.0
|
||||||
|
|
||||||
210
0044-hikptool-roce-Add-ext-query-for-roce_mdb-cmd.patch
Normal file
210
0044-hikptool-roce-Add-ext-query-for-roce_mdb-cmd.patch
Normal file
@ -0,0 +1,210 @@
|
|||||||
|
From b949611a7a302743916155adee01db0c73c0f8e7 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Junxian Huang <huangjunxian6@hisilicon.com>
|
||||||
|
Date: Fri, 4 Aug 2023 17:25:23 +0800
|
||||||
|
Subject: hikptool/roce: Add ext query for roce_mdb cmd
|
||||||
|
|
||||||
|
Add ext query for roce_mdb cmd. To query these ext registers, add
|
||||||
|
-e to the query cmd.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
hikptool roce_mdb -i eth1 -e
|
||||||
|
|
||||||
|
Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com>
|
||||||
|
---
|
||||||
|
net/roce/roce_mdb/hikp_roce_mdb.c | 83 ++++++++++++++++++++-----------
|
||||||
|
net/roce/roce_mdb/hikp_roce_mdb.h | 13 ++++-
|
||||||
|
2 files changed, 67 insertions(+), 29 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/net/roce/roce_mdb/hikp_roce_mdb.c b/net/roce/roce_mdb/hikp_roce_mdb.c
|
||||||
|
index 9cc07a1..04af817 100644
|
||||||
|
--- a/net/roce/roce_mdb/hikp_roce_mdb.c
|
||||||
|
+++ b/net/roce/roce_mdb/hikp_roce_mdb.c
|
||||||
|
@@ -14,7 +14,6 @@
|
||||||
|
#include <unistd.h>
|
||||||
|
#include "hikp_roce_mdb.h"
|
||||||
|
|
||||||
|
-#define ROCE_MDB_CMD_CLEAR HI_BIT(0)
|
||||||
|
static struct cmd_roce_mdb_param g_roce_mdb_param = { 0 };
|
||||||
|
|
||||||
|
static int hikp_roce_mdb_help(struct major_cmd_ctrl *self, const char *argv)
|
||||||
|
@@ -25,6 +24,7 @@ static int hikp_roce_mdb_help(struct major_cmd_ctrl *self, const char *argv)
|
||||||
|
printf(" %s, %-25s %s\n", "-h", "--help", "display this help and exit");
|
||||||
|
printf(" %s, %-25s %s\n", "-i", "--interface=<interface>", "device target, e.g. eth0");
|
||||||
|
printf(" %s, %-25s %s\n", "-c", "--clear=<clear>", "clear mdb registers");
|
||||||
|
+ printf(" %s, %-25s %s\n", "-e", "--extend", "query extend mdb registers");
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
@@ -34,7 +34,7 @@ static int hikp_roce_mdb_target(struct major_cmd_ctrl *self, const char *argv)
|
||||||
|
{
|
||||||
|
self->err_no = tool_check_and_get_valid_bdf_id(argv, &(g_roce_mdb_param.target));
|
||||||
|
if (self->err_no) {
|
||||||
|
- snprintf(self->err_str, sizeof(self->err_str), "Unknown device %s.", argv);
|
||||||
|
+ snprintf(self->err_str, sizeof(self->err_str), "Unknown device %s.\n", argv);
|
||||||
|
return self->err_no;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -43,7 +43,8 @@ static int hikp_roce_mdb_target(struct major_cmd_ctrl *self, const char *argv)
|
||||||
|
|
||||||
|
static int hikp_roce_mdb_clear_set(struct major_cmd_ctrl *self, const char *argv)
|
||||||
|
{
|
||||||
|
- g_roce_mdb_param.reset_flag = ROCE_MDB_CMD_CLEAR;
|
||||||
|
+ g_roce_mdb_param.flag |= ROCE_MDB_CMD_CLEAR;
|
||||||
|
+
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -58,53 +59,78 @@ static void hikp_roce_mdb_print(uint32_t reg_num, struct roce_mdb_rsp_data *mdb_
|
||||||
|
printf("***********************************\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
-static int hikp_roce_mdb_show(struct major_cmd_ctrl *self)
|
||||||
|
+static int hikp_roce_mdb_get_data(struct hikp_cmd_ret **cmd_ret,
|
||||||
|
+ uint32_t block_id)
|
||||||
|
{
|
||||||
|
- struct roce_mdb_req_para req_data = { 0 };
|
||||||
|
- struct roce_mdb_rsp_data *mdb_rsp = NULL;
|
||||||
|
+ struct roce_mdb_req_param_ext req_data_ext;
|
||||||
|
struct hikp_cmd_header req_header = { 0 };
|
||||||
|
+ uint32_t req_size;
|
||||||
|
+ int ret;
|
||||||
|
+
|
||||||
|
+ req_data_ext.origin_param.bdf = g_roce_mdb_param.target.bdf;
|
||||||
|
+ req_data_ext.block_id = block_id;
|
||||||
|
+
|
||||||
|
+ req_size = (g_roce_mdb_param.flag & ROCE_MDB_CMD_EXT) ?
|
||||||
|
+ sizeof(struct roce_mdb_req_param_ext) :
|
||||||
|
+ sizeof(struct roce_mdb_req_para);
|
||||||
|
+ hikp_cmd_init(&req_header, ROCE_MOD, GET_ROCEE_MDB_CMD,
|
||||||
|
+ g_roce_mdb_param.sub_cmd);
|
||||||
|
+ *cmd_ret = hikp_cmd_alloc(&req_header, &req_data_ext, req_size);
|
||||||
|
+ ret = hikp_rsp_normal_check(*cmd_ret);
|
||||||
|
+ if (ret)
|
||||||
|
+ printf("hikptool roce_mdb cmd_ret malloc failed, sub_cmd = %u, ret = %d.\n",
|
||||||
|
+ g_roce_mdb_param.sub_cmd, ret);
|
||||||
|
+
|
||||||
|
+ return ret;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void hikp_roce_mdb_execute_origin(struct major_cmd_ctrl *self)
|
||||||
|
+{
|
||||||
|
+ struct roce_mdb_rsp_data *mdb_rsp = NULL;
|
||||||
|
struct hikp_cmd_ret *cmd_ret = NULL;
|
||||||
|
uint32_t reg_num;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
- req_data.bdf = g_roce_mdb_param.target.bdf;
|
||||||
|
- if (g_roce_mdb_param.reset_flag)
|
||||||
|
- hikp_cmd_init(&req_header, ROCE_MOD, GET_ROCEE_MDB_CMD, MDB_CLEAR);
|
||||||
|
- else
|
||||||
|
- hikp_cmd_init(&req_header, ROCE_MOD, GET_ROCEE_MDB_CMD, MDB_SHOW);
|
||||||
|
-
|
||||||
|
- cmd_ret = hikp_cmd_alloc(&req_header, &req_data, sizeof(req_data));
|
||||||
|
- ret = hikp_rsp_normal_check(cmd_ret);
|
||||||
|
- if (ret != 0)
|
||||||
|
+ self->err_no = hikp_roce_mdb_get_data(&cmd_ret, 0);
|
||||||
|
+ if (self->err_no) {
|
||||||
|
+ printf("hikptool roce_mdb get data failed\n");
|
||||||
|
goto exec_error;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
reg_num = cmd_ret->rsp_data_num / ROCE_HIKP_REG_SWICTH;
|
||||||
|
if (reg_num != ROCE_HIKP_MDB_REG_NUM) {
|
||||||
|
printf("version might not match.\n");
|
||||||
|
- ret = -1;
|
||||||
|
+ self->err_no = -EPROTO;
|
||||||
|
goto exec_error;
|
||||||
|
}
|
||||||
|
|
||||||
|
mdb_rsp = (struct roce_mdb_rsp_data *)(cmd_ret->rsp_data);
|
||||||
|
hikp_roce_mdb_print(reg_num, mdb_rsp);
|
||||||
|
- ret = 0;
|
||||||
|
|
||||||
|
exec_error:
|
||||||
|
- free(cmd_ret);
|
||||||
|
- cmd_ret = NULL;
|
||||||
|
- return ret;
|
||||||
|
+ if (cmd_ret)
|
||||||
|
+ free(cmd_ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void hikp_roce_mdb_execute(struct major_cmd_ctrl *self)
|
||||||
|
{
|
||||||
|
- self->err_no = hikp_roce_mdb_show(self);
|
||||||
|
- if (self->err_no)
|
||||||
|
- return;
|
||||||
|
-
|
||||||
|
- if (g_roce_mdb_param.reset_flag)
|
||||||
|
- printf("clear roce_mdb reg success.\n");
|
||||||
|
- else
|
||||||
|
- printf("show roce_mdb reg success.\n");
|
||||||
|
+ if (g_roce_mdb_param.flag & ROCE_MDB_CMD_EXT) {
|
||||||
|
+ g_roce_mdb_param.sub_cmd = (g_roce_mdb_param.flag & ROCE_MDB_CMD_CLEAR) ?
|
||||||
|
+ MDB_CLEAR_EXT : MDB_EXT;
|
||||||
|
+ hikp_roce_ext_execute(self, GET_ROCEE_MDB_CMD,
|
||||||
|
+ hikp_roce_mdb_get_data);
|
||||||
|
+ } else {
|
||||||
|
+ g_roce_mdb_param.sub_cmd = (g_roce_mdb_param.flag & ROCE_MDB_CMD_CLEAR) ?
|
||||||
|
+ MDB_CLEAR : MDB_SHOW;
|
||||||
|
+ hikp_roce_mdb_execute_origin(self);
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int hikp_roce_mdb_ext_set(struct major_cmd_ctrl *self, const char *argv)
|
||||||
|
+{
|
||||||
|
+ g_roce_mdb_param.flag |= ROCE_MDB_CMD_EXT;
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void cmd_roce_mdb_init(void)
|
||||||
|
@@ -117,6 +143,7 @@ static void cmd_roce_mdb_init(void)
|
||||||
|
cmd_option_register("-h", "--help", false, hikp_roce_mdb_help);
|
||||||
|
cmd_option_register("-i", "--interface", true, hikp_roce_mdb_target);
|
||||||
|
cmd_option_register("-c", "--clear", false, hikp_roce_mdb_clear_set);
|
||||||
|
+ cmd_option_register("-e", "--extend", false, hikp_roce_mdb_ext_set);
|
||||||
|
}
|
||||||
|
|
||||||
|
HIKP_CMD_DECLARE("roce_mdb", "get or clear roce_mdb registers information", cmd_roce_mdb_init);
|
||||||
|
diff --git a/net/roce/roce_mdb/hikp_roce_mdb.h b/net/roce/roce_mdb/hikp_roce_mdb.h
|
||||||
|
index 7643dff..26fc549 100644
|
||||||
|
--- a/net/roce/roce_mdb/hikp_roce_mdb.h
|
||||||
|
+++ b/net/roce/roce_mdb/hikp_roce_mdb.h
|
||||||
|
@@ -19,15 +19,24 @@
|
||||||
|
#define ROCE_HIKP_MDB_REG_NUM 22
|
||||||
|
#define ROCE_HIKP_REG_SWICTH 2
|
||||||
|
|
||||||
|
+#define ROCE_MDB_CMD_CLEAR (1 << 0)
|
||||||
|
+#define ROCE_MDB_CMD_EXT (1 << 1)
|
||||||
|
+
|
||||||
|
struct cmd_roce_mdb_param {
|
||||||
|
struct tool_target target;
|
||||||
|
- int reset_flag;
|
||||||
|
+ uint32_t sub_cmd;
|
||||||
|
+ uint8_t flag;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct roce_mdb_req_para {
|
||||||
|
struct bdf_t bdf;
|
||||||
|
};
|
||||||
|
|
||||||
|
+struct roce_mdb_req_param_ext {
|
||||||
|
+ struct roce_mdb_req_para origin_param;
|
||||||
|
+ uint32_t block_id;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
struct roce_mdb_rsp_data {
|
||||||
|
uint32_t reg_offset[ROCE_HIKP_MDB_REG_NUM];
|
||||||
|
uint32_t reg_data[ROCE_HIKP_MDB_REG_NUM];
|
||||||
|
@@ -36,6 +45,8 @@ struct roce_mdb_rsp_data {
|
||||||
|
enum roce_mdb_cmd_type {
|
||||||
|
MDB_SHOW = 0x0,
|
||||||
|
MDB_CLEAR,
|
||||||
|
+ MDB_EXT,
|
||||||
|
+ MDB_CLEAR_EXT,
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* __HIKP_ROCE_MDB_H__ */
|
||||||
|
--
|
||||||
|
2.30.0
|
||||||
|
|
||||||
252
0045-hikptool-roce-Add-ext-query-for-roce_qmm-cmd.patch
Normal file
252
0045-hikptool-roce-Add-ext-query-for-roce_qmm-cmd.patch
Normal file
@ -0,0 +1,252 @@
|
|||||||
|
From 87f8605c32d308938df17b29816720ca97b0a23f Mon Sep 17 00:00:00 2001
|
||||||
|
From: Junxian Huang <huangjunxian6@hisilicon.com>
|
||||||
|
Date: Sat, 26 Aug 2023 15:05:53 +0800
|
||||||
|
Subject: hikptool/roce: Add ext query for roce_qmm cmd
|
||||||
|
|
||||||
|
Add ext query for roce_qmm cmd. To query these ext registers, add
|
||||||
|
-e to the query cmd.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
hikptool roce_qmm -i eth1 -e
|
||||||
|
|
||||||
|
Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com>
|
||||||
|
---
|
||||||
|
net/roce/roce_qmm/hikp_roce_qmm.c | 137 ++++++++++++++----------------
|
||||||
|
net/roce/roce_qmm/hikp_roce_qmm.h | 11 +++
|
||||||
|
2 files changed, 75 insertions(+), 73 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/net/roce/roce_qmm/hikp_roce_qmm.c b/net/roce/roce_qmm/hikp_roce_qmm.c
|
||||||
|
index c7e0ca4..b020c6a 100644
|
||||||
|
--- a/net/roce/roce_qmm/hikp_roce_qmm.c
|
||||||
|
+++ b/net/roce/roce_qmm/hikp_roce_qmm.c
|
||||||
|
@@ -25,6 +25,7 @@ static int hikp_roce_qmm_help(struct major_cmd_ctrl *self, const char *argv)
|
||||||
|
printf(" %s, %-25s %s\n", "-i", "--interface=<interface>", "device target, e.g. eth0");
|
||||||
|
printf(" %s, %-25s %s\n", "-b", "--bank=<bank>",
|
||||||
|
"[option]bank number, e.g. 0~7. (default 0)");
|
||||||
|
+ printf(" %s, %-25s %s\n", "-e", "--extend", "query extend qmm registers");
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
@@ -34,7 +35,7 @@ static int hikp_roce_qmm_target(struct major_cmd_ctrl *self, const char *argv)
|
||||||
|
{
|
||||||
|
self->err_no = tool_check_and_get_valid_bdf_id(argv, &(g_roce_qmm_param.target));
|
||||||
|
if (self->err_no != 0) {
|
||||||
|
- snprintf(self->err_str, sizeof(self->err_str), "Unknown device %s.", argv);
|
||||||
|
+ snprintf(self->err_str, sizeof(self->err_str), "Unknown device %s.\n", argv);
|
||||||
|
return self->err_no;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -61,6 +62,8 @@ static void hikp_roce_qmm_print(struct roce_qmm_rsp_data *qmm_rsp)
|
||||||
|
{
|
||||||
|
int index = 0;
|
||||||
|
|
||||||
|
+ printf("**************QMM %s INFO*************\n",
|
||||||
|
+ g_roce_qmm_param.sub_name);
|
||||||
|
while (index < qmm_rsp->reg_num) {
|
||||||
|
printf("0x%08X : 0x%08X\n", qmm_rsp->qmm_content[index][0],
|
||||||
|
qmm_rsp->qmm_content[index][1]);
|
||||||
|
@@ -69,101 +72,88 @@ static void hikp_roce_qmm_print(struct roce_qmm_rsp_data *qmm_rsp)
|
||||||
|
printf("***************************************\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
-static int hikp_roce_qmm_show_cqc(struct major_cmd_ctrl *self)
|
||||||
|
+static int hikp_roce_qmm_get_data(struct hikp_cmd_ret **cmd_ret,
|
||||||
|
+ uint32_t block_id)
|
||||||
|
{
|
||||||
|
- struct roce_qmm_req_para req_data = { 0 };
|
||||||
|
- struct roce_qmm_rsp_data *qmm_rsp = NULL;
|
||||||
|
+ struct roce_qmm_req_para_ext req_data_ext;
|
||||||
|
struct hikp_cmd_header req_header = { 0 };
|
||||||
|
- struct hikp_cmd_ret *cmd_ret = NULL;
|
||||||
|
+ uint32_t req_size;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
- req_data.bdf = g_roce_qmm_param.target.bdf;
|
||||||
|
+ req_data_ext.origin_param.bdf = g_roce_qmm_param.target.bdf;
|
||||||
|
+ req_data_ext.origin_param.bank_id = g_roce_qmm_param.bank_id;
|
||||||
|
+ req_data_ext.block_id = block_id;
|
||||||
|
+
|
||||||
|
+ req_size = g_roce_qmm_param.ext_flag ?
|
||||||
|
+ sizeof(struct roce_qmm_req_para) :
|
||||||
|
+ sizeof(struct roce_qmm_req_para_ext);
|
||||||
|
+ hikp_cmd_init(&req_header, ROCE_MOD, GET_ROCEE_QMM_CMD,
|
||||||
|
+ g_roce_qmm_param.sub_cmd);
|
||||||
|
+ *cmd_ret = hikp_cmd_alloc(&req_header, &req_data_ext, req_size);
|
||||||
|
+ ret = hikp_rsp_normal_check(*cmd_ret);
|
||||||
|
+ if (ret)
|
||||||
|
+ printf("hikptool roce_qmm cmd_ret malloc failed, sub_cmd = %u, ret = %d.\n",
|
||||||
|
+ g_roce_qmm_param.sub_cmd, ret);
|
||||||
|
|
||||||
|
- hikp_cmd_init(&req_header, ROCE_MOD, GET_ROCEE_QMM_CMD, QMM_SHOW_CQC);
|
||||||
|
- cmd_ret = hikp_cmd_alloc(&req_header, &req_data, sizeof(req_data));
|
||||||
|
- ret = hikp_rsp_normal_check(cmd_ret);
|
||||||
|
- if (ret != 0)
|
||||||
|
- goto out;
|
||||||
|
-
|
||||||
|
- qmm_rsp = (struct roce_qmm_rsp_data *)(cmd_ret->rsp_data);
|
||||||
|
- printf("**************QMM CQC INFO*************\n");
|
||||||
|
- hikp_roce_qmm_print(qmm_rsp);
|
||||||
|
-out:
|
||||||
|
- free(cmd_ret);
|
||||||
|
- cmd_ret = NULL;
|
||||||
|
- return ret;
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
-static int hikp_roce_qmm_show_qpc(struct major_cmd_ctrl *self)
|
||||||
|
-{
|
||||||
|
- struct roce_qmm_req_para req_data = { 0 };
|
||||||
|
- struct roce_qmm_rsp_data *qmm_rsp = NULL;
|
||||||
|
- struct hikp_cmd_header req_header = { 0 };
|
||||||
|
- struct hikp_cmd_ret *cmd_ret = NULL;
|
||||||
|
- int ret;
|
||||||
|
-
|
||||||
|
- req_data.bdf = g_roce_qmm_param.target.bdf;
|
||||||
|
- req_data.bank_id = g_roce_qmm_param.bank_id;
|
||||||
|
-
|
||||||
|
- hikp_cmd_init(&req_header, ROCE_MOD, GET_ROCEE_QMM_CMD, QMM_SHOW_QPC);
|
||||||
|
- cmd_ret = hikp_cmd_alloc(&req_header, &req_data, sizeof(req_data));
|
||||||
|
- ret = hikp_rsp_normal_check(cmd_ret);
|
||||||
|
- if (ret != 0)
|
||||||
|
- goto out;
|
||||||
|
-
|
||||||
|
- qmm_rsp = (struct roce_qmm_rsp_data *)(cmd_ret->rsp_data);
|
||||||
|
- printf("**************QMM QPC INFO*************\n");
|
||||||
|
- hikp_roce_qmm_print(qmm_rsp);
|
||||||
|
-out:
|
||||||
|
- free(cmd_ret);
|
||||||
|
- cmd_ret = NULL;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
-static int hikp_roce_qmm_show_top(struct major_cmd_ctrl *self)
|
||||||
|
+static void hikp_roce_qmm_execute_origin(struct major_cmd_ctrl *self)
|
||||||
|
{
|
||||||
|
- struct roce_qmm_req_para req_data = { 0 };
|
||||||
|
- struct roce_qmm_rsp_data *qmm_rsp = NULL;
|
||||||
|
- struct hikp_cmd_header req_header = { 0 };
|
||||||
|
- struct hikp_cmd_ret *cmd_ret = NULL;
|
||||||
|
- int ret;
|
||||||
|
+ struct roce_qmm_rsp_data *roce_qmm_res;
|
||||||
|
+ struct hikp_cmd_ret *cmd_ret;
|
||||||
|
|
||||||
|
- req_data.bdf = g_roce_qmm_param.target.bdf;
|
||||||
|
-
|
||||||
|
- hikp_cmd_init(&req_header, ROCE_MOD, GET_ROCEE_QMM_CMD, QMM_SHOW_TOP);
|
||||||
|
- cmd_ret = hikp_cmd_alloc(&req_header, &req_data, sizeof(req_data));
|
||||||
|
- ret = hikp_rsp_normal_check(cmd_ret);
|
||||||
|
- if (ret != 0)
|
||||||
|
- goto out;
|
||||||
|
+ self->err_no = hikp_roce_qmm_get_data(&cmd_ret, 0);
|
||||||
|
+ if (self->err_no) {
|
||||||
|
+ printf("hikptool roce_qmm get data failed.\n");
|
||||||
|
+ goto exec_error;
|
||||||
|
+ }
|
||||||
|
+ roce_qmm_res = (struct roce_qmm_rsp_data *)cmd_ret->rsp_data;
|
||||||
|
+ hikp_roce_qmm_print(roce_qmm_res);
|
||||||
|
|
||||||
|
- qmm_rsp = (struct roce_qmm_rsp_data *)(cmd_ret->rsp_data);
|
||||||
|
- printf("**************QMM TOP INFO*************\n");
|
||||||
|
- hikp_roce_qmm_print(qmm_rsp);
|
||||||
|
-out:
|
||||||
|
- free(cmd_ret);
|
||||||
|
- cmd_ret = NULL;
|
||||||
|
- return ret;
|
||||||
|
+exec_error:
|
||||||
|
+ if (cmd_ret)
|
||||||
|
+ free(cmd_ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void hikp_roce_qmm_execute(struct major_cmd_ctrl *self)
|
||||||
|
{
|
||||||
|
- int (*func[])(struct major_cmd_ctrl *self) = {
|
||||||
|
- hikp_roce_qmm_show_cqc, hikp_roce_qmm_show_qpc, hikp_roce_qmm_show_top
|
||||||
|
+ const struct cmd_type_info {
|
||||||
|
+ enum roce_qmm_cmd_type sub_cmd;
|
||||||
|
+ enum roce_qmm_cmd_type sub_ext_cmd;
|
||||||
|
+ const char *sub_name;
|
||||||
|
+ } sub_cmd_info_table[] = {
|
||||||
|
+ {QMM_SHOW_CQC, QMM_SHOW_CQC_EXT, "CQC"},
|
||||||
|
+ {QMM_SHOW_QPC, QMM_SHOW_QPC_EXT, "QPC"},
|
||||||
|
+ {QMM_SHOW_TOP, QMM_SHOW_TOP_EXT, "TOP"},
|
||||||
|
};
|
||||||
|
- char *function[] = {"show cqc", "show qpc", "show top"};
|
||||||
|
- int ret;
|
||||||
|
|
||||||
|
- for (int i = 0; i < HIKP_ARRAY_SIZE(func); i++) {
|
||||||
|
- ret = func[i](self);
|
||||||
|
- if (ret != 0) {
|
||||||
|
- self->err_no = -EINVAL;
|
||||||
|
+ for (int i = 0; i < HIKP_ARRAY_SIZE(sub_cmd_info_table); i++) {
|
||||||
|
+ g_roce_qmm_param.sub_name = sub_cmd_info_table[i].sub_name;
|
||||||
|
+ if (g_roce_qmm_param.ext_flag) {
|
||||||
|
+ g_roce_qmm_param.sub_cmd = sub_cmd_info_table[i].sub_ext_cmd;
|
||||||
|
+ hikp_roce_ext_execute(self, GET_ROCEE_QMM_CMD,
|
||||||
|
+ hikp_roce_qmm_get_data);
|
||||||
|
+ } else {
|
||||||
|
+ g_roce_qmm_param.sub_cmd = sub_cmd_info_table[i].sub_cmd;
|
||||||
|
+ hikp_roce_qmm_execute_origin(self);
|
||||||
|
+ }
|
||||||
|
+ if (self->err_no) {
|
||||||
|
snprintf(self->err_str, sizeof(self->err_str),
|
||||||
|
- "roce_qmm %s function failed\n", function[i]);
|
||||||
|
+ "roce_qmm show %s function failed\n",
|
||||||
|
+ sub_cmd_info_table[i].sub_name);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
+static int hikp_roce_qmm_ext_set(struct major_cmd_ctrl *self, const char *argv)
|
||||||
|
+{
|
||||||
|
+ g_roce_qmm_param.ext_flag = true;
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static void cmd_roce_qmm_init(void)
|
||||||
|
{
|
||||||
|
struct major_cmd_ctrl *major_cmd = get_major_cmd();
|
||||||
|
@@ -174,6 +164,7 @@ static void cmd_roce_qmm_init(void)
|
||||||
|
cmd_option_register("-h", "--help", false, hikp_roce_qmm_help);
|
||||||
|
cmd_option_register("-i", "--interface", true, hikp_roce_qmm_target);
|
||||||
|
cmd_option_register("-b", "--bank", true, hikp_roce_qmm_bank_get);
|
||||||
|
+ cmd_option_register("-e", "--extend", false, hikp_roce_qmm_ext_set);
|
||||||
|
}
|
||||||
|
|
||||||
|
HIKP_CMD_DECLARE("roce_qmm", "get roce_qmm registers information", cmd_roce_qmm_init);
|
||||||
|
diff --git a/net/roce/roce_qmm/hikp_roce_qmm.h b/net/roce/roce_qmm/hikp_roce_qmm.h
|
||||||
|
index 0645ab3..06e6bcf 100644
|
||||||
|
--- a/net/roce/roce_qmm/hikp_roce_qmm.h
|
||||||
|
+++ b/net/roce/roce_qmm/hikp_roce_qmm.h
|
||||||
|
@@ -22,6 +22,9 @@
|
||||||
|
struct cmd_roce_qmm_param_t {
|
||||||
|
struct tool_target target;
|
||||||
|
uint32_t bank_id;
|
||||||
|
+ uint32_t sub_cmd;
|
||||||
|
+ const char *sub_name;
|
||||||
|
+ bool ext_flag;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct roce_qmm_rsp_data {
|
||||||
|
@@ -34,10 +37,18 @@ struct roce_qmm_req_para {
|
||||||
|
uint32_t bank_id;
|
||||||
|
};
|
||||||
|
|
||||||
|
+struct roce_qmm_req_para_ext {
|
||||||
|
+ struct roce_qmm_req_para origin_param;
|
||||||
|
+ uint32_t block_id;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
enum roce_qmm_cmd_type {
|
||||||
|
QMM_SHOW_CQC = 0x1,
|
||||||
|
QMM_SHOW_QPC = 0x2,
|
||||||
|
QMM_SHOW_TOP = 0x3,
|
||||||
|
+ QMM_SHOW_CQC_EXT,
|
||||||
|
+ QMM_SHOW_QPC_EXT,
|
||||||
|
+ QMM_SHOW_TOP_EXT,
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* __HIKP_ROCE_QMM_H__ */
|
||||||
|
--
|
||||||
|
2.30.0
|
||||||
|
|
||||||
100
0046-hikptool-Querying-the-SerDes-Relationship-of-the-PCI.patch
Normal file
100
0046-hikptool-Querying-the-SerDes-Relationship-of-the-PCI.patch
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
From 6747635a4423fc0844230bc66112853856b9fe97 Mon Sep 17 00:00:00 2001
|
||||||
|
From: mou bingquan <moubingquan@huawei.com>
|
||||||
|
Date: Wed, 18 Oct 2023 09:52:39 +0800
|
||||||
|
Subject: [PATCH] hikptool : Querying the SerDes Relationship of the PCIe
|
||||||
|
|
||||||
|
This function is used to query the macro corresponding to the
|
||||||
|
port of the PCIe. It is a type of SerDes multiplexing relationship.
|
||||||
|
---
|
||||||
|
pcie/func_lib/pcie_func/pcie_statistics.c | 30 +++++++++++++++++++++++
|
||||||
|
pcie/func_lib/pcie_func/pcie_statistics.h | 10 ++++++++
|
||||||
|
2 files changed, 40 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/pcie/func_lib/pcie_func/pcie_statistics.c b/pcie/func_lib/pcie_func/pcie_statistics.c
|
||||||
|
index 308a142..128e7f7 100644
|
||||||
|
--- a/pcie/func_lib/pcie_func/pcie_statistics.c
|
||||||
|
+++ b/pcie/func_lib/pcie_func/pcie_statistics.c
|
||||||
|
@@ -25,6 +25,10 @@ static const char *g_global_width_name[GLOBAL_WIDTH_TABLE_SIZE] = {
|
||||||
|
"PCIE_WIDTH_X1", "PCIE_WIDTH_X2", "PCIE_WIDTH_X4", "PCIE_WIDTH_X8", "PCIE_WIDTH_X16"
|
||||||
|
};
|
||||||
|
|
||||||
|
+static const char *g_global_ndie_name[] = {
|
||||||
|
+ "Ndie_A", "Ndie_B"
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
static int port_distribution_rsp_data_check(const struct hikp_cmd_ret *cmd_ret, uint32_t *port_num)
|
||||||
|
{
|
||||||
|
size_t rsp_data_size, expect_data_size;
|
||||||
|
@@ -58,6 +62,29 @@ static int port_distribution_rsp_data_check(const struct hikp_cmd_ret *cmd_ret,
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
+static int pcie_portid_serdes_relation(const struct pcie_macro_info *macro_info,
|
||||||
|
+ uint32_t macro_num, uint32_t ndie_id)
|
||||||
|
+{
|
||||||
|
+ uint32_t i, j;
|
||||||
|
+
|
||||||
|
+ if (ndie_id >= HIKP_ARRAY_SIZE(g_global_ndie_name)) {
|
||||||
|
+ Info("PCIe Base", "ndie_id [%u]: %s\n", ndie_id, "UNKNOWN_NDIE");
|
||||||
|
+ return -1;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (macro_num >= MAX_MACRO_ONEPORT) {
|
||||||
|
+ Info("PCIe Base", "macro_num [%u] exceeds the maximum array length\n", macro_num);
|
||||||
|
+ return -1;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ Info("PCIe Base", "\tndie_id: %s\n", g_global_ndie_name[ndie_id]);
|
||||||
|
+ for (i = 0; i < macro_num; i++) {
|
||||||
|
+ for (j = macro_info[i].lane_s; j <= macro_info[i].lane_e; j++)
|
||||||
|
+ Info("PCIe Base", "\t\tmacro %d \t lane: %d\n", macro_info[i].id, j);
|
||||||
|
+ }
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
int pcie_port_distribution_get(uint32_t chip_id)
|
||||||
|
{
|
||||||
|
struct hikp_cmd_header req_header;
|
||||||
|
@@ -86,6 +113,9 @@ int pcie_port_distribution_get(uint32_t chip_id)
|
||||||
|
}
|
||||||
|
Info("PCIe Base", "port_id[%u] %s\n", port_info->info_pair[i].port_id,
|
||||||
|
g_global_width_name[port_info->info_pair[i].port_width]);
|
||||||
|
+ pcie_portid_serdes_relation(port_info->info_pair[i].macro_info,
|
||||||
|
+ port_info->info_pair[i].macro_num,
|
||||||
|
+ port_info->info_pair[i].ndie_id);
|
||||||
|
}
|
||||||
|
free_cmd_ret:
|
||||||
|
free(cmd_ret);
|
||||||
|
diff --git a/pcie/func_lib/pcie_func/pcie_statistics.h b/pcie/func_lib/pcie_func/pcie_statistics.h
|
||||||
|
index 2a3cc66..3e3916b 100644
|
||||||
|
--- a/pcie/func_lib/pcie_func/pcie_statistics.h
|
||||||
|
+++ b/pcie/func_lib/pcie_func/pcie_statistics.h
|
||||||
|
@@ -17,6 +17,7 @@
|
||||||
|
#include "pcie_common_api.h"
|
||||||
|
|
||||||
|
#define GLOBAL_WIDTH_TABLE_SIZE 5
|
||||||
|
+#define MAX_MACRO_ONEPORT 3
|
||||||
|
|
||||||
|
union mac_test_cnt {
|
||||||
|
/* Define the struct bits */
|
||||||
|
@@ -88,9 +89,18 @@ union dfx_dcrc_err_num {
|
||||||
|
unsigned int u32;
|
||||||
|
};
|
||||||
|
|
||||||
|
+struct pcie_macro_info {
|
||||||
|
+ uint32_t id;
|
||||||
|
+ uint32_t lane_s;
|
||||||
|
+ uint32_t lane_e;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
struct pcie_info_distribution_pair {
|
||||||
|
uint32_t port_id;
|
||||||
|
uint32_t port_width;
|
||||||
|
+ uint32_t ndie_id;
|
||||||
|
+ uint32_t macro_num;
|
||||||
|
+ struct pcie_macro_info macro_info[MAX_MACRO_ONEPORT];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct pcie_port_info {
|
||||||
|
--
|
||||||
|
2.33.0
|
||||||
177
0047-hikptool-Remove-the-function-of-querying-SAS-device-.patch
Normal file
177
0047-hikptool-Remove-the-function-of-querying-SAS-device-.patch
Normal file
@ -0,0 +1,177 @@
|
|||||||
|
From ba80a0dd531a4eebccb1852a65b4b7272a02c06d Mon Sep 17 00:00:00 2001
|
||||||
|
From: Yihang Li <liyihang9@huawei.com>
|
||||||
|
Date: Tue, 17 Oct 2023 18:58:27 +0800
|
||||||
|
Subject: [PATCH] hikptool: Remove the function of querying SAS device
|
||||||
|
configurations
|
||||||
|
|
||||||
|
Currently, SAS device information cannot be obtained.
|
||||||
|
Remove the function of querying SAS device configurations
|
||||||
|
|
||||||
|
Signed-off-by: Yihang Li <liyihang9@huawei.com>
|
||||||
|
---
|
||||||
|
sas/sas_func/sas_common.h | 2 --
|
||||||
|
sas/sas_func/sas_read_dev.c | 21 ---------------------
|
||||||
|
sas/user_cmd/cmd_code/sas_cmd_common.c | 10 ----------
|
||||||
|
sas/user_cmd/cmd_code/sas_cmd_dev.c | 17 -----------------
|
||||||
|
sas/user_cmd/cmd_code/sas_tools_include.h | 2 --
|
||||||
|
5 files changed, 52 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/sas/sas_func/sas_common.h b/sas/sas_func/sas_common.h
|
||||||
|
index 9464792..1bace0c 100644
|
||||||
|
--- a/sas/sas_func/sas_common.h
|
||||||
|
+++ b/sas/sas_func/sas_common.h
|
||||||
|
@@ -22,7 +22,6 @@
|
||||||
|
#define IPTT_ICT_STATUS 29
|
||||||
|
#define LINK_SPEED_OFFSET 8
|
||||||
|
#define LINK_SPEED_WIDTH 4
|
||||||
|
-#define MAX_DEVICE_NUM 2048
|
||||||
|
|
||||||
|
#define DWS_LOST 0
|
||||||
|
#define RESET_PROB 1
|
||||||
|
@@ -73,7 +72,6 @@ enum sas_errcode_cmd_type {
|
||||||
|
|
||||||
|
enum sas_dev_cmd_type {
|
||||||
|
DEV_LINK,
|
||||||
|
- DEV_INFO,
|
||||||
|
DEV_UNKNOWN_TYPE,
|
||||||
|
};
|
||||||
|
|
||||||
|
diff --git a/sas/sas_func/sas_read_dev.c b/sas/sas_func/sas_read_dev.c
|
||||||
|
index 8b9b58d..3a3db07 100644
|
||||||
|
--- a/sas/sas_func/sas_read_dev.c
|
||||||
|
+++ b/sas/sas_func/sas_read_dev.c
|
||||||
|
@@ -76,24 +76,6 @@ static void print_dev_link(const uint32_t *reg_save, uint32_t reg_num)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
-static void print_dev_info(const void *reg_save, uint32_t reg_num)
|
||||||
|
-{
|
||||||
|
- volatile struct hikp_sas_itct *itct = (volatile struct hikp_sas_itct *)reg_save;
|
||||||
|
-
|
||||||
|
- printf("The device information as below:\n");
|
||||||
|
- printf("dev_type: %d\n", itct->dw0.dev_type);
|
||||||
|
- printf("dev_valid: %d\n", itct->dw0.dev_valid);
|
||||||
|
- printf("break_reply_en: %d\n", itct->dw0.break_reply_en);
|
||||||
|
- printf("smp_timeout: %d\n", itct->dw0.smp_timeout);
|
||||||
|
- printf("tlr_en: %d\n", itct->dw0.tlr_en);
|
||||||
|
- printf("awt_continue: %d\n", itct->dw0.awt_continue);
|
||||||
|
- printf("sas_addr: 0x%llx\n", itct->sas_addr);
|
||||||
|
- printf("I_T_nexus_loss: %d\n", itct->dw2.I_T_nexus_loss);
|
||||||
|
- printf("awt_initial_value: %d\n", itct->dw2.awt_initial_value);
|
||||||
|
- printf("maximum_connect_time: %d\n", itct->dw2.maximum_connect_time);
|
||||||
|
- printf("reject_to_open_limit: %d\n", itct->dw2.reject_to_open_limit);
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
static void sas_print_dev(const uint32_t *reg_save, uint32_t reg_num, uint32_t cmd_type)
|
||||||
|
{
|
||||||
|
uint32_t i;
|
||||||
|
@@ -106,9 +88,6 @@ static void sas_print_dev(const uint32_t *reg_save, uint32_t reg_num, uint32_t c
|
||||||
|
case DEV_LINK:
|
||||||
|
print_dev_link(reg_save, reg_num);
|
||||||
|
break;
|
||||||
|
- case DEV_INFO:
|
||||||
|
- print_dev_info(reg_save, reg_num);
|
||||||
|
- break;
|
||||||
|
default:
|
||||||
|
printf("cmd_type is error\n");
|
||||||
|
}
|
||||||
|
diff --git a/sas/user_cmd/cmd_code/sas_cmd_common.c b/sas/user_cmd/cmd_code/sas_cmd_common.c
|
||||||
|
index 9dca63f..358cf39 100644
|
||||||
|
--- a/sas/user_cmd/cmd_code/sas_cmd_common.c
|
||||||
|
+++ b/sas/user_cmd/cmd_code/sas_cmd_common.c
|
||||||
|
@@ -54,11 +54,6 @@ int sas_get_phy_id(void)
|
||||||
|
return g_sas_cmd.phy_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
-int sas_get_dev_id(void)
|
||||||
|
-{
|
||||||
|
- return g_sas_cmd.dev_id;
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
int sas_get_que_id(void)
|
||||||
|
{
|
||||||
|
return g_sas_cmd.que_id;
|
||||||
|
@@ -84,11 +79,6 @@ int sas_set_die_id(struct major_cmd_ctrl *self, const char *argv)
|
||||||
|
return sas_set_id(self, argv, &g_sas_cmd.die_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
-int sas_set_dev_id(struct major_cmd_ctrl *self, const char *argv)
|
||||||
|
-{
|
||||||
|
- return sas_set_id(self, argv, &g_sas_cmd.dev_id);
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
int sas_set_que_id(struct major_cmd_ctrl *self, const char *argv)
|
||||||
|
{
|
||||||
|
return sas_set_id(self, argv, &g_sas_cmd.que_id);
|
||||||
|
diff --git a/sas/user_cmd/cmd_code/sas_cmd_dev.c b/sas/user_cmd/cmd_code/sas_cmd_dev.c
|
||||||
|
index c95006b..6a5eae0 100644
|
||||||
|
--- a/sas/user_cmd/cmd_code/sas_cmd_dev.c
|
||||||
|
+++ b/sas/user_cmd/cmd_code/sas_cmd_dev.c
|
||||||
|
@@ -26,7 +26,6 @@ static int sas_dev_help(struct major_cmd_ctrl *self, const char *argv)
|
||||||
|
printf("\n Options:\n\n");
|
||||||
|
printf(" %s, %-25s %s\n", "-h", "--help", "display this help and exit\n");
|
||||||
|
printf(" %s, %-25s %s\n", "-l", "--link", "dispaly device type and speed\n");
|
||||||
|
- printf(" %s, %-25s %s\n", "-i", "--info", "dispaly the device detail information\n");
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
@@ -37,19 +36,6 @@ static int sas_dev_link(struct major_cmd_ctrl *self, const char *argv)
|
||||||
|
return sas_set_cmd_type(DEV_LINK);
|
||||||
|
}
|
||||||
|
|
||||||
|
-static int sas_dev_info(struct major_cmd_ctrl *self, const char *argv)
|
||||||
|
-{
|
||||||
|
- int ret;
|
||||||
|
-
|
||||||
|
- (void)sas_set_cmd_type(DEV_INFO);
|
||||||
|
- ret = sas_set_dev_id(self, argv);
|
||||||
|
- if (ret || sas_get_dev_id() >= MAX_DEVICE_NUM) {
|
||||||
|
- printf("device id is too large(>=%d)\n", MAX_DEVICE_NUM);
|
||||||
|
- return -EINVAL;
|
||||||
|
- }
|
||||||
|
- return ret;
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
static int sas_dev_excute_funs_call(uint32_t cmd_type)
|
||||||
|
{
|
||||||
|
if (cmd_type != SAS_UNKNOW_CMD)
|
||||||
|
@@ -63,11 +49,9 @@ static void sas_dev_execute(struct major_cmd_ctrl *self)
|
||||||
|
int ret, cmd;
|
||||||
|
const char *suc_msg[] = {
|
||||||
|
"sas_dev_link success.",
|
||||||
|
- "sas_dev_info success.",
|
||||||
|
};
|
||||||
|
const char *err_msg[] = {
|
||||||
|
"sas_dev_link error.",
|
||||||
|
- "sas_dev_info error.",
|
||||||
|
"sas_dev failed, unknown type",
|
||||||
|
};
|
||||||
|
|
||||||
|
@@ -95,7 +79,6 @@ static void cmd_sas_dev_init(void)
|
||||||
|
cmd_option_register("-d", "--dieid", true, sas_set_die_id);
|
||||||
|
cmd_option_register("-h", "--help", false, sas_dev_help);
|
||||||
|
cmd_option_register("-l", "--link", false, sas_dev_link);
|
||||||
|
- cmd_option_register("-i", "--info", true, sas_dev_info);
|
||||||
|
}
|
||||||
|
|
||||||
|
HIKP_CMD_DECLARE("sas_dev", "sas device information ", cmd_sas_dev_init);
|
||||||
|
diff --git a/sas/user_cmd/cmd_code/sas_tools_include.h b/sas/user_cmd/cmd_code/sas_tools_include.h
|
||||||
|
index a71e614..0aa7703 100644
|
||||||
|
--- a/sas/user_cmd/cmd_code/sas_tools_include.h
|
||||||
|
+++ b/sas/user_cmd/cmd_code/sas_tools_include.h
|
||||||
|
@@ -34,13 +34,11 @@ struct tool_sas_cmd {
|
||||||
|
int sas_set_cmd_type(int cmd_type);
|
||||||
|
int sas_get_cmd_type(void);
|
||||||
|
int sas_get_phy_id(void);
|
||||||
|
-int sas_get_dev_id(void);
|
||||||
|
int sas_get_que_id(void);
|
||||||
|
struct tool_sas_cmd *sas_get_cmd_p(void);
|
||||||
|
int sas_set_chip_id(struct major_cmd_ctrl *self, const char *argv);
|
||||||
|
int sas_set_phy_id(struct major_cmd_ctrl *self, const char *argv);
|
||||||
|
int sas_set_die_id(struct major_cmd_ctrl *self, const char *argv);
|
||||||
|
-int sas_set_dev_id(struct major_cmd_ctrl *self, const char *argv);
|
||||||
|
int sas_set_que_id(struct major_cmd_ctrl *self, const char *argv);
|
||||||
|
int sas_set_dqe_id(struct major_cmd_ctrl *self, const char *argv);
|
||||||
|
|
||||||
|
--
|
||||||
|
2.33.0
|
||||||
@ -0,0 +1,31 @@
|
|||||||
|
From 2abbc6020498b1c464775623de8b2db76e684d55 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Junxian Huang <huangjunxian6@hisilicon.com>
|
||||||
|
Date: Tue, 24 Oct 2023 11:16:49 +0800
|
||||||
|
Subject: hikptool/roce: Use calloc to alloc memory for array instead of malloc
|
||||||
|
|
||||||
|
calloc is more situable for memory allocation for array than malloc,
|
||||||
|
since the allocated memory will be set to 0.
|
||||||
|
|
||||||
|
Fixes: 8b3b68347165 ("hikptool/roce: Add a common frame for hikptool roce register query")
|
||||||
|
Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com>
|
||||||
|
---
|
||||||
|
net/roce/roce_ext_common/hikp_roce_ext_common.c | 4 ++--
|
||||||
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/net/roce/roce_ext_common/hikp_roce_ext_common.c b/net/roce/roce_ext_common/hikp_roce_ext_common.c
|
||||||
|
index d0fae69..d5ae64a 100644
|
||||||
|
--- a/net/roce/roce_ext_common/hikp_roce_ext_common.c
|
||||||
|
+++ b/net/roce/roce_ext_common/hikp_roce_ext_common.c
|
||||||
|
@@ -115,8 +115,8 @@ static int hikp_roce_ext_get_res(enum roce_cmd_type cmd_type,
|
||||||
|
max_size = res_head->total_block_num * sizeof(uint32_t);
|
||||||
|
|
||||||
|
if (block_id == 0) {
|
||||||
|
- reg->offset = (uint32_t *)malloc(max_size);
|
||||||
|
- reg->data = (uint32_t *)malloc(max_size);
|
||||||
|
+ reg->offset = (uint32_t *)calloc(res_head->total_block_num, sizeof(uint32_t));
|
||||||
|
+ reg->data = (uint32_t *)calloc(res_head->total_block_num, sizeof(uint32_t));
|
||||||
|
if ((reg->offset == NULL) || (reg->data == NULL)) {
|
||||||
|
printf("hikptool roce_%s alloc log memmory 0x%x failed!\n",
|
||||||
|
cmd_name, max_size);
|
||||||
|
--
|
||||||
|
2.30.0
|
||||||
127
0049-hikptool-roce-Fix-missing-check-of-reg-num-responsed.patch
Normal file
127
0049-hikptool-roce-Fix-missing-check-of-reg-num-responsed.patch
Normal file
@ -0,0 +1,127 @@
|
|||||||
|
From 679cfd5353da2165dbf5b89769bbd5b69209bc5b Mon Sep 17 00:00:00 2001
|
||||||
|
From: Junxian Huang <huangjunxian6@hisilicon.com>
|
||||||
|
Date: Tue, 24 Oct 2023 15:12:41 +0800
|
||||||
|
Subject: hikptool/roce: Fix missing check of reg num responsed from FW
|
||||||
|
|
||||||
|
If the reg num responsed from a new-version FW exceeds the array
|
||||||
|
length in the old-version hikptool, an out-of-bounds access error
|
||||||
|
will occur. So add a check to ensure the reg num is not greater
|
||||||
|
than tha array length.
|
||||||
|
|
||||||
|
Fixes: 392c269be165 ("support querying RoCE module information")
|
||||||
|
Fixes: 87f8605c32d3 ("hikptool/roce: Add ext query for roce_qmm cmd")
|
||||||
|
Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com>
|
||||||
|
---
|
||||||
|
net/roce/roce_caep/hikp_roce_caep.c | 7 +++++++
|
||||||
|
net/roce/roce_pkt/hikp_roce_pkt.c | 7 +++++++
|
||||||
|
net/roce/roce_qmm/hikp_roce_qmm.c | 7 +++++++
|
||||||
|
net/roce/roce_timer/hikp_roce_timer.c | 12 ++++++++++++
|
||||||
|
net/roce/roce_tsp/hikp_roce_tsp.c | 6 ++++++
|
||||||
|
5 files changed, 39 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/net/roce/roce_caep/hikp_roce_caep.c b/net/roce/roce_caep/hikp_roce_caep.c
|
||||||
|
index 6c92ea1..126551a 100644
|
||||||
|
--- a/net/roce/roce_caep/hikp_roce_caep.c
|
||||||
|
+++ b/net/roce/roce_caep/hikp_roce_caep.c
|
||||||
|
@@ -85,7 +85,14 @@ static void hikp_roce_caep_execute_origin(struct major_cmd_ctrl *self)
|
||||||
|
printf("hikptool roce_caep get data failed.\n");
|
||||||
|
goto exec_error;
|
||||||
|
}
|
||||||
|
+
|
||||||
|
roce_caep_res = (struct roce_caep_res_param *)cmd_ret->rsp_data;
|
||||||
|
+ if (roce_caep_res->total_block_num > ROCE_HIKP_CAEP_REG_NUM) {
|
||||||
|
+ printf("version might not match, adjust the reg num to %d.\n",
|
||||||
|
+ ROCE_HIKP_CAEP_REG_NUM);
|
||||||
|
+ roce_caep_res->total_block_num = ROCE_HIKP_CAEP_REG_NUM;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
hikp_roce_caep_print(roce_caep_res->total_block_num,
|
||||||
|
roce_caep_res->reg_data.offset,
|
||||||
|
roce_caep_res->reg_data.data);
|
||||||
|
diff --git a/net/roce/roce_pkt/hikp_roce_pkt.c b/net/roce/roce_pkt/hikp_roce_pkt.c
|
||||||
|
index d3bf885..e710e08 100644
|
||||||
|
--- a/net/roce/roce_pkt/hikp_roce_pkt.c
|
||||||
|
+++ b/net/roce/roce_pkt/hikp_roce_pkt.c
|
||||||
|
@@ -87,7 +87,14 @@ static void hikp_roce_pkt_execute(struct major_cmd_ctrl *self)
|
||||||
|
self->err_no = ret;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
+
|
||||||
|
roce_pkt_res = (struct roce_pkt_res_param *)cmd_ret->rsp_data;
|
||||||
|
+ if (roce_pkt_res->total_block_num > ROCE_HIKP_PKT_REG_NUM) {
|
||||||
|
+ printf("version might not match, adjust the reg num to %d.\n",
|
||||||
|
+ ROCE_HIKP_PKT_REG_NUM);
|
||||||
|
+ roce_pkt_res->total_block_num = ROCE_HIKP_PKT_REG_NUM;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
hikp_roce_pkt_print(roce_pkt_res->total_block_num,
|
||||||
|
roce_pkt_res->reg_data.offset, roce_pkt_res->reg_data.data);
|
||||||
|
|
||||||
|
diff --git a/net/roce/roce_qmm/hikp_roce_qmm.c b/net/roce/roce_qmm/hikp_roce_qmm.c
|
||||||
|
index b020c6a..d127264 100644
|
||||||
|
--- a/net/roce/roce_qmm/hikp_roce_qmm.c
|
||||||
|
+++ b/net/roce/roce_qmm/hikp_roce_qmm.c
|
||||||
|
@@ -108,7 +108,14 @@ static void hikp_roce_qmm_execute_origin(struct major_cmd_ctrl *self)
|
||||||
|
printf("hikptool roce_qmm get data failed.\n");
|
||||||
|
goto exec_error;
|
||||||
|
}
|
||||||
|
+
|
||||||
|
roce_qmm_res = (struct roce_qmm_rsp_data *)cmd_ret->rsp_data;
|
||||||
|
+ if (roce_qmm_res->reg_num > ROCE_HIKP_QMM_REG_NUM) {
|
||||||
|
+ printf("version might not match, adjust the reg num to %d.\n",
|
||||||
|
+ ROCE_HIKP_QMM_REG_NUM);
|
||||||
|
+ roce_qmm_res->reg_num = ROCE_HIKP_QMM_REG_NUM;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
hikp_roce_qmm_print(roce_qmm_res);
|
||||||
|
|
||||||
|
exec_error:
|
||||||
|
diff --git a/net/roce/roce_timer/hikp_roce_timer.c b/net/roce/roce_timer/hikp_roce_timer.c
|
||||||
|
index c4e979f..a78d383 100644
|
||||||
|
--- a/net/roce/roce_timer/hikp_roce_timer.c
|
||||||
|
+++ b/net/roce/roce_timer/hikp_roce_timer.c
|
||||||
|
@@ -76,6 +76,12 @@ static int hikp_roce_timer_show_qpc(struct major_cmd_ctrl *self)
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
timer_rsp = (struct roce_timer_rsp_data *)(cmd_ret->rsp_data);
|
||||||
|
+ if (timer_rsp->reg_num > ROCE_HIKP_TIMER_REG_NUM) {
|
||||||
|
+ printf("version might not match, adjust the reg num to %d.\n",
|
||||||
|
+ ROCE_HIKP_TIMER_REG_NUM);
|
||||||
|
+ timer_rsp->reg_num = ROCE_HIKP_TIMER_REG_NUM;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
printf("**************QPC TIMER INFO*************\n");
|
||||||
|
hikp_roce_timer_print(timer_rsp);
|
||||||
|
out:
|
||||||
|
@@ -104,6 +110,12 @@ static int hikp_roce_timer_show_cqc(struct major_cmd_ctrl *self)
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
timer_rsp = (struct roce_timer_rsp_data *)(cmd_ret->rsp_data);
|
||||||
|
+ if (timer_rsp->reg_num > ROCE_HIKP_TIMER_REG_NUM) {
|
||||||
|
+ printf("version might not match, adjust the reg num to %d.\n",
|
||||||
|
+ ROCE_HIKP_TIMER_REG_NUM);
|
||||||
|
+ timer_rsp->reg_num = ROCE_HIKP_TIMER_REG_NUM;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
printf("**************CQC TIMER INFO*************\n");
|
||||||
|
hikp_roce_timer_print(timer_rsp);
|
||||||
|
out:
|
||||||
|
diff --git a/net/roce/roce_tsp/hikp_roce_tsp.c b/net/roce/roce_tsp/hikp_roce_tsp.c
|
||||||
|
index a036fae..5bb2649 100644
|
||||||
|
--- a/net/roce/roce_tsp/hikp_roce_tsp.c
|
||||||
|
+++ b/net/roce/roce_tsp/hikp_roce_tsp.c
|
||||||
|
@@ -181,6 +181,12 @@ static void hikp_roce_tsp_execute(struct major_cmd_ctrl *self)
|
||||||
|
}
|
||||||
|
|
||||||
|
roce_tsp_res = (struct roce_tsp_res_param *)cmd_ret->rsp_data;
|
||||||
|
+ if (roce_tsp_res->total_block_num > ROCE_HIKP_TSP_REG_NUM) {
|
||||||
|
+ printf("version might not match, adjust the reg num to %d.\n",
|
||||||
|
+ ROCE_HIKP_TSP_REG_NUM);
|
||||||
|
+ roce_tsp_res->total_block_num = ROCE_HIKP_TSP_REG_NUM;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
hikp_roce_tsp_print(roce_tsp_res->total_block_num,
|
||||||
|
roce_tsp_res->reg_data.offset, roce_tsp_res->reg_data.data);
|
||||||
|
|
||||||
|
--
|
||||||
|
2.30.0
|
||||||
43
0050-hikptool-Change-the-unic_ppp-directory-to-ub_ppp.patch
Normal file
43
0050-hikptool-Change-the-unic_ppp-directory-to-ub_ppp.patch
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
From bb4201e589f3875351a5a7b1305254701663dc9a Mon Sep 17 00:00:00 2001
|
||||||
|
From: JianQiang Li <lijianqiang16@huawei.com>
|
||||||
|
Date: Wed, 25 Oct 2023 09:14:55 +0800
|
||||||
|
Subject: [PATCH] [hikptool] Change the unic_ppp directory to ub_ppp.
|
||||||
|
|
||||||
|
tool inclusion
|
||||||
|
category:bugfix
|
||||||
|
bugzilla:NA
|
||||||
|
CVE:NA
|
||||||
|
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
|
||||||
|
Change the unic_ppp directory to ub_ppp and add a blank line to the end of the hikp_unic_ppp.c file.
|
||||||
|
|
||||||
|
Signed-off-by: Jianqiang Li <lijianqiang16@huawei.com>
|
||||||
|
---
|
||||||
|
net/ub/{ub_unic => ub_ppp}/hikp_unic_ppp.c | 2 +-
|
||||||
|
net/ub/{ub_unic => ub_ppp}/hikp_unic_ppp.h | 0
|
||||||
|
2 files changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
rename net/ub/{ub_unic => ub_ppp}/hikp_unic_ppp.c (99%)
|
||||||
|
rename net/ub/{ub_unic => ub_ppp}/hikp_unic_ppp.h (100%)
|
||||||
|
|
||||||
|
diff --git a/net/ub/ub_unic/hikp_unic_ppp.c b/net/ub/ub_ppp/hikp_unic_ppp.c
|
||||||
|
similarity index 99%
|
||||||
|
rename from net/ub/ub_unic/hikp_unic_ppp.c
|
||||||
|
rename to net/ub/ub_ppp/hikp_unic_ppp.c
|
||||||
|
index 5325b03..ccba4e0 100644
|
||||||
|
--- a/net/ub/ub_unic/hikp_unic_ppp.c
|
||||||
|
+++ b/net/ub/ub_ppp/hikp_unic_ppp.c
|
||||||
|
@@ -465,4 +465,4 @@ static void cmd_unic_get_ppp_init(void)
|
||||||
|
cmd_option_register("-du", "--dump", true, hikp_unic_cmd_ppp_feature_select);
|
||||||
|
}
|
||||||
|
|
||||||
|
-HIKP_CMD_DECLARE("unic_ppp", "dump ppp info of unic!", cmd_unic_get_ppp_init);
|
||||||
|
\ No newline at end of file
|
||||||
|
+HIKP_CMD_DECLARE("unic_ppp", "dump ppp info of unic!", cmd_unic_get_ppp_init);
|
||||||
|
diff --git a/net/ub/ub_unic/hikp_unic_ppp.h b/net/ub/ub_ppp/hikp_unic_ppp.h
|
||||||
|
similarity index 100%
|
||||||
|
rename from net/ub/ub_unic/hikp_unic_ppp.h
|
||||||
|
rename to net/ub/ub_ppp/hikp_unic_ppp.h
|
||||||
|
--
|
||||||
|
2.21.0.windows.1
|
||||||
|
|
||||||
29
0051-hikptool-roce-Fix-the-wrong-maximum-of-gmv-index.patch
Normal file
29
0051-hikptool-roce-Fix-the-wrong-maximum-of-gmv-index.patch
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
From 48d87bcd204c6aa226b5dbdb8c68ead8d12b1745 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Junxian Huang <huangjunxian6@hisilicon.com>
|
||||||
|
Date: Tue, 31 Oct 2023 20:51:38 +0800
|
||||||
|
Subject: hikptool/roce: Fix the wrong maximum of gmv index
|
||||||
|
|
||||||
|
The RoCE driver supports up to 256 gmv table entry, the allowed
|
||||||
|
gmv index of hikptool command roce_gmv should cover this range.
|
||||||
|
|
||||||
|
Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com>
|
||||||
|
---
|
||||||
|
net/roce/roce_gmv/hikp_roce_gmv.h | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/net/roce/roce_gmv/hikp_roce_gmv.h b/net/roce/roce_gmv/hikp_roce_gmv.h
|
||||||
|
index 1ef5b93..a02b960 100644
|
||||||
|
--- a/net/roce/roce_gmv/hikp_roce_gmv.h
|
||||||
|
+++ b/net/roce/roce_gmv/hikp_roce_gmv.h
|
||||||
|
@@ -18,7 +18,7 @@
|
||||||
|
|
||||||
|
#define ROCE_HIKP_GMV_REG_NUM 7
|
||||||
|
#define ROCE_HIKP_GMV_REG_SWICTH 2
|
||||||
|
-#define ROCE_MAX_HIKPTOOL_GMV 128
|
||||||
|
+#define ROCE_MAX_HIKPTOOL_GMV 256
|
||||||
|
struct cmd_roce_gmv_param {
|
||||||
|
struct tool_target target;
|
||||||
|
uint32_t gmv_index;
|
||||||
|
--
|
||||||
|
2.30.0
|
||||||
|
|
||||||
1390
0052-hikptool-Resolved-some-centralized-code-review-comme.patch
Normal file
1390
0052-hikptool-Resolved-some-centralized-code-review-comme.patch
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,42 @@
|
|||||||
|
From 15e5379c7a1e041d8ea384f55c6cf77698646ac7 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Junxian Huang <huangjunxian6@hisilicon.com>
|
||||||
|
Date: Tue, 7 Nov 2023 15:59:27 +0800
|
||||||
|
Subject: hikptool/roce: Fix the infinite loop due to compatibility issue
|
||||||
|
|
||||||
|
When a new-version hikptool sends a subcmd of caep ext registers to
|
||||||
|
an old-version FW which doesn't support the query of ext registers
|
||||||
|
yet, due to the lack of subcmd check in old-version FW, there will
|
||||||
|
be no error and register data will still be responsed to hikptool.
|
||||||
|
|
||||||
|
In the new-version hikptool, a do-while loop is used to implement a
|
||||||
|
multi-round query, and the loop variable is updated based on the
|
||||||
|
cur_block_num responsed from FW. Since there is no error reported,
|
||||||
|
the new-version hikptool will parse the old-version data based on the
|
||||||
|
new-version data structure. This may cause the parsed cur_block_num
|
||||||
|
remains 0, and the loop becomes infinite.
|
||||||
|
|
||||||
|
To fix this problem, add a check of the responsed cur_block_num.
|
||||||
|
If it's 0, return with an error code.
|
||||||
|
|
||||||
|
Fixes: 8b3b68347165 ("hikptool/roce: Add a common frame for hikptool roce register query")
|
||||||
|
Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com>
|
||||||
|
---
|
||||||
|
net/roce/roce_ext_common/hikp_roce_ext_common.c | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/net/roce/roce_ext_common/hikp_roce_ext_common.c b/net/roce/roce_ext_common/hikp_roce_ext_common.c
|
||||||
|
index 3a0c1ae..5bc3ce6 100644
|
||||||
|
--- a/net/roce/roce_ext_common/hikp_roce_ext_common.c
|
||||||
|
+++ b/net/roce/roce_ext_common/hikp_roce_ext_common.c
|
||||||
|
@@ -131,7 +131,7 @@ static int hikp_roce_ext_get_res(enum roce_cmd_type cmd_type,
|
||||||
|
}
|
||||||
|
|
||||||
|
cur_size = res_head->cur_block_num * sizeof(uint32_t);
|
||||||
|
- if (cur_size > max_size) {
|
||||||
|
+ if (!cur_size || cur_size > max_size) {
|
||||||
|
printf("hikptool roce_%s log data copy size error, data size: 0x%zx, max size: 0x%zx\n",
|
||||||
|
cmd_name, cur_size, max_size);
|
||||||
|
ret = -EINVAL;
|
||||||
|
--
|
||||||
|
2.30.0
|
||||||
|
|
||||||
@ -0,0 +1,37 @@
|
|||||||
|
From 93c9cd4501edc9fc487af78ea4fd4c0f37bc4dc1 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Ke Chen <chenke54@huawei.com>
|
||||||
|
Date: Fri, 15 Dec 2023 10:20:53 +0800
|
||||||
|
Subject: [PATCH] hikptool/roh: fix the display information for roh mac mib
|
||||||
|
statistics
|
||||||
|
|
||||||
|
Add a prompt head information "ROH MAC MIB INFO"
|
||||||
|
|
||||||
|
Fixes: 99d48570419c ("support querying the RoH module information")
|
||||||
|
Signed-off-by: Ke Chen <chenke54@huawei.com>
|
||||||
|
---
|
||||||
|
net/roh/hikp_roh_show_mib.c | 2 ++
|
||||||
|
1 file changed, 2 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/net/roh/hikp_roh_show_mib.c b/net/roh/hikp_roh_show_mib.c
|
||||||
|
index 425a0e6..7267fe5 100644
|
||||||
|
--- a/net/roh/hikp_roh_show_mib.c
|
||||||
|
+++ b/net/roh/hikp_roh_show_mib.c
|
||||||
|
@@ -232,6 +232,7 @@ static void hikp_roh_show_mib_in_multi_rounds(struct major_cmd_ctrl *self)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ printf("**************ROH MAC MIB INFO*************\n");
|
||||||
|
for (int i = 0; i < total_round; i++) {
|
||||||
|
ret = hikp_roh_fill_pmu_cnt(i);
|
||||||
|
if (ret != 0) {
|
||||||
|
@@ -239,6 +240,7 @@ static void hikp_roh_show_mib_in_multi_rounds(struct major_cmd_ctrl *self)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
+ printf("*****************************************\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
static void hikp_roh_show_mib_execute(struct major_cmd_ctrl *self)
|
||||||
|
--
|
||||||
|
2.30.0
|
||||||
|
|
||||||
30
0055-hikptool-augument-serdes-relationship-of-the-PCIe.patch
Normal file
30
0055-hikptool-augument-serdes-relationship-of-the-PCIe.patch
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
From 51382f799643371ecfbe2e311923e9ebfac436ea Mon Sep 17 00:00:00 2001
|
||||||
|
From: moubingquan <moubingquan@huawei.com>
|
||||||
|
Date: Tue, 19 Dec 2023 11:09:35 +0800
|
||||||
|
Subject: [PATCH] hikptool : augument serdes relationship of the PCIe
|
||||||
|
|
||||||
|
The Ndie infomation is missing when different chips are adapted.
|
||||||
|
Add two Ndie to ensure that die information is properly printed.
|
||||||
|
|
||||||
|
Fixes: 1d2a0bb9cddc ("hikptool : Querying the SerDes Relationship of the PCIe")
|
||||||
|
Signed-off-by: moubingquan <moubingquan@huawei.com>
|
||||||
|
---
|
||||||
|
pcie/func_lib/pcie_func/pcie_statistics.c | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/pcie/func_lib/pcie_func/pcie_statistics.c b/pcie/func_lib/pcie_func/pcie_statistics.c
|
||||||
|
index 5dff720..d2661a4 100644
|
||||||
|
--- a/pcie/func_lib/pcie_func/pcie_statistics.c
|
||||||
|
+++ b/pcie/func_lib/pcie_func/pcie_statistics.c
|
||||||
|
@@ -26,7 +26,7 @@ static const char *g_global_width_name[GLOBAL_WIDTH_TABLE_SIZE] = {
|
||||||
|
};
|
||||||
|
|
||||||
|
static const char *g_global_ndie_name[] = {
|
||||||
|
- "Ndie_A", "Ndie_B"
|
||||||
|
+ "Ndie_A", "Ndie_B", "Ndie_C", "Ndie_D"
|
||||||
|
};
|
||||||
|
|
||||||
|
static int port_distribution_rsp_data_check(const struct hikp_cmd_ret *cmd_ret, uint32_t *port_num)
|
||||||
|
--
|
||||||
|
2.33.0
|
||||||
|
|
||||||
484
0056-hikptool-Supported-parsing-the-optical-module-that-u.patch
Normal file
484
0056-hikptool-Supported-parsing-the-optical-module-that-u.patch
Normal file
@ -0,0 +1,484 @@
|
|||||||
|
From 32a3a456b701d9b82742bba5371d8d828c6fe309 Mon Sep 17 00:00:00 2001
|
||||||
|
From: veega2022 <zhuweijia@huawei.com>
|
||||||
|
Date: Thu, 4 Jan 2024 14:54:29 +0800
|
||||||
|
Subject: [PATCH] hikptool: Supported parsing the optical module that use the
|
||||||
|
CMIS protocol
|
||||||
|
|
||||||
|
Added support dump and parse optical modules
|
||||||
|
whose Identifier Values are 0x18, 0x1A, 0x1E, 0x1F, and 0x20.
|
||||||
|
|
||||||
|
Signed-off-by: veega2022 <zhuweijia@huawei.com>
|
||||||
|
---
|
||||||
|
net/nic/nic_mac/hikp_nic_xsfp.c | 250 ++++++++++++++++++++++++++++++++
|
||||||
|
net/nic/nic_mac/hikp_nic_xsfp.h | 159 ++++++++++++++++++++
|
||||||
|
2 files changed, 409 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/net/nic/nic_mac/hikp_nic_xsfp.c b/net/nic/nic_mac/hikp_nic_xsfp.c
|
||||||
|
index d97a506..70ed589 100644
|
||||||
|
--- a/net/nic/nic_mac/hikp_nic_xsfp.c
|
||||||
|
+++ b/net/nic/nic_mac/hikp_nic_xsfp.c
|
||||||
|
@@ -55,6 +55,108 @@ static struct sff_ext_comp g_sff_ext_spec_comp[] = {
|
||||||
|
{0x4A, "50GBASE-ER"},
|
||||||
|
};
|
||||||
|
|
||||||
|
+static struct sff_host_media_id g_sff_host_ids[] = {
|
||||||
|
+ {0x0, "Undefined", 0x0, "Undefined"},
|
||||||
|
+ {0x1, "1000BASE-CX", 0x1, "NRZ"},
|
||||||
|
+ {0xC, "100GAUI-4 C2M", 0x4, "NRZ"},
|
||||||
|
+ {0xD, "100GAUI-2 C2M", 0x2, "PAM4"},
|
||||||
|
+ {0x4B, "100GAUI-1-S C2M", 0x1, "PAM4"},
|
||||||
|
+ {0x4C, "100GAUI-1-L C2M", 0x1, "PAM4"},
|
||||||
|
+ {0xE, "200GAUI-8 C2M", 0x8, "NRZ"},
|
||||||
|
+ {0xF, "200GAUI-4 C2M", 0x4, "PAM4"},
|
||||||
|
+ {0x4D, "200GAUI-2-S C2M", 0x2, "PAM4"},
|
||||||
|
+ {0x4E, "200GAUI-2-L C2M", 0x2, "PAM4"},
|
||||||
|
+ {0x11, "400GAUI-8 C2M", 0x8, "PAM4"},
|
||||||
|
+ {0x4F, "400GAUI-4-S C2M", 0x4, "PAM4"},
|
||||||
|
+ {0x50, "400GAUI-4-L C2M", 0x4, "PAM4"},
|
||||||
|
+ {0x13, "10GBASE-CX4", 0x4, "NRZ"},
|
||||||
|
+ {0x14, "25GBASE-CR CA-25G-L", 0x1, "NRZ"},
|
||||||
|
+ {0x15, "25GBASE-CR or 25GBASE-CR-SCA-25G-S", 0x1, "NRZ"},
|
||||||
|
+ {0x16, "25GBASE-CR or 25GBASE-CR-SCA-25G-N", 0x1, "NRZ"},
|
||||||
|
+ {0x17, "40GBASE-CR4", 0x4, "NRZ"},
|
||||||
|
+ {0x43, "50GBASE-CR2 with RS(528,514)FEC", 0x2, "NRZ"},
|
||||||
|
+ {0x44, "50GBASE-CR2 with BASE-R, Fire code FEC", 0x2, "NRZ"},
|
||||||
|
+ {0x45, "50GBASE-CR2 with no FEC", 0x2, "NRZ"},
|
||||||
|
+ {0x18, "50GBASE-CR", 0x1, "PAM4"},
|
||||||
|
+ {0x1A, "100GBASE-CR4", 0x4, "NRZ"},
|
||||||
|
+ {0x1B, "100GBASE-CR2", 0x2, "PAM4"},
|
||||||
|
+ {0x46, "100GBASE-CR1", 0x1, "PAM4"},
|
||||||
|
+ {0x1C, "200GBASE-CR4", 0x4, "PAM4"},
|
||||||
|
+ {0x47, "200GBASE-CR2", 0x2, "PAM4"},
|
||||||
|
+ {0x1D, "400G CR8", 0x8, "PAM4"},
|
||||||
|
+ {0x48, "400GBASE-CR4", 0x4, "PAM4"},
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+static struct sff_host_media_id g_mmf_media_ids[] = {
|
||||||
|
+ {0x0, "Undefined", 0x0, "Undefined"},
|
||||||
|
+ {0x2, "10GBASE-SR", 0x1, "NRZ"},
|
||||||
|
+ {0x3, "25GBASE-SR", 0x1, "NRZ"},
|
||||||
|
+ {0x4, "40GBASE-SR4", 0x4, "NRZ"},
|
||||||
|
+ {0x5, "40GE SWDM4 MSA", 0x4, "NRZ"},
|
||||||
|
+ {0x7, "50GBASE-SR", 0x1, "PAM4"},
|
||||||
|
+ {0x9, "100GBASE-SR4", 0x4, "NRZ"},
|
||||||
|
+ {0xA, "100GE SWDM4 MSA", 0x4, "NRZ"},
|
||||||
|
+ {0xC, "100GBASE-SR2", 0x2, "PAM4"},
|
||||||
|
+ {0xD, "100GBASE-SR1", 0x1, "PAM4"},
|
||||||
|
+ {0x1D, "100GBASE-VR1", 0x1, "PAM4"},
|
||||||
|
+ {0xE, "200GBASE-SR4", 0x4, "PAM4"},
|
||||||
|
+ {0x1B, "200GBASE-SR2", 0x2, "PAM4"},
|
||||||
|
+ {0x1E, "200GBASE-VR2", 0x2, "PAM4"},
|
||||||
|
+ {0x10, "400GBASE-SR8", 0x8, "PAM4"},
|
||||||
|
+ {0x11, "400GBASE-SR4", 0x4, "PAM4"},
|
||||||
|
+ {0x1F, "400GBASE-VR4", 0x4, "PAM4"},
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+static struct sff_host_media_id g_smf_media_ids[] = {
|
||||||
|
+ {0x0, "Undefined", 0x0, "Undefined"},
|
||||||
|
+ {0x4, "10GBASE-LR", 0x1, "NRZ"},
|
||||||
|
+ {0x5, "10GBASE-ER", 0x1, "NRZ"},
|
||||||
|
+ {0x4E, "10GBASE-BR", 0x1, "NRZ"},
|
||||||
|
+ {0x6, "10G-ZR", 0x1, "NRZ"},
|
||||||
|
+ {0x7, "25GBASE-LR", 0x1, "NRZ"},
|
||||||
|
+ {0x8, "25GBASE-ER", 0x1, "NRZ"},
|
||||||
|
+ {0x4F, "25GBASE-BR", 0x1, "NRZ"},
|
||||||
|
+ {0x9, "40GBASE-LR4", 0x4, "NRZ"},
|
||||||
|
+ {0xB, "50GBASE-FR", 0x1, "PAM4"},
|
||||||
|
+ {0xC, "50GBASE-LR", 0x1, "PAM4"},
|
||||||
|
+ {0x40, "50GBASE-ER", 0x1, "PAM4"},
|
||||||
|
+ {0x50, "50GBASE-BR", 0x1, "PAM4"},
|
||||||
|
+ {0xD, "100GBASE-LR4", 0x4, "NRZ"},
|
||||||
|
+ {0xE, "100GBASE-ER4", 0x4, "NRZ"},
|
||||||
|
+ {0xF, "100G PSM4 MSA", 0x4, "NRZ"},
|
||||||
|
+ {0x34, "100G CWDM4-OCP", 0x4, "NRZ"},
|
||||||
|
+ {0x10, "100G CWDM4 MSA", 0x4, "NRZ"},
|
||||||
|
+ {0x11, "100G 4WDM-10 MSA", 0x4, "NRZ"},
|
||||||
|
+ {0x12, "100G 4WDM-20 MSA", 0x4, "NRZ"},
|
||||||
|
+ {0x13, "100G 4WDM-40 MSA", 0x4, "NRZ"},
|
||||||
|
+ {0x14, "100GBASE-DR", 0x1, "PAM4"},
|
||||||
|
+ {0x17, "200GBASE-DR4", 0x4, "PAM4"},
|
||||||
|
+ {0x18, "200GBASE-FR4", 0x4, "PAM4"},
|
||||||
|
+ {0x19, "200GBASE-LR4", 0x4, "PAM4"},
|
||||||
|
+ {0x41, "200GBASE-ER4", 0x4, "PAM4"},
|
||||||
|
+ {0x1A, "400GBASE-FR8", 0x8, "PAM4"},
|
||||||
|
+ {0x1B, "400GBASE-LR8", 0x8, "PAM4"},
|
||||||
|
+ {0x42, "400GBASE-ER8", 0x8, "PAM4"},
|
||||||
|
+ {0x1C, "400GBASE-DR4", 0x4, "PAM4"},
|
||||||
|
+ {0x55, "400GBASE-DR4-2", 0x4, "PAM4"},
|
||||||
|
+ {0x43, "400GBASE-LR4-6", 0x4, "PAM4"},
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+static struct sff_media_cable_id g_passive_cable_ids[] = {
|
||||||
|
+ {0x0, "Undefined"},
|
||||||
|
+ {0x1, "Copper cable"},
|
||||||
|
+ {0xBF, "Passive Loopback module"},
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+static struct sff_media_cable_id g_active_cable_ids[] = {
|
||||||
|
+ {0x0, "Undefined"},
|
||||||
|
+ {0x1, "Active Cable assembly"},
|
||||||
|
+ {0x2, "Active Cable assembly"},
|
||||||
|
+ {0x3, "Active Cable assembly"},
|
||||||
|
+ {0x4, "Active Cable assembly"},
|
||||||
|
+ {0xBF, "Active Loopback module"},
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
static int hikp_xsfp_get_cmd_data(struct hikp_cmd_ret **cmd_resp, uint32_t sub_cmd, uint32_t blk_id)
|
||||||
|
{
|
||||||
|
struct hikp_xsfp_req req = {0};
|
||||||
|
@@ -320,6 +422,148 @@ static void hikp_show_qsfp_info(const uint8_t *data, uint32_t size)
|
||||||
|
printf("--------------------------------------------------------------\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
+static void cmis_print_media_optical(const struct cmis_app_desc *desc,
|
||||||
|
+ struct sff_host_media_id *ids, size_t len)
|
||||||
|
+{
|
||||||
|
+ for (uint8_t i = 0; i < len; i++) {
|
||||||
|
+ if (desc->media_id == ids[i].id) {
|
||||||
|
+ printf("%s(%s)\n", ids[i].int_spec, ids[i].modulation);
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ printf("0x%x\n", desc->media_id);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void cmis_print_media_cable(const struct cmis_app_desc *desc,
|
||||||
|
+ struct sff_media_cable_id *ids, size_t len)
|
||||||
|
+{
|
||||||
|
+ for (uint8_t i = 0; i < len; i++) {
|
||||||
|
+ if (desc->media_id == ids[i].id) {
|
||||||
|
+ printf("%s\n", ids[i].app_name);
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ printf("0x%x\n", desc->media_id);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void cmis_print_host_int_spec(const struct cmis_app_desc *desc)
|
||||||
|
+{
|
||||||
|
+ size_t size = HIKP_ARRAY_SIZE(g_sff_host_ids);
|
||||||
|
+
|
||||||
|
+ for (uint8_t i = 0; i < size; i++) {
|
||||||
|
+ if (desc->host_id == g_sff_host_ids[i].id) {
|
||||||
|
+ printf("%s(%s) | ",
|
||||||
|
+ g_sff_host_ids[i].int_spec, g_sff_host_ids[i].modulation);
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ printf("0x%x | ", desc->host_id);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void cmis_print_host_and_media_int(const struct cmis_page_info *info, uint8_t app_id)
|
||||||
|
+{
|
||||||
|
+ const struct cmis_app_desc *desc = &info->page0_lower.apps[app_id];
|
||||||
|
+ uint8_t media_type = info->page0_lower.media_type;
|
||||||
|
+
|
||||||
|
+ printf("%s %-9u: %s", "app_descriptor", app_id, "host and media int: ");
|
||||||
|
+ cmis_print_host_int_spec(desc);
|
||||||
|
+
|
||||||
|
+ switch (media_type) {
|
||||||
|
+ case OPT_MMF:
|
||||||
|
+ cmis_print_media_optical(desc, g_mmf_media_ids, HIKP_ARRAY_SIZE(g_mmf_media_ids));
|
||||||
|
+ break;
|
||||||
|
+ case OPT_SMF:
|
||||||
|
+ cmis_print_media_optical(desc, g_smf_media_ids, HIKP_ARRAY_SIZE(g_smf_media_ids));
|
||||||
|
+ break;
|
||||||
|
+ case PASSIVE_COPPER:
|
||||||
|
+ cmis_print_media_cable(desc, g_passive_cable_ids,
|
||||||
|
+ HIKP_ARRAY_SIZE(g_passive_cable_ids));
|
||||||
|
+ break;
|
||||||
|
+ case ACTIVE_CABLE:
|
||||||
|
+ cmis_print_media_cable(desc, g_active_cable_ids,
|
||||||
|
+ HIKP_ARRAY_SIZE(g_active_cable_ids));
|
||||||
|
+ break;
|
||||||
|
+ default:
|
||||||
|
+ printf("0x%x\n", desc->media_id);
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void cmis_print_application_desc(const struct cmis_page_info *info)
|
||||||
|
+{
|
||||||
|
+ for (uint8_t i = 0; i < CMIS_LOW_MEM_APP_DESC_NUM; i++) {
|
||||||
|
+ /* Undefined or unused, not print */
|
||||||
|
+ if ((info->page0_lower.apps[i].host_id == 0xFF) ||
|
||||||
|
+ (!info->page0_lower.apps[i].host_id && !info->page0_lower.apps[i].media_id))
|
||||||
|
+ continue;
|
||||||
|
+
|
||||||
|
+ cmis_print_host_and_media_int(info, i);
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void cmis_print_base_id_info(const struct cmis_page_info *info)
|
||||||
|
+{
|
||||||
|
+ /* page00h reg 202: bit6-7 */
|
||||||
|
+ float cab_len_mul[] = {0.1f, 1.0f, 10.0f, 100.0f};
|
||||||
|
+ /* page01h reg 132: bit6-7 */
|
||||||
|
+ float smf_len_mul[] = {0.1f, 1.0f, 10.0f, 1.0f};
|
||||||
|
+ const char *type[MEDIA_TYPE_RSVD] = {
|
||||||
|
+ "Undefined", "MMF Optical Interfaces", "SMF Optical Interfaces",
|
||||||
|
+ "Passive Copper Cables", "Active Cables", "BASE-T"
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ printf("%-24s: 0x%02x\n", "identifier", info->page0_lower.identifier);
|
||||||
|
+ printf("%-24s: 0x%02x\n", "connector", info->page0_upper.connector_type);
|
||||||
|
+
|
||||||
|
+ if (info->page0_lower.media_type >= MEDIA_TYPE_RSVD)
|
||||||
|
+ printf("%-24s: 0x%02x\n", "media_type", info->page0_lower.media_type);
|
||||||
|
+ else
|
||||||
|
+ printf("%-24s: %s\n", "media_type", type[info->page0_lower.media_type]);
|
||||||
|
+
|
||||||
|
+ printf("%-24s: %0.2f (m)\n", "cable_len", (float)info->page0_upper.cab_base_len *
|
||||||
|
+ cab_len_mul[info->page0_upper.len_multiplier]);
|
||||||
|
+ printf("%-24s: %0.2f (km)\n", "smf_len_km",
|
||||||
|
+ (float)info->page1.smf_len * smf_len_mul[info->page1.smf_len_multip]);
|
||||||
|
+ printf("%-24s: %u (m)\n", "om5_len", info->page1.om5_len * 0x2);
|
||||||
|
+ printf("%-24s: %u (m)\n", "om4_len", info->page1.om4_len * 0x2);
|
||||||
|
+ printf("%-24s: %u (m)\n", "om3_len", info->page1.om3_len * 0x2);
|
||||||
|
+ printf("%-24s: %u (m)\n", "om2_len", info->page1.om2_len);
|
||||||
|
+ printf("%-24s: %u (nm)\n", "wavelength",
|
||||||
|
+ (((uint16_t)info->page1.nominal_wave_len[0] << 8U) |
|
||||||
|
+ (uint16_t)info->page1.nominal_wave_len[1]) / CMIS_WAVE_LEN_DIV);
|
||||||
|
+ printf("%-24s: %u (nm)\n", "wavelength_tolerance",
|
||||||
|
+ (((uint16_t)info->page1.wave_len_tolerance[0] << 8U) |
|
||||||
|
+ (uint16_t)info->page1.wave_len_tolerance[1]) / CMIS_TOL_WAVE_LEN_DIV);
|
||||||
|
+ printf("%-24s: 0x%02x\n", "media_technology", info->page0_upper.media_int_tech);
|
||||||
|
+ xsfp_print_data("vendor_name", VEND_NAME_LEN, info->page0_upper.vend_name, PRINT_ASCII);
|
||||||
|
+ xsfp_print_data("vendor_oui", VEND_OUI_LEN, info->page0_upper.vend_oui, PRINT_HEX);
|
||||||
|
+ xsfp_print_data("vendor_pn", VEND_PN_LEN, info->page0_upper.vend_pn, PRINT_ASCII);
|
||||||
|
+ xsfp_print_data("vendor_rev", CMIS_VEND_REV_LEN, info->page0_upper.vend_rev, PRINT_ASCII);
|
||||||
|
+ xsfp_print_data("vendor_sn", VEND_SN_LEN, info->page0_upper.vend_sn, PRINT_ASCII);
|
||||||
|
+ xsfp_print_data("vendor_date_code", VEND_DATE_CODE_LEN,
|
||||||
|
+ info->page0_upper.date_code, PRINT_ASCII);
|
||||||
|
+
|
||||||
|
+ cmis_print_application_desc(info);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void cmis_print_dom_info(const struct cmis_page_info *info)
|
||||||
|
+{
|
||||||
|
+ if (!info->page0_lower.mem_model && info->page1.temp_mon_supp)
|
||||||
|
+ printf("%-24s: %d.%02u\n", "temperature", (int8_t)info->page0_lower.module_temp[0],
|
||||||
|
+ info->page0_lower.module_temp[1]);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void hikp_show_cmis_info(const uint8_t *data, uint32_t size)
|
||||||
|
+{
|
||||||
|
+ struct cmis_page_info *cmis_data = (struct cmis_page_info *)data;
|
||||||
|
+
|
||||||
|
+ printf("------------------------show cmis info------------------------\n");
|
||||||
|
+ cmis_print_base_id_info(cmis_data);
|
||||||
|
+ cmis_print_dom_info(cmis_data);
|
||||||
|
+ printf("--------------------------------------------------------------\n");
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static void hikp_xsfp_parse_info(const uint8_t *data, uint32_t size)
|
||||||
|
{
|
||||||
|
if (data[SFF_ID_OFFSET] == ID_SFP) {
|
||||||
|
@@ -328,6 +572,12 @@ static void hikp_xsfp_parse_info(const uint8_t *data, uint32_t size)
|
||||||
|
data[SFF_ID_OFFSET] == ID_QSFP_PLUS ||
|
||||||
|
data[SFF_ID_OFFSET] == ID_QSFP28) {
|
||||||
|
hikp_show_qsfp_info(data, size);
|
||||||
|
+ } else if (data[SFF_ID_OFFSET] == ID_QSFP_DD ||
|
||||||
|
+ data[SFF_ID_OFFSET] == ID_SFP_DD ||
|
||||||
|
+ data[SFF_ID_OFFSET] == ID_QSFP_P_CMIS ||
|
||||||
|
+ data[SFF_ID_OFFSET] == ID_SFP_DD_CMIS ||
|
||||||
|
+ data[SFF_ID_OFFSET] == ID_SFP_P_CMIS) {
|
||||||
|
+ hikp_show_cmis_info(data, size);
|
||||||
|
} else {
|
||||||
|
/* unknown type just dump hex data */
|
||||||
|
hikp_xsfp_dump_hex(data, size);
|
||||||
|
diff --git a/net/nic/nic_mac/hikp_nic_xsfp.h b/net/nic/nic_mac/hikp_nic_xsfp.h
|
||||||
|
index a378197..6f5e38f 100644
|
||||||
|
--- a/net/nic/nic_mac/hikp_nic_xsfp.h
|
||||||
|
+++ b/net/nic/nic_mac/hikp_nic_xsfp.h
|
||||||
|
@@ -75,6 +75,11 @@
|
||||||
|
#define QSFP_10GBASE_LR_MASK HI_BIT(5)
|
||||||
|
#define QSFP_10GBASE_LRM_MASK HI_BIT(6)
|
||||||
|
|
||||||
|
+#define CMIS_WAVE_LEN_DIV 20
|
||||||
|
+#define CMIS_TOL_WAVE_LEN_DIV 200
|
||||||
|
+
|
||||||
|
+#define CMIS_VEND_REV_LEN 2
|
||||||
|
+
|
||||||
|
enum print_type {
|
||||||
|
PRINT_ASCII = 0,
|
||||||
|
PRINT_HEX,
|
||||||
|
@@ -87,6 +92,11 @@ enum sff_id_val {
|
||||||
|
ID_QSFP = 0x0C,
|
||||||
|
ID_QSFP_PLUS = 0x0D,
|
||||||
|
ID_QSFP28 = 0x11,
|
||||||
|
+ ID_QSFP_DD = 0x18,
|
||||||
|
+ ID_SFP_DD = 0x1A,
|
||||||
|
+ ID_QSFP_P_CMIS = 0x1E,
|
||||||
|
+ ID_SFP_DD_CMIS = 0x1F,
|
||||||
|
+ ID_SFP_P_CMIS = 0x20,
|
||||||
|
};
|
||||||
|
|
||||||
|
struct sff_comp_info {
|
||||||
|
@@ -99,6 +109,18 @@ struct sff_ext_comp {
|
||||||
|
const char *module_cap;
|
||||||
|
};
|
||||||
|
|
||||||
|
+struct sff_host_media_id {
|
||||||
|
+ uint8_t id;
|
||||||
|
+ const char *int_spec;
|
||||||
|
+ uint8_t lane_cnt;
|
||||||
|
+ const char *modulation;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+struct sff_media_cable_id {
|
||||||
|
+ uint8_t id;
|
||||||
|
+ const char *app_name;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
struct sfp_a0_page {
|
||||||
|
uint8_t identifier; /* reg 0: Identifier */
|
||||||
|
uint8_t ext_identifier; /* reg 1: Ext. Identifier */
|
||||||
|
@@ -358,6 +380,143 @@ struct qsfp_page0_info {
|
||||||
|
struct qsfp_page0_upper page_upper;
|
||||||
|
};
|
||||||
|
|
||||||
|
+enum cmis_media_type {
|
||||||
|
+ UNDEFINED = 0,
|
||||||
|
+ OPT_MMF,
|
||||||
|
+ OPT_SMF,
|
||||||
|
+ PASSIVE_COPPER,
|
||||||
|
+ ACTIVE_CABLE,
|
||||||
|
+ BASE_T,
|
||||||
|
+ MEDIA_TYPE_RSVD,
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+#define CMIS_LOW_MEM_APP_DESC_NUM 8
|
||||||
|
+struct cmis_app_desc {
|
||||||
|
+ uint8_t host_id; /* host electrical interface id */
|
||||||
|
+ uint8_t media_id; /* module media electrical interface id */
|
||||||
|
+ uint8_t media_lane_cnt : 4,
|
||||||
|
+ host_lane_cnt : 4; /* host and media lane counts */
|
||||||
|
+ uint8_t host_assign; /* Host Lane Assignment Options */
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+struct cmis_page0_lower {
|
||||||
|
+ uint8_t identifier; /* reg 0: Identifier */
|
||||||
|
+ uint8_t rev_compliance; /* reg 1: CMIS revision */
|
||||||
|
+ /* reg 2: Module Management Characteristics */
|
||||||
|
+ uint8_t rsv0 : 2,
|
||||||
|
+ mci_max_speed : 2,
|
||||||
|
+ rsv1 : 2,
|
||||||
|
+ step_cfg_only : 1,
|
||||||
|
+ mem_model : 1;
|
||||||
|
+ /* reg 3: Global Status Information */
|
||||||
|
+ uint8_t intr_deasserted : 1,
|
||||||
|
+ module_state : 3,
|
||||||
|
+ rsv2 : 4;
|
||||||
|
+ uint8_t flags_sum[4]; /* reg 4-7: Lane-Level Flags Summary */
|
||||||
|
+ uint8_t module_flags[6]; /* reg 8-13: Module-Level Flags */
|
||||||
|
+ uint8_t module_temp[2]; /* reg 14-15: TempMonValue */
|
||||||
|
+ uint8_t module_vcc[2]; /* reg 16-17: VccMonVoltage */
|
||||||
|
+ uint8_t module_mon_val[8]; /* reg 18-25: Module-Level Mon Value */
|
||||||
|
+ /* reg 26: Module Global Controls */
|
||||||
|
+ uint8_t rsv3 : 3,
|
||||||
|
+ sw_reset : 1,
|
||||||
|
+ lowpwr_req_sw : 1,
|
||||||
|
+ squ_method_sel : 1,
|
||||||
|
+ lowpwr_allow_req_hw : 1,
|
||||||
|
+ bank_bc_enable : 1;
|
||||||
|
+ uint8_t rsv4[14]; /* reg 27-40: */
|
||||||
|
+ uint8_t module_fault; /* reg 41: Module Fault Information */
|
||||||
|
+ uint8_t rsv5[22]; /* reg 42-63: Reserved */
|
||||||
|
+ uint8_t custom[21]; /* reg 64-84: Custom */
|
||||||
|
+ uint8_t media_type; /* reg 85: Media Type Encodings */
|
||||||
|
+ /* reg 86-117: Application Descriptor */
|
||||||
|
+ struct cmis_app_desc apps[CMIS_LOW_MEM_APP_DESC_NUM];
|
||||||
|
+ uint8_t pwd_area[8]; /* reg 118-125: Password Facilities */
|
||||||
|
+ uint8_t bank_sel; /* reg 126: Bank Index of Page mapped to Upper Memory */
|
||||||
|
+ uint8_t page_sel; /* reg 127: Page Index of Page mapped to Upper Memory */
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+struct cmis_page0_upper {
|
||||||
|
+ uint8_t identifier_cp; /* reg 128: The Same Byte 00h:0 */
|
||||||
|
+ uint8_t vend_name[16]; /* reg 129-144: Vendor name (ASCII) */
|
||||||
|
+ uint8_t vend_oui[3]; /* reg 145-147: Vendor IEEE company ID */
|
||||||
|
+ uint8_t vend_pn[16]; /* reg 148-163: Part number provided by vendor (ASCII) */
|
||||||
|
+ /* reg 164-165: Revision level for part number provided by vendor (ASCII) */
|
||||||
|
+ uint8_t vend_rev[2];
|
||||||
|
+ uint8_t vend_sn[16]; /* reg 166-181: Vendor Serial Number (ASCII) */
|
||||||
|
+ uint8_t date_code[8]; /* reg 182-189: Manufacturing Date Code (ASCII) */
|
||||||
|
+ /* reg 190-199: Common Language Equipment Identification Code (ASCII) */
|
||||||
|
+ uint8_t clei_code[10];
|
||||||
|
+ uint8_t module_pwr_class; /* reg 200: Module Power Class */
|
||||||
|
+ /* reg 201: Maximum power consumption in multiples of 0.25 W
|
||||||
|
+ * rounded up to the next whole multiple of 0.25 W
|
||||||
|
+ */
|
||||||
|
+ uint8_t max_power;
|
||||||
|
+ /* reg 202: Cable Assembly Link Length */
|
||||||
|
+ uint8_t cab_base_len : 6,
|
||||||
|
+ len_multiplier : 2;
|
||||||
|
+ uint8_t connector_type; /* reg 203: Media Connector Type */
|
||||||
|
+ uint8_t copp_attenuation[6]; /* reg 204-209: Copper Cable Attenuation */
|
||||||
|
+ uint8_t media_lanes; /* reg 210: Media Lane Information */
|
||||||
|
+ uint8_t cable_assembly_lane; /* reg 211: Cable Assembly Lane Information */
|
||||||
|
+ uint8_t media_int_tech; /* reg 212: Media Interface Technology */
|
||||||
|
+ uint8_t rsv0[8]; /* reg 213-220: Reserved */
|
||||||
|
+ uint8_t rsv1; /* reg 221: Custom1 */
|
||||||
|
+ uint8_t page_check_sum; /* reg 222: Page Checksum over bytes 128-221 */
|
||||||
|
+ uint8_t rsv[33]; /* reg 223-255: Custom Info (non-volatile) */
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+struct cmis_page1_info {
|
||||||
|
+ uint8_t inac_fw_hw_ver[4]; /* reg 128-131: Inactive FW revision and HW revision */
|
||||||
|
+ uint8_t smf_len : 6, /* reg 132: Base link length for SMF fiber in km */
|
||||||
|
+ smf_len_multip : 2; /* Link length multiplier for SMF fiber */
|
||||||
|
+ uint8_t om5_len; /* reg 133: Link length supported for OM5 fiber */
|
||||||
|
+ uint8_t om4_len; /* reg 134: Link length supported for OM4 fiber */
|
||||||
|
+ uint8_t om3_len; /* reg 135: Link length supported for EBW 50/125 µm fiber (OM3) */
|
||||||
|
+ uint8_t om2_len; /* reg 136: Link length supported for 50/125 µm fiber (OM2) */
|
||||||
|
+ uint8_t rsv0; /* reg 137: Reserved */
|
||||||
|
+ uint8_t nominal_wave_len[2]; /* reg 138-139: NominalWavelength */
|
||||||
|
+ uint8_t wave_len_tolerance[2]; /* reg 140-141: WavelengthTolerance */
|
||||||
|
+ uint8_t pages_support; /* reg 142: Supported Pages Advertising */
|
||||||
|
+ uint8_t duration_adv[2]; /* reg 143-144: Durations Advertising */
|
||||||
|
+ uint8_t module_char[10]; /* reg 145-154: Module Characteristics Advertising */
|
||||||
|
+ uint8_t contrl_support[2]; /* reg 155-156: Supported Controls Advertisement */
|
||||||
|
+ uint8_t flags_support[2]; /* reg 157-158: Supported Flags Advertisement */
|
||||||
|
+ /* reg 159: Supported Mon Advertisement */
|
||||||
|
+ uint8_t temp_mon_supp : 1,
|
||||||
|
+ vcc_mon_supp : 1,
|
||||||
|
+ aux1_mon_supp : 1,
|
||||||
|
+ aux2_mon_supp : 1,
|
||||||
|
+ aux3_mon_supp : 1,
|
||||||
|
+ custom_mon_supp : 1,
|
||||||
|
+ rsv1 : 2;
|
||||||
|
+ /* reg 160: Supported Power Mon Advertisement */
|
||||||
|
+ uint8_t txbias_mon_supp : 1,
|
||||||
|
+ tx_pwr_mon_supp : 1,
|
||||||
|
+ rx_pwr_mon_supp : 1,
|
||||||
|
+ txbias_curr_scal : 2,
|
||||||
|
+ rsv2 : 3;
|
||||||
|
+ /* reg 161-162: Supported Configuration and Signal Integrity Controls Advertisement */
|
||||||
|
+ uint8_t sig_intr_support[2];
|
||||||
|
+ uint8_t cdb_func_support[4]; /* reg 163-166: CDB Messaging Support Advertisement */
|
||||||
|
+ uint8_t add_dura_adv[3]; /* reg 167-169: Additional Durations Advertising */
|
||||||
|
+ uint8_t rsv3[7]; /* reg 170-175: Reserved */
|
||||||
|
+ uint8_t media_lane_adv[15]; /* reg 176-190: Media Lane Assignment Advertising */
|
||||||
|
+ uint8_t custom[32]; /* reg 191-222: Custom */
|
||||||
|
+ uint8_t add_app_desc[28]; /* reg 223-250: Additional Application Descriptor Registers */
|
||||||
|
+ uint8_t rsv4[4]; /* reg 251-254: Reserved */
|
||||||
|
+ uint8_t page_check_sum; /* reg 255: Page Checksum */
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+/* Current support max 640 bytes data */
|
||||||
|
+struct cmis_page_info {
|
||||||
|
+ struct cmis_page0_lower page0_lower;
|
||||||
|
+ struct cmis_page0_upper page0_upper;
|
||||||
|
+ struct cmis_page1_info page1;
|
||||||
|
+ uint8_t page2_data[128];
|
||||||
|
+ uint8_t page3_data[128];
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
#define XSFP_TARGET_BIT HI_BIT(0)
|
||||||
|
#define XSFP_RAW_DATA_BIT HI_BIT(1)
|
||||||
|
|
||||||
|
--
|
||||||
|
2.33.0
|
||||||
|
|
||||||
@ -0,0 +1,71 @@
|
|||||||
|
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
|
||||||
|
|
||||||
167
0058-hikptool-The-nic_port-command-is-adapted-to-display-.patch
Normal file
167
0058-hikptool-The-nic_port-command-is-adapted-to-display-.patch
Normal file
@ -0,0 +1,167 @@
|
|||||||
|
From 9bdcedb5d634b438139daf6de851a0f40e8708fe Mon Sep 17 00:00:00 2001
|
||||||
|
From: veega2022 <zhuweijia@huawei.com>
|
||||||
|
Date: Thu, 22 Feb 2024 10:34:09 +0800
|
||||||
|
Subject: [PATCH] hikptool: The nic_port command is adapted to display the DFX
|
||||||
|
of the ROH MAC
|
||||||
|
|
||||||
|
ROH MAC is different from ETH MAC. For ROH MAC,
|
||||||
|
the following DFX parameters are added:
|
||||||
|
tx link lanes, rx link lanes, pcs link, mac link, tx retry count, etc.
|
||||||
|
|
||||||
|
For the firmware of earlier versions,
|
||||||
|
the MAC DFX of the ETH type is displayed by default.
|
||||||
|
|
||||||
|
Signed-off-by: veega2022 <zhuweijia@huawei.com>
|
||||||
|
---
|
||||||
|
net/nic/nic_mac/hikp_mac_cmd.h | 1 +
|
||||||
|
net/nic/nic_mac/hikp_nic_port.c | 63 +++++++++++++++++++++++++++++++--
|
||||||
|
net/nic/nic_mac/hikp_nic_port.h | 25 +++++++++++++
|
||||||
|
3 files changed, 86 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/net/nic/nic_mac/hikp_mac_cmd.h b/net/nic/nic_mac/hikp_mac_cmd.h
|
||||||
|
index f74fd2a..9a3f0d9 100644
|
||||||
|
--- a/net/nic/nic_mac/hikp_mac_cmd.h
|
||||||
|
+++ b/net/nic/nic_mac/hikp_mac_cmd.h
|
||||||
|
@@ -32,6 +32,7 @@ enum mac_port_sub_cmd {
|
||||||
|
QUERY_HOT_PLUG_CARD_DFX,
|
||||||
|
QUERY_PORT_CDR_DFX,
|
||||||
|
QUERY_PORT_INFO_DFX_CAP,
|
||||||
|
+ QUERY_PORT_ROH_MAC_DFX,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum mac_dump_reg_sub_cmd {
|
||||||
|
diff --git a/net/nic/nic_mac/hikp_nic_port.c b/net/nic/nic_mac/hikp_nic_port.c
|
||||||
|
index 5ba6927..725ef95 100644
|
||||||
|
--- a/net/nic/nic_mac/hikp_nic_port.c
|
||||||
|
+++ b/net/nic/nic_mac/hikp_nic_port.c
|
||||||
|
@@ -174,7 +174,7 @@ static void mac_show_speed(uint32_t speed, uint32_t lanes)
|
||||||
|
printf("speed: %s_%s\n", speed_str, lanes_str);
|
||||||
|
}
|
||||||
|
|
||||||
|
-static void mac_cmd_disp_mac_info(const struct mac_cmd_mac_dfx *mac_dfx)
|
||||||
|
+static void mac_cmd_disp_eth_mac_info(const struct mac_cmd_mac_dfx *mac_dfx)
|
||||||
|
{
|
||||||
|
printf("\n========================== MAC INFO ==========================\n");
|
||||||
|
mac_show_speed(mac_dfx->speed, mac_dfx->lanes);
|
||||||
|
@@ -192,7 +192,7 @@ static void mac_cmd_disp_mac_info(const struct mac_cmd_mac_dfx *mac_dfx)
|
||||||
|
printf("pcs_err = 0x%x\n", mac_dfx->pcs_err_cnt);
|
||||||
|
}
|
||||||
|
|
||||||
|
-static void mac_cmd_show_mac(struct major_cmd_ctrl *self)
|
||||||
|
+static void mac_cmd_show_eth_mac(struct major_cmd_ctrl *self)
|
||||||
|
{
|
||||||
|
struct mac_cmd_mac_dfx *mac_dfx = NULL;
|
||||||
|
struct hikp_cmd_ret *cmd_ret = NULL;
|
||||||
|
@@ -206,8 +206,65 @@ static void mac_cmd_show_mac(struct major_cmd_ctrl *self)
|
||||||
|
}
|
||||||
|
|
||||||
|
mac_dfx = (struct mac_cmd_mac_dfx *)(cmd_ret->rsp_data);
|
||||||
|
- mac_cmd_disp_mac_info(mac_dfx);
|
||||||
|
+ mac_cmd_disp_eth_mac_info(mac_dfx);
|
||||||
|
+ free(cmd_ret);
|
||||||
|
+ cmd_ret = NULL;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void mac_cmd_disp_roh_mac_info(const struct mac_cmd_roh_mac_dfx *mac_dfx)
|
||||||
|
+{
|
||||||
|
+ printf("\n========================== MAC INFO ==========================\n");
|
||||||
|
+ mac_show_speed(mac_dfx->speed, mac_dfx->lanes);
|
||||||
|
+ mac_print_enum("fec", mac_dfx->fec, g_fec_table, HIKP_ARRAY_SIZE(g_fec_table), "unknown");
|
||||||
|
+ mac_print_enum("sds_rate", mac_dfx->sds_rate, g_sds_rate_table,
|
||||||
|
+ HIKP_ARRAY_SIZE(g_sds_rate_table), "unknown");
|
||||||
|
+ printf("tx_link_lanes: %u\n", mac_dfx->tx_link_lanes);
|
||||||
|
+ printf("rx_link_lanes: %u\n", mac_dfx->rx_link_lanes);
|
||||||
|
+ mac_print_link("pcs_link", mac_dfx->pcs_link);
|
||||||
|
+ mac_print_link("mac_link", mac_dfx->mac_link);
|
||||||
|
+ printf("tx_retry_cnt: %u\n", mac_dfx->tx_retry_cnt);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void mac_cmd_show_roh_mac(struct major_cmd_ctrl *self)
|
||||||
|
+{
|
||||||
|
+ struct mac_cmd_roh_mac_dfx *mac_dfx = NULL;
|
||||||
|
+ struct hikp_cmd_ret *cmd_ret = NULL;
|
||||||
|
+ int ret;
|
||||||
|
+
|
||||||
|
+ ret = mac_cmd_get_dfx_cfg(QUERY_PORT_ROH_MAC_DFX, &cmd_ret);
|
||||||
|
+ if (ret) {
|
||||||
|
+ snprintf(self->err_str, sizeof(self->err_str), "mac get roh mac dfx failed.");
|
||||||
|
+ self->err_no = -ENOSPC;
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ mac_dfx = (struct mac_cmd_roh_mac_dfx *)(cmd_ret->rsp_data);
|
||||||
|
+ mac_cmd_disp_roh_mac_info(mac_dfx);
|
||||||
|
free(cmd_ret);
|
||||||
|
+ cmd_ret = NULL;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void mac_cmd_show_mac(struct major_cmd_ctrl *self)
|
||||||
|
+{
|
||||||
|
+ struct mac_cmd_port_hardware *hw = NULL;
|
||||||
|
+ struct hikp_cmd_ret *hw_cmd_ret = NULL;
|
||||||
|
+ int ret;
|
||||||
|
+
|
||||||
|
+ ret = mac_cmd_get_dfx_cfg(QUERY_PORT_HARDWARE, &hw_cmd_ret);
|
||||||
|
+ if (ret) {
|
||||||
|
+ snprintf(self->err_str, sizeof(self->err_str), "mac get hardware dfx failed.");
|
||||||
|
+ self->err_no = -ENOSPC;
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ hw = (struct mac_cmd_port_hardware *)(hw_cmd_ret->rsp_data);
|
||||||
|
+ if (hw->cmd_mac_type == CMD_MAC_TYPE_ROH || hw->cmd_mac_type == CMD_MAC_TYPE_UB)
|
||||||
|
+ mac_cmd_show_roh_mac(self);
|
||||||
|
+ else
|
||||||
|
+ mac_cmd_show_eth_mac(self);
|
||||||
|
+
|
||||||
|
+ free(hw_cmd_ret);
|
||||||
|
+ hw_cmd_ret = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void mac_cmd_disp_link_info(struct mac_cmd_link_dfx *link_dfx)
|
||||||
|
diff --git a/net/nic/nic_mac/hikp_nic_port.h b/net/nic/nic_mac/hikp_nic_port.h
|
||||||
|
index 78928b3..cb72ebc 100644
|
||||||
|
--- a/net/nic/nic_mac/hikp_nic_port.h
|
||||||
|
+++ b/net/nic/nic_mac/hikp_nic_port.h
|
||||||
|
@@ -107,6 +107,9 @@ struct mac_item {
|
||||||
|
struct mac_cmd_port_hardware {
|
||||||
|
uint8_t port_type;
|
||||||
|
uint8_t media_type;
|
||||||
|
+ uint8_t cmd_mac_type : 4,
|
||||||
|
+ rsv0 : 4;
|
||||||
|
+ uint8_t rsv1;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct mac_cmd_mac_dfx {
|
||||||
|
@@ -230,6 +233,28 @@ struct mac_cmd_port_dfx_cap {
|
||||||
|
uint32_t rsvd[3];
|
||||||
|
};
|
||||||
|
|
||||||
|
+enum cmd_mac_type {
|
||||||
|
+ CMD_MAC_TYPE_ETH = 0,
|
||||||
|
+ CMD_MAC_TYPE_ROH,
|
||||||
|
+ CMD_MAC_TYPE_UB,
|
||||||
|
+ CMD_MAC_TYPE_MAX,
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+struct mac_cmd_roh_mac_dfx {
|
||||||
|
+ uint8_t speed;
|
||||||
|
+ uint8_t fec;
|
||||||
|
+ uint8_t lanes;
|
||||||
|
+ uint8_t sds_rate;
|
||||||
|
+ uint8_t tx_link_lanes : 4,
|
||||||
|
+ rx_link_lanes : 4;
|
||||||
|
+ uint8_t pcs_link : 1,
|
||||||
|
+ mac_link : 1,
|
||||||
|
+ rsv0 : 6;
|
||||||
|
+ uint8_t rsv1[2];
|
||||||
|
+ uint32_t tx_retry_cnt;
|
||||||
|
+ uint32_t rsv2[4];
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
struct mac_cmd_dfx_callback {
|
||||||
|
uint32_t mask;
|
||||||
|
void (*show_dfx)(struct major_cmd_ctrl *self);
|
||||||
|
--
|
||||||
|
2.30.0
|
||||||
|
|
||||||
79
0059-hikptool-fix-cleancode-codecheck-alarm.patch
Normal file
79
0059-hikptool-fix-cleancode-codecheck-alarm.patch
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
From 84eb49f12133a4938805462940eaa2847492bdfb Mon Sep 17 00:00:00 2001
|
||||||
|
From: veega2022 <zhuweijia@huawei.com>
|
||||||
|
Date: Wed, 28 Feb 2024 11:23:59 +0800
|
||||||
|
Subject: [PATCH] hikptool: fix cleancode codecheck alarm
|
||||||
|
|
||||||
|
1. invalid case style for macro definition __HIKPTDEV_PLUG_H
|
||||||
|
fix it to HIKPTDEV_PLUG_H
|
||||||
|
|
||||||
|
2. Please do not mix signed and unsigned numbers
|
||||||
|
Modify the operator to ensure that the types on both sides are consistent.
|
||||||
|
|
||||||
|
Signed-off-by: veega2022 <zhuweijia@huawei.com>
|
||||||
|
---
|
||||||
|
libhikptdev/include/hikptdev_plug.h | 6 +++---
|
||||||
|
tool_lib/op_logs.c | 2 +-
|
||||||
|
tool_lib/tool_lib.c | 4 ++--
|
||||||
|
3 files changed, 6 insertions(+), 6 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/libhikptdev/include/hikptdev_plug.h b/libhikptdev/include/hikptdev_plug.h
|
||||||
|
index 34fd783..8b242d3 100644
|
||||||
|
--- a/libhikptdev/include/hikptdev_plug.h
|
||||||
|
+++ b/libhikptdev/include/hikptdev_plug.h
|
||||||
|
@@ -11,8 +11,8 @@
|
||||||
|
* See the Mulan PSL v2 for more details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
-#ifndef __HIKPTDEV_PLUG_H
|
||||||
|
-#define __HIKPTDEV_PLUG_H
|
||||||
|
+#ifndef HIKPTDEV_PLUG_H
|
||||||
|
+#define HIKPTDEV_PLUG_H
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
@@ -57,4 +57,4 @@ void hikp_dev_uninit(void);
|
||||||
|
int hikp_rsp_normal_check(const struct hikp_cmd_ret *cmd_ret);
|
||||||
|
int hikp_rsp_normal_check_with_version(const struct hikp_cmd_ret *cmd_ret, uint32_t version);
|
||||||
|
|
||||||
|
-#endif
|
||||||
|
+#endif /* HIKPTDEV_PLUG_H */
|
||||||
|
diff --git a/tool_lib/op_logs.c b/tool_lib/op_logs.c
|
||||||
|
index f57f5fd..9fb91d8 100644
|
||||||
|
--- a/tool_lib/op_logs.c
|
||||||
|
+++ b/tool_lib/op_logs.c
|
||||||
|
@@ -283,7 +283,7 @@ void op_log_record_input(const int argc, const char **argv)
|
||||||
|
arg = input_str;
|
||||||
|
for (i = 0; i < argc; i++) {
|
||||||
|
ret = snprintf(arg, (sizeof(input_str) - (arg - input_str)), "%s ", argv[i]);
|
||||||
|
- if (ret < 0 || ret >= (sizeof(input_str) - (arg - input_str)))
|
||||||
|
+ if (ret < 0 || ret >= (int)(sizeof(input_str) - (arg - input_str)))
|
||||||
|
return;
|
||||||
|
|
||||||
|
arg = arg + strlen(argv[i]) + 1;
|
||||||
|
diff --git a/tool_lib/tool_lib.c b/tool_lib/tool_lib.c
|
||||||
|
index 180418f..5c1a02d 100644
|
||||||
|
--- a/tool_lib/tool_lib.c
|
||||||
|
+++ b/tool_lib/tool_lib.c
|
||||||
|
@@ -281,9 +281,9 @@ static int get_rand_str(char *str, int length)
|
||||||
|
[TYPE_LOWERCASE] = {'a', 26},
|
||||||
|
};
|
||||||
|
uint32_t r[RANDOM_NUM];
|
||||||
|
+ uint32_t type;
|
||||||
|
int fd, size;
|
||||||
|
int i, j;
|
||||||
|
- int type;
|
||||||
|
|
||||||
|
fd = open("/dev/urandom", O_RDONLY);
|
||||||
|
if (fd < 0) {
|
||||||
|
@@ -325,7 +325,7 @@ int generate_file_name(unsigned char *file_name,
|
||||||
|
ret = snprintf((char *)file_name, file_name_len, "%s_%d_%d_%d_%d_%d_%d_%s.log", prefix,
|
||||||
|
timeinfo.tm_year + START_YEAR, timeinfo.tm_mon + 1, timeinfo.tm_mday,
|
||||||
|
timeinfo.tm_hour, timeinfo.tm_min, timeinfo.tm_sec, str_r);
|
||||||
|
- if (ret < 0 || ret >= file_name_len) {
|
||||||
|
+ if (ret < 0 || (uint32_t)ret >= file_name_len) {
|
||||||
|
HIKP_ERROR_PRINT("generate file name failed, errno is %d\n", errno);
|
||||||
|
return -errno;
|
||||||
|
}
|
||||||
|
--
|
||||||
|
2.30.0
|
||||||
|
|
||||||
32
0060-hikptool-Delete-meaningless-printing.patch
Normal file
32
0060-hikptool-Delete-meaningless-printing.patch
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
From c28e333b43508b4037cba59a6ce8bb3912f63939 Mon Sep 17 00:00:00 2001
|
||||||
|
From: veega2022 <zhuweijia@huawei.com>
|
||||||
|
Date: Mon, 18 Mar 2024 17:36:40 +0800
|
||||||
|
Subject: [PATCH] hikptool: Delete meaningless printing
|
||||||
|
|
||||||
|
The revision IDs of different chips may be different.
|
||||||
|
Therefore, the print of revision ID mismatch is deleted.
|
||||||
|
It is normal that the revision IDs are different.
|
||||||
|
|
||||||
|
Signed-off-by: veega2022 <zhuweijia@huawei.com>
|
||||||
|
---
|
||||||
|
libhikptdev/src/rciep/hikpt_rciep.c | 4 ++--
|
||||||
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/libhikptdev/src/rciep/hikpt_rciep.c b/libhikptdev/src/rciep/hikpt_rciep.c
|
||||||
|
index f673dd0..75ec224 100644
|
||||||
|
--- a/libhikptdev/src/rciep/hikpt_rciep.c
|
||||||
|
+++ b/libhikptdev/src/rciep/hikpt_rciep.c
|
||||||
|
@@ -366,8 +366,8 @@ static int hikp_iep_check(const char *tmp_vendor_dir,
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
ret = hikp_iep_check_item(revision_dir, MAX_PCI_REVISION_LEN, HIKP_IEP_REVISION);
|
||||||
|
- if (ret != 0)
|
||||||
|
- printf("Revision id not match %s.\n", HIKP_IEP_REVISION);
|
||||||
|
+ if (ret != 0 && ret != -ENXIO)
|
||||||
|
+ return ret;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
--
|
||||||
|
2.30.0
|
||||||
|
|
||||||
28
0061-hikptool-Update-the-tool-version-number-to-1.1.1.patch
Normal file
28
0061-hikptool-Update-the-tool-version-number-to-1.1.1.patch
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
From 1354eaf629ac399a4f0789a0cdc460a4293ec905 Mon Sep 17 00:00:00 2001
|
||||||
|
From: veega2022 <zhuweijia@huawei.com>
|
||||||
|
Date: Tue, 23 Apr 2024 21:45:02 +0800
|
||||||
|
Subject: [PATCH] hikptool: Update the tool version number to 1.1.1
|
||||||
|
|
||||||
|
Update the tool version number to 1.1.1
|
||||||
|
|
||||||
|
Signed-off-by: veega2022 <zhuweijia@huawei.com>
|
||||||
|
---
|
||||||
|
tool_lib/tool_lib.h | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/tool_lib/tool_lib.h b/tool_lib/tool_lib.h
|
||||||
|
index 14b3db5..72a99c6 100644
|
||||||
|
--- a/tool_lib/tool_lib.h
|
||||||
|
+++ b/tool_lib/tool_lib.h
|
||||||
|
@@ -18,7 +18,7 @@
|
||||||
|
|
||||||
|
#define TOOL_NAME "hikptool"
|
||||||
|
|
||||||
|
-#define TOOL_VER "1.1.0"
|
||||||
|
+#define TOOL_VER "1.1.1"
|
||||||
|
|
||||||
|
#define HI_GET_BITFIELD(value, start, mask) (((value) >> (start)) & (mask))
|
||||||
|
#define HI_SET_FIELD(origin, shift, val) ((origin) |= (val) << (shift))
|
||||||
|
--
|
||||||
|
2.42.0.windows.2
|
||||||
|
|
||||||
@ -0,0 +1,44 @@
|
|||||||
|
From 87b58805e41ccb47c313266e76219d9b0bb5f05e Mon Sep 17 00:00:00 2001
|
||||||
|
From: moubingquan <moubingquan@huawei.com>
|
||||||
|
Date: Mon, 20 May 2024 14:13:24 +0800
|
||||||
|
Subject: [PATCH] hikptool: The ecam register is added to the PCIe dumpreg.
|
||||||
|
|
||||||
|
The ecam register is added to facilitate fault locating.
|
||||||
|
|
||||||
|
Updated the tool version to 1.1.2.
|
||||||
|
|
||||||
|
Signed-off-by: moubingquan <moubingquan@huawei.com>
|
||||||
|
---
|
||||||
|
pcie/func_lib/pcie_func/pcie_reg_dump.c | 2 ++
|
||||||
|
tool_lib/tool_lib.h | 2 +-
|
||||||
|
2 files changed, 3 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/pcie/func_lib/pcie_func/pcie_reg_dump.c b/pcie/func_lib/pcie_func/pcie_reg_dump.c
|
||||||
|
index b8c2241..535807c 100644
|
||||||
|
--- a/pcie/func_lib/pcie_func/pcie_reg_dump.c
|
||||||
|
+++ b/pcie/func_lib/pcie_func/pcie_reg_dump.c
|
||||||
|
@@ -144,6 +144,8 @@ struct pcie_dumpreg_info g_reg_table_pcs[] = {
|
||||||
|
};
|
||||||
|
|
||||||
|
struct pcie_dumpreg_info g_reg_table_iob_tx[] = {
|
||||||
|
+ {0, "IOB_TX_ECAM_CONTROL0"},
|
||||||
|
+ {0, "IOB_TX_ECAM_CONTROL1"},
|
||||||
|
{0, "IOB_TX_ECAM_BASE_ADDR_L"},
|
||||||
|
{0, "IOB_TX_ECAM_BASE_ADDR_H"},
|
||||||
|
{0, "IOB_TX_CXL_BASE_BUS_0"},
|
||||||
|
diff --git a/tool_lib/tool_lib.h b/tool_lib/tool_lib.h
|
||||||
|
index 72a99c6..644a08e 100644
|
||||||
|
--- a/tool_lib/tool_lib.h
|
||||||
|
+++ b/tool_lib/tool_lib.h
|
||||||
|
@@ -18,7 +18,7 @@
|
||||||
|
|
||||||
|
#define TOOL_NAME "hikptool"
|
||||||
|
|
||||||
|
-#define TOOL_VER "1.1.1"
|
||||||
|
+#define TOOL_VER "1.1.2"
|
||||||
|
|
||||||
|
#define HI_GET_BITFIELD(value, start, mask) (((value) >> (start)) & (mask))
|
||||||
|
#define HI_SET_FIELD(origin, shift, val) ((origin) |= (val) << (shift))
|
||||||
|
--
|
||||||
|
2.45.0.windows.1
|
||||||
|
|
||||||
@ -1,7 +1,9 @@
|
|||||||
|
%global debug_package %{nil}
|
||||||
|
|
||||||
Name: hikptool
|
Name: hikptool
|
||||||
Summary: A userspace tool for Linux providing problem location on Kunpeng chips
|
Summary: A userspace tool for Linux providing problem location on Kunpeng chips
|
||||||
Version: 1.0.0
|
Version: 1.0.0
|
||||||
Release: 9
|
Release: 15
|
||||||
License: MulanPSL2
|
License: MulanPSL2
|
||||||
Source: %{name}-%{version}.tar.gz
|
Source: %{name}-%{version}.tar.gz
|
||||||
ExclusiveOS: linux
|
ExclusiveOS: linux
|
||||||
@ -18,6 +20,64 @@ Patch0001: 0001-socip-Return-EINVAL-when-the-parameter-check-fails.patch
|
|||||||
Patch0002: 0002-fix-compiler-security-option-problem.patch
|
Patch0002: 0002-fix-compiler-security-option-problem.patch
|
||||||
Patch0003: 0003-fix-the-security-compilation-PIE-issue.patch
|
Patch0003: 0003-fix-the-security-compilation-PIE-issue.patch
|
||||||
Patch0004: 0004-hikptool-fix-print-sas_dev-info-error-problem.patch
|
Patch0004: 0004-hikptool-fix-print-sas_dev-info-error-problem.patch
|
||||||
|
Patch0005: 0005-fix-hikptool-rciep-rsp-filed-error-problem.patch
|
||||||
|
Patch0006: 0006-fix-pcie_info-cmd-print-display-problem.patch
|
||||||
|
Patch0007: 0007-fix-signal-proc-func-api-modified-to-be-open-to-the-.patch
|
||||||
|
Patch0008: 0008-delete-pcie-AP_INT-module-for-dump-reg.patch
|
||||||
|
Patch0009: 0009-fix-serdes-module-dump-reg-num-is-not-enough-problem.patch
|
||||||
|
Patch0010: 0010-fix-the-number-of-PCS-lane-registers-in-the-PCIe-dum.patch
|
||||||
|
Patch0011: 0011-optimize-the-nic_mac-dump-register.patch
|
||||||
|
Patch0012: 0012-Fix-a-resource-release-bug-in-hikp_roh_get_cam_reg_n.patch
|
||||||
|
Patch0013: 0013-fix-missing-white-space-issue.patch
|
||||||
|
Patch0014: 0014-hikptool-fix-maininfo-detail-info-print-error.patch
|
||||||
|
Patch0015: 0015-hikptool-fix-print-sas_dqe-info-error-problem.patch
|
||||||
|
Patch0016: 0016-hikptool-fix-compiling-specifications-check-problem.patch
|
||||||
|
Patch0017: 0017-Complete-the-developing-of-hikptool-ub_dfx-function.patch
|
||||||
|
Patch0018: 0018-Complete-the-developing-of-hikptool-ub_link-function.patch
|
||||||
|
Patch0019: 0019-Complete-the-developing-of-hikptool-ub_bp-function.patch
|
||||||
|
Patch0020: 0020-Complete-the-developing-of-hikptool-ub_crd-function.patch
|
||||||
|
Patch0021: 0021-Complete-the-developing-of-hikptool-ub_info-function.patch
|
||||||
|
Patch0022: 0022-add-support-query-ip-guid-entries.patch
|
||||||
|
Patch0023: 0023-hikptool-delete-redundant-copyright-notices.patch
|
||||||
|
Patch0024: 0024-hikptool-add-pm-trace.patch
|
||||||
|
Patch0025: 0025-hikptool-add-The-security-compilation-options.patch
|
||||||
|
Patch0026: 0026-hikptool-nic_port-cmd-add-print-arb-info-and-phy-inf.patch
|
||||||
|
Patch0027: 0027-hikptool-add-pcie-new-dump.patch
|
||||||
|
Patch0028: 0028-hikptool-add-show-CDR-DFX-info-in-nic_port-cmd.patch
|
||||||
|
Patch0029: 0029-hikptool-add-new-cmd-support-query-ncsi-dfx-info.patch
|
||||||
|
Patch0030: 0030-hikptool-Don-t-show-gen5.patch
|
||||||
|
Patch0031: 0031-hikptool-RDMA-Fix-the-missing-bank-ID-in-roce_trp-GE.patch
|
||||||
|
Patch0032: 0032-hikptool-fix-the-memory-leak-risk-problem.patch
|
||||||
|
Patch0033: 0033-hikptool-add-new-cmd-support-query-fault-notify-pkt-.patch
|
||||||
|
Patch0034: 0034-hikptool-add-new-cmd-to-support-query-port-fault-inf.patch
|
||||||
|
Patch0035: 0035-hikptool-support-to-query-pfc-storm-parameters.patch
|
||||||
|
Patch0036: 0036-hikptool-add-sub-cmd-nic_torus-support.patch
|
||||||
|
Patch0037: 0037-hikptool-optimized-display-the-hot-plug-card-info-in.patch
|
||||||
|
Patch0038: 0038-hikptool-Update-the-tool-version-number-to-1.1.0.patch
|
||||||
|
Patch0039: 0039-hikptool-roce-Add-a-common-frame-for-hikptool-roce-r.patch
|
||||||
|
Patch0040: 0040-hikptool-roce-Add-roce_rst-cmd-for-reset-signal-regi.patch
|
||||||
|
Patch0041: 0041-hikptool-roce-Add-roce_global_cfg-cmd-for-global-con.patch
|
||||||
|
Patch0042: 0042-hikptool-roce-Add-roce_bond-cmd-for-bond-registers-q.patch
|
||||||
|
Patch0043: 0043-hikptool-roce-Add-ext-query-for-roce_caep-cmd.patch
|
||||||
|
Patch0044: 0044-hikptool-roce-Add-ext-query-for-roce_mdb-cmd.patch
|
||||||
|
Patch0045: 0045-hikptool-roce-Add-ext-query-for-roce_qmm-cmd.patch
|
||||||
|
Patch0046: 0046-hikptool-Querying-the-SerDes-Relationship-of-the-PCI.patch
|
||||||
|
Patch0047: 0047-hikptool-Remove-the-function-of-querying-SAS-device-.patch
|
||||||
|
Patch0048: 0048-hikptool-roce-Use-calloc-to-alloc-memory-for-array-i.patch
|
||||||
|
Patch0049: 0049-hikptool-roce-Fix-missing-check-of-reg-num-responsed.patch
|
||||||
|
Patch0050: 0050-hikptool-Change-the-unic_ppp-directory-to-ub_ppp.patch
|
||||||
|
Patch0051: 0051-hikptool-roce-Fix-the-wrong-maximum-of-gmv-index.patch
|
||||||
|
Patch0052: 0052-hikptool-Resolved-some-centralized-code-review-comme.patch
|
||||||
|
Patch0053: 0053-hikptool-roce-Fix-the-infinite-loop-due-to-compatibi.patch
|
||||||
|
Patch0054: 0054-hikptool-roh-fix-the-display-information-for-roh-mac.patch
|
||||||
|
Patch0055: 0055-hikptool-augument-serdes-relationship-of-the-PCIe.patch
|
||||||
|
Patch0056: 0056-hikptool-Supported-parsing-the-optical-module-that-u.patch
|
||||||
|
Patch0057: 0057-hikptool-Fixed-an-issue-where-the-MAC-type-is-incorr.patch
|
||||||
|
Patch0058: 0058-hikptool-The-nic_port-command-is-adapted-to-display-.patch
|
||||||
|
Patch0059: 0059-hikptool-fix-cleancode-codecheck-alarm.patch
|
||||||
|
Patch0060: 0060-hikptool-Delete-meaningless-printing.patch
|
||||||
|
Patch0061: 0061-hikptool-Update-the-tool-version-number-to-1.1.1.patch
|
||||||
|
Patch0062: 0062-hikptool-The-ecam-register-is-added-to-the-PCIe-dump.patch
|
||||||
|
|
||||||
%description
|
%description
|
||||||
This package contains the hikptool
|
This package contains the hikptool
|
||||||
@ -70,6 +130,24 @@ fi
|
|||||||
/sbin/ldconfig
|
/sbin/ldconfig
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu May 23 2024 veega2022 <zhuweijia@huawei.com> 1.0.0-15
|
||||||
|
- Synchronize code, the DFX register of the ECAM is added when the PCIe dumps registers
|
||||||
|
|
||||||
|
* Wed Apr 24 2024 veega2022 <zhuweijia@huawei.com> 1.0.0-14
|
||||||
|
- Synchronize code, fix some issues with ROH, PCIE and NIC modules
|
||||||
|
|
||||||
|
* Thu Nov 16 2023 veega2022 <zhuweijia@huawei.com> 1.0.0-13
|
||||||
|
- Synchronize the code and add the DFX of the roce module to resolve some review comments
|
||||||
|
|
||||||
|
* Fri Oct 20 2023 veega2022 <zhuweijia@huawei.com> 1.0.0-12
|
||||||
|
- Added DFX for UB, NIC, MAC modules, fixed some bugs
|
||||||
|
|
||||||
|
* Sat Jun 03 2023 veega2022 <zhuweijia@huawei.com> 1.0.0-11
|
||||||
|
- fix compiling specifications check problem
|
||||||
|
|
||||||
|
* Tue May 30 2023 veega2022 <zhuweijia@huawei.com> 1.0.0-10
|
||||||
|
- sync code: fix PCIe and serdes, roh module problem
|
||||||
|
|
||||||
* Thu Apr 06 2023 veega2022 <zhuweijia@huawei.com> 1.0.0-9
|
* Thu Apr 06 2023 veega2022 <zhuweijia@huawei.com> 1.0.0-9
|
||||||
- fix sas device info print error bug
|
- fix sas device info print error bug
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user