Synchronize the code and add the DFX of the roce module to resolve some review comments Add roce_rst, roce_global_cfg, roce_bond cmd Signed-off-by: veega2022 <zhuweijia@huawei.com>
180 lines
6.0 KiB
Diff
180 lines
6.0 KiB
Diff
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
|
|
|