From 513a68f332d9a40b3ee800d85bba335dacc22212 Mon Sep 17 00:00:00 2001
From: Xingui Yang <yangxingui@huawei.com>
Date: Tue, 27 Aug 2024 11:02:55 +0800
Subject: [PATCH] hikptool: Support for info collect

Add the option of information collection and used to collect
full information from each module, such as imp, serdes, pcie
sas, sata, nic, roce, acc, socip, as follow.
1. Help for collect info, e.g. hikptool info_collect -h/--help
2. Collect imp info, e.g. hikptool info_collect -/--imp
3. Collect all info, e.g. hikptool info_collect -/--all

Signed-off-by: Xingui Yang <yangxingui@huawei.com>
---
 CMakeLists.txt                                |   1 +
 info_collect/hikp_collect.h                   |  53 ++
 info_collect/hikp_collect_acc.c               | 237 ++++++++
 info_collect/hikp_collect_common.c            | 258 +++++++++
 info_collect/hikp_collect_imp.c               | 133 +++++
 info_collect/hikp_collect_lib.c               | 508 ++++++++++++++++++
 info_collect/hikp_collect_lib.h               |  61 +++
 info_collect/hikp_collect_main.c              | 274 ++++++++++
 info_collect/hikp_collect_nic.c               | 368 +++++++++++++
 info_collect/hikp_collect_pcie.c              | 215 ++++++++
 info_collect/hikp_collect_roce.c              | 489 +++++++++++++++++
 info_collect/hikp_collect_sas.c               | 453 ++++++++++++++++
 info_collect/hikp_collect_serdes.c            | 244 +++++++++
 info_collect/hikp_collect_socip.c             | 272 ++++++++++
 info_collect/hikp_collect_socip.h             | 238 ++++++++
 net/nic/nic_dfx/hikp_nic_dfx.c                |  11 +-
 net/nic/nic_dfx/hikp_nic_dfx.h                |   3 +
 net/nic/nic_fd/hikp_nic_fd.c                  |  11 +-
 net/nic/nic_fd/hikp_nic_fd.h                  |   4 +
 net/nic/nic_fec/hikp_nic_fec.c                |   4 +-
 net/nic/nic_fec/hikp_nic_fec.h                |   2 +
 net/nic/nic_ft/hikp_nic_port_fault.c          |   4 +-
 net/nic/nic_ft/hikp_nic_port_fault.h          |   2 +
 net/nic/nic_gro/hikp_nic_gro.c                |   4 +-
 net/nic/nic_gro/hikp_nic_gro.h                |   2 +
 net/nic/nic_info/hikp_nic_info.c              |   4 +-
 net/nic/nic_info/hikp_nic_info.h              |   2 +
 net/nic/nic_log/hikp_nic_log.c                |  39 +-
 net/nic/nic_log/hikp_nic_log.h                |   7 +
 net/nic/nic_mac/hikp_nic_mac_dump.c           |  28 +-
 net/nic/nic_mac/hikp_nic_mac_dump.h           |  11 +
 net/nic/nic_mac/hikp_nic_port.c               |  18 +
 net/nic/nic_mac/hikp_nic_port.h               |   6 +
 net/nic/nic_mac/hikp_nic_xsfp.c               |  23 +
 net/nic/nic_mac/hikp_nic_xsfp.h               |   6 +
 net/nic/nic_ncsi/hikp_nic_ncsi.c              |  18 +
 net/nic/nic_ncsi/hikp_nic_ncsi.h              |   6 +
 net/nic/nic_notify_pkt/hikp_nic_notify_pkt.c  |   4 +-
 net/nic/nic_notify_pkt/hikp_nic_notify_pkt.h  |   2 +
 net/nic/nic_ppp/hikp_nic_ppp.c                |  11 +-
 net/nic/nic_ppp/hikp_nic_ppp.h                |   3 +
 net/nic/nic_qos/hikp_nic_qos.c                |  22 +-
 net/nic/nic_qos/hikp_nic_qos.h                |  10 +-
 net/nic/nic_queue/hikp_nic_queue.c            |  12 +-
 net/nic/nic_queue/hikp_nic_queue.h            |   4 +
 net/nic/nic_rss/hikp_nic_rss.c                |   9 +-
 net/nic/nic_rss/hikp_nic_rss.h                |   3 +
 net/nic/nic_torus/hikp_nic_torus.c            |   4 +-
 net/nic/nic_torus/hikp_nic_torus.h            |   2 +
 net/roce/roce_bond/hikp_roce_bond.c           |   8 +-
 net/roce/roce_bond/hikp_roce_bond.h           |   3 +
 net/roce/roce_caep/hikp_roce_caep.c           |  13 +-
 net/roce/roce_caep/hikp_roce_caep.h           |   4 +
 .../roce_global_cfg/hikp_roce_global_cfg.c    |   8 +-
 .../roce_global_cfg/hikp_roce_global_cfg.h    |   3 +
 net/roce/roce_gmv/hikp_roce_gmv.c             |  13 +-
 net/roce/roce_gmv/hikp_roce_gmv.h             |   4 +
 net/roce/roce_mdb/hikp_roce_mdb.c             |  13 +-
 net/roce/roce_mdb/hikp_roce_mdb.h             |   5 +
 net/roce/roce_pkt/hikp_roce_pkt.c             |   8 +-
 net/roce/roce_pkt/hikp_roce_pkt.h             |   3 +
 net/roce/roce_qmm/hikp_roce_qmm.c             |  18 +-
 net/roce/roce_qmm/hikp_roce_qmm.h             |   5 +
 net/roce/roce_rst/hikp_roce_rst.c             |   8 +-
 net/roce/roce_rst/hikp_roce_rst.h             |   3 +
 net/roce/roce_scc/hikp_roce_scc.c             |  19 +-
 net/roce/roce_scc/hikp_roce_scc.h             |   6 +-
 net/roce/roce_timer/hikp_roce_timer.c         |   8 +-
 net/roce/roce_timer/hikp_roce_timer.h         |   3 +
 net/roce/roce_trp/hikp_roce_trp.c             |  24 +-
 net/roce/roce_trp/hikp_roce_trp.h             |   7 +-
 net/roce/roce_tsp/hikp_roce_tsp.c             |  28 +-
 net/roce/roce_tsp/hikp_roce_tsp.h             |   7 +-
 pcie/func_lib/pcie_func/pcie_link_ltssm.c     |   2 +-
 pcie/func_lib/pcie_func/pcie_link_ltssm.h     |   1 +
 pcie/func_lib/pcie_func/pcie_reg_dump.c       |   7 +-
 pcie/func_lib/pcie_func/pcie_reg_dump.h       |   4 +
 pcie/func_lib/pcie_func/pcie_statistics.c     |   2 +-
 pcie/func_lib/pcie_func/pcie_statistics.h     |   2 +
 sas/sas_func/sas_common.h                     |   2 +-
 serdes/hikp_serdes.c                          | 215 ++++----
 serdes/hikp_serdes.h                          |   4 +-
 socip/hikp_socip.h                            |   1 +
 socip/hikp_socip_dumpreg.c                    |   2 +-
 tool_lib/tool_lib.c                           |  40 ++
 tool_lib/tool_lib.h                           |  16 +
 86 files changed, 4434 insertions(+), 190 deletions(-)
 create mode 100644 info_collect/hikp_collect.h
 create mode 100644 info_collect/hikp_collect_acc.c
 create mode 100644 info_collect/hikp_collect_common.c
 create mode 100644 info_collect/hikp_collect_imp.c
 create mode 100644 info_collect/hikp_collect_lib.c
 create mode 100644 info_collect/hikp_collect_lib.h
 create mode 100644 info_collect/hikp_collect_main.c
 create mode 100644 info_collect/hikp_collect_nic.c
 create mode 100644 info_collect/hikp_collect_pcie.c
 create mode 100644 info_collect/hikp_collect_roce.c
 create mode 100644 info_collect/hikp_collect_sas.c
 create mode 100644 info_collect/hikp_collect_serdes.c
 create mode 100644 info_collect/hikp_collect_socip.c
 create mode 100644 info_collect/hikp_collect_socip.h

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4fb82ca..f28a870 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -38,6 +38,7 @@ file(GLOB_RECURSE HIKPTOOL_SRC
 	${CMAKE_CURRENT_SOURCE_DIR}/serdes/*.c
 	${CMAKE_CURRENT_SOURCE_DIR}/socip/*.c
 	${CMAKE_CURRENT_SOURCE_DIR}/tool_lib/*.c
+	${CMAKE_CURRENT_SOURCE_DIR}/info_collect/*.c
 	${CMAKE_CURRENT_SOURCE_DIR}/hikp_init_main.c
 	)
 
diff --git a/info_collect/hikp_collect.h b/info_collect/hikp_collect.h
new file mode 100644
index 0000000..28aa5a4
--- /dev/null
+++ b/info_collect/hikp_collect.h
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2024 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_COLLECT_H
+#define HIKP_COLLECT_H
+
+#define GROUP_SAS "sas"
+#define GROUP_SATA "sata"
+#define GROUP_ACC "acc"
+#define GROUP_SOCIP "socip"
+#define GROUP_NIC "nic"
+#define GROUP_ROCE "roce"
+#define GROUP_PCIE "pcie"
+#define GROUP_IMP "imp"
+#define GROUP_COMMON "common"
+#define GROUP_SERDES "serdes"
+
+enum info_collect_type {
+	COLLECT_ACC,
+	COLLECT_IMP,
+	COLLECT_NIC,
+	COLLECT_PCIE,
+	COLLECT_ROCE,
+	COLLECT_SAS,
+	COLLECT_SATA,
+	COLLECT_SERDES,
+	COLLECT_SOCIP,
+	COLLECT_ALL,
+	COLLECT_UNKNOWN_TYPE,
+};
+
+void collect_sas_log(void);
+void collect_sata_log(void);
+void collect_acc_log(void);
+void collect_socip_log(void);
+void collect_common_log(void);
+void collect_nic_log(void);
+void collect_roce_log(void);
+void collect_pcie_info(void);
+void collect_imp_log(void);
+void collect_serdes_log(void);
+
+#endif /* HIKP_COLLECT_H */
diff --git a/info_collect/hikp_collect_acc.c b/info_collect/hikp_collect_acc.c
new file mode 100644
index 0000000..e0f3918
--- /dev/null
+++ b/info_collect/hikp_collect_acc.c
@@ -0,0 +1,237 @@
+/*
+ * Copyright (c) 2024 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 <dirent.h>
+#include <unistd.h>
+
+#include "hikp_collect_lib.h"
+#include "hikp_collect.h"
+#include "tool_lib.h"
+
+struct info_collect_cmd acc_cmd_arr[] = {
+	{
+		.group = GROUP_ACC,
+		.log_name = "uadk_version",
+		.args = {"uadk_tool", "dfx", "--version", NULL},
+	},
+	{
+		.group = GROUP_ACC,
+		.log_name = "openssl_version",
+		.args = {"openssl", "version", NULL},
+	},
+	{
+		.group = GROUP_ACC,
+		.log_name = "openssl3_version",
+		.args = {"openssl3", "version", NULL},
+	},
+	{
+		.group = GROUP_ACC,
+		.log_name = "qemu_version",
+		.args = {"qemu-system-aarch64", "-version", NULL},
+	},
+};
+
+struct info_collect_cmd acc_cmd_copy[] = {
+	{
+		.group = GROUP_ACC,
+		.log_name = "uadk",
+		.args = {"cp", "-rf", "/var/log/uadk.log", NULL},
+	},
+	{
+		.group = GROUP_ACC,
+		.log_name = "acc_sec",
+		.args = {"cp", "-rf", "/sys/kernel/debug/hisi_sec2/", NULL},
+	},
+	{
+		.group = GROUP_ACC,
+		.log_name = "acc_sec",
+		.args = {"cp", "-rf", "/sys/module/hisi_sec2/parameters/", NULL},
+	},
+	{
+		.group = GROUP_ACC,
+		.log_name = "acc_hpre",
+		.args = {"cp", "-rf", "/sys/kernel/debug/hisi_hpre/", NULL},
+	},
+	{
+		.group = GROUP_ACC,
+		.log_name = "acc_hpre",
+		.args = {"cp", "-rf", "/sys/module/hisi_hpre/parameters/", NULL},
+	},
+	{
+		.group = GROUP_ACC,
+		.log_name = "acc_zip",
+		.args = {"cp", "-rf", "/sys/kernel/debug/hisi_zip/", NULL},
+	},
+	{
+		.group = GROUP_ACC,
+		.log_name = "acc_zip",
+		.args = {"cp", "-rf", "/sys/module/hisi_zip/parameters/", NULL},
+	},
+	{
+		.group = GROUP_ACC,
+		.log_name = "acc_trng",
+		.args = {"cp", "-rf", "/sys/module/hisi_trng_v2/parameters/", NULL},
+	},
+};
+
+struct info_collect_cmd acc_copy_link[] = {
+	{
+		.group = GROUP_ACC,
+		.log_name = "uacce",
+		.args = {"cp", "-rf", "/sys/class/uacce", NULL},
+	}
+};
+
+static int acc_cmd_mkdir(char *root_path, char *src_patch)
+{
+	char dir_path[LOG_FILE_PATH_MAX_LEN] = {0};
+	int ret;
+
+	/* mkdir for log sub source */
+	ret = snprintf(dir_path, LOG_FILE_PATH_MAX_LEN, "%s/%s",
+				   root_path, src_patch);
+	if (ret < 0 || (uint32_t)(ret) >= LOG_FILE_PATH_MAX_LEN) {
+		HIKP_ERROR_PRINT("create dir path failed: %d\n", ret);
+		return -EINVAL;
+	}
+
+	ret = tool_mk_dir((const char *)dir_path);
+	if (ret)
+		return ret;
+
+	return 0;
+}
+
+static int acc_collect_file(struct info_collect_cmd *acc_cmd, char *root_path, char *dev_path)
+{
+	char sub_src_path[LOG_FILE_PATH_MAX_LEN] = {0};
+	char save_path[LOG_FILE_PATH_MAX_LEN] = {0};
+	struct info_collect_cmd tmp_cmd = {0};
+	char *source_path = acc_cmd->args[ARGS_IDX2];
+	char *sub_group = acc_cmd->log_name;
+	int ret;
+
+	ret = snprintf(sub_src_path, LOG_FILE_PATH_MAX_LEN, "%s/%s/",
+				   source_path, dev_path);
+	if (ret < 0 || (uint32_t)(ret) >= LOG_FILE_PATH_MAX_LEN) {
+		HIKP_ERROR_PRINT("create sub source path failed: %d\n", ret);
+		return -EINVAL;
+	}
+	if (access(sub_src_path, F_OK) != 0) {
+		HIKP_ERROR_PRINT("Can't access sub source path: %s\n", sub_src_path);
+		return -ENOENT;
+	}
+
+	ret = snprintf(save_path, LOG_FILE_PATH_MAX_LEN, "%s/%s/%s/",
+				   root_path, sub_group, dev_path);
+	if (ret < 0 || (uint32_t)(ret) >= LOG_FILE_PATH_MAX_LEN) {
+		HIKP_ERROR_PRINT("create save path failed: %d\n", ret);
+		return -EINVAL;
+	}
+
+	tmp_cmd.group = acc_cmd->group;
+	tmp_cmd.log_name = acc_cmd->log_name;
+	tmp_cmd.args[ARGS_IDX0] = acc_cmd->args[ARGS_IDX0];
+	tmp_cmd.args[ARGS_IDX1] = acc_cmd->args[ARGS_IDX1];
+	tmp_cmd.args[ARGS_IDX2] = sub_src_path;
+	tmp_cmd.args[ARGS_IDX3] = save_path;
+	tmp_cmd.args[ARGS_IDX4] = NULL;
+
+	ret = hikp_collect_exec((void *)&tmp_cmd);
+	if (ret)
+		return ret;
+
+	return 0;
+}
+
+static int acc_save_link_files(struct info_collect_cmd *link_cmd)
+{
+	char root_path[LOG_FILE_PATH_MAX_LEN] = {0};
+	char *source_path = link_cmd->args[ARGS_IDX2];
+	char *sub_group = link_cmd->log_name;
+	struct dirent *dev_dir;
+	DIR *link_dir;
+	int ret;
+
+	if (strcmp(link_cmd->args[ARGS_IDX0], "cp") != 0) {
+		HIKP_ERROR_PRINT("input cmd failed: %s.\n", link_cmd->args[ARGS_IDX0]);
+		return -EINVAL;
+	}
+
+	ret = hikp_get_file_path(root_path, LOG_FILE_PATH_MAX_LEN, link_cmd->group);
+	if (ret < 0) {
+		HIKP_ERROR_PRINT("get save path fail: %d\n", ret);
+		return ret;
+	}
+
+	if (source_path == NULL || access(source_path, F_OK) != 0) {
+		HIKP_ERROR_PRINT("Can't access source path: %s\n", source_path);
+		return -ENOENT;
+	}
+
+	ret = acc_cmd_mkdir(root_path, sub_group);
+	if (ret)
+		return ret;
+
+	link_dir = opendir(source_path);
+	if (!link_dir) {
+		HIKP_ERROR_PRINT("input source file dir is error!\n");
+		return -ENOENT;
+	}
+
+	/* 1 is sizeof ".", 2 is sizeof ".." */
+	while ((dev_dir = readdir(link_dir)) != NULL) {
+		if (!strncmp(dev_dir->d_name, ".", 1) ||
+		    !strncmp(dev_dir->d_name, "..", sizeof("..")))
+			continue;
+
+		ret = acc_collect_file(link_cmd, root_path, dev_dir->d_name);
+		if (ret)
+			goto free_dir;
+	}
+
+	closedir(link_dir);
+	return 0;
+
+free_dir:
+	closedir(link_dir);
+	return ret;
+}
+
+void collect_acc_log(void)
+{
+	int i, asize;
+	int ret;
+
+	asize = (int)HIKP_ARRAY_SIZE(acc_cmd_arr);
+	for (i = 0; i < asize; i++) {
+		ret = hikp_collect_log(acc_cmd_arr[i].group, acc_cmd_arr[i].log_name,
+							   hikp_collect_exec, (void *)&acc_cmd_arr[i]);
+		if (ret)
+			HIKP_ERROR_PRINT("collect_acc_log arr failed: %d\n", ret);
+	}
+
+	asize = (int)HIKP_ARRAY_SIZE(acc_copy_link);
+	for (i = 0; i < asize; i++) {
+		ret = acc_save_link_files(&acc_copy_link[i]);
+		if (ret)
+			HIKP_ERROR_PRINT("collect_acc_log link copy failed: %d\n", ret);
+	}
+
+	asize = (int)HIKP_ARRAY_SIZE(acc_cmd_copy);
+	for (i = 0; i < asize; i++) {
+		ret = hikp_save_files(&acc_cmd_copy[i]);
+		if (ret)
+			HIKP_ERROR_PRINT("collect_acc_log copy failed: %d\n", ret);
+	}
+}
diff --git a/info_collect/hikp_collect_common.c b/info_collect/hikp_collect_common.c
new file mode 100644
index 0000000..413aac1
--- /dev/null
+++ b/info_collect/hikp_collect_common.c
@@ -0,0 +1,258 @@
+/*
+ * Copyright (c) 2024 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_collect_lib.h"
+#include "hikp_collect.h"
+#include "tool_lib.h"
+
+static int software_version_exec(void *data)
+{
+	const struct info_collect_cmd software_version_cmds[] = {
+		{
+			.args = {"uname", "-a", NULL},
+		},
+		{
+			.log_name = "os-release",
+			.args = {"cat", "/etc/*release", NULL},
+		},
+		{
+			.log_name = "os-latest",
+			.args = {"cat", "/etc/*latest", NULL},
+		},
+	};
+	HIKP_SET_USED(data);
+	size_t i, size;
+	int ret;
+
+	size = HIKP_ARRAY_SIZE(software_version_cmds);
+	for (i = 0; i < size; i++) {
+		if (!strcmp(software_version_cmds[i].args[ARGS_IDX0], "cat"))
+			ret = hikp_collect_cat_glob_exec((void *)&software_version_cmds[i]);
+		else
+			ret = hikp_collect_exec((void *)&software_version_cmds[i]);
+
+		if (ret)
+			HIKP_ERROR_PRINT("collect software_version_cmds[%zu] log failed: %d\n",
+					 i, ret);
+	}
+
+	return 0;
+}
+
+static int mem_info_exec(void *data)
+{
+	const struct info_collect_cmd mem_info_cmds[] = {
+		{
+			.args = {"cat", "/proc/meminfo", NULL},
+		},
+		{
+			.args = {"free", "-m", NULL},
+		},
+		{
+			.args = {"vmstat", NULL},
+		},
+		{
+			.args = {"cat", "/proc/iomem", NULL},
+		},
+	};
+	HIKP_SET_USED(data);
+	size_t i, size;
+	int ret;
+
+	size = HIKP_ARRAY_SIZE(mem_info_cmds);
+	for (i = 0; i < size; i++) {
+		ret = hikp_collect_exec((void *)&mem_info_cmds[i]);
+		if (ret)
+			HIKP_ERROR_PRINT("collect mem_info_cmds[%zu] log failed: %d\n", i, ret);
+	}
+
+	return 0;
+}
+
+static int process_info_exec(void *data)
+{
+	const struct info_collect_cmd process_info_cmds[] = {
+		{
+			.args = {"ps", "euf", NULL},
+		},
+		{
+			.args = {"ps", "aux", NULL},
+		},
+		{
+			.args = {"top", "-bn", "1", NULL},
+		},
+		{
+			.args = {"mpstat", NULL},
+		},
+	};
+	HIKP_SET_USED(data);
+	size_t i, size;
+	int ret;
+
+	size = HIKP_ARRAY_SIZE(process_info_cmds);
+	for (i = 0; i < size; i++) {
+		ret = hikp_collect_exec((void *)&process_info_cmds[i]);
+		if (ret)
+			HIKP_ERROR_PRINT("collect process_info_cmds[%zu] log failed: %d\n",
+					 i, ret);
+	}
+
+	return 0;
+}
+
+static int config_info_exec(void *data)
+{
+	struct info_collect_cmd config_info_cmds[] = {
+		{
+			.args = {"cat", "/proc/cmdline", NULL},
+		},
+		{
+			.args = {"getconf", "PAGE_SIZE", NULL},
+		},
+		{
+			.group = GROUP_COMMON,
+			.log_name = "config",
+			.args = {"cp", "-f", "/boot/config-*", NULL},
+		},
+		{
+			.group = GROUP_COMMON,
+			.log_name = "smmu",
+			.args = {"cp", "-rf", "/sys/class/iommu", NULL},
+		},
+	};
+	HIKP_SET_USED(data);
+	size_t i, size;
+	int ret;
+
+	size = HIKP_ARRAY_SIZE(config_info_cmds);
+	for (i = 0; i < size; i++) {
+		char *log_name = config_info_cmds[i].log_name;
+
+		if (log_name && !strcmp(log_name, "config"))
+			ret = hikp_collect_cp_glob_exec((void *)&config_info_cmds[i]);
+		else if (log_name && !strcmp(log_name, "smmu"))
+			ret = hikp_save_files(&config_info_cmds[i]);
+		else
+			ret = hikp_collect_exec((void *)&config_info_cmds[i]);
+
+		if (ret)
+			HIKP_ERROR_PRINT("collect process_info_cmds[%zu] log failed: %d\n",
+					 i, ret);
+	}
+
+	return 0;
+}
+
+static int service_info_exec(void *data)
+{
+	const struct info_collect_cmd service_info_cmds[] = {
+		{
+			.args = {"service", "iptables", "status", NULL},
+		},
+		{
+			.args = {"service", "irqbalance", "status", NULL},
+		},
+	};
+	HIKP_SET_USED(data);
+	size_t i, size;
+	int ret;
+
+	size = HIKP_ARRAY_SIZE(service_info_cmds);
+	for (i = 0; i < size; i++) {
+		ret = hikp_collect_exec((void *)&service_info_cmds[i]);
+		if (ret)
+			HIKP_ERROR_PRINT("collect service_info_cmds[%zu] log failed: %d\n",
+					 i, ret);
+	}
+
+	return 0;
+}
+
+static void collect_software_info(void)
+{
+	int ret;
+
+	ret = hikp_collect_log(GROUP_COMMON, "software_version", software_version_exec, (void *)NULL);
+	if (ret)
+		HIKP_ERROR_PRINT("software_version_exec failed: %d\n", ret);
+
+	ret = hikp_collect_log(GROUP_COMMON, "mem_info", mem_info_exec, (void *)NULL);
+	if (ret)
+		HIKP_ERROR_PRINT("mem_info_exec failed: %d\n", ret);
+
+	ret = hikp_collect_log(GROUP_COMMON, "process_info", process_info_exec, (void *)NULL);
+	if (ret)
+		HIKP_ERROR_PRINT("process_info_exec failed: %d\n", ret);
+
+	ret = hikp_collect_log(GROUP_COMMON, "config_info", config_info_exec, (void *)NULL);
+	if (ret)
+		HIKP_ERROR_PRINT("config_info_exec failed: %d\n", ret);
+
+	ret = hikp_collect_log(GROUP_COMMON, "service_info", service_info_exec, (void *)NULL);
+	if (ret)
+		HIKP_ERROR_PRINT("service_info_exec failed: %d\n", ret);
+}
+
+static int hardware_info_exec(void *data)
+{
+	const struct info_collect_cmd hardware_cmds[] = {
+		{
+			.args = {"cat", MIDR_EL1_PATH, NULL},
+		},
+		{
+			.args = {"cat", "/sys/bus/cpu/devices/cpu0/cpufreq/scaling_governor", NULL},
+		},
+		{
+			.args = {"cat", "/sys/devices/system/cpu/online", NULL},
+		},
+		{
+			.args = {"numactl", "-H", NULL},
+		},
+		{
+			.args = {"numastat", NULL},
+		},
+		{
+			.args = {"lscpu", NULL},
+		},
+		{
+			.args = {"dmidecode", NULL},
+		},
+	};
+	HIKP_SET_USED(data);
+	size_t i, size;
+	int ret;
+
+	size = HIKP_ARRAY_SIZE(hardware_cmds);
+	for (i = 0; i < size; i++) {
+		ret = hikp_collect_exec((void *)&hardware_cmds[i]);
+		if (ret)
+			HIKP_ERROR_PRINT("collect hardware_cmds[%zu] log failed: %d\n", i, ret);
+	}
+
+	return 0;
+}
+
+static void collect_hardware_info(void)
+{
+	int ret;
+
+	ret = hikp_collect_log(GROUP_COMMON, "hardware_info", hardware_info_exec, (void *)NULL);
+	if (ret)
+		HIKP_ERROR_PRINT("hardware_info_exec failed: %d\n", ret);
+}
+
+void collect_common_log(void)
+{
+	collect_software_info();
+	collect_hardware_info();
+}
diff --git a/info_collect/hikp_collect_imp.c b/info_collect/hikp_collect_imp.c
new file mode 100644
index 0000000..296cf07
--- /dev/null
+++ b/info_collect/hikp_collect_imp.c
@@ -0,0 +1,133 @@
+/*
+ * Copyright (c) 2024 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_collect_lib.h"
+#include "hikp_collect.h"
+#include "tool_lib.h"
+#include "hikp_nic_log.h"
+#include "hikp_nic_mac_dump.h"
+#include "hikp_nic_port.h"
+#include "hikp_nic_xsfp.h"
+#include "hikp_nic_ncsi.h"
+
+static int hikp_collect_nic_log_info(void *dev_name)
+{
+	struct info_collect_cmd nic_log_cmd = {
+		.group = GROUP_IMP,
+		.log_name = NULL,
+		.args = {"mv", NULL, NULL},
+	};
+	struct nic_log_collect_param param = {0};
+	char log_name[MAX_LOG_NAME_LEN] = {0};
+	int ret;
+
+	param.net_dev_name = (const char *)dev_name;
+	ret = snprintf(log_name, MAX_LOG_NAME_LEN, "%s_nic_log", (char *)dev_name);
+	if (ret < 0 || (uint32_t)ret >= MAX_LOG_NAME_LEN)
+		return -EINVAL;
+
+	ret = hikp_collect_log(GROUP_IMP, log_name, hikp_info_collect_nic_log, (void *)&param);
+	if (ret) {
+		HIKP_ERROR_PRINT("collect %s log failed: %d\n", log_name, ret);
+		return ret;
+	}
+
+	nic_log_cmd.args[ARGS_IDX1] = (char *)hikp_info_collect_get_log_path();
+	ret = hikp_move_files(&nic_log_cmd);
+	if (ret)
+		HIKP_ERROR_PRINT("collect imp log failed, %d\n", ret);
+
+	return ret;
+}
+
+static int hikp_collect_nic_port_info(void *dev_name)
+{
+	struct nic_port_collect_param param = {0};
+	char log_name[MAX_LOG_NAME_LEN] = {0};
+	int ret;
+
+	param.net_dev_name = (const char *)dev_name;
+	ret = snprintf(log_name, MAX_LOG_NAME_LEN, "%s_nic_port", (char *)dev_name);
+	if (ret < 0 || (uint32_t)ret >= MAX_LOG_NAME_LEN)
+		return -EINVAL;
+
+	ret = hikp_collect_log(GROUP_IMP, log_name, hikp_info_collect_nic_port, (void *)&param);
+	if (ret)
+		HIKP_ERROR_PRINT("collect %s log failed: %d\n", log_name, ret);
+
+	return ret;
+}
+
+static int hikp_collect_nic_xsfp_info(void *dev_name)
+{
+	struct nic_xsfp_collect_param param = {0};
+	char log_name[MAX_LOG_NAME_LEN] = {0};
+	int ret;
+
+	param.net_dev_name = (const char *)dev_name;
+	ret = snprintf(log_name, MAX_LOG_NAME_LEN, "%s_nic_xsfp", (char *)dev_name);
+	if (ret < 0 || (uint32_t)ret >= MAX_LOG_NAME_LEN)
+		return -EINVAL;
+
+	ret = hikp_collect_log(GROUP_IMP, log_name, hikp_info_collect_nic_xsfp, (void *)&param);
+	if (ret)
+		HIKP_ERROR_PRINT("collect %s log failed: %d\n", log_name, ret);
+
+	return ret;
+}
+
+static int hikp_collect_nic_mac_info(void *dev_name)
+{
+	struct nic_mac_collect_param param = {0};
+	char log_name[MAX_LOG_NAME_LEN] = {0};
+	int ret;
+
+	param.net_dev_name = (const char *)dev_name;
+	param.module_name = "ALL";
+	ret = snprintf(log_name, MAX_LOG_NAME_LEN, "%s_nic_mac", (char *)dev_name);
+	if (ret < 0 || (uint32_t)ret >= MAX_LOG_NAME_LEN)
+		return -EINVAL;
+
+	ret = hikp_collect_log(GROUP_IMP, log_name, hikp_info_collect_nic_mac, (void *)&param);
+	if (ret)
+		HIKP_ERROR_PRINT("collect %s log failed: %d\n", log_name, ret);
+
+	return ret;
+}
+
+static int hikp_collect_nic_ncsi_info(void *dev_name)
+{
+	struct nic_ncsi_collect_param param = {0};
+	char log_name[MAX_LOG_NAME_LEN] = {0};
+	int ret;
+
+	param.net_dev_name = (const char *)dev_name;
+	ret = snprintf(log_name, MAX_LOG_NAME_LEN, "%s_nic_ncsi", (char *)dev_name);
+	if (ret < 0 || (uint32_t)ret >= MAX_LOG_NAME_LEN)
+		return -EINVAL;
+
+	ret = hikp_collect_log(GROUP_IMP, log_name, hikp_info_collect_nic_ncsi, (void *)&param);
+	if (ret)
+		HIKP_ERROR_PRINT("collect %s log failed: %d\n", log_name, ret);
+
+	return ret;
+}
+
+void collect_imp_log(void)
+{
+	hikp_collect_all_nic_cmd_log(hikp_collect_nic_log_info);
+	hikp_collect_all_nic_cmd_log(hikp_collect_nic_port_info);
+	hikp_collect_all_nic_cmd_log(hikp_collect_nic_xsfp_info);
+	hikp_collect_all_nic_cmd_log(hikp_collect_nic_mac_info);
+	hikp_collect_all_nic_cmd_log(hikp_collect_nic_ncsi_info);
+}
diff --git a/info_collect/hikp_collect_lib.c b/info_collect/hikp_collect_lib.c
new file mode 100644
index 0000000..bada846
--- /dev/null
+++ b/info_collect/hikp_collect_lib.c
@@ -0,0 +1,508 @@
+/*
+ * Copyright (c) 2024 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_collect_lib.h"
+#include <unistd.h>
+#include <sys/wait.h>
+#include <sys/stat.h>
+#include <time.h>
+#include <glob.h>
+#include <dirent.h>
+#include "tool_lib.h"
+
+static char log_save_path[LOG_FILE_PATH_MAX_LEN] = {0};
+static char g_collect_name[MAX_LOG_NAME_LEN] = {0};
+
+static bool hikp_nic_drv_check(char *nic_name)
+{
+	char drv_path[LOG_FILE_PATH_MAX_LEN] = {0};
+	struct dirent *ptr = NULL;
+	bool hns3_if = false;
+	DIR *dir = NULL;
+	int ret;
+
+	ret = snprintf(drv_path, LOG_FILE_PATH_MAX_LEN, "%s%s/%s", HIKP_NIC_NAME_DIR,
+		       nic_name, HIKP_NIC_DRV_DIR);
+	if (ret < 0 || (uint32_t)(ret) >= LOG_FILE_PATH_MAX_LEN)
+		return false;
+
+	if ((dir = opendir(drv_path)) == NULL)
+		return false;
+
+	while ((ptr = readdir(dir)) != NULL) {
+		if (strcmp(ptr->d_name, HIKP_NIC_DRV_NAME) == 0) {
+			hns3_if = true;
+			break;
+		}
+	}
+
+	closedir(dir);
+	return hns3_if;
+}
+
+void hikp_collect_all_nic_cmd_log(collect_cmd_handler_t hikp_collect_one_nic_log)
+{
+	struct dirent *ptr = NULL;
+	DIR *dir = NULL;
+	int ret;
+
+	if (!hikp_collect_one_nic_log) {
+		HIKP_ERROR_PRINT("Invalid parameters!\n");
+		return;
+	}
+
+	dir = opendir(HIKP_NIC_NAME_DIR);
+	if (!dir) {
+		HIKP_ERROR_PRINT("failed to open path!\n");
+		return;
+	}
+
+	while ((ptr = readdir(dir)) != NULL) {
+		if ((strcmp(ptr->d_name, ".") == 0) || (strcmp(ptr->d_name, "..") == 0)) {
+			continue;
+		} else if (ptr->d_type == DT_LNK) {
+			if (hikp_nic_drv_check(ptr->d_name)) {
+				ret = hikp_collect_one_nic_log((void *)ptr->d_name);
+				if (ret) {
+					HIKP_WARN_PRINT("failed to collect log for: %s", ptr->d_name);
+					break;
+				}
+			}
+		}
+	}
+
+	closedir(dir);
+}
+
+static bool is_cmd_valid(struct info_collect_cmd *cmd, unsigned int args_num)
+{
+	unsigned int i;
+
+	if (cmd == NULL || cmd->log_name == NULL || args_num == 0 || args_num >= ARGS_MAX_NUM)
+		return false;
+
+	for (i = 0; i < args_num; i++)
+		if (cmd->args[i] == NULL)
+			return false;
+
+	return true;
+}
+
+int hikp_create_save_path(const char *name)
+{
+	char collect_name[MAX_LOG_NAME_LEN] = {0};
+	time_t time_seconds = time(0);
+	struct tm timeinfo;
+	int ret;
+
+	localtime_r(&time_seconds, &timeinfo);
+	if (name != NULL)
+		(void)snprintf((char *)collect_name, MAX_LOG_NAME_LEN,
+			"collect_%s_%04d%02d%02d%02d%02d%02d",
+			name, timeinfo.tm_year + START_YEAR,
+			timeinfo.tm_mon + 1, timeinfo.tm_mday,
+			timeinfo.tm_hour, timeinfo.tm_min, timeinfo.tm_sec);
+	else
+		(void)snprintf((char *)collect_name, MAX_LOG_NAME_LEN,
+			"collect_%04d%02d%02d%02d%02d%02d",
+			timeinfo.tm_year + START_YEAR, timeinfo.tm_mon + 1,
+			timeinfo.tm_mday, timeinfo.tm_hour, timeinfo.tm_min,
+			timeinfo.tm_sec);
+
+	ret = snprintf((char *)log_save_path, LOG_FILE_PATH_MAX_LEN,
+			HIKP_COLLECT_LOG_DIR_PATH"%s", collect_name);
+	if (ret < 0 || (uint32_t)(ret) >= LOG_FILE_PATH_MAX_LEN)
+		return -EINVAL;
+
+	if (!is_dir_exist((const char*)log_save_path)) {
+		if (tool_mk_dir((const char*)log_save_path)) {
+			HIKP_ERROR_PRINT("mkdir %s failed, errno is %d\n",
+					log_save_path, errno);
+			memset(log_save_path, 0, LOG_FILE_PATH_MAX_LEN);
+			return -ENOENT;
+		}
+	}
+
+	ret = snprintf((char *)g_collect_name, MAX_LOG_NAME_LEN, "%s", collect_name);
+	if (ret < 0 || (uint32_t)(ret) >= MAX_LOG_NAME_LEN)
+		return -EINVAL;
+
+	return 0;
+}
+
+static int hikp_get_save_path(char *file_path, unsigned int file_path_len)
+{
+	int ret;
+
+	if (access(log_save_path, F_OK) != 0)
+		return -ENOENT;
+
+	ret = snprintf((char *)file_path, file_path_len, "%s", log_save_path);
+	if (ret < 0 || (uint32_t)(ret) >= LOG_FILE_PATH_MAX_LEN)
+		return -EINVAL;
+
+	return 0;
+}
+
+int hikp_get_file_path(char *file_path, uint32_t file_path_len,
+		char *group)
+{
+	char tmp_path[LOG_FILE_PATH_MAX_LEN] = {0};
+	int ret;
+
+	ret = hikp_get_save_path(tmp_path, LOG_FILE_PATH_MAX_LEN);
+	if (ret < 0) {
+		HIKP_ERROR_PRINT("get file save path failed: %d\n", ret);
+		return ret;
+	}
+
+	if (group != NULL)
+		ret = snprintf(file_path, file_path_len, "%s/%s",
+				tmp_path, group);
+	else
+		ret = snprintf(file_path, file_path_len, "%s",
+				tmp_path);
+
+	if (ret < 0 || (uint32_t)(ret) >= LOG_FILE_PATH_MAX_LEN) {
+		HIKP_ERROR_PRINT("create file path fail: %d\n", ret);
+		return -EINVAL;
+	}
+
+	if (!is_dir_exist((const char*)file_path)) {
+		if (tool_mk_dir((const char*)file_path)) {
+			HIKP_ERROR_PRINT("mkdir %s failed: %d\n",
+					file_path, errno);
+			return -ENOENT;
+		}
+	}
+
+	return 0;
+}
+
+static int hikp_collect_cmd_exec(const struct info_collect_cmd *cmd)
+{
+	pid_t pid;
+	int status;
+
+	pid = fork();
+	if (pid == 0) {
+		/*
+		 * When the command execution fails, exit the child
+		 * process just like when it succeeds.
+		 * */
+		if (execvp(cmd->args[ARGS_IDX0], cmd->args) < 0) {
+			HIKP_ERROR_PRINT("execvp failed: %d\n", errno);
+			exit(EXIT_FAILURE);
+		}
+	} else if (pid > 0) {
+		/* Parent process */
+		waitpid(pid, &status, 0);
+	} else {
+		HIKP_ERROR_PRINT("fork failed!\n");
+		return -ECHILD;
+	}
+
+	return 0;
+}
+
+int hikp_collect_exec(void *data)
+{
+	struct info_collect_cmd *cmd = (struct info_collect_cmd *)data;
+	struct info_collect_cmd echo_cmd = {0};
+	char result[MAX_LOG_NAME_LEN] = {0};
+	int len = 0;
+	int ret;
+	int i;
+
+	echo_cmd.args[ARGS_IDX0] = "echo";
+	echo_cmd.args[ARGS_IDX1] = result;
+	echo_cmd.args[ARGS_IDX2] = NULL;
+	for (i = 0; i < ARGS_MAX_NUM && cmd->args[i] != NULL; i++) {
+		ret = snprintf(result + len,
+				MAX_LOG_NAME_LEN - len - 1,
+				"%s ", cmd->args[i]);
+		len += ret;
+		if (ret < 0 || len >= (MAX_LOG_NAME_LEN - 1)) {
+			HIKP_INFO_PRINT("Error getting command args");
+			break;
+		}
+	}
+
+	ret = hikp_collect_cmd_exec(&echo_cmd);
+	if (ret)
+		return ret;
+
+	return hikp_collect_cmd_exec(cmd);
+}
+
+int hikp_collect_log(char *group, char *log_name, collect_cmd_handler_t func, void *data)
+{
+	unsigned char file_name[MAX_LOG_NAME_LEN] = {0};
+	char file_dir[LOG_FILE_PATH_MAX_LEN] = {0};
+	char file_path[LOG_FILE_PATH_MAX_LEN] = {0};
+	int stdout_fd = dup(STDOUT_FILENO);
+	int stderr_fd = dup(STDERR_FILENO);
+	FILE *log_file;
+	int ret;
+
+	if (log_name == NULL) {
+		HIKP_ERROR_PRINT("log name is NULL");
+		return -EINVAL;
+	}
+
+	ret = generate_file_name(file_name, MAX_LOG_NAME_LEN,
+			(const unsigned char*)log_name);
+	if (ret < 0)
+		return ret;
+
+	ret = hikp_get_file_path(file_dir, LOG_FILE_PATH_MAX_LEN, group);
+	if (ret < 0)
+		return ret;
+
+	ret = snprintf(file_path, LOG_FILE_PATH_MAX_LEN, "%s/%s", file_dir, file_name);
+	if (ret < 0 || (uint32_t)(ret) >= LOG_FILE_PATH_MAX_LEN) {
+                HIKP_ERROR_PRINT("create log file path fail: %d\n", ret);
+                return -EINVAL;
+	}
+
+	log_file = fopen(file_path, "a");
+	if (log_file == NULL) {
+		HIKP_ERROR_PRINT("open %s failed.", file_path);
+		return -ENOENT;
+	 }
+
+	(void)chmod(file_path, S_IRUSR | S_IWUSR | S_IRGRP);
+
+	fflush(stdout);
+	fflush(stderr);
+
+	/* Copy the standard output and error information to log_file */
+	dup2(fileno(log_file), STDOUT_FILENO);
+	dup2(fileno(log_file), STDERR_FILENO);
+
+	ret = func(data);
+
+	fflush(stdout);
+	fflush(stderr);
+
+	/* Redirect stdout and stderr back to the terminal */
+	dup2(stdout_fd, STDOUT_FILENO);
+	dup2(stderr_fd, STDERR_FILENO);
+
+	fclose(log_file);
+	close(stdout_fd);
+	close(stderr_fd);
+
+	return ret;
+}
+
+int hikp_compress_log(void)
+{
+	char file_path[LOG_FILE_PATH_MAX_LEN] = {0};
+	char tar_name[LOG_FILE_PATH_MAX_LEN] = {0};
+	struct info_collect_cmd tar_cmd = {0};
+	struct info_collect_cmd rm_cmd = {0};
+	int ret;
+
+	ret = hikp_get_save_path(file_path, LOG_FILE_PATH_MAX_LEN);
+	if (ret < 0) {
+		HIKP_ERROR_PRINT("get save path fail: %d\n", ret);
+		return ret;
+	}
+
+	ret = snprintf((char *)tar_name, LOG_FILE_PATH_MAX_LEN, "%s.tar.gz",
+			file_path);
+	if (ret < 0 || (uint32_t)(ret) >= LOG_FILE_PATH_MAX_LEN) {
+		HIKP_ERROR_PRINT("create tar path fail: %d\n", ret);
+		return -EINVAL;
+	}
+
+	tar_cmd.args[ARGS_IDX0] = "tar";
+	tar_cmd.args[ARGS_IDX1] = "-zPcf";
+	tar_cmd.args[ARGS_IDX2] = tar_name;
+	tar_cmd.args[ARGS_IDX3] = "-C";
+	tar_cmd.args[ARGS_IDX4] = HIKP_COLLECT_LOG_DIR_PATH;
+	tar_cmd.args[ARGS_IDX5] = g_collect_name;
+	tar_cmd.args[ARGS_IDX6] = NULL;
+
+	ret = hikp_collect_exec(&tar_cmd);
+	if (ret)
+		return ret;
+
+	/* Delete the original log after the log is packaged. */
+	rm_cmd.args[ARGS_IDX0] = "rm";
+	rm_cmd.args[ARGS_IDX1] = "-rf";
+	rm_cmd.args[ARGS_IDX2] = file_path;
+	rm_cmd.args[ARGS_IDX3] = NULL;
+
+	return hikp_collect_exec(&rm_cmd);
+}
+
+int hikp_move_files(struct info_collect_cmd *mv_cmd)
+{
+	char dest_path[LOG_FILE_PATH_MAX_LEN] = {0};
+	char tmp_path[LOG_FILE_PATH_MAX_LEN] = {0};
+	char *src_path = mv_cmd->args[ARGS_IDX1];
+	char *sub_group = mv_cmd->log_name;
+	int ret;
+
+	if (strcmp(mv_cmd->args[ARGS_IDX0], "mv") != 0) {
+		HIKP_ERROR_PRINT("input cmd failed: %s.\n", mv_cmd->args[ARGS_IDX0]);
+		return -EINVAL;
+	}
+
+	if (src_path == NULL || access(src_path, F_OK) != 0) {
+		HIKP_ERROR_PRINT("Can't access source path: %s\n", src_path);
+		return -ENOENT;
+	}
+
+	ret = hikp_get_file_path(tmp_path, LOG_FILE_PATH_MAX_LEN, mv_cmd->group);
+	if (ret < 0) {
+		HIKP_ERROR_PRINT("get destination path fail: %d\n", ret);
+		return ret;
+	}
+
+	if (sub_group == NULL)
+		ret = snprintf(dest_path, LOG_FILE_PATH_MAX_LEN, "%s", tmp_path);
+	else
+		ret = snprintf(dest_path, LOG_FILE_PATH_MAX_LEN, "%s/%s",
+			       tmp_path, sub_group);
+	if (ret < 0 || (uint32_t)(ret) >= LOG_FILE_PATH_MAX_LEN) {
+		HIKP_ERROR_PRINT("create destination path failed: %d\n", ret);
+		return -EINVAL;
+	}
+
+	mv_cmd->args[ARGS_IDX2] = dest_path;
+	mv_cmd->args[ARGS_IDX3] = NULL;
+
+	return hikp_collect_exec((void *)mv_cmd);
+}
+
+int hikp_save_files(struct info_collect_cmd *save_cmd)
+{
+	char save_path[LOG_FILE_PATH_MAX_LEN] = {0};
+	char tmp_path[LOG_FILE_PATH_MAX_LEN] = {0};
+	char *source_path = save_cmd->args[ARGS_IDX2];
+	char *sub_group = save_cmd->log_name;
+	int ret;
+
+	if (strcmp(save_cmd->args[ARGS_IDX0], "cp") != 0) {
+		HIKP_ERROR_PRINT("input cmd failed: %s.\n", save_cmd->args[ARGS_IDX0]);
+		return -EINVAL;
+	}
+
+	if (source_path == NULL || access(source_path, F_OK) != 0) {
+		HIKP_ERROR_PRINT("Can't access source path: %s\n", source_path);
+		return -ENOENT;
+	}
+
+	ret = hikp_get_file_path(tmp_path, LOG_FILE_PATH_MAX_LEN, save_cmd->group);
+	if (ret < 0) {
+		HIKP_ERROR_PRINT("get save path fail: %d\n", ret);
+		return ret;
+	}
+
+	if (sub_group == NULL)
+		ret = snprintf(save_path, LOG_FILE_PATH_MAX_LEN, "%s", tmp_path);
+	else
+		ret = snprintf(save_path, LOG_FILE_PATH_MAX_LEN, "%s/%s",
+					   tmp_path, sub_group);
+	if (ret < 0 || (uint32_t)(ret) >= LOG_FILE_PATH_MAX_LEN) {
+		HIKP_ERROR_PRINT("create save path failed: %d\n", ret);
+		return -EINVAL;
+	}
+
+	save_cmd->args[ARGS_IDX3] = save_path;
+	save_cmd->args[ARGS_IDX4] = NULL;
+
+	return hikp_collect_exec((void *)save_cmd);
+}
+
+int hikp_collect_cat_glob_exec(void *data)
+{
+	struct info_collect_cmd *cmd = (struct info_collect_cmd *)data;
+	glob_t glb_buff;
+	size_t i;
+	int ret;
+
+	if (!is_cmd_valid(cmd, ARGS_IDX2))
+		return -EINVAL;
+
+	if (strcmp(cmd->args[ARGS_IDX0], "cat"))
+		return -EINVAL;
+
+	ret = glob(cmd->args[ARGS_IDX1], GLOB_TILDE, NULL, &glb_buff);
+	if (ret) {
+		HIKP_ERROR_PRINT("failed to generate cat paths: %s\n", cmd->args[ARGS_IDX1]);
+		return ret;
+	}
+
+	for (i = 0; i < glb_buff.gl_pathc; i++) {
+		cmd->args[ARGS_IDX1] = glb_buff.gl_pathv[i];
+		ret = hikp_collect_exec((void *)cmd);
+		if(ret)
+			HIKP_INFO_PRINT("cat %s failed\n", glb_buff.gl_pathv[i]);
+	}
+
+	globfree(&glb_buff);
+
+	return 0;
+}
+
+int hikp_collect_cp_glob_exec(void *data)
+{
+	struct info_collect_cmd *cmd = (struct info_collect_cmd *)data;
+	char log_name[MAX_LOG_NAME_LEN] = {0};
+	char tmp[MAX_LOG_NAME_LEN] = {0};
+	glob_t glb_buff;
+	size_t i;
+	int ret;
+
+	if (!is_cmd_valid(cmd, ARGS_IDX3))
+		return -EINVAL;
+
+	if (strcmp(cmd->args[ARGS_IDX0], "cp"))
+		return -EINVAL;
+
+	ret = glob(cmd->args[ARGS_IDX2], GLOB_TILDE, NULL, &glb_buff);
+	if (ret) {
+		HIKP_ERROR_PRINT("failed to generate cp paths: %s\n", cmd->args[ARGS_IDX2]);
+		return ret;
+	}
+
+	ret = snprintf(tmp, MAX_LOG_NAME_LEN, "%s", cmd->log_name);
+	if (ret < 0 || (uint32_t)(ret) >= MAX_LOG_NAME_LEN) {
+		HIKP_ERROR_PRINT("log name is invalid\n");
+		globfree(&glb_buff);
+		return -EINVAL;
+	}
+
+	for (i = 0; i < glb_buff.gl_pathc; i++) {
+		ret = snprintf(log_name, MAX_LOG_NAME_LEN, "%s_%zu", tmp, i);
+		if (ret < 0 || (uint32_t)(ret) >= MAX_LOG_NAME_LEN) {
+			HIKP_ERROR_PRINT("create log name failed\n");
+			globfree(&glb_buff);
+			return -EINVAL;
+		}
+
+		cmd->log_name = log_name;
+		cmd->args[ARGS_IDX2] = glb_buff.gl_pathv[i];
+		ret = hikp_save_files(cmd);
+		if(ret)
+			HIKP_INFO_PRINT("cp %s failed\n", glb_buff.gl_pathv[i]);
+	}
+
+	globfree(&glb_buff);
+
+	return 0;
+}
diff --git a/info_collect/hikp_collect_lib.h b/info_collect/hikp_collect_lib.h
new file mode 100644
index 0000000..2c59bf0
--- /dev/null
+++ b/info_collect/hikp_collect_lib.h
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2024 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_COLLECT_LIB_H
+#define HIKP_COLLECT_LIB_H
+
+#ifndef NULL
+#define NULL	((void *)0)
+#endif
+
+#define ARGS_IDX0	0
+#define ARGS_IDX1	1
+#define ARGS_IDX2	2
+#define ARGS_IDX3	3
+#define ARGS_IDX4	4
+#define ARGS_IDX5	5
+#define ARGS_IDX6	6
+#define ARGS_IDX7	7
+#define ARGS_IDX8	8
+#define ARGS_IDX9	9
+#define ARGS_IDX10	10
+#define ARGS_IDX11	11
+#define ARGS_MAX_NUM	12
+#define LOG_FILE_PATH_MAX_LEN	512
+#define HIKP_COLLECT_LOG_DIR_PATH	"/var/log/hikp/"
+#define HIKP_ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
+#define HIKP_NIC_NAME_DIR		"/sys/class/net/"
+#define HIKP_NIC_DRV_DIR		"device/driver/module/drivers/"
+#define HIKP_NIC_DRV_NAME		"pci:hns3"
+
+typedef int (*collect_cmd_handler_t)(void *);
+
+struct info_collect_cmd {
+	char *group;
+	char *log_name;
+	char *args[ARGS_MAX_NUM];
+};
+
+int hikp_compress_log(void);
+int hikp_create_save_path(const char *name);
+int hikp_get_file_path(char *file_path, unsigned int file_path_len,
+		       char *group);
+int hikp_collect_exec(void *data);
+int hikp_collect_log(char *group, char *log_name,
+		collect_cmd_handler_t func, void *data);
+int hikp_move_files(struct info_collect_cmd *mv_cmd);
+int hikp_save_files(struct info_collect_cmd *save_cmd);
+int hikp_collect_cat_glob_exec(void *data);
+int hikp_collect_cp_glob_exec(void *data);
+void hikp_collect_all_nic_cmd_log(collect_cmd_handler_t hikp_collect_one_nic_log);
+#endif /* HIKP_COLLECT_LIB_H */
diff --git a/info_collect/hikp_collect_main.c b/info_collect/hikp_collect_main.c
new file mode 100644
index 0000000..c413346
--- /dev/null
+++ b/info_collect/hikp_collect_main.c
@@ -0,0 +1,274 @@
+/*
+ * Copyright (c) 2024 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_collect_lib.h"
+#include "hikp_collect.h"
+#include "tool_lib.h"
+#include "tool_cmd.h"
+
+static enum info_collect_type g_info_collect_type = COLLECT_UNKNOWN_TYPE;
+static enum info_collect_type get_info_collect_type(void)
+{
+	return g_info_collect_type;
+}
+
+static void set_info_collect_type(enum info_collect_type type)
+{
+	g_info_collect_type = type;
+}
+
+static int info_collect_acc(struct major_cmd_ctrl *self, const char *argv)
+{
+	HIKP_SET_USED(self);
+	HIKP_SET_USED(argv);
+
+	set_info_collect_type(COLLECT_ACC);
+	return 0;
+}
+
+static int info_collect_imp(struct major_cmd_ctrl *self, const char *argv)
+{
+	HIKP_SET_USED(self);
+	HIKP_SET_USED(argv);
+
+	set_info_collect_type(COLLECT_IMP);
+	return 0;
+}
+
+static int info_collect_nic(struct major_cmd_ctrl *self, const char *argv)
+{
+	HIKP_SET_USED(self);
+	HIKP_SET_USED(argv);
+
+	set_info_collect_type(COLLECT_NIC);
+	return 0;
+}
+
+static int info_collect_pcie(struct major_cmd_ctrl *self, const char *argv)
+{
+	HIKP_SET_USED(self);
+	HIKP_SET_USED(argv);
+
+	set_info_collect_type(COLLECT_PCIE);
+	return 0;
+}
+
+static int info_collect_roce(struct major_cmd_ctrl *self, const char *argv)
+{
+	HIKP_SET_USED(self);
+	HIKP_SET_USED(argv);
+
+	set_info_collect_type(COLLECT_ROCE);
+	return 0;
+}
+
+static int info_collect_sas(struct major_cmd_ctrl *self, const char *argv)
+{
+	HIKP_SET_USED(self);
+	HIKP_SET_USED(argv);
+
+	set_info_collect_type(COLLECT_SAS);
+	return 0;
+}
+
+static int info_collect_sata(struct major_cmd_ctrl *self, const char *argv)
+{
+	HIKP_SET_USED(self);
+	HIKP_SET_USED(argv);
+
+	set_info_collect_type(COLLECT_SATA);
+	return 0;
+}
+
+static int info_collect_serdes(struct major_cmd_ctrl *self, const char *argv)
+{
+	HIKP_SET_USED(self);
+	HIKP_SET_USED(argv);
+
+	set_info_collect_type(COLLECT_SERDES);
+	return 0;
+}
+
+static int info_collect_socip(struct major_cmd_ctrl *self, const char *argv)
+{
+	HIKP_SET_USED(self);
+	HIKP_SET_USED(argv);
+
+	set_info_collect_type(COLLECT_SOCIP);
+	return 0;
+}
+
+static int info_collect_all(struct major_cmd_ctrl *self, const char *argv)
+{
+	HIKP_SET_USED(self);
+	HIKP_SET_USED(argv);
+
+	set_info_collect_type(COLLECT_ALL);
+	return 0;
+}
+
+static void collect_all_log(void)
+{
+	collect_pcie_info();
+	collect_acc_log();
+	collect_imp_log();
+	collect_nic_log();
+	collect_roce_log();
+	collect_sas_log();
+	collect_sata_log();
+	collect_serdes_log();
+	collect_socip_log();
+}
+
+static int info_collect_excute_funs_call(uint32_t collect_type)
+{
+	const char *type_name[] = {"acc", "imp", "nic", "pcie", "roce", "sas",
+		"sata", "serdes", "socip", "all"};
+	int ret;
+
+	if (collect_type == COLLECT_UNKNOWN_TYPE)
+		return -EINVAL;
+
+	ret = hikp_create_save_path(type_name[collect_type]);
+	if (ret) {
+		HIKP_ERROR_PRINT("create save path fail: %d\n", ret);
+		return ret;
+	}
+
+	switch (collect_type) {
+	case COLLECT_ACC:
+		collect_acc_log();
+		break;
+	case COLLECT_IMP:
+		collect_imp_log();
+		break;
+	case COLLECT_NIC:
+		collect_nic_log();
+		break;
+	case COLLECT_PCIE:
+		collect_pcie_info();
+		break;
+	case COLLECT_ROCE:
+		collect_roce_log();
+		break;
+	case COLLECT_SAS:
+		collect_sas_log();
+		break;
+	case COLLECT_SATA:
+		collect_sata_log();
+		break;
+	case COLLECT_SERDES:
+		collect_serdes_log();
+		break;
+	case COLLECT_SOCIP:
+		collect_socip_log();
+		break;
+	case COLLECT_ALL:
+		collect_all_log();
+		break;
+	default:
+		return -EINVAL;
+	}
+
+	collect_common_log();
+	ret = hikp_compress_log();
+
+	return ret;
+}
+
+
+static void info_collect_execute(struct major_cmd_ctrl *self)
+{
+	const char *suc_msg[] = {
+		"collect acc info success.",
+		"collect imp info success.",
+		"collect nic info success.",
+		"collect pcie info success.",
+		"collect roce info success.",
+		"collect sas info success.",
+		"collect sata info success.",
+		"collect serdes info success.",
+		"collect socip info success.",
+		"collect all info success.",
+	};
+	const char *err_msg[] = {
+		"collect acc info error.",
+		"collect imp info error.",
+		"collect nic info error.",
+		"collect pcie info error.",
+		"collect roce info error.",
+		"collect sas info error.",
+		"collect sata info error.",
+		"collect serdes info error.",
+		"collect socip info error.",
+		"collect all info error.",
+		"collect info failed, unknown type.",
+	};
+	enum info_collect_type type;
+	int ret;
+
+	type = get_info_collect_type();
+	ret = info_collect_excute_funs_call(type);
+	set_info_collect_type(COLLECT_UNKNOWN_TYPE);
+	if (ret == 0) {
+		printf("%s\n", suc_msg[type]);
+	} else {
+		(void)snprintf(self->err_str, sizeof(self->err_str), "%s\n", err_msg[type]);
+		self->err_no = ret;
+	}
+}
+
+static int info_collect_help(struct major_cmd_ctrl *self, const char *argv)
+{
+	HIKP_SET_USED(argv);
+
+	printf("\n  Usage: %s\n", self->cmd_ptr->name);
+	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\n");
+	printf("    %s, %-25s %s\n", "-acc", "--acc", "collect acc info\n");
+	printf("    %s, %-25s %s\n", "-imp", "--imp", "collect imp info\n");
+	printf("    %s, %-25s %s\n", "-nic", "--nic", "collect nic info\n");
+	printf("    %s, %-25s %s\n", "-pcie", "--pcie", "collect pcie info\n");
+	printf("    %s, %-25s %s\n", "-roce", "--roce", "collect roce info\n");
+	printf("    %s, %-25s %s\n", "-sas", "--sas", "collect sas info\n");
+	printf("    %s, %-25s %s\n", "-sata", "--sata", "collect sata info\n");
+	printf("    %s, %-25s %s\n", "-serdes", "--serdes", "collect serdes info\n");
+	printf("    %s, %-25s %s\n", "-socip", "--socip", "collect socip info\n");
+	printf("    %s, %-25s %s\n", "-all", "--all", "collect all info\n");
+	printf("\n");
+
+	return 0;
+}
+
+static void cmd_info_collect_init(void)
+{
+	struct major_cmd_ctrl *major_cmd = get_major_cmd();
+
+	major_cmd->option_count = 0;
+	major_cmd->execute = info_collect_execute;
+
+	cmd_option_register("-h", "--help", false, info_collect_help);
+	cmd_option_register("-acc", "--acc", false, info_collect_acc);
+	cmd_option_register("-imp", "--imp", false, info_collect_imp);
+	cmd_option_register("-nic", "--nic", false, info_collect_nic);
+	cmd_option_register("-pcie", "--pcie", false, info_collect_pcie);
+	cmd_option_register("-roce", "--roce", false, info_collect_roce);
+	cmd_option_register("-sas", "--sas", false, info_collect_sas);
+	cmd_option_register("-sata", "--sata", false, info_collect_sata);
+	cmd_option_register("-serdes", "--serdes", false, info_collect_serdes);
+	cmd_option_register("-socip", "--socip", false, info_collect_socip);
+	cmd_option_register("-all", "--all", false, info_collect_all);
+}
+
+HIKP_CMD_DECLARE("info_collect", "information collect", cmd_info_collect_init);
diff --git a/info_collect/hikp_collect_nic.c b/info_collect/hikp_collect_nic.c
new file mode 100644
index 0000000..23c4e49
--- /dev/null
+++ b/info_collect/hikp_collect_nic.c
@@ -0,0 +1,368 @@
+/*
+ * Copyright (c) 2024 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_collect_lib.h"
+#include "hikp_collect.h"
+#include "tool_lib.h"
+#include "hikp_nic_fd.h"
+#include "hikp_nic_gro.h"
+#include "hikp_nic_ppp.h"
+#include "hikp_nic_qos.h"
+#include "hikp_nic_queue.h"
+#include "hikp_nic_rss.h"
+#include "hikp_nic_torus.h"
+#include "hikp_nic_fec.h"
+#include "hikp_nic_dfx.h"
+#include "hikp_nic_info.h"
+#include "hikp_nic_notify_pkt.h"
+#include "hikp_nic_port_fault.h"
+#include "hikp_nic_mac_dump.h"
+
+static void collect_nic_debugfs_log(void)
+{
+	struct info_collect_cmd nic_cmd_copy = {
+		.group = GROUP_NIC,
+		.log_name = "debugfs",
+		.args = {"cp", "-rf", "/sys/kernel/debug/hns3/", NULL},
+	};
+	int ret;
+
+	ret = hikp_save_files(&nic_cmd_copy);
+	if (ret)
+		HIKP_ERROR_PRINT("collect_nic_log debugfs failed, %d\n", ret);
+}
+
+static int collect_hikp_nic_fd_log(void *nic_name)
+{
+	struct major_cmd_ctrl self = {0};
+	struct hikp_cmd_type type = {0};
+	int ret;
+
+	/* collect nic_fd hw_info */
+	printf("hikptool nic_fd -i %s -du hw_info\n", (char *)nic_name);
+	hikp_nic_set_fd_idx(NIC_FD_HW_INFO_DUMP, -1);
+	self.cmd_ptr = &type;
+	ret = hikp_nic_cmd_get_fd_target(&self, (char *)nic_name);
+	if (ret) {
+		HIKP_ERROR_PRINT("failed to set bdf for %s.\n", (char *)nic_name);
+		return ret;
+	}
+	hikp_nic_fd_cmd_execute(&self);
+
+	/* collect nic_fd rules and counters */
+	printf("hikptool nic_fd -i %s -du rules -st 1\n", (char *)nic_name);
+	hikp_nic_set_fd_idx(NIC_FD_RULES_INFO_DUMP, 1);
+	hikp_nic_fd_cmd_execute(&self);
+	printf("hikptool nic_fd -i %s -du counter -st 1\n", (char *)nic_name);
+	hikp_nic_set_fd_idx(NIC_FD_COUNTER_STATS_DUMP, 1);
+	hikp_nic_fd_cmd_execute(&self);
+
+	return 0;
+}
+
+static int collect_hikp_nic_gro_log(void *nic_name)
+{
+	struct major_cmd_ctrl self = {0};
+	struct hikp_cmd_type type = {0};
+	int ret;
+
+	printf("hikptool nic_gro -i %s\n", (char *)nic_name);
+	self.cmd_ptr = &type;
+	ret = hikp_nic_gro_get_target(&self, (char *)nic_name);
+	if (ret) {
+		HIKP_ERROR_PRINT("failed to get bdf for %s.\n", (char *)nic_name);
+		return ret;
+	}
+
+	hikp_nic_gro_cmd_execute(&self);
+	return 0;
+}
+
+static int collect_hikp_nic_ppp_log(void *nic_name)
+{
+	const char *sub_cmd_name[] = {"mac", "vlan", "mng", "promisc", "vlan_offload"};
+	struct major_cmd_ctrl self = {0};
+	struct hikp_cmd_type type = {0};
+	int i, ret;
+
+	self.cmd_ptr = &type;
+	ret = hikp_nic_cmd_get_ppp_target(&self, (char *)nic_name);
+	if (ret) {
+		HIKP_ERROR_PRINT("failed to get bdf for %s.\n", (char *)nic_name);
+		return ret;
+	}
+
+	for (i = NIC_MAC_TBL_DUMP; i <= NIC_VLAN_OFFLOAD_DUMP; ++i) {
+		printf("hikptool nic_ppp -i %s -du %s\n", (char *)nic_name,
+		       sub_cmd_name[i - NIC_MAC_TBL_DUMP]);
+		hikp_nic_ppp_set_cmd_param(i-1);
+		hikp_nic_ppp_cmd_execute(&self);
+	}
+
+	return 0;
+}
+
+static int collect_hikp_nic_qos_log(void *nic_name)
+{
+	const char *sub_cmd_name[] = {"pkt_buf", "dcb", "pause"};
+	const char *dir_name[] = {"rx", "tx"};
+	struct major_cmd_ctrl self = {0};
+	struct hikp_cmd_type type = {0};
+	int i, ret;
+
+	self.cmd_ptr = &type;
+	ret = hikp_nic_cmd_get_qos_target(&self, (char *)nic_name);
+	if (ret) {
+		HIKP_ERROR_PRINT("failed to get bdf for %s.\n", (char *)nic_name);
+		return ret;
+	}
+
+	for (i = NIC_PACKET_BUFFER_DUMP; i <= NIC_PAUSE_DUMP; ++i) {
+		printf("hikptool nic_qos -i %s -g %s\n", (char *)nic_name, sub_cmd_name[i]);
+		hikp_nic_qos_set_cmd_feature_idx(i);
+		hikp_nic_qos_cmd_execute(&self);
+	}
+
+	hikp_nic_qos_set_cmd_feature_idx(NIC_PFC_STORM_PARA_DUMP);
+	for (i = NIC_RX_QOS; i <= NIC_TX_QOS; ++i) {
+		printf("hikptool nic_qos -i %s -g pfc_storm_para -d %s\n", (char *)nic_name,
+		       dir_name[i]);
+		hikp_nic_qos_set_cmd_direction(i);
+		hikp_nic_qos_cmd_execute(&self);
+	}
+
+	return 0;
+}
+
+static int collect_hikp_nic_queue_log(void *nic_name)
+{
+	const char *dir_name[] = {"tx", "rx"};
+	struct major_cmd_ctrl self = {0};
+	struct hikp_cmd_type type = {0};
+	int j, ret;
+
+	self.cmd_ptr = &type;
+	ret = hikp_nic_cmd_get_queue_target(&self, (char *)nic_name);
+	if (ret) {
+		HIKP_ERROR_PRINT("failed to get bdf for %s.\n", (char *)nic_name);
+		return ret;
+	}
+
+	printf("hikptool nic_queue -i %s -du queue_en -a on\n", (char *)nic_name);
+	hikp_nic_queue_cmd_set_param(QUEUE_EN_INFO, -1, NIC_QUEUE_DIR_UNKNOWN);
+	hikp_nic_queue_cmd_execute(&self);
+	printf("hikptool nic_queue -i %s -du func_map\n", (char *)nic_name);
+	hikp_nic_queue_cmd_set_param(QUEUE_FUNC_MAP, -1, NIC_QUEUE_DIR_UNKNOWN);
+	hikp_nic_queue_cmd_execute(&self);
+
+	for (j = NIC_TX_QUEUE; j <= NIC_RX_QUEUE; ++j) {
+		printf("hikptool nic_queue -i %s -du basic_info -d %s -q 0\n", (char *)nic_name,
+		       dir_name[j]);
+		hikp_nic_queue_cmd_set_param(QUEUE_BASIC_INFO, 0, j);
+		hikp_nic_queue_cmd_execute(&self);
+		printf("hikptool nic_queue -i %s -du intr_map -d %s -a on\n", (char *)nic_name,
+		       dir_name[j]);
+		hikp_nic_queue_cmd_set_param(QUEUE_INTR_MAP, -1, j);
+		hikp_nic_queue_cmd_execute(&self);
+	}
+
+	return 0;
+}
+
+static int collect_hikp_nic_rss_log(void *nic_name)
+{
+	const char *sub_cmd_name[] = {"algo", "key", "tuple", "reta", "tc_mode"};
+	struct major_cmd_ctrl self = {0};
+	struct hikp_cmd_type type = {0};
+	int i, ret;
+
+	self.cmd_ptr = &type;
+	ret = hikp_nic_cmd_get_rss_target(&self, (char *)nic_name);
+	if (ret) {
+		HIKP_ERROR_PRINT("failed to get bdf for %s.\n", (char *)nic_name);
+		return ret;
+	}
+
+	for (i = RSS_ALGO_DUMP; i <= RSS_TC_MODE_DUMP; ++i) {
+		printf("hikptool nic_rss -i %s -g %s\n", (char *)nic_name, sub_cmd_name[i]);
+		hikp_nic_rss_cmd_set_feature_idx(i);
+		hikp_nic_rss_cmd_execute(&self);
+	}
+
+	return 0;
+}
+
+static int collect_hikp_nic_torus_log(void *nic_name)
+{
+	struct major_cmd_ctrl self = {0};
+	struct hikp_cmd_type type = {0};
+	int ret;
+
+	self.cmd_ptr = &type;
+	ret = hikp_nic_torus_get_target(&self, (char *)nic_name);
+	if (ret) {
+		HIKP_ERROR_PRINT("failed to get bdf for %s.\n", (char *)nic_name);
+		return ret;
+	}
+
+	printf("hikptool nic_torus -i %s\n", (char *)nic_name);
+	hikp_nic_torus_cmd_execute(&self);
+	return 0;
+}
+
+static int collect_hikp_nic_fec_log(void *nic_name)
+{
+	struct major_cmd_ctrl self = {0};
+	struct hikp_cmd_type type = {0};
+	int ret;
+
+	self.cmd_ptr = &type;
+	ret = hikp_nic_fec_get_target(&self, (char *)nic_name);
+	if (ret) {
+		HIKP_ERROR_PRINT("failed to get bdf for %s.\n", (char *)nic_name);
+		return ret;
+	}
+
+	printf("hikptool nic_fec -i %s\n", (char *)nic_name);
+	hikp_nic_fec_cmd_execute(&self);
+	return 0;
+}
+
+static int collect_hikp_nic_dfx_log(void *nic_name)
+{
+	const char *sub_cmd_name[] = {"SSU", "IGU_EGU", "PPP", "NCSI", "BIOS", "RCB", "TXDMA",
+				      "MASTER"};
+	struct major_cmd_ctrl self = {0};
+	struct hikp_cmd_type type = {0};
+	int i, ret;
+
+	self.cmd_ptr = &type;
+	ret = hikp_nic_cmd_dfx_target(&self, (char *)nic_name);
+	if (ret) {
+		HIKP_ERROR_PRINT("failed to get bdf for %s.\n", (char *)nic_name);
+		return ret;
+	}
+	for (i = SSU_DFX_REG_DUMP; i <= MASTER_DFX_REG_DUMP; ++i) {
+		printf("hikptool nic_dfx -i %s -m %s\n", (char *)nic_name, sub_cmd_name[i]);
+		hikp_nic_dfx_set_cmd_para(i);
+		hikp_nic_dfx_cmd_execute(&self);
+	}
+
+	return 0;
+}
+
+static int collect_hikp_nic_info_log(void *nic_name)
+{
+	struct major_cmd_ctrl self = {0};
+	struct hikp_cmd_type type = {0};
+	int ret;
+
+	printf("hikptool nic_info -i %s\n", (char *)nic_name);
+	self.cmd_ptr = &type;
+	ret = hikp_nic_cmd_get_info_target(&self, (char *)nic_name);
+	if (ret) {
+		HIKP_ERROR_PRINT("failed to get bdf for %s.\n", (char *)nic_name);
+		return ret;
+	}
+
+	hikp_nic_info_cmd_execute(&self);
+	return 0;
+}
+
+static int collect_hikp_nic_notify_pkt_log(void *nic_name)
+{
+	struct major_cmd_ctrl self = {0};
+	struct hikp_cmd_type type = {0};
+	int ret;
+
+	printf("hikptool nic_notify_pkt -i %s\n", (char *)nic_name);
+	self.cmd_ptr = &type;
+	ret = hikp_nic_notify_pkt_get_target(&self, (char *)nic_name);
+	if (ret) {
+		HIKP_ERROR_PRINT("failed to get bdf for %s.\n", (char *)nic_name);
+		return ret;
+	}
+
+	hikp_nic_notify_pkt_cmd_execute(&self);
+	return 0;
+}
+
+static int collect_hikp_nic_port_fault_log(void *nic_name)
+{
+	struct major_cmd_ctrl self = {0};
+	struct hikp_cmd_type type = {0};
+	int ret;
+
+	printf("hikptool nic_port_fault -i %s\n", (char *)nic_name);
+	self.cmd_ptr = &type;
+	ret = hikp_nic_port_fault_get_target(&self, (char *)nic_name);
+	if (ret) {
+		HIKP_ERROR_PRINT("failed to get bdf for %s.\n", (char *)nic_name);
+		return ret;
+	}
+
+	hikp_nic_port_fault_cmd_execute(&self);
+	return 0;
+}
+
+static int collect_one_nic_hikp_log_compact(char *net_name, char *module, collect_cmd_handler_t hikp_pfn)
+{
+	char log_name[LOG_FILE_PATH_MAX_LEN] = {0};
+	int ret;
+
+	ret = snprintf(log_name, LOG_FILE_PATH_MAX_LEN, "%s_%s", net_name, module);
+	if (ret < 0 || (uint32_t)ret >= LOG_FILE_PATH_MAX_LEN)
+		return -EINVAL;
+
+	return hikp_collect_log(GROUP_NIC, log_name, hikp_pfn, (void *)net_name);
+}
+
+static int collect_one_nic_hikp_log(void *net_name)
+{
+	struct collect_nic_hikp_log_meta {
+		const char *module_name;
+		collect_cmd_handler_t hikp_pfn;
+	} nic_hikp_log_meta[] = {
+		{ "nic_fd", collect_hikp_nic_fd_log },
+		{ "nic_gro", collect_hikp_nic_gro_log },
+		{ "nic_ppp", collect_hikp_nic_ppp_log },
+		{ "nic_qos", collect_hikp_nic_qos_log },
+		{ "nic_queue", collect_hikp_nic_queue_log },
+		{ "nic_rss", collect_hikp_nic_rss_log },
+		{ "nic_torus", collect_hikp_nic_torus_log },
+		{ "nic_fec", collect_hikp_nic_fec_log },
+		{ "nic_dfx", collect_hikp_nic_dfx_log },
+		{ "nic_info", collect_hikp_nic_info_log },
+		{ "nic_notify_pkt", collect_hikp_nic_notify_pkt_log },
+		{ "nic_port_fault", collect_hikp_nic_port_fault_log },
+	};
+	size_t i;
+	int ret;
+
+	for (i = 0; i < HIKP_ARRAY_SIZE(nic_hikp_log_meta); ++i) {
+		ret = collect_one_nic_hikp_log_compact((char *)net_name,
+					nic_hikp_log_meta[i].module_name,
+					nic_hikp_log_meta[i].hikp_pfn);
+		if (ret)
+			HIKP_ERROR_PRINT("collect %s log failed: %d\n",
+					 nic_hikp_log_meta[i].module_name, ret);
+	}
+
+	return 0;
+}
+
+void collect_nic_log(void)
+{
+	collect_nic_debugfs_log();
+	hikp_collect_all_nic_cmd_log(collect_one_nic_hikp_log);
+}
diff --git a/info_collect/hikp_collect_pcie.c b/info_collect/hikp_collect_pcie.c
new file mode 100644
index 0000000..d3cd7ad
--- /dev/null
+++ b/info_collect/hikp_collect_pcie.c
@@ -0,0 +1,215 @@
+/*
+ * Copyright (c) 2024 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 <dirent.h>
+#include <string.h>
+#include <unistd.h>
+#include "hikp_collect_lib.h"
+#include "hikp_collect.h"
+#include "tool_lib.h"
+#include "hikptdev_plug.h"
+#include "pcie_link_ltssm.h"
+#include "pcie_statistics.h"
+#include "pcie_common.h"
+#include "pcie_reg_dump.h"
+
+#define PCIE_DEV_LEN 512
+#define PCIE_DEV_PATH "/sys/bus/pci/devices"
+#define MAX_NIMBUS_NUM_ALL 8
+
+/* Optimization barrier */
+#ifndef barrier
+/* The "volatile" is due to gcc bugs */
+# define barrier() __asm__ __volatile__("": : :"memory")
+#endif
+
+struct pcie_id_info {
+	uint32_t chip_id;
+	uint32_t port_id;
+};
+
+/* get pcie config space info */
+static void collect_pcie_common(char *pcie_dev_name)
+{
+	struct info_collect_cmd pcie_cmd_arr = {0};
+	int ret;
+
+	pcie_cmd_arr.group = GROUP_PCIE;
+	pcie_cmd_arr.log_name = pcie_dev_name;
+	pcie_cmd_arr.args[ARGS_IDX0] = "lspci";
+	pcie_cmd_arr.args[ARGS_IDX1] = "-vvvxxxx";
+	pcie_cmd_arr.args[ARGS_IDX2] = "-s";
+	pcie_cmd_arr.args[ARGS_IDX3] = pcie_dev_name;
+	pcie_cmd_arr.args[ARGS_IDX4] = NULL;
+	ret = hikp_collect_log(pcie_cmd_arr.group, pcie_cmd_arr.log_name,
+					 hikp_collect_exec, (void *)&pcie_cmd_arr);
+	if (ret)
+		HIKP_ERROR_PRINT("collect_pcie_common failed: %d\n", ret);
+}
+
+static void collect_pcie_single_cfg(void)
+{
+	char dev_name[PCIE_DEV_LEN];
+	struct dirent *ptr = NULL;
+	DIR *dir = NULL;
+
+	if ((dir = opendir(PCIE_DEV_PATH)) == NULL) {
+		perror("failed to open path \n");
+		return;
+	}
+
+	while ((ptr = readdir(dir)) != NULL) {
+		if ((strcmp(ptr->d_name, ".") == 0) || (strcmp(ptr->d_name, "..") == 0)) {
+			continue;
+		} else if (ptr->d_type == DT_LNK) {
+			memset(dev_name, 0, sizeof(dev_name));
+			strncpy(dev_name, ptr->d_name, sizeof(dev_name) - 1);
+			dev_name[sizeof(dev_name) - 1] = '\0';
+			collect_pcie_common(dev_name);
+		}
+	}
+
+	closedir(dir);
+}
+
+/* get pcie config tree info */
+static void collect_pcie_cfg_tree(void)
+{
+	struct info_collect_cmd pcie_cmd_arr = {
+		.group = GROUP_PCIE,
+		.log_name = "pcie_tree",
+		.args = {"lspci", "-tv", NULL},
+	};
+	int ret;
+
+	ret = hikp_collect_log(pcie_cmd_arr.group, pcie_cmd_arr.log_name,
+					 hikp_collect_exec, (void *)&pcie_cmd_arr);
+	if (ret)
+		HIKP_ERROR_PRINT("collect_pcie_cfg_tree failed: %d\n", ret);
+}
+
+static int pcie_mv_dumplog(void)
+{
+	struct info_collect_cmd pcie_cmd_arr = { 0 };
+
+	pcie_cmd_arr.group = GROUP_PCIE;
+	pcie_cmd_arr.args[ARGS_IDX0] = "mv";
+	pcie_cmd_arr.args[ARGS_IDX1] = dumpreg_log_file;
+
+	return hikp_move_files(&pcie_cmd_arr);
+}
+
+static int collect_pcie_local_info(void *data)
+{
+	struct pcie_id_info *info = (struct pcie_id_info *)data;
+	uint32_t port_id;
+
+	port_id = info->port_id;
+	printf("chip_id:%u, port_id:%u\n", info->chip_id, port_id);
+	/* do dump action for each port */
+	/* step 1  pcie trace */
+	printf("hikptool pcie_trace -i %u -s\n", port_id);
+	(void)pcie_ltssm_trace_show(port_id);
+	/* step 2  pcie link status */
+	printf("hikptool pcie_trace -i %u -f\n", port_id);
+	(void)pcie_ltssm_link_status_get(port_id);
+	/* step 3  pcie err cnt */
+	printf("hikptool pcie_info -i %u -es\n", port_id);
+	(void)pcie_error_state_get(port_id);
+	/* step 4  pcie pm trace */
+	printf("hikptool pcie_trace -i %u -pm\n",  port_id);
+	(void)pcie_pm_trace(port_id);
+
+	return 0;
+}
+
+static int pcie_port_distribution_info(void *data)
+{
+	uint32_t chip_id = *(uint32_t *)(data);
+	int ret;
+
+	printf("hikptool pcie_info -i %u -d\n",  chip_id);
+	ret = pcie_port_distribution_get(chip_id);
+	if (ret)
+		HIKP_ERROR_PRINT("pcie_port_distribution_get failed: %d\n", ret);
+	return ret;
+}
+
+static void collect_pcie_local(void)
+{
+	struct pcie_info_req_para req_data = { 0 };
+	char name[MAX_LOG_NAME_LEN + 1] = { 0 };
+	struct pcie_port_info *port_info = NULL;
+	struct hikp_cmd_ret *cmd_ret = NULL;
+	struct hikp_cmd_header req_header;
+	struct pcie_id_info info;
+	uint32_t port_num;
+	uint32_t port_id;
+	uint32_t i, j;
+	int ret;
+
+	for (i = 0; i < MAX_NIMBUS_NUM_ALL; i++) {
+		req_data.interface_id = i;
+
+		memset(name, 0, MAX_LOG_NAME_LEN + 1);
+		(void)snprintf(name, MAX_LOG_NAME_LEN, "pcie_local_nimbus_%u", i);
+
+		ret = hikp_collect_log(GROUP_PCIE, name, pcie_port_distribution_info, (void *)&i);
+		if (ret) {
+			HIKP_INFO_PRINT("Nimbus:%u hikp_collect_log pcie_port_distribution_info unsuccessful!\n", i);
+			return;
+		}
+
+		hikp_cmd_init(&req_header, PCIE_MOD, PCIE_INFO, INFO_DISTRIBUTION);
+		cmd_ret = hikp_cmd_alloc(&req_header, &req_data, sizeof(req_data));
+		ret = port_distribution_rsp_data_check(cmd_ret, &port_num);
+		if (ret) {
+			HIKP_ERROR_PRINT("port_distribution_rsp_data_check failed: %d\n", ret);
+			hikp_cmd_free(&cmd_ret);
+			return;
+		}
+
+		port_info = (struct pcie_port_info *)cmd_ret->rsp_data;
+		for (j = 0; j < port_num; j++) {
+			port_id = port_info->info_pair[j].port_id;
+			info.chip_id = i;
+			info.port_id = port_info->info_pair[j].port_id;
+
+			memset(name, 0, MAX_LOG_NAME_LEN + 1);
+			(void)snprintf(name, MAX_LOG_NAME_LEN, "pcie_local_port_%u", j);
+
+			ret = hikp_collect_log(GROUP_PCIE, name, collect_pcie_local_info, (void *)&info);
+			if (ret) {
+				HIKP_ERROR_PRINT("hikp_collect_log collect_pcie_local_info failed: %d\n", ret);
+				hikp_cmd_free(&cmd_ret);
+				return;
+			}
+			/* step 1  pcie dumpreg core level */
+			(void)pcie_dumpreg_do_dump(port_id, DUMP_GLOBAL_LEVEL);
+			(void)pcie_mv_dumplog();
+			/* step 2  pcie dumpreg port level */
+			(void)pcie_dumpreg_do_dump(port_id, DUMP_PORT_LEVEL);
+			(void)pcie_mv_dumplog();
+		}
+		hikp_cmd_free(&cmd_ret);
+	}
+}
+
+void collect_pcie_info(void)
+{
+	collect_pcie_cfg_tree();
+
+	collect_pcie_single_cfg();
+
+	collect_pcie_local();
+}
diff --git a/info_collect/hikp_collect_roce.c b/info_collect/hikp_collect_roce.c
new file mode 100644
index 0000000..baf2899
--- /dev/null
+++ b/info_collect/hikp_collect_roce.c
@@ -0,0 +1,489 @@
+/*
+ * Copyright (c) 2024 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_collect_lib.h"
+#include "hikp_collect.h"
+#include "tool_lib.h"
+#include "hikp_roce_bond.h"
+#include "hikp_roce_global_cfg.h"
+#include "hikp_roce_rst.h"
+#include "hikp_roce_timer.h"
+#include "hikp_roce_pkt.h"
+#include "hikp_roce_mdb.h"
+#include "hikp_roce_caep.h"
+#include "hikp_roce_qmm.h"
+#include "hikp_roce_trp.h"
+#include "hikp_roce_tsp.h"
+#include "hikp_roce_scc.h"
+#include "hikp_roce_gmv.h"
+
+static void collect_roce_devinfo_log(void)
+{
+	const struct info_collect_cmd roce_devinfo_cmd = {
+		.group = GROUP_ROCE,
+		.log_name = "ibv_devinfo",
+		.args = {"ibv_devinfo", NULL},
+	};
+	int ret;
+
+	ret = hikp_collect_log(roce_devinfo_cmd.group,
+			       roce_devinfo_cmd.log_name,
+			       hikp_collect_exec,
+			       (void *)&roce_devinfo_cmd);
+	if (ret)
+		HIKP_ERROR_PRINT("collect %s log failed: %d\n",
+				 roce_devinfo_cmd.log_name, ret);
+}
+
+static void collect_roce_cc_param_log(void)
+{
+	struct info_collect_cmd roce_cc_param_cmd = {
+		.group = GROUP_ROCE,
+		.log_name = "cc_param",
+		.args = {"cp", "-rf",
+			 "/sys/class/infiniband/*/ports/1/cc_param", NULL},
+	};
+	int ret;
+
+	ret = hikp_collect_log(roce_cc_param_cmd.group,
+			       roce_cc_param_cmd.log_name,
+			       hikp_collect_cp_glob_exec,
+			       (void *)&roce_cc_param_cmd);
+	if (ret)
+		HIKP_ERROR_PRINT("collect %s log failed: %d\n",
+				 roce_cc_param_cmd.log_name, ret);
+}
+
+static void collect_roce_sw_stats_log(void)
+{
+	struct info_collect_cmd roce_sw_stats_cmd = {
+		.group = GROUP_ROCE,
+		.log_name = "sw_stat",
+		.args = {"cat", "/sys/kernel/debug/hns_roce/*/sw_stat/sw_stat",
+			 NULL},
+	};
+	int ret;
+
+	ret = hikp_collect_log(roce_sw_stats_cmd.group,
+			       roce_sw_stats_cmd.log_name,
+			       hikp_collect_cat_glob_exec,
+			       (void *)&roce_sw_stats_cmd);
+	if (ret)
+		HIKP_ERROR_PRINT("collect %s log failed: %d\n",
+				 roce_sw_stats_cmd.log_name, ret);
+}
+
+static void collect_roce_res_stats_log(void)
+{
+	const struct info_collect_cmd roce_res_stats_cmd = {
+		.group = GROUP_ROCE,
+		.log_name = "rdma_res_show",
+		.args = {"rdma", "res", "show", NULL},
+	};
+	int ret;
+
+	ret = hikp_collect_log(roce_res_stats_cmd.group,
+			       roce_res_stats_cmd.log_name,
+			       hikp_collect_exec,
+			       (void *)&roce_res_stats_cmd);
+	if (ret)
+		HIKP_ERROR_PRINT("collect %s log failed: %d\n",
+				 roce_res_stats_cmd.log_name, ret);
+}
+
+static int collect_hikp_roce_gmv_log(void *nic_name)
+{
+	struct major_cmd_ctrl self = {0};
+	struct hikp_cmd_type type = {0};
+	uint32_t gmv_index;
+	int ret;
+
+	self.cmd_ptr = &type;
+	ret = hikp_roce_set_gmv_bdf((char *)nic_name);
+	if (ret) {
+		HIKP_ERROR_PRINT("failed to set roce_gmv bdf for %s.\n",
+				 (char *)nic_name);
+		return ret;
+	}
+
+	for (gmv_index = 0; gmv_index < ROCE_MAX_HIKPTOOL_GMV; gmv_index++) {
+		printf("hikptool roce_gmv -i %s -x %u\n", (char *)nic_name, gmv_index);
+		hikp_roce_set_gmv_index(gmv_index);
+		hikp_roce_gmv_execute(&self);
+	}
+
+	return 0;
+}
+
+static int collect_hikp_roce_scc_log(void *nic_name)
+{
+	struct major_cmd_ctrl self = {0};
+	struct hikp_cmd_type type = {0};
+	int ret;
+
+	self.cmd_ptr = &type;
+	ret = hikp_roce_set_scc_bdf((char *)nic_name);
+	if (ret) {
+		HIKP_ERROR_PRINT("failed to set roce_scc bdf for %s.\n",
+				 (char *)nic_name);
+		return ret;
+	}
+
+	printf("hikptool roce_scc -i %s -m COMMON\n", (char *)nic_name);
+	hikp_roce_set_scc_submodule(SCC_COMMON);
+	hikp_roce_scc_execute(&self);
+
+	printf("hikptool roce_scc -i %s -m DCQCN\n", (char *)nic_name);
+	hikp_roce_set_scc_submodule(DCQCN);
+	hikp_roce_scc_execute(&self);
+
+	printf("hikptool roce_scc -i %s -m DIP\n", (char *)nic_name);
+	hikp_roce_set_scc_submodule(DIP);
+	hikp_roce_scc_execute(&self);
+
+	printf("hikptool roce_scc -i %s -m HC3\n", (char *)nic_name);
+	hikp_roce_set_scc_submodule(HC3);
+	hikp_roce_scc_execute(&self);
+
+	printf("hikptool roce_scc -i %s -m LDCP\n", (char *)nic_name);
+	hikp_roce_set_scc_submodule(LDCP);
+	hikp_roce_scc_execute(&self);
+
+	printf("hikptool roce_scc -i %s -m CFG\n", (char *)nic_name);
+	hikp_roce_set_scc_submodule(CFG);
+	hikp_roce_scc_execute(&self);
+
+	return 0;
+}
+
+static int collect_hikp_roce_tsp_log(void *nic_name)
+{
+	struct major_cmd_ctrl self = {0};
+	struct hikp_cmd_type type = {0};
+	uint32_t bankid;
+	int ret;
+
+	self.cmd_ptr = &type;
+	ret = hikp_roce_set_tsp_bdf((char *)nic_name);
+	if (ret) {
+		HIKP_ERROR_PRINT("failed to set roce_tsp bdf for %s.\n",
+				 (char *)nic_name);
+		return ret;
+	}
+
+	hikp_roce_set_tsp_submodule(TSP_COMMON);
+	for (bankid = 0; bankid <= MAX_TSP_BANK_NUM; bankid++) {
+		hikp_roce_set_tsp_bankid(bankid);
+
+		printf("hikptool roce_tsp -i %s -m COMMON -b %u\n", (char *)nic_name, bankid);
+		hikp_roce_tsp_execute(&self);
+	}
+
+	hikp_roce_set_tsp_submodule(TGP_TMP);
+	for (bankid = 0; bankid <= MAX_TGP_TMP_BANK_NUM; bankid++) {
+		hikp_roce_set_tsp_bankid(bankid);
+
+		printf("hikptool roce_tsp -i %s -m TGP_TMP -b %u\n", (char *)nic_name, bankid);
+		hikp_roce_tsp_execute(&self);
+	}
+
+	printf("hikptool roce_tsp -i %s -m TDP\n", (char *)nic_name);
+	hikp_roce_set_tsp_submodule(TDP);
+	hikp_roce_tsp_execute(&self);
+
+	return 0;
+}
+
+static int collect_hikp_roce_trp_log(void *nic_name)
+{
+	struct major_cmd_ctrl self = {0};
+	struct hikp_cmd_type type = {0};
+	uint32_t bankid;
+	int ret;
+
+	self.cmd_ptr = &type;
+	ret = hikp_roce_set_trp_bdf((char *)nic_name);
+	if (ret) {
+		HIKP_ERROR_PRINT("failed to set roce_trp bdf for %s.\n",
+				 (char *)nic_name);
+		return ret;
+	}
+
+	hikp_roce_set_trp_submodule(TRP_COMMON);
+	for (bankid = 0; bankid <= TRP_MAX_BANK_NUM; bankid++) {
+		hikp_roce_set_trp_bankid(bankid);
+
+		printf("hikptool roce_trp -i %s -m COMMON -b %u\n", (char *)nic_name, bankid);
+		hikp_roce_trp_execute(&self);
+	}
+
+	printf("hikptool roce_trp -i %s -m TRP_RX\n", (char *)nic_name);
+	hikp_roce_set_trp_submodule(TRP_RX);
+	hikp_roce_trp_execute(&self);
+
+	hikp_roce_set_trp_submodule(GEN_AC);
+	for (bankid = 0; bankid <= GAC_MAX_BANK_NUM; bankid++) {
+		hikp_roce_set_trp_bankid(bankid);
+
+		printf("hikptool roce_trp -i %s -m GEN_AC -b %u\n", (char *)nic_name, bankid);
+		hikp_roce_trp_execute(&self);
+	}
+
+	hikp_roce_set_trp_submodule(PAYL);
+	for (bankid = 0; bankid <= PAYL_MAX_BANK_NUM; bankid++) {
+		hikp_roce_set_trp_bankid(bankid);
+
+		printf("hikptool roce_trp -i %s -m PAYL -b %u\n", (char *)nic_name, bankid);
+		hikp_roce_trp_execute(&self);
+	}
+
+	return 0;
+}
+
+static int collect_hikp_roce_qmm_log(void *nic_name)
+{
+	struct major_cmd_ctrl self = {0};
+	struct hikp_cmd_type type = {0};
+	uint32_t bankid;
+	int ret;
+
+	self.cmd_ptr = &type;
+	ret = hikp_roce_set_qmm_bdf((char *)nic_name);
+	if (ret) {
+		HIKP_ERROR_PRINT("failed to set roce_qmm bdf for %s.\n",
+				 (char *)nic_name);
+		return ret;
+	}
+
+	for (bankid = 0; bankid <= QMM_BANK_NUM; bankid++) {
+		hikp_roce_set_qmm_bankid(bankid);
+
+		printf("hikptool roce_qmm -i %s -b %u\n", (char *)nic_name, bankid);
+		hikp_roce_set_qmm_ext_flag(false);
+		hikp_roce_qmm_execute(&self);
+
+		printf("hikptool roce_qmm -i %s -b %u -e\n", (char *)nic_name, bankid);
+		hikp_roce_set_qmm_ext_flag(true);
+		hikp_roce_qmm_execute(&self);
+	}
+
+	return 0;
+}
+
+static int collect_hikp_roce_caep_log(void *nic_name)
+{
+	struct major_cmd_ctrl self = {0};
+	struct hikp_cmd_type type = {0};
+	int ret;
+
+	self.cmd_ptr = &type;
+	ret = hikp_roce_set_caep_bdf((char *)nic_name);
+	if (ret) {
+		HIKP_ERROR_PRINT("failed to set roce_caep bdf for %s.\n",
+				 (char *)nic_name);
+		return ret;
+	}
+
+	printf("hikptool roce_caep -i %s\n", (char *)nic_name);
+	hikp_roce_set_caep_mode(CAEP_ORIGIN);
+	hikp_roce_caep_execute(&self);
+
+	printf("hikptool roce_caep -i %s -e\n", (char *)nic_name);
+	hikp_roce_set_caep_mode(CAEP_EXT);
+	hikp_roce_caep_execute(&self);
+
+	return 0;
+}
+
+static int collect_hikp_roce_mdb_log(void *nic_name)
+{
+	struct major_cmd_ctrl self = {0};
+	struct hikp_cmd_type type = {0};
+	int ret;
+
+	self.cmd_ptr = &type;
+	ret = hikp_roce_set_mdb_bdf((char *)nic_name);
+	if (ret) {
+		HIKP_ERROR_PRINT("failed to set roce_mdb bdf for %s.\n",
+				 (char *)nic_name);
+		return ret;
+	}
+
+	printf("hikptool roce_mdb -i %s\n", (char *)nic_name);
+	hikp_roce_set_mdb_mode(ROCE_MDB_CMD);
+	hikp_roce_mdb_execute(&self);
+
+	printf("hikptool roce_mdb -i %s -e\n", (char *)nic_name);
+	hikp_roce_set_mdb_mode(ROCE_MDB_CMD_EXT);
+	hikp_roce_mdb_execute(&self);
+
+	return 0;
+}
+
+static int collect_hikp_roce_pkt_log(void *nic_name)
+{
+	struct major_cmd_ctrl self = {0};
+	struct hikp_cmd_type type = {0};
+	int ret;
+
+	self.cmd_ptr = &type;
+	ret = hikp_roce_set_pkt_bdf((char *)nic_name);
+	if (ret) {
+		HIKP_ERROR_PRINT("failed to set roce_pkt bdf for %s.\n",
+				 (char *)nic_name);
+		return ret;
+	}
+
+	printf("hikptool roce_pkt -i %s\n", (char *)nic_name);
+	hikp_roce_pkt_execute(&self);
+
+	return 0;
+}
+
+static int collect_hikp_roce_timer_log(void *nic_name)
+{
+	struct major_cmd_ctrl self = {0};
+	struct hikp_cmd_type type = {0};
+	int ret;
+
+	self.cmd_ptr = &type;
+	ret = hikp_roce_set_timer_bdf((char *)nic_name);
+	if (ret) {
+		HIKP_ERROR_PRINT("failed to set roce_timer bdf for %s.\n",
+				 (char *)nic_name);
+		return ret;
+	}
+
+	printf("hikptool roce_timer -i %s\n", (char *)nic_name);
+	hikp_roce_timer_execute(&self);
+
+	return 0;
+}
+
+static int collect_hikp_roce_rst_log(void *nic_name)
+{
+	struct major_cmd_ctrl self = {0};
+	struct hikp_cmd_type type = {0};
+	int ret;
+
+	self.cmd_ptr = &type;
+	ret = hikp_roce_set_rst_bdf((char *)nic_name);
+	if (ret) {
+		HIKP_ERROR_PRINT("failed to set roce_rst bdf for %s.\n",
+				 (char *)nic_name);
+		return ret;
+	}
+
+	printf("hikptool roce_rst -i %s\n", (char *)nic_name);
+	hikp_roce_rst_execute(&self);
+
+	return 0;
+}
+
+static int collect_hikp_roce_global_cfg_log(void *nic_name)
+{
+	struct major_cmd_ctrl self = {0};
+	struct hikp_cmd_type type = {0};
+	int ret;
+
+	self.cmd_ptr = &type;
+	ret = hikp_roce_set_global_cfg_bdf((char *)nic_name);
+	if (ret) {
+		HIKP_ERROR_PRINT("failed to set roce global_cfg bdf for %s.\n",
+				 (char *)nic_name);
+		return ret;
+	}
+
+	printf("hikptool roce_global_cfg -i %s\n", (char *)nic_name);
+	hikp_roce_global_cfg_execute(&self);
+
+	return 0;
+}
+
+static int collect_hikp_roce_bond_log(void *nic_name)
+{
+	struct major_cmd_ctrl self = {0};
+	struct hikp_cmd_type type = {0};
+	int ret;
+
+	self.cmd_ptr = &type;
+	ret = hikp_roce_set_bond_bdf((char *)nic_name);
+	if (ret) {
+		HIKP_ERROR_PRINT("failed to set roce bond bdf for %s.\n",
+				 (char *)nic_name);
+		return ret;
+	}
+
+	printf("hikptool roce_bond -i %s\n", (char *)nic_name);
+	hikp_roce_bond_execute(&self);
+
+	return 0;
+}
+
+static void collect_one_roce_hikp_log_compact(char *net_name, char *module,
+					      collect_cmd_handler_t hikp_pfn)
+{
+	char log_name[LOG_FILE_PATH_MAX_LEN] = {0};
+	int ret;
+
+	ret = snprintf(log_name, LOG_FILE_PATH_MAX_LEN, "%s_%s", net_name,
+		       module);
+	if (ret < 0 || (uint32_t)ret >= LOG_FILE_PATH_MAX_LEN) {
+		HIKP_ERROR_PRINT("failed to set %s path %d\n", net_name, ret);
+		return;
+	}
+
+	ret = hikp_collect_log(GROUP_ROCE, log_name, hikp_pfn, (void *)net_name);
+	if (ret)
+		HIKP_ERROR_PRINT("failed to get %s info %d\n", net_name, ret);
+}
+
+static int collect_one_roce_hikp_log(void *net_name)
+{
+	struct collect_roce_hikp_log_meta {
+		const char *module_name;
+		collect_cmd_handler_t hikp_pfn;
+	} roce_hikp_log_meta[] = {
+		{ "roce_bond", collect_hikp_roce_bond_log },
+		{ "roce_global_cfg", collect_hikp_roce_global_cfg_log },
+		{ "roce_rst", collect_hikp_roce_rst_log },
+		{ "roce_timer", collect_hikp_roce_timer_log },
+		{ "roce_pkt", collect_hikp_roce_pkt_log },
+		{ "roce_mdb", collect_hikp_roce_mdb_log },
+		{ "roce_caep", collect_hikp_roce_caep_log },
+		{ "roce_qmm", collect_hikp_roce_qmm_log },
+		{ "roce_trp", collect_hikp_roce_trp_log },
+		{ "roce_tsp", collect_hikp_roce_tsp_log },
+		{ "roce_scc", collect_hikp_roce_scc_log },
+		{ "roce_gmv", collect_hikp_roce_gmv_log },
+	};
+	size_t i;
+
+	for (i = 0; i < HIKP_ARRAY_SIZE(roce_hikp_log_meta); ++i) {
+		collect_one_roce_hikp_log_compact((char *)net_name,
+					roce_hikp_log_meta[i].module_name,
+					roce_hikp_log_meta[i].hikp_pfn);
+	}
+
+	return 0;
+}
+
+void collect_roce_log(void)
+{
+	collect_roce_devinfo_log();
+	collect_roce_cc_param_log();
+	collect_roce_sw_stats_log();
+	collect_roce_res_stats_log();
+	hikp_collect_all_nic_cmd_log(collect_one_roce_hikp_log);
+}
+
diff --git a/info_collect/hikp_collect_sas.c b/info_collect/hikp_collect_sas.c
new file mode 100644
index 0000000..11022dc
--- /dev/null
+++ b/info_collect/hikp_collect_sas.c
@@ -0,0 +1,453 @@
+/*
+ * Copyright (c) 2024 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_collect_lib.h"
+#include "hikp_collect.h"
+#include "tool_lib.h"
+#include "sas_tools_include.h"
+#include "sas_common.h"
+#include "sas_analy_queue.h"
+#include "sas_dump_reg.h"
+#include "sas_read_dev.h"
+#include "sas_read_errcode.h"
+#include "sata_dump_reg.h"
+
+#define CHIP_MAX_SIZE 10
+#define DIE_MAX_SIZE 10
+
+typedef int (*reg_info_func_t)(uint32_t, uint32_t);
+
+enum sata_dump_type {
+	SATA_DUMP_UNKNOWN = 0,
+	SATA_DUMP_GLOBAL,
+	SATA_DUMP_PORTX,
+};
+
+struct reg_op {
+	char *func_name;
+	reg_info_func_t func;
+};
+
+static int sas_sata_reg_log(void *data)
+{
+	struct reg_op *op = (struct reg_op *)data;
+	bool stop_flag = false;
+	uint32_t i, j;
+	int ret;
+
+	for (i = 0; i < CHIP_MAX_SIZE; i++) {
+		for (j = 0; j < DIE_MAX_SIZE; j++) {
+			ret = op->func(i, j);
+			if (ret) {
+				HIKP_ERROR_PRINT("%s chip%u die%u failed: %d\n", op->func_name,
+						i, j, ret);
+				/*
+				 * Stop collection when the die id is 0, indicating that the
+				 * current chip id is not supported.
+				 * */
+				if (j == 0)
+					stop_flag = true;
+
+				break;
+			}
+		}
+
+		if (stop_flag)
+			break;
+	}
+
+	return 0;
+}
+
+static void collect_sas_path_log(char *group)
+{
+	struct info_collect_cmd sas_path_cmd = {
+		.log_name = "ls_by-path",
+		.args = {"ls", "-l", "/dev/disk/by-path/", NULL},
+	};
+	int ret;
+
+	ret = hikp_collect_log(group, sas_path_cmd.log_name,
+			       hikp_collect_exec, (void *)&sas_path_cmd);
+	if (ret)
+		HIKP_ERROR_PRINT("collect %s log failed: %d\n", sas_path_cmd.log_name, ret);
+}
+
+static void collect_sas_phy_log(void)
+{
+	struct info_collect_cmd sas_phy_cmds[] = {
+		{
+			.log_name = "phy-invalid_dword_count",
+			.args = {"cat", "/sys/class/sas_phy/*/invalid_dword_count", NULL},
+		},
+		{
+			.log_name = "phy-negotiated_linkrate",
+			.args = {"cat", "/sys/class/sas_phy/*/negotiated_linkrate", NULL},
+		},
+		{
+			.log_name = "phy-enable",
+			.args = {"cat", "/sys/class/sas_phy/*/enable", NULL},
+		},
+	};
+	size_t i, size;
+	int ret;
+
+	size = HIKP_ARRAY_SIZE(sas_phy_cmds);
+	for (i = 0; i < size; i++) {
+		ret = hikp_collect_log(GROUP_SAS, sas_phy_cmds[i].log_name,
+				       hikp_collect_cat_glob_exec, (void *)&sas_phy_cmds[i]);
+		if (ret)
+			HIKP_ERROR_PRINT("collect %s log failed: %d\n",
+					 sas_phy_cmds[i].log_name, ret);
+	}
+}
+
+static void collect_sas_host_log(void)
+{
+	struct info_collect_cmd sas_host_cmds[] = {
+		{
+			.log_name = "host-nr_hw_queues",
+			.args = {"cat", "/sys/class/scsi_host/host*/nr_hw_queues", NULL},
+		},
+		{
+			.log_name = "host-intr",
+			.args = {"cat", "/sys/class/scsi_host/host*/intr*", NULL},
+		},
+	};
+	size_t i, size;
+	int ret;
+
+	size = HIKP_ARRAY_SIZE(sas_host_cmds);
+	for (i = 0; i < size; i++) {
+		ret = hikp_collect_log(GROUP_SAS, sas_host_cmds[i].log_name,
+				       hikp_collect_cat_glob_exec, (void *)&sas_host_cmds[i]);
+		if (ret)
+			HIKP_ERROR_PRINT("collect %s log failed: %d\n",
+					 sas_host_cmds[i].log_name, ret);
+	}
+}
+
+static void collect_sas_disk_log(void)
+{
+	struct info_collect_cmd sas_disk_cmds[] = {
+		{
+			.log_name = "disk-scheduler",
+			.args = {"cat", "/sys/block/sd*/queue/scheduler", NULL},
+		},
+		{
+			.log_name = "disk-max",
+			.args = {"cat", "/sys/block/sd*/queue/max*", NULL},
+		},
+		{
+			.log_name = "disk-state",
+			.args = {"cat", "/sys/block/sd*/device/state", NULL},
+		},
+	};
+	size_t i, size;
+	int ret;
+
+	size = HIKP_ARRAY_SIZE(sas_disk_cmds);
+	for (i = 0; i < size; i++) {
+		ret = hikp_collect_log(GROUP_SAS, sas_disk_cmds[i].log_name,
+				       hikp_collect_cat_glob_exec, (void *)&sas_disk_cmds[i]);
+		if (ret)
+			HIKP_ERROR_PRINT("collect %s log failed: %d\n",
+					 sas_disk_cmds[i].log_name, ret);
+	}
+}
+
+static int collect_sas_lsscsi_log_exec(void *data)
+{
+	const struct info_collect_cmd sas_lsscsi_cmds[] = {
+		{
+			.args = {"lsscsi", "-lg", NULL},
+		},
+		{
+			.args = {"lsscsi", "-pvt", NULL},
+		},
+		{
+			.args = {"lsscsi", "-H", NULL},
+		},
+	};
+	size_t i, size;
+	(void)data;
+	int ret;
+
+	size = HIKP_ARRAY_SIZE(sas_lsscsi_cmds);
+	for (i = 0; i < size; i++) {
+		ret = hikp_collect_exec((void *)&sas_lsscsi_cmds[i]);
+		if (ret)
+			return ret;
+	}
+
+	return 0;
+}
+
+static void collect_sas_lsscsi_log(char *group)
+{
+	int ret;
+
+	ret = hikp_collect_log(group, "lsscsi", collect_sas_lsscsi_log_exec, (void *)NULL);
+	if (ret)
+		HIKP_ERROR_PRINT("collect lsscsi log failed: %d\n", ret);
+}
+
+static void collect_sas_copy_files(void)
+{
+	struct info_collect_cmd sas_copy_cmds[] = {
+		{
+			.group = GROUP_SAS,
+			.log_name = "debugfs",
+			.args = {"cp", "-rf", "/sys/kernel/debug/hisi_sas/", NULL},
+		},
+		{
+			.group = GROUP_SAS,
+			.log_name = "parameters_hw",
+			.args = {"cp", "-rf", "/sys/module/hisi_sas_v3_hw/parameters/", NULL},
+		},
+		{
+			.group = GROUP_SAS,
+			.log_name = "parameters_main",
+			.args = {"cp", "-rf", "/sys/module/hisi_sas_main/parameters/", NULL},
+		},
+	};
+	size_t i, size;
+	int ret;
+
+	size = HIKP_ARRAY_SIZE(sas_copy_cmds);
+	for (i = 0; i < size; i++) {
+		ret = hikp_save_files(&sas_copy_cmds[i]);
+		if (ret)
+			HIKP_ERROR_PRINT("cp %s failed: %d\n",
+					 sas_copy_cmds[i].args[ARGS_IDX2], ret);
+	}
+}
+
+static int sas_anacq_info(uint32_t chip_id, uint32_t die_id)
+{
+	struct tool_sas_cmd cmd = {
+		.chip_id = chip_id,
+		.die_id = die_id,
+	};
+	int ret;
+
+	printf("hikptool sas_anacq -c %u -d %u -s\n", cmd.chip_id, cmd.die_id);
+	cmd.sas_cmd_type = ANACQ_NUM;
+	ret = sas_analy_cmd(&cmd);
+	if (ret) {
+		HIKP_ERROR_PRINT("collect cq number failed: %d\n", ret);
+		return ret;
+	}
+
+	printf("hikptool sas_anacq -c %u -d %u -p\n", cmd.chip_id, cmd.die_id);
+	cmd.sas_cmd_type = ANACQ_PRT;
+	ret = sas_analy_cmd(&cmd);
+	if (ret)
+		HIKP_ERROR_PRINT("collect cq read/write pointer failed: %d\n", ret);
+
+	return ret;
+}
+
+static int sas_anadq_info(uint32_t chip_id, uint32_t die_id)
+{
+	struct tool_sas_cmd cmd = {
+		.chip_id = chip_id,
+		.die_id = die_id,
+	};
+	int ret;
+
+	printf("hikptool sas_anadq -c %u -d %u -s\n", cmd.chip_id, cmd.die_id);
+	cmd.sas_cmd_type = ANADQ_NUM;
+	ret = sas_analy_cmd(&cmd);
+	if (ret) {
+		HIKP_ERROR_PRINT("collect dq num failed: %d\n", ret);
+		return ret;
+	}
+
+	printf("hikptool sas_anadq -c %u -d %u -p\n", cmd.chip_id, cmd.die_id);
+	cmd.sas_cmd_type = ANADQ_PRT;
+	ret = sas_analy_cmd(&cmd);
+	if (ret)
+		HIKP_ERROR_PRINT("collect dq read/write pointer failed: %d\n", ret);
+
+	return ret;
+}
+
+static int sas_dump_info(uint32_t chip_id, uint32_t die_id)
+{
+	struct tool_sas_cmd cmd = {
+		.chip_id = chip_id,
+		.die_id = die_id,
+	};
+	uint32_t i;
+	int ret;
+
+	printf("hikptool sas_dump -c %u -d %u -g\n", cmd.chip_id, cmd.die_id);
+	cmd.sas_cmd_type = DUMP_GLOBAL;
+	ret = sas_reg_dump(&cmd);
+	if (ret) {
+		HIKP_ERROR_PRINT("dump global failed: %d\n", ret);
+		return ret;
+	}
+
+	for (i = 0; i <= SAS_MAX_PHY_NUM; i++) {
+		printf("hikptool sas_dump -c %u -d %u -p %u\n", cmd.chip_id, cmd.die_id, i);
+		cmd.sas_cmd_type = DUMP_PHYX;
+		cmd.phy_id = i;
+		ret = sas_reg_dump(&cmd);
+		if (ret) {
+			HIKP_ERROR_PRINT("dump phy %u failed: %d\n", i, ret);
+			return ret;
+		}
+	}
+
+	printf("hikptool sas_dump -c %u -d %u -b\n", cmd.chip_id, cmd.die_id);
+	cmd.sas_cmd_type = DUMP_AXI;
+	ret = sas_reg_dump(&cmd);
+	if (ret)
+		HIKP_ERROR_PRINT("dump axi failed: %d\n", ret);
+
+	return ret;
+}
+
+static int sas_dev_info(uint32_t chip_id, uint32_t die_id)
+{
+	struct tool_sas_cmd cmd = {
+		.chip_id = chip_id,
+		.die_id = die_id,
+	};
+
+	printf("hikptool sas_dev -c %u -d %u -l\n", cmd.chip_id, cmd.die_id);
+	cmd.sas_cmd_type = DEV_LINK;
+	return sas_dev(&cmd);
+}
+
+static int sas_errcode_info(uint32_t chip_id, uint32_t die_id)
+{
+	struct tool_sas_cmd cmd = {
+		.chip_id = chip_id,
+		.die_id = die_id,
+	};
+	uint32_t i;
+	int ret;
+
+	for (i = 0; i < SAS_MAX_ERR_NUM; i++) {
+		printf("hikptool sas_errcode -c %u -d %u -t %u\n", cmd.chip_id, cmd.die_id, i);
+		cmd.sas_cmd_type = i;
+		ret = sas_errcode_read(&cmd);
+		if (ret) {
+			HIKP_ERROR_PRINT("collect errcode %u info failed: %d\n", i, ret);
+			return ret;
+		}
+	}
+
+	return 0;
+}
+
+static void collect_sas_reg_log(void)
+{
+	struct reg_op op = {0};
+	int ret;
+
+	op.func = sas_anacq_info;
+	op.func_name = "sas_anacq_info";
+	ret = hikp_collect_log(GROUP_SAS, "sas_anacq", sas_sata_reg_log, (void *)&op);
+	if (ret)
+		HIKP_INFO_PRINT("%s failed: %d\n", op.func_name, ret);
+
+	op.func = sas_anadq_info;
+	op.func_name = "sas_anadq_info";
+	ret = hikp_collect_log(GROUP_SAS, "sas_anadq", sas_sata_reg_log, (void *)&op);
+	if (ret)
+		HIKP_INFO_PRINT("%s failed: %d\n", op.func_name, ret);
+
+	op.func = sas_dump_info;
+	op.func_name = "sas_dump_info";
+	ret = hikp_collect_log(GROUP_SAS, "sas_dump", sas_sata_reg_log, (void *)&op);
+	if (ret)
+		HIKP_INFO_PRINT("%s failed: %d\n", op.func_name, ret);
+
+	op.func = sas_dev_info;
+	op.func_name = "sas_dev_info";
+	ret = hikp_collect_log(GROUP_SAS, "sas_dev", sas_sata_reg_log, (void *)&op);
+	if (ret)
+		HIKP_INFO_PRINT("%s failed: %d\n", op.func_name, ret);
+
+	op.func = sas_errcode_info;
+	op.func_name = "sas_errcode_info";
+	ret = hikp_collect_log(GROUP_SAS, "sas_errcode", sas_sata_reg_log, (void *)&op);
+	if (ret)
+		HIKP_INFO_PRINT("%s failed: %d\n", op.func_name, ret);
+}
+
+void collect_sas_log(void)
+{
+	collect_sas_phy_log();
+	collect_sas_host_log();
+	collect_sas_disk_log();
+	collect_sas_copy_files();
+	collect_sas_path_log(GROUP_SAS);
+	collect_sas_lsscsi_log(GROUP_SAS);
+	collect_sas_reg_log();
+}
+
+static int sata_reg_dump_info(uint32_t chip_id, uint32_t die_id)
+{
+	struct tool_sata_cmd cmd = {
+		.chip_id = chip_id,
+		.die_id = die_id,
+	};
+	uint32_t i;
+	int ret;
+
+	printf("hikptool sata_dump -c %u -d %u -g\n", cmd.chip_id, cmd.die_id);
+	cmd.sata_cmd_type = SATA_DUMP_GLOBAL;
+	ret = sata_reg_dump(&cmd);
+	if (ret) {
+		HIKP_ERROR_PRINT("dump global failed: %d\n", ret);
+		return ret;
+	}
+
+	cmd.sata_cmd_type = SATA_DUMP_PORTX;
+	for (i = 0; i <= 1; i++) {
+		printf("hikptool sata_dump -c %u -d %u -p %u\n", cmd.chip_id, cmd.die_id, i);
+		cmd.phy_id = i;
+		ret = sata_reg_dump(&cmd);
+		if (ret) {
+			HIKP_INFO_PRINT("dump port%u reg failed: %d\n", i, ret);
+			return ret;
+		}
+	}
+
+	return 0;
+}
+
+static void collect_sata_reg_log(void)
+{
+	struct reg_op op = {
+		.func = sata_reg_dump_info,
+		.func_name = "sata_reg_dump_info",
+	};
+	int ret;
+
+	ret = hikp_collect_log(GROUP_SATA, "reg_dump", sas_sata_reg_log, (void *)&op);
+	if (ret)
+		HIKP_INFO_PRINT("%s failed: %d\n", op.func_name, ret);
+}
+
+void collect_sata_log(void)
+{
+	collect_sas_path_log(GROUP_SATA);
+	collect_sas_lsscsi_log(GROUP_SATA);
+	collect_sata_reg_log();
+}
diff --git a/info_collect/hikp_collect_serdes.c b/info_collect/hikp_collect_serdes.c
new file mode 100644
index 0000000..31f29b3
--- /dev/null
+++ b/info_collect/hikp_collect_serdes.c
@@ -0,0 +1,244 @@
+/*
+ * Copyright (c) 2024 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_collect_lib.h"
+#include "hikp_collect.h"
+#include "tool_lib.h"
+#include "hikp_serdes.h"
+
+#define MAX_CHIP_NUM_SUPPORT 8
+#define HIP10_DIE_NUM        2
+#define HIP11_DIE_NUM        4
+#define HIP10_DIE_MACRO_NUM  7
+#define HIP11_DIE_MACRO_NUM  4
+
+struct serdes_macro_info {
+	uint8_t macro_id;
+	uint8_t ds_num;
+};
+
+struct serdes_log_cmd {
+	struct cmd_serdes_param *cmd;
+	unsigned char die_id;
+};
+
+struct serdes_macro_info g_hip10[] = {
+	{0, 4}, /* 0, 4: macro_id, ds_num */
+	{1, 4}, /* 1, 4: macro_id, ds_num */
+	{2, 8}, /* 2, 8: macro_id, ds_num */
+	{3, 8}, /* 3, 8: macro_id, ds_num */
+	{4, 8}, /* 4, 8: macro_id, ds_num */
+	{5, 8}, /* 5, 8: macro_id, ds_num */
+	{6, 8}, /* 6, 8: macro_id, ds_num */
+};
+
+struct serdes_macro_info g_hip11[] = {
+	{0, 4}, /* 0, 4: macro_id, ds_num */
+	{1, 8}, /* 1, 8: macro_id, ds_num */
+	{2, 4}, /* 2, 4: macro_id, ds_num */
+	{3, 4}, /* 3, 4: macro_id, ds_num */
+};
+
+static int is_chip_hip11(void)
+{
+	return get_chip_type() == CHIP_HIP11;
+}
+
+static unsigned char serdes_get_die_num(void)
+{
+	return is_chip_hip11() ? HIP11_DIE_NUM : HIP10_DIE_NUM;
+}
+
+static unsigned char serdes_get_die_macro_num(void)
+{
+	return is_chip_hip11() ? HIP11_DIE_MACRO_NUM : HIP10_DIE_MACRO_NUM;
+}
+
+static struct serdes_macro_info *serdes_get_macro_info(void)
+{
+	return is_chip_hip11() ? g_hip11 : g_hip10;
+}
+
+static int collect_serdes_info_process(void *data)
+{
+	struct serdes_log_cmd *log_cmd = (struct serdes_log_cmd *)data;
+	struct serdes_macro_info *macro_info = serdes_get_macro_info();
+	unsigned char die_macro_num = serdes_get_die_macro_num();
+	struct cmd_serdes_param *cmd = log_cmd->cmd;
+	const char *info_cmd_str[] = {"", "-k"};
+	unsigned char die_id = log_cmd->die_id;
+	/* 0, 1: brief info, detail info */
+	unsigned char subcmd_list[] = {0, 1};
+	unsigned char k, p;
+	int ret;
+
+	for (k = 0; k < die_macro_num; k++) {
+		cmd->macro_id = die_id * die_macro_num + k;
+		cmd->start_sds_id = 0;
+		cmd->sds_num = macro_info[k].ds_num;
+		for (p = 0; p < sizeof(subcmd_list) / sizeof(subcmd_list[0]); p++) {
+			cmd->sub_cmd = subcmd_list[p];
+			printf("hikptool serdes_info -i %u -s m%ud%u -n %u %s\n",
+			       cmd->chip_id, cmd->macro_id, cmd->start_sds_id,
+			       cmd->sds_num, info_cmd_str[cmd->sub_cmd]);
+			ret = hikp_serdes_get_reponse(cmd);
+			if (ret) {
+				HIKP_ERROR_PRINT("collect chip%u die%u macro%u "
+						 "serdes_info%u failed: %d\n",
+						 cmd->chip_id, die_id, k, subcmd_list[p], ret);
+
+				if (ret == -EINVAL)
+					return ret;
+			}
+		}
+	}
+
+	return 0;
+}
+
+static void collect_serdes_info_log(void)
+{
+	struct cmd_serdes_param serdes_info_cmd = {0};
+	unsigned char chip_num = MAX_CHIP_NUM_SUPPORT;
+	unsigned char die_num = serdes_get_die_num();
+	char log_name[MAX_LOG_NAME_LEN] = {0};
+	struct serdes_log_cmd log_cmd = {0};
+	bool stop = false;
+	unsigned char i, j;
+	int ret;
+
+	serdes_info_cmd.cmd_type = SERDES_KEY_INFO;
+	for (i = 0; i < chip_num; i++) {
+		for (j = 0; j < die_num; j++) {
+			serdes_info_cmd.chip_id = i;
+			log_cmd.cmd = &serdes_info_cmd;
+			log_cmd.die_id = j;
+			ret = snprintf(log_name, MAX_LOG_NAME_LEN, "serdes_info_c%ud%u", i, j);
+			if (ret < 0 || (uint32_t)(ret) >= MAX_LOG_NAME_LEN) {
+				HIKP_ERROR_PRINT("create serdes_info log name failed\n");
+				break;
+			}
+			ret = hikp_collect_log(GROUP_SERDES, log_name,
+					       collect_serdes_info_process,
+					       (void *)&log_cmd);
+			if (ret) {
+				/*
+				 * Stop collection when the die id is 0 and ret is -EINVAL,
+				 * indicating that the current chip id is not supported.
+				 */
+				if (j == 0 && ret == -EINVAL)
+					stop = true;
+
+				if (ret == -EINVAL)
+					break;
+
+				HIKP_ERROR_PRINT("%s chip%u die%u failed: %d\n", __func__,
+						 i, j, ret);
+			}
+		}
+
+		if (stop)
+			break;
+	}
+}
+
+static int collect_serdes_dump_process(void *data)
+{
+	const char *dump_cmd_str[HILINK_DUMP_TYPE_END] = {"cs", "ds", "csds", "ram", "subctrl"};
+	struct serdes_log_cmd *log_cmd = (struct serdes_log_cmd *)data;
+	struct serdes_macro_info *macro_info = serdes_get_macro_info();
+	unsigned char die_macro_num = serdes_get_die_macro_num();
+	struct cmd_serdes_param *cmd = log_cmd->cmd;
+	unsigned char die_id = log_cmd->die_id;
+	unsigned char subcmd_list[] = {0, 1, 4}; /* 0, 1, 4: cs, ds, subctrl reg */
+	unsigned char k, p, q;
+	int ret;
+
+	for (k = 0; k < die_macro_num; k++) {
+		cmd->macro_id = die_id * die_macro_num + k;
+		for (q = 0; q < macro_info[k].ds_num; q++) {
+			cmd->start_sds_id = q;
+			cmd->sds_num = 1;
+			for (p = 0; p < sizeof(subcmd_list) / sizeof(subcmd_list[0]); p++) {
+				cmd->sub_cmd = subcmd_list[p];
+				printf("hikptool serdes_dump -i %u -s m%ud%u -c %s\n",
+				       cmd->chip_id, cmd->macro_id, cmd->start_sds_id,
+				       dump_cmd_str[cmd->sub_cmd]);
+				ret = hikp_serdes_get_reponse(cmd);
+				if (ret) {
+					HIKP_ERROR_PRINT("collect chip%u die%u macro%u lane%u "
+							 "serdes_dump%u failed: %d\n",
+							 cmd->chip_id, die_id, k, q,
+							 subcmd_list[p], ret);
+
+					if (ret == -EINVAL)
+						return ret;
+				}
+			}
+		}
+	}
+
+	return 0;
+}
+
+static void collect_serdes_dump_log(void)
+{
+	struct cmd_serdes_param serdes_dump_cmd = {0};
+	unsigned char chip_num = MAX_CHIP_NUM_SUPPORT;
+	unsigned char die_num = serdes_get_die_num();
+	struct serdes_log_cmd log_cmd = {0};
+	char log_name[MAX_LOG_NAME_LEN] = {0};
+	unsigned char i, j;
+	bool stop = false;
+	int ret;
+
+	serdes_dump_cmd.cmd_type = SERDES_DUMP_REG;
+	for (i = 0; i < chip_num; i++) {
+		for (j = 0; j < die_num; j++) {
+			serdes_dump_cmd.chip_id = i;
+			log_cmd.cmd = &serdes_dump_cmd;
+			log_cmd.die_id = j;
+			ret = snprintf(log_name, MAX_LOG_NAME_LEN, "serdes_dump_c%ud%u", i, j);
+			if (ret < 0 || (uint32_t)(ret) >= MAX_LOG_NAME_LEN) {
+				HIKP_ERROR_PRINT("create serdes_info log name failed\n");
+				break;
+			}
+			ret = hikp_collect_log(GROUP_SERDES, log_name,
+					       collect_serdes_dump_process,
+					       (void *)&log_cmd);
+			if (ret) {
+				/*
+				 * Stop collection when the die id is 0 and ret is -EINVAL,
+				 * indicating that the current chip id is not supported.
+				 */
+				if (j == 0 && ret == -EINVAL)
+					stop = true;
+
+				if (ret == -EINVAL)
+					break;
+
+				HIKP_ERROR_PRINT("%s chip%u die%u failed: %d\n", __func__,
+						 i, j, ret);
+			}
+		}
+
+		if (stop)
+			break;
+	}
+}
+
+void collect_serdes_log(void)
+{
+	collect_serdes_info_log();
+	collect_serdes_dump_log();
+}
diff --git a/info_collect/hikp_collect_socip.c b/info_collect/hikp_collect_socip.c
new file mode 100644
index 0000000..6bccf6a
--- /dev/null
+++ b/info_collect/hikp_collect_socip.c
@@ -0,0 +1,272 @@
+/*
+ * Copyright (c) 2024 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 <glob.h>
+#include "hikp_collect_lib.h"
+#include "hikp_collect.h"
+#include "tool_lib.h"
+#include "hikptdev_plug.h"
+#include "hikp_socip.h"
+#include "hikp_collect_socip.h"
+
+#define SOCIP_MODULENUM	7
+#define MAX_CHIPNUM 30
+
+enum socip_collect_type {
+	GPIO,
+	SPI,
+	I2C,
+	SFC,
+	USB,
+	UART,
+	BT,
+};
+
+const char *g_socip_modulename[SOCIP_MODULENUM] = {
+	"gpio",
+	"spi",
+	"i2c",
+	"sfc",
+	"usb",
+	"uart",
+	"bt",
+};
+
+struct info_collect_cmd gpio_cmd_arr[] = {
+	{
+		.group = GROUP_SOCIP,
+		.log_name = "gpio",
+		.args = {"cat", "/sys/kernel/debug/gpio", NULL},
+	},
+};
+
+struct info_collect_cmd spi_cmd_arr[] = {
+	{
+		.group = GROUP_SOCIP,
+		.log_name = "spi",
+		.args = {"cat", "/sys/kernel/debug/dw_spi*/registers", NULL},
+	},
+
+	{
+		.group = GROUP_SOCIP,
+		.log_name = "spi",
+		.args = {"cat", "/sys/kernel/debug/hisi_spi*/registers", NULL},
+	},
+
+	{
+		.group = GROUP_SOCIP,
+		.log_name = "spi",
+		.args = {"cat", "/sys/class/spi_master/spi*/statistics/bytes", NULL},
+	},
+
+	{
+		.group = GROUP_SOCIP,
+		.log_name = "spi",
+		.args = {"cat", "/sys/class/spi_master/spi*/statistics/bytes_rx", NULL},
+	},
+
+	{
+		.group = GROUP_SOCIP,
+		.log_name = "spi",
+		.args = {"cat", "/sys/class/spi_master/spi*/statistics/bytes_tx", NULL},
+	},
+};
+
+struct info_collect_cmd i2c_cmd_arr[] = {
+	{
+		.group = GROUP_SOCIP,
+		.log_name = "i2c",
+		.args = {"ls", "/sys/class/i2c-adapter", NULL},
+	},
+
+	{
+		.group = GROUP_SOCIP,
+		.log_name = "i2c",
+		.args = {"ls", "/sys/class/i2c-dev", NULL},
+	},
+};
+
+struct info_collect_cmd sfc_cmd_arr[] = {
+	{
+		.group = GROUP_SOCIP,
+		.log_name = "sfc",
+		.args = {"mtd_debug", "info", "/dev/mtd0", NULL},
+	},
+};
+
+struct info_collect_cmd usb_cmd_arr[] = {
+	{
+		.group = GROUP_SOCIP,
+		.log_name = "usb",
+		.args = {"cat", "/sys/kernel/debug/usb/devices", NULL},
+	},
+};
+
+struct info_collect_cmd uart_cmd_arr[] = {
+	{
+		.group = GROUP_SOCIP,
+		.log_name = "uart",
+		.args = {"stty", "-F", "/dev/ttyAMA0", "-a", NULL},
+	},
+
+	{
+		.group = GROUP_SOCIP,
+		.log_name = "uart",
+		.args = {"cat", "/proc/tty/driver/ttyAMA", NULL},
+	},
+};
+
+struct info_collect_cmd bt_cmd_arr[] = {
+	{
+		.group = GROUP_SOCIP,
+		.log_name = "bt",
+		.args = {"ls", "/dev/ipmi0", NULL},
+	},
+};
+
+static int socip_get_dumpregparam(struct socip_collect_dumpreg_req req_struct,
+				  struct socip_dump_reg_req_data_t *req_data_ptr, uint8_t chip_id, int controller_num)
+{
+	req_data_ptr->controller_id = req_struct.controller_id[controller_num];
+	if (req_data_ptr->controller_id == CONTROLLER_MAX_NUM)
+		return -EINVAL;
+
+	req_data_ptr->chip_id = chip_id;
+	req_data_ptr->die_id = req_struct.die_id;
+	return 0;
+}
+
+static int collect_socip_dumpreglog(void *version)
+{
+	size_t i, msize;
+	uint8_t chip_id;
+	uint32_t cpu_version = *(uint32_t *)version;
+	int controller_num, ret;
+	struct hikp_cmd_ret *cmd_ret;
+	struct socip_collect_dumpreg_req *req_struct;
+	struct socip_dump_reg_req_data_t req_data = {0};
+	struct hikp_cmd_header req_header = {0};
+
+	switch (cpu_version) {
+	case CHIP_HIP09:
+	case CHIP_HIP10:
+	case CHIP_HIP10C:
+		req_struct = socip_hip09_hip10x_reg_arr;
+		msize = HIKP_ARRAY_SIZE(socip_hip09_hip10x_reg_arr);
+		break;
+	case CHIP_HIP11:
+		req_struct = socip_hip11_reg_arr;
+		msize = HIKP_ARRAY_SIZE(socip_hip11_reg_arr);
+		break;
+	default:
+		HIKP_ERROR_PRINT("Cpu version not support.\n");
+		return 0;
+	}
+
+	for (chip_id = 0; chip_id < MAX_CHIPNUM; chip_id++) {
+		for (i = 0; i < msize; i++) {
+			controller_num = 0;
+			while(controller_num < CONTROLLER_MAX_NUM) {
+				struct socip_dump_reg_req_data_t *req_data_ptr = &req_data;
+				ret = socip_get_dumpregparam(req_struct[i], req_data_ptr, chip_id, controller_num);
+				if (ret)
+					break;
+
+				hikp_cmd_init(&req_header, SOCIP_MOD, HIKP_SOCIP_CMD_DUMPREG,
+						req_struct[i].module);
+				cmd_ret = hikp_cmd_alloc(&req_header, &req_data, sizeof(req_data));
+				if (!cmd_ret || cmd_ret->status != 0) {
+					HIKP_ERROR_PRINT("hikp_cmd_alloc failed\n");
+					hikp_cmd_free(&cmd_ret);
+					return 0;
+				}
+				printf("%s\n", req_struct[i].reg_info);
+				printf("hikptool socip_dumpreg -c %u -d %u -m %u -i %u\n",req_data.chip_id,
+					req_data.die_id, req_struct[i].module, req_data.controller_id);
+				dump_reg_info(&cmd_ret->rsp_data[0], cmd_ret->rsp_data_num);
+				hikp_cmd_free(&cmd_ret);
+				controller_num++;
+			}
+		}
+	}
+
+	return 0;
+}
+
+static int collect_socip_modulelog(void *module)
+{
+	size_t i, msize;
+	int ret;
+
+	switch (*(int *)module) {
+	case GPIO:
+		msize = HIKP_ARRAY_SIZE(gpio_cmd_arr);
+		for (i = 0; i < msize; i++)
+			ret = hikp_collect_exec((void *)&gpio_cmd_arr[i]);
+		break;
+	case SPI:
+		msize = HIKP_ARRAY_SIZE(spi_cmd_arr);
+		for (i = 0; i < msize; i++)
+			ret = hikp_collect_cat_glob_exec((void *)&spi_cmd_arr[i]);
+		break;
+	case I2C:
+		msize = HIKP_ARRAY_SIZE(i2c_cmd_arr);
+		for (i = 0; i < msize; i++)
+			ret = hikp_collect_exec((void *)&i2c_cmd_arr[i]);
+		break;
+	case SFC:
+		msize = HIKP_ARRAY_SIZE(sfc_cmd_arr);
+		for (i = 0; i < msize; i++)
+			ret = hikp_collect_exec((void *)&sfc_cmd_arr[i]);
+		break;
+	case USB:
+		msize = HIKP_ARRAY_SIZE(usb_cmd_arr);
+		for (i = 0; i < msize; i++)
+			ret = hikp_collect_exec((void *)&usb_cmd_arr[i]);
+		break;
+	case UART:
+		msize = HIKP_ARRAY_SIZE(uart_cmd_arr);
+		for (i = 0; i < msize; i++)
+			ret = hikp_collect_exec((void *)&uart_cmd_arr[i]);
+		break;
+	case BT:
+		msize = HIKP_ARRAY_SIZE(bt_cmd_arr);
+		for (i = 0; i < msize; i++)
+			ret = hikp_collect_exec((void *)&bt_cmd_arr[i]);
+		break;
+	default:
+		ret = 0;
+		break;
+	}
+
+	return ret;
+}
+
+void collect_socip_log(void)
+{
+	int i, ret;
+	uint32_t cpu_version = get_chip_type();
+
+	for (i = 0; i < SOCIP_MODULENUM; i++) {
+		ret = hikp_collect_log(GROUP_SOCIP, (char *)g_socip_modulename[i],
+					collect_socip_modulelog, (void *)&i);
+		if (ret) {
+			HIKP_ERROR_PRINT("collect_socip_log %s arr failed: %d\n",
+					 g_socip_modulename[i], ret);
+		}
+	}
+
+	ret = hikp_collect_log(GROUP_SOCIP, "dumpreg", collect_socip_dumpreglog, (void *)&cpu_version);
+	if (ret)
+		HIKP_ERROR_PRINT("collect_socip_log dumpreg failed: %d\n", ret);
+}
diff --git a/info_collect/hikp_collect_socip.h b/info_collect/hikp_collect_socip.h
new file mode 100644
index 0000000..b8bb879
--- /dev/null
+++ b/info_collect/hikp_collect_socip.h
@@ -0,0 +1,238 @@
+/*
+ * Copyright (c) 2024 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_COLLECT_SOCIP_H
+#define HIKP_COLLECT_SOCIP_H
+
+#define MIN_DIE_ID  0
+#define NIMBUS_A_ID 0
+#define TOTEM_A_ID  1
+#define NIMBUS_B_ID 2
+#define TOTEM_C_ID  2
+#define TOTEM_B_ID  3
+#define INVALID_DIE_ID 0xFF
+#define MAX_DIE_ID  3
+#define CONTROLLER_MAX_NUM	12
+
+#define DIE_MIN_INDEX     0
+#define CPUDIE_MIN_INDEX  0
+#define CPUDIE_A_INDEX    0
+#define CPUDIE_B_INDEX    1
+#define CPUDIE_MAX_INDEX  1
+#define IODIE_MIN_INDEX   2
+#define IODIE_A0_INDEX    2
+#define IODIE_A1_INDEX    3
+#define IODIE_B0_INDEX    4
+#define IODIE_B1_INDEX    5
+#define IODIE_MAX_INDEX   5
+#define DIE_MAX_INDEX     5
+
+struct socip_collect_dumpreg_req {
+	char *reg_info;
+	uint8_t module;
+	uint8_t die_id;
+	uint8_t controller_id[CONTROLLER_MAX_NUM];
+};
+
+struct socip_collect_dumpreg_req socip_hip09_hip10x_reg_arr[] = {
+	{
+		.reg_info = "gpio_NA",
+		.module = HIKP_SOCIP_SUBCMD_DUMPREG_GPIO,
+		.die_id = NIMBUS_A_ID,
+		.controller_id = {0, 1, CONTROLLER_MAX_NUM},
+	},
+
+	{
+		.reg_info = "gpio_NB",
+		.module = HIKP_SOCIP_SUBCMD_DUMPREG_GPIO,
+		.die_id = NIMBUS_B_ID,
+		.controller_id = {0, 1, CONTROLLER_MAX_NUM},
+	},
+
+	{
+		.reg_info = "gpio_TA",
+		.module = HIKP_SOCIP_SUBCMD_DUMPREG_GPIO,
+		.die_id = TOTEM_A_ID,
+		.controller_id = {0, 1, CONTROLLER_MAX_NUM},
+	},
+
+	{
+		.reg_info = "gpio_TB",
+		.module = HIKP_SOCIP_SUBCMD_DUMPREG_GPIO,
+		.die_id = TOTEM_B_ID,
+		.controller_id = {0, 1, CONTROLLER_MAX_NUM},
+	},
+
+	{
+		.reg_info = "i2c_NA",
+		.module = HIKP_SOCIP_SUBCMD_DUMPREG_I2C,
+		.die_id = NIMBUS_A_ID,
+		.controller_id = {0, 1, 5, CONTROLLER_MAX_NUM},
+	},
+
+	{
+		.reg_info = "i2c_NB",
+		.module = HIKP_SOCIP_SUBCMD_DUMPREG_I2C,
+		.die_id = NIMBUS_A_ID,
+		.controller_id = {0, 1, 5, CONTROLLER_MAX_NUM},
+	},
+
+	{
+		.reg_info = "spi_NA",
+		.module = HIKP_SOCIP_SUBCMD_DUMPREG_SPI,
+		.die_id = NIMBUS_A_ID,
+		.controller_id = {0, CONTROLLER_MAX_NUM},
+	},
+
+	{
+		.reg_info = "spi_NB",
+		.module = HIKP_SOCIP_SUBCMD_DUMPREG_SPI,
+		.die_id = NIMBUS_B_ID,
+		.controller_id = {0, CONTROLLER_MAX_NUM},
+	},
+
+	{
+		.reg_info = "sfc_NA",
+		.module = HIKP_SOCIP_SUBCMD_DUMPREG_SFC,
+		.die_id = NIMBUS_A_ID,
+		.controller_id = {0, 1, CONTROLLER_MAX_NUM},
+	},
+
+	{
+		.reg_info = "sfc_NB",
+		.module = HIKP_SOCIP_SUBCMD_DUMPREG_SFC,
+		.die_id = NIMBUS_B_ID,
+		.controller_id = {0, 1, CONTROLLER_MAX_NUM},
+	},
+
+	{
+		.reg_info = "btc_NA",
+		.module = HIKP_SOCIP_SUBCMD_DUMPREG_SFC,
+		.die_id = NIMBUS_A_ID,
+		.controller_id = {0, CONTROLLER_MAX_NUM},
+	},
+
+	{
+		.reg_info = "btc_NB",
+		.module = HIKP_SOCIP_SUBCMD_DUMPREG_SFC,
+		.die_id = NIMBUS_B_ID,
+		.controller_id = {0, CONTROLLER_MAX_NUM},
+	},
+};
+
+struct socip_collect_dumpreg_req socip_hip11_reg_arr[] = {
+	{
+		.reg_info = "gpio_IOA0",
+		.module = HIKP_SOCIP_SUBCMD_DUMPREG_GPIO,
+		.die_id = IODIE_A0_INDEX,
+		.controller_id = {0, CONTROLLER_MAX_NUM},
+	},
+
+	{
+		.reg_info = "gpio_IOA1",
+		.module = HIKP_SOCIP_SUBCMD_DUMPREG_GPIO,
+		.die_id = IODIE_A1_INDEX,
+		.controller_id = {0, CONTROLLER_MAX_NUM},
+	},
+
+	{
+		.reg_info = "gpio_IOB0",
+		.module = HIKP_SOCIP_SUBCMD_DUMPREG_GPIO,
+		.die_id = IODIE_B0_INDEX,
+		.controller_id = {0, CONTROLLER_MAX_NUM},
+	},
+
+	{
+		.reg_info = "gpio_IOB1",
+		.module = HIKP_SOCIP_SUBCMD_DUMPREG_GPIO,
+		.die_id = IODIE_B1_INDEX,
+		.controller_id = {0, CONTROLLER_MAX_NUM},
+	},
+
+	{
+		.reg_info = "gpio_CA",
+		.module = HIKP_SOCIP_SUBCMD_DUMPREG_GPIO,
+		.die_id = CPUDIE_A_INDEX,
+		.controller_id = {0, 1, CONTROLLER_MAX_NUM},
+	},
+
+	{
+		.reg_info = "gpio_CB",
+		.module = HIKP_SOCIP_SUBCMD_DUMPREG_GPIO,
+		.die_id = CPUDIE_B_INDEX,
+		.controller_id = {0, 1, CONTROLLER_MAX_NUM},
+	},
+
+	{
+		.reg_info = "i2c_IOA0",
+		.module = HIKP_SOCIP_SUBCMD_DUMPREG_I2C,
+		.die_id = IODIE_A0_INDEX,
+		.controller_id = {0, 1, CONTROLLER_MAX_NUM},
+	},
+
+	{
+		.reg_info = "i2c_IOA1",
+		.module = HIKP_SOCIP_SUBCMD_DUMPREG_I2C,
+		.die_id = IODIE_A1_INDEX,
+		.controller_id = {0, 1, CONTROLLER_MAX_NUM},
+	},
+
+	{
+		.reg_info = "i2c_IOB0",
+		.module = HIKP_SOCIP_SUBCMD_DUMPREG_I2C,
+		.die_id = IODIE_B0_INDEX,
+		.controller_id = {0, 1, CONTROLLER_MAX_NUM},
+	},
+
+	{
+		.reg_info = "i2c_IOB1",
+		.module = HIKP_SOCIP_SUBCMD_DUMPREG_I2C,
+		.die_id = IODIE_B1_INDEX,
+		.controller_id = {0, 1, CONTROLLER_MAX_NUM},
+	},
+
+	{
+		.reg_info = "i2c_CA",
+		.module = HIKP_SOCIP_SUBCMD_DUMPREG_I2C,
+		.die_id = CPUDIE_A_INDEX,
+		.controller_id = {0, CONTROLLER_MAX_NUM},
+	},
+
+	{
+		.reg_info = "i2c_CB",
+		.module = HIKP_SOCIP_SUBCMD_DUMPREG_I2C,
+		.die_id = CPUDIE_B_INDEX,
+		.controller_id = {0, CONTROLLER_MAX_NUM},
+	},
+
+	{
+		.reg_info = "spi_CB",
+		.module = HIKP_SOCIP_SUBCMD_DUMPREG_SPI,
+		.die_id = CPUDIE_B_INDEX,
+		.controller_id = {0, CONTROLLER_MAX_NUM},
+	},
+
+	{
+		.reg_info = "sfc_CA",
+		.module = HIKP_SOCIP_SUBCMD_DUMPREG_SFC,
+		.die_id = CPUDIE_A_INDEX,
+		.controller_id = {0, CONTROLLER_MAX_NUM},
+	},
+
+	{
+		.reg_info = "BTC_IOB0",
+		.module = HIKP_SOCIP_SUBCMD_DUMPREG_SFC,
+		.die_id = IODIE_B0_INDEX,
+		.controller_id = {0, CONTROLLER_MAX_NUM},
+	},
+};
+#endif /* HIKP_COLLECT_SOCIP_H */
diff --git a/net/nic/nic_dfx/hikp_nic_dfx.c b/net/nic/nic_dfx/hikp_nic_dfx.c
index c42b8e7..3bc4e05 100644
--- a/net/nic/nic_dfx/hikp_nic_dfx.c
+++ b/net/nic/nic_dfx/hikp_nic_dfx.c
@@ -404,6 +404,13 @@ static const struct dfx_type_name_parse g_dfx_ssu_name_parse[] = {
 		dfx_ssu_type_64_tx_comm_stats,		HIKP_ARRAY_SIZE(dfx_ssu_type_64_tx_comm_stats)},
 };
 
+void hikp_nic_dfx_set_cmd_para(int idx)
+{
+	g_dfx_param.sub_cmd_code = g_dfx_module_parse[idx].sub_cmd_code;
+	g_dfx_param.module_idx = idx;
+	g_dfx_param.flag |= MODULE_SET_FLAG;
+}
+
 static void dfx_help_info(const struct major_cmd_ctrl *self)
 {
 	printf("\n  Usage: %s %s\n", self->cmd_ptr->name, "-i <interface>\n");
@@ -421,7 +428,7 @@ static int hikp_cmd_dfx_help(struct major_cmd_ctrl *self, const char *argv)
 	return 0;
 }
 
-static int hikp_nic_cmd_dfx_target(struct major_cmd_ctrl *self, const char *argv)
+int hikp_nic_cmd_dfx_target(struct major_cmd_ctrl *self, const char *argv)
 {
 	self->err_no = tool_check_and_get_valid_bdf_id(argv, &(g_dfx_param.target));
 	if (self->err_no != 0) {
@@ -714,7 +721,7 @@ static void hikp_nic_dfx_print(const struct nic_dfx_rsp_head_t *rsp_head, uint32
 	printf("################### ====== dump end ====== ######################\n");
 }
 
-static void hikp_nic_dfx_cmd_execute(struct major_cmd_ctrl *self)
+void hikp_nic_dfx_cmd_execute(struct major_cmd_ctrl *self)
 {
 	struct nic_dfx_rsp_head_t rsp_head = { 0 };
 	struct nic_dfx_rsp_head_t tmp_head = { 0 };
diff --git a/net/nic/nic_dfx/hikp_nic_dfx.h b/net/nic/nic_dfx/hikp_nic_dfx.h
index 38f76aa..d77bbc3 100644
--- a/net/nic/nic_dfx/hikp_nic_dfx.h
+++ b/net/nic/nic_dfx/hikp_nic_dfx.h
@@ -149,4 +149,7 @@ struct dfx_type_name_parse {
 	uint32_t reg_num;
 };
 
+int hikp_nic_cmd_dfx_target(struct major_cmd_ctrl *self, const char *argv);
+void hikp_nic_dfx_cmd_execute(struct major_cmd_ctrl *self);
+void hikp_nic_dfx_set_cmd_para(int idx);
 #endif /* HIKP_NIC_DFX_H */
diff --git a/net/nic/nic_fd/hikp_nic_fd.c b/net/nic/nic_fd/hikp_nic_fd.c
index fb9333a..d19d7c8 100644
--- a/net/nic/nic_fd/hikp_nic_fd.c
+++ b/net/nic/nic_fd/hikp_nic_fd.c
@@ -109,6 +109,13 @@ static const struct fd_feature_cmd g_fd_feature_cmd[] = {
 	 hikp_nic_query_fd_counter, hikp_nic_show_fd_counter},
 };
 
+void hikp_nic_set_fd_idx(int feature_idx, int stage_no)
+{
+	g_fd_param.id = -1;
+	g_fd_param.feature_idx = feature_idx;
+	g_fd_param.stage_no = stage_no;
+}
+
 static int hikp_nic_fd_cmd_help(struct major_cmd_ctrl *self, const char *argv)
 {
 	printf("\n  Usage: %s %s\n", self->cmd_ptr->name, "-i <device>");
@@ -923,7 +930,7 @@ static int hikp_nic_fd_check_input_param(struct major_cmd_ctrl *self,
 	return 0;
 }
 
-static void hikp_nic_fd_cmd_execute(struct major_cmd_ctrl *self)
+void hikp_nic_fd_cmd_execute(struct major_cmd_ctrl *self)
 {
 	struct bdf_t *bdf = &g_fd_param.target.bdf;
 	const struct fd_feature_cmd *fd_cmd;
@@ -983,7 +990,7 @@ out:
 	hikp_nic_fd_data_free(fd_data);
 }
 
-static int hikp_nic_cmd_get_fd_target(struct major_cmd_ctrl *self, const char *argv)
+int hikp_nic_cmd_get_fd_target(struct major_cmd_ctrl *self, const char *argv)
 {
 	self->err_no = tool_check_and_get_valid_bdf_id(argv, &(g_fd_param.target));
 	if (self->err_no != 0) {
diff --git a/net/nic/nic_fd/hikp_nic_fd.h b/net/nic/nic_fd/hikp_nic_fd.h
index 3f409d0..ce363c9 100644
--- a/net/nic/nic_fd/hikp_nic_fd.h
+++ b/net/nic/nic_fd/hikp_nic_fd.h
@@ -224,4 +224,8 @@ struct fd_feature_cmd {
 	void (*show)(const void *data);
 };
 
+int hikp_nic_cmd_get_fd_target(struct major_cmd_ctrl *self, const char *argv);
+void hikp_nic_fd_cmd_execute(struct major_cmd_ctrl *self);
+void hikp_nic_set_fd_idx(int feature_idx, int stage_no);
+
 #endif /* HIKP_NIC_FD_H */
diff --git a/net/nic/nic_fec/hikp_nic_fec.c b/net/nic/nic_fec/hikp_nic_fec.c
index 5a34bfd..13c6e13 100644
--- a/net/nic/nic_fec/hikp_nic_fec.c
+++ b/net/nic/nic_fec/hikp_nic_fec.c
@@ -108,7 +108,7 @@ static void hikp_nic_fec_err_show(const struct nic_fec_err_info *info)
 	printf("#################### END #######################\n");
 }
 
-static void hikp_nic_fec_cmd_execute(struct major_cmd_ctrl *self)
+void hikp_nic_fec_cmd_execute(struct major_cmd_ctrl *self)
 {
 	struct bdf_t *bdf = &g_fec_target.bdf;
 	struct nic_fec_err_info info = { 0 };
@@ -136,7 +136,7 @@ static int hikp_nic_fec_cmd_help(struct major_cmd_ctrl *self, const char *argv)
 	return 0;
 }
 
-static int hikp_nic_fec_get_target(struct major_cmd_ctrl *self, const char *argv)
+int hikp_nic_fec_get_target(struct major_cmd_ctrl *self, const char *argv)
 {
 	self->err_no = tool_check_and_get_valid_bdf_id(argv, &g_fec_target);
 	if (self->err_no != 0) {
diff --git a/net/nic/nic_fec/hikp_nic_fec.h b/net/nic/nic_fec/hikp_nic_fec.h
index 7996273..79a87b5 100644
--- a/net/nic/nic_fec/hikp_nic_fec.h
+++ b/net/nic/nic_fec/hikp_nic_fec.h
@@ -69,4 +69,6 @@ struct nic_fec_err_info {
 	};
 };
 
+int hikp_nic_fec_get_target(struct major_cmd_ctrl *self, const char *argv);
+void hikp_nic_fec_cmd_execute(struct major_cmd_ctrl *self);
 #endif /* HIKP_NIC_FEC_H */
diff --git a/net/nic/nic_ft/hikp_nic_port_fault.c b/net/nic/nic_ft/hikp_nic_port_fault.c
index 5f78cdd..331b1ec 100644
--- a/net/nic/nic_ft/hikp_nic_port_fault.c
+++ b/net/nic/nic_ft/hikp_nic_port_fault.c
@@ -80,7 +80,7 @@ static void hikp_nic_port_fault_show(struct nic_port_fault_status *info)
 	printf("#################### END #######################\n");
 }
 
-static void hikp_nic_port_fault_cmd_execute(struct major_cmd_ctrl *self)
+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 = { 0 };
@@ -108,7 +108,7 @@ static int hikp_nic_port_fault_cmd_help(struct major_cmd_ctrl *self, const char
 	return 0;
 }
 
-static int hikp_nic_port_fault_get_target(struct major_cmd_ctrl *self, const char *argv)
+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) {
diff --git a/net/nic/nic_ft/hikp_nic_port_fault.h b/net/nic/nic_ft/hikp_nic_port_fault.h
index 7db54f7..9c7e4b2 100644
--- a/net/nic/nic_ft/hikp_nic_port_fault.h
+++ b/net/nic/nic_ft/hikp_nic_port_fault.h
@@ -51,4 +51,6 @@ struct nic_port_fault_status {
 	uint8_t hilink_ref_status;
 };
 
+int hikp_nic_port_fault_get_target(struct major_cmd_ctrl *self, const char *argv);
+void hikp_nic_port_fault_cmd_execute(struct major_cmd_ctrl *self);
 #endif /* HIKP_NIC_PORT_FAULT_H */
diff --git a/net/nic/nic_gro/hikp_nic_gro.c b/net/nic/nic_gro/hikp_nic_gro.c
index 19395af..d821a47 100644
--- a/net/nic/nic_gro/hikp_nic_gro.c
+++ b/net/nic/nic_gro/hikp_nic_gro.c
@@ -53,7 +53,7 @@ static void hikp_nic_gro_show(const struct nic_gro_info *info)
 	printf("#################### END #######################\n");
 }
 
-static void hikp_nic_gro_cmd_execute(struct major_cmd_ctrl *self)
+void hikp_nic_gro_cmd_execute(struct major_cmd_ctrl *self)
 {
 	struct bdf_t *bdf = &g_gro_target.bdf;
 	struct nic_gro_info info = { 0 };
@@ -81,7 +81,7 @@ static int hikp_nic_gro_cmd_help(struct major_cmd_ctrl *self, const char *argv)
 	return 0;
 }
 
-static int hikp_nic_gro_get_target(struct major_cmd_ctrl *self, const char *argv)
+int hikp_nic_gro_get_target(struct major_cmd_ctrl *self, const char *argv)
 {
 	self->err_no = tool_check_and_get_valid_bdf_id(argv, &g_gro_target);
 	if (self->err_no != 0) {
diff --git a/net/nic/nic_gro/hikp_nic_gro.h b/net/nic/nic_gro/hikp_nic_gro.h
index 49328e6..ae58703 100644
--- a/net/nic/nic_gro/hikp_nic_gro.h
+++ b/net/nic/nic_gro/hikp_nic_gro.h
@@ -43,4 +43,6 @@ struct nic_gro_info {
 	uint32_t max_coal_bd_num;
 };
 
+int hikp_nic_gro_get_target(struct major_cmd_ctrl *self, const char *argv);
+void hikp_nic_gro_cmd_execute(struct major_cmd_ctrl *self);
 #endif /* HIKP_NIC_GRO_H */
diff --git a/net/nic/nic_info/hikp_nic_info.c b/net/nic/nic_info/hikp_nic_info.c
index 49f143f..6fb17a2 100644
--- a/net/nic/nic_info/hikp_nic_info.c
+++ b/net/nic/nic_info/hikp_nic_info.c
@@ -37,7 +37,7 @@ static int hikp_nic_cmd_get_info_help(struct major_cmd_ctrl *self, const char *a
 	return 0;
 }
 
-static int hikp_nic_cmd_get_info_target(struct major_cmd_ctrl *self, const char *argv)
+int hikp_nic_cmd_get_info_target(struct major_cmd_ctrl *self, const char *argv)
 {
 	self->err_no = tool_check_and_get_valid_bdf_id(argv, &(g_info_param.target));
 	if (self->err_no != 0) {
@@ -305,7 +305,7 @@ static void hikp_nic_info_print_cur_vf(const struct bdf_t *bdf)
 	}
 }
 
-static void hikp_nic_info_cmd_execute(struct major_cmd_ctrl *self)
+void hikp_nic_info_cmd_execute(struct major_cmd_ctrl *self)
 {
 	struct bdf_t *bdf = &g_info_param.target.bdf;
 
diff --git a/net/nic/nic_info/hikp_nic_info.h b/net/nic/nic_info/hikp_nic_info.h
index b1dd7dc..83323e8 100644
--- a/net/nic/nic_info/hikp_nic_info.h
+++ b/net/nic/nic_info/hikp_nic_info.h
@@ -77,4 +77,6 @@ enum nic_info_mac_type {
 	MAC_TYPE_MAX,
 };
 
+void hikp_nic_info_cmd_execute(struct major_cmd_ctrl *self);
+int hikp_nic_cmd_get_info_target(struct major_cmd_ctrl *self, const char *argv);
 #endif /* HIKP_NIC_INFO_H */
diff --git a/net/nic/nic_log/hikp_nic_log.c b/net/nic/nic_log/hikp_nic_log.c
index f182d25..be23ca3 100644
--- a/net/nic/nic_log/hikp_nic_log.c
+++ b/net/nic/nic_log/hikp_nic_log.c
@@ -23,6 +23,7 @@
 #include "hikp_nic_log.h"
 
 static struct log_param g_log_param = { 0 };
+static char g_log_path[OP_LOG_FILE_PATH_MAXLEN] = {0};
 
 static int hikp_nic_cmd_log_help(struct major_cmd_ctrl *self, const char *argv)
 {
@@ -49,7 +50,6 @@ static int hikp_nic_cmd_log_target(struct major_cmd_ctrl *self, const char *argv
 
 static int hikp_nic_write_data_to_file(uint8_t *data, uint32_t len)
 {
-	uint8_t file_path[OP_LOG_FILE_PATH_MAXLEN] = { 0 };
 	uint8_t file_name[MAX_LOG_NAME_LEN] = { 0 };
 	size_t write_cnt;
 	FILE *fp = NULL;
@@ -59,23 +59,23 @@ static int hikp_nic_write_data_to_file(uint8_t *data, uint32_t len)
 	if (ret < 0)
 		return ret;
 
-	ret = snprintf((char *)file_path, sizeof(file_path), HIKP_LOG_DIR_PATH"%s", file_name);
+	ret = snprintf(g_log_path, sizeof(g_log_path), HIKP_LOG_DIR_PATH"%s", file_name);
 	if (ret < 0) {
 		HIKP_ERROR_PRINT("creat log file path fail.\n");
 		return -EIO;
 	}
-	(void)remove((const char *)file_path);
-	fp = fopen((char *)file_path, "w+");
+	(void)remove((const char *)g_log_path);
+	fp = fopen(g_log_path, "w+");
 	if (fp == NULL) {
-		HIKP_ERROR_PRINT("open %s failed, errno is %d\n", file_path, errno);
+		HIKP_ERROR_PRINT("open %s failed, errno is %d\n", g_log_path, errno);
 		return -errno;
 	}
 	write_cnt = fwrite(data, 1, len, fp);
 	if (write_cnt != len)
-		HIKP_ERROR_PRINT("write %s failed, write cnt %lu.\n", file_path, write_cnt);
+		HIKP_ERROR_PRINT("write %s failed, write cnt %lu.\n", g_log_path, write_cnt);
 
-	printf("dump m7 log completed, log file: %s.\n", file_path);
-	(void)chmod((char *)file_path, 0440);
+	printf("dump m7 log completed, log file: %s.\n", g_log_path);
+	(void)chmod(g_log_path, 0440);
 	(void)fclose(fp);
 	return 0;
 }
@@ -199,6 +199,29 @@ static void hikp_nic_log_cmd_execute(struct major_cmd_ctrl *self)
 	self->err_no = hikp_nic_dump_m7_log(self);
 }
 
+const char *hikp_info_collect_get_log_path(void)
+{
+	return (const char *)g_log_path;
+}
+
+int hikp_info_collect_nic_log(void *data)
+{
+	struct nic_log_collect_param *param = (struct nic_log_collect_param *)data;
+	struct major_cmd_ctrl *major_cmd = get_major_cmd();
+	int ret;
+
+	memset(&g_log_param, 0, sizeof(g_log_param));
+
+	ret = hikp_nic_cmd_log_target(major_cmd, param->net_dev_name);
+	if (ret)
+		return ret;
+
+	printf("hikptool nic_log -i %s\n", param->net_dev_name);
+	hikp_nic_log_cmd_execute(major_cmd);
+
+	return ret;
+}
+
 static void cmd_nic_log_init(void)
 {
 	struct major_cmd_ctrl *major_cmd = get_major_cmd();
diff --git a/net/nic/nic_log/hikp_nic_log.h b/net/nic/nic_log/hikp_nic_log.h
index 2998464..cff1980 100644
--- a/net/nic/nic_log/hikp_nic_log.h
+++ b/net/nic/nic_log/hikp_nic_log.h
@@ -38,4 +38,11 @@ struct log_param {
 	struct tool_target target;
 };
 
+struct nic_log_collect_param {
+	const char *net_dev_name;
+};
+
+const char *hikp_info_collect_get_log_path(void);
+int hikp_info_collect_nic_log(void *data);
+
 #endif /* HIKP_NIC_LOG_H */
diff --git a/net/nic/nic_mac/hikp_nic_mac_dump.c b/net/nic/nic_mac/hikp_nic_mac_dump.c
index 5439c71..751953c 100644
--- a/net/nic/nic_mac/hikp_nic_mac_dump.c
+++ b/net/nic/nic_mac/hikp_nic_mac_dump.c
@@ -184,7 +184,7 @@ static int mac_cmd_dump_para_check(struct major_cmd_ctrl *self)
 	return 0;
 }
 
-static void mac_cmd_dump_execute(struct major_cmd_ctrl *self)
+void mac_cmd_dump_execute(struct major_cmd_ctrl *self)
 {
 	int ret;
 
@@ -203,7 +203,7 @@ static void mac_cmd_dump_execute(struct major_cmd_ctrl *self)
 		mac_cmd_dump_module(self, g_dump_reg_info.module_name);
 }
 
-static int mac_cmd_dump_reg_target(struct major_cmd_ctrl *self, const char *argv)
+int mac_cmd_dump_reg_target(struct major_cmd_ctrl *self, const char *argv)
 {
 	self->err_no = tool_check_and_get_valid_bdf_id(argv, &g_dump_reg_info.target);
 	if (self->err_no) {
@@ -233,13 +233,35 @@ static int mac_cmd_dump_reg_help(struct major_cmd_ctrl *self, const char *argv)
 	return 0;
 }
 
-static int mac_cmd_dump_module_cfg(struct major_cmd_ctrl *self, const char *argv)
+int mac_cmd_dump_module_cfg(struct major_cmd_ctrl *self, const char *argv)
 {
 	g_dump_reg_info.module_name = argv;
 
 	return 0;
 }
 
+int hikp_info_collect_nic_mac(void *data)
+{
+	struct nic_mac_collect_param *param = (struct nic_mac_collect_param *)data;
+	struct major_cmd_ctrl *major_cmd = get_major_cmd();
+	int ret;
+
+	memset(&g_dump_reg_info, 0, sizeof(g_dump_reg_info));
+
+	ret = mac_cmd_dump_reg_target(major_cmd, param->net_dev_name);
+	if (ret)
+		return ret;
+
+	ret = mac_cmd_dump_module_cfg(major_cmd, param->module_name);
+	if (ret)
+		return ret;
+
+	printf("hikptool nic_mac -i %s -m %s\n", param->net_dev_name, param->module_name);
+	mac_cmd_dump_execute(major_cmd);
+
+	return ret;
+}
+
 static void cmd_mac_dump_reg_init(void)
 {
 	struct major_cmd_ctrl *major_cmd = get_major_cmd();
diff --git a/net/nic/nic_mac/hikp_nic_mac_dump.h b/net/nic/nic_mac/hikp_nic_mac_dump.h
index 0c58ad5..f74a99e 100644
--- a/net/nic/nic_mac/hikp_nic_mac_dump.h
+++ b/net/nic/nic_mac/hikp_nic_mac_dump.h
@@ -60,4 +60,15 @@ struct cmd_mac_dump {
 	uint32_t blk_num[MOD_ID_MAX];
 	const char *module_name;
 };
+
+struct nic_mac_collect_param {
+	const char *net_dev_name;
+	const char *module_name;
+};
+
+int hikp_info_collect_nic_mac(void *data);
+
+int mac_cmd_dump_module_cfg(struct major_cmd_ctrl *self, const char *argv);
+int mac_cmd_dump_reg_target(struct major_cmd_ctrl *self, const char *argv);
+void mac_cmd_dump_execute(struct major_cmd_ctrl *self);
 #endif /* HIKP_NIC_MAC_DUMP_H */
diff --git a/net/nic/nic_mac/hikp_nic_port.c b/net/nic/nic_mac/hikp_nic_port.c
index e28a040..737de07 100644
--- a/net/nic/nic_mac/hikp_nic_port.c
+++ b/net/nic/nic_mac/hikp_nic_port.c
@@ -630,6 +630,24 @@ static int mac_cmd_port_show_help(struct major_cmd_ctrl *self, const char *argv)
 	return 0;
 }
 
+int hikp_info_collect_nic_port(void *data)
+{
+	struct nic_port_collect_param *param = (struct nic_port_collect_param *)data;
+	struct major_cmd_ctrl *major_cmd = get_major_cmd();
+	int ret;
+
+	memset(&g_port_info, 0, sizeof(g_port_info));
+
+	ret = mac_cmd_get_port_target(major_cmd, param->net_dev_name);
+	if (ret)
+		return ret;
+
+	printf("hikptool nic_port -i %s\n", param->net_dev_name);
+	mac_cmd_port_execute(major_cmd);
+
+	return ret;
+}
+
 static void cmd_mac_get_port_init(void)
 {
 	struct major_cmd_ctrl *major_cmd = get_major_cmd();
diff --git a/net/nic/nic_mac/hikp_nic_port.h b/net/nic/nic_mac/hikp_nic_port.h
index 69ebb53..433eba4 100644
--- a/net/nic/nic_mac/hikp_nic_port.h
+++ b/net/nic/nic_mac/hikp_nic_port.h
@@ -271,4 +271,10 @@ struct cmd_hot_plug_card_info {
 	uint8_t cur_type;
 };
 
+struct nic_port_collect_param {
+	const char *net_dev_name;
+};
+
+int hikp_info_collect_nic_port(void *data);
+
 #endif /* HIKP_NIC_PORT_H */
diff --git a/net/nic/nic_mac/hikp_nic_xsfp.c b/net/nic/nic_mac/hikp_nic_xsfp.c
index 573837b..91daa52 100644
--- a/net/nic/nic_mac/hikp_nic_xsfp.c
+++ b/net/nic/nic_mac/hikp_nic_xsfp.c
@@ -734,6 +734,29 @@ static int hikp_xsfp_dump_raw_data(struct major_cmd_ctrl *self, const char *argv
 	return 0;
 }
 
+int hikp_info_collect_nic_xsfp(void *data)
+{
+	struct nic_xsfp_collect_param *param = (struct nic_xsfp_collect_param *)data;
+	struct major_cmd_ctrl *major_cmd = get_major_cmd();
+	int ret;
+
+	memset(&g_xsfp_dump, 0, sizeof(g_xsfp_dump));
+
+	ret = hikp_xsfp_get_target(major_cmd, param->net_dev_name);
+	if (ret)
+		return ret;
+
+	printf("hikptool nic_xsfp -i %s\n", param->net_dev_name);
+	hikp_xsfp_get_info(major_cmd);
+
+	printf("hikptool nic_xsfp -i %s -d\n", param->net_dev_name);
+	/* No need to judge the return value */
+	(void)hikp_xsfp_dump_raw_data(major_cmd, NULL);
+	hikp_xsfp_get_info(major_cmd);
+
+	return ret;
+}
+
 static void cmd_get_xsfp_info(void)
 {
 	struct major_cmd_ctrl *major_cmd = get_major_cmd();
diff --git a/net/nic/nic_mac/hikp_nic_xsfp.h b/net/nic/nic_mac/hikp_nic_xsfp.h
index 50cbb2d..7db9693 100644
--- a/net/nic/nic_mac/hikp_nic_xsfp.h
+++ b/net/nic/nic_mac/hikp_nic_xsfp.h
@@ -549,4 +549,10 @@ struct hikp_xsfp_ctrl {
 	uint32_t dump_param;
 };
 
+struct nic_xsfp_collect_param {
+	const char *net_dev_name;
+};
+
+int hikp_info_collect_nic_xsfp(void *data);
+
 #endif /* HIKP_NIC_XSFP_H */
diff --git a/net/nic/nic_ncsi/hikp_nic_ncsi.c b/net/nic/nic_ncsi/hikp_nic_ncsi.c
index 2e1ea11..84f6337 100644
--- a/net/nic/nic_ncsi/hikp_nic_ncsi.c
+++ b/net/nic/nic_ncsi/hikp_nic_ncsi.c
@@ -100,6 +100,24 @@ static int nic_ncsi_cmd_show_help(struct major_cmd_ctrl *self, const char *argv)
 	return 0;
 }
 
+int hikp_info_collect_nic_ncsi(void *data)
+{
+	struct nic_ncsi_collect_param *param = (struct nic_ncsi_collect_param *)data;
+	struct major_cmd_ctrl *major_cmd = get_major_cmd();
+	int ret;
+
+	memset(&g_ncsi_cmd_info, 0, sizeof(g_ncsi_cmd_info));
+
+	ret = nic_ncsi_cmd_get_port_info(major_cmd, param->net_dev_name);
+	if (ret)
+		return ret;
+
+	printf("hikptool nic_ncsi -i %s\n", param->net_dev_name);
+	nic_ncsi_cmd_execute(major_cmd);
+
+	return ret;
+}
+
 static void cmd_nic_get_ncsi_init(void)
 {
 	struct major_cmd_ctrl *major_cmd = get_major_cmd();
diff --git a/net/nic/nic_ncsi/hikp_nic_ncsi.h b/net/nic/nic_ncsi/hikp_nic_ncsi.h
index a391d20..56ab653 100644
--- a/net/nic/nic_ncsi/hikp_nic_ncsi.h
+++ b/net/nic/nic_ncsi/hikp_nic_ncsi.h
@@ -54,4 +54,10 @@ struct nic_ncsi_cmd_info {
 	bool port_flag;
 };
 
+struct nic_ncsi_collect_param {
+	const char *net_dev_name;
+};
+
+int hikp_info_collect_nic_ncsi(void *data);
+
 #endif  /* HIKP_NIC_NCSI_H */
diff --git a/net/nic/nic_notify_pkt/hikp_nic_notify_pkt.c b/net/nic/nic_notify_pkt/hikp_nic_notify_pkt.c
index 5cd8bfa..4efaadc 100644
--- a/net/nic/nic_notify_pkt/hikp_nic_notify_pkt.c
+++ b/net/nic/nic_notify_pkt/hikp_nic_notify_pkt.c
@@ -70,7 +70,7 @@ static void hikp_nic_notify_pkt_show(const struct nic_notify_pkt_info *info)
 	printf("####################### END ###########################\n");
 }
 
-static void hikp_nic_notify_pkt_cmd_execute(struct major_cmd_ctrl *self)
+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 = {0};
@@ -94,7 +94,7 @@ static int hikp_nic_notify_pkt_cmd_help(struct major_cmd_ctrl *self, const char
 	return 0;
 }
 
-static int hikp_nic_notify_pkt_get_target(struct major_cmd_ctrl *self, const char *argv)
+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) {
diff --git a/net/nic/nic_notify_pkt/hikp_nic_notify_pkt.h b/net/nic/nic_notify_pkt/hikp_nic_notify_pkt.h
index 8bdb795..26a86fe 100644
--- a/net/nic/nic_notify_pkt/hikp_nic_notify_pkt.h
+++ b/net/nic/nic_notify_pkt/hikp_nic_notify_pkt.h
@@ -49,4 +49,6 @@ struct nic_notify_pkt_info {
 #define HIKP_NOTIFY_PKT_CFG_PKT_NUM_M		GENMASK(5, 2)
 #define HIKP_NOTIFY_PKT_CFG_PKT_NUM_S		2
 
+int hikp_nic_notify_pkt_get_target(struct major_cmd_ctrl *self, const char *argv);
+void hikp_nic_notify_pkt_cmd_execute(struct major_cmd_ctrl *self);
 #endif /* HIKP_NIC_NOTIFY_PKT_H */
diff --git a/net/nic/nic_ppp/hikp_nic_ppp.c b/net/nic/nic_ppp/hikp_nic_ppp.c
index aa63f12..24f41ee 100644
--- a/net/nic/nic_ppp/hikp_nic_ppp.c
+++ b/net/nic/nic_ppp/hikp_nic_ppp.c
@@ -57,6 +57,13 @@ static const struct ppp_feature_cmd g_ppp_feature_cmd[] = {
 	 hikp_nic_query_ppp_by_blkid,   hikp_nic_ppp_show_vlan_offload},
 };
 
+void hikp_nic_ppp_set_cmd_param(int feature_idx)
+{
+	g_ppp_param.func_id = -1;
+	g_ppp_param.is_uc = -1;
+	g_ppp_param.feature_idx = feature_idx;
+}
+
 static int hikp_nic_ppp_cmd_help(struct major_cmd_ctrl *self, const char *argv)
 {
 	printf("\n  Usage: %s %s\n", self->cmd_ptr->name, "-i <device>");
@@ -1098,7 +1105,7 @@ static int hikp_nic_check_hw_res(struct hikp_nic_ppp_hw_resources *hw_res)
 	return 0;
 }
 
-static void hikp_nic_ppp_cmd_execute(struct major_cmd_ctrl *self)
+void hikp_nic_ppp_cmd_execute(struct major_cmd_ctrl *self)
 {
 	struct bdf_t *bdf = &g_ppp_param.target.bdf;
 	const struct ppp_feature_cmd *ppp_cmd;
@@ -1157,7 +1164,7 @@ out:
 	hikp_nic_ppp_data_free(ppp_data);
 }
 
-static int hikp_nic_cmd_get_ppp_target(struct major_cmd_ctrl *self, const char *argv)
+int hikp_nic_cmd_get_ppp_target(struct major_cmd_ctrl *self, const char *argv)
 {
 	self->err_no = tool_check_and_get_valid_bdf_id(argv, &(g_ppp_param.target));
 	if (self->err_no != 0) {
diff --git a/net/nic/nic_ppp/hikp_nic_ppp.h b/net/nic/nic_ppp/hikp_nic_ppp.h
index 033ca4d..229e019 100644
--- a/net/nic/nic_ppp/hikp_nic_ppp.h
+++ b/net/nic/nic_ppp/hikp_nic_ppp.h
@@ -246,4 +246,7 @@ struct ppp_feature_cmd {
 	void (*show)(const void *data);
 };
 
+void hikp_nic_ppp_set_cmd_param(int feature_idx);
+int hikp_nic_cmd_get_ppp_target(struct major_cmd_ctrl *self, const char *argv);
+void hikp_nic_ppp_cmd_execute(struct major_cmd_ctrl *self);
 #endif /* HIKP_NIC_PPP_H */
diff --git a/net/nic/nic_qos/hikp_nic_qos.c b/net/nic/nic_qos/hikp_nic_qos.c
index c620a08..dc6f63e 100644
--- a/net/nic/nic_qos/hikp_nic_qos.c
+++ b/net/nic/nic_qos/hikp_nic_qos.c
@@ -33,6 +33,16 @@ static const struct qos_feature_cmd g_qos_feature_cmd[] = {
 	 hikp_nic_qos_show_pfc_storm_para},
 };
 
+void hikp_nic_qos_set_cmd_feature_idx(int feature_idx)
+{
+	g_qos_param.feature_idx = feature_idx;
+}
+
+void hikp_nic_qos_set_cmd_direction(enum nic_pfc_dir dir)
+{
+	g_qos_param.dir = dir;
+}
+
 static int hikp_nic_qos_cmd_help(struct major_cmd_ctrl *self, const char *argv)
 {
 	printf("\n  Usage: %s %s\n", self->cmd_ptr->name, "-i <device>");
@@ -242,7 +252,7 @@ static int hikp_nic_query_qos_feature(struct hikp_cmd_header *req_header, const
 	return ret;
 }
 
-static void hikp_nic_qos_cmd_execute(struct major_cmd_ctrl *self)
+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;
@@ -265,7 +275,7 @@ static void hikp_nic_qos_cmd_execute(struct major_cmd_ctrl *self)
 	}
 
 	if (g_qos_param.feature_idx == NIC_PFC_STORM_PARA_DUMP &&
-	    g_qos_param.dir == NIC_QUEUE_DIR_NONE) {
+	    g_qos_param.dir == NIC_QOS_DIR_NONE) {
 		hikp_nic_qos_cmd_help(self, NULL);
 		snprintf(self->err_str, sizeof(self->err_str),
 			 "-d/--dir param error!");
@@ -296,7 +306,7 @@ static void hikp_nic_qos_cmd_execute(struct major_cmd_ctrl *self)
 	printf("#################### END #######################\n");
 }
 
-static int hikp_nic_cmd_get_qos_target(struct major_cmd_ctrl *self, const char *argv)
+int hikp_nic_cmd_get_qos_target(struct major_cmd_ctrl *self, const char *argv)
 {
 	self->err_no = tool_check_and_get_valid_bdf_id(argv, &(g_qos_param.target));
 	if (self->err_no != 0) {
@@ -330,11 +340,11 @@ 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;
+		g_qos_param.dir = NIC_RX_QOS;
 		return 0;
 	}
 	if (strcmp(argv, "tx") == 0) {
-		g_qos_param.dir = NIC_TX_QUEUE;
+		g_qos_param.dir = NIC_TX_QOS;
 		return 0;
 	}
 
@@ -350,7 +360,7 @@ 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;
+	g_qos_param.dir = NIC_QOS_DIR_NONE;
 
 	major_cmd->option_count = 0;
 	major_cmd->execute = hikp_nic_qos_cmd_execute;
diff --git a/net/nic/nic_qos/hikp_nic_qos.h b/net/nic/nic_qos/hikp_nic_qos.h
index 77fbdd9..6ff4e05 100644
--- a/net/nic/nic_qos/hikp_nic_qos.h
+++ b/net/nic/nic_qos/hikp_nic_qos.h
@@ -118,9 +118,9 @@ struct nic_qos_req_para {
 };
 
 enum nic_pfc_dir {
-	NIC_RX_QUEUE = 0,
-	NIC_TX_QUEUE,
-	NIC_QUEUE_DIR_NONE,
+	NIC_RX_QOS = 0,
+	NIC_TX_QOS,
+	NIC_QOS_DIR_NONE,
 };
 
 struct nic_qos_param {
@@ -137,4 +137,8 @@ struct qos_feature_cmd {
 	void (*show)(const void *data);
 };
 
+int hikp_nic_cmd_get_qos_target(struct major_cmd_ctrl *self, const char *argv);
+void hikp_nic_qos_cmd_execute(struct major_cmd_ctrl *self);
+void hikp_nic_qos_set_cmd_feature_idx(int feature_idx);
+void hikp_nic_qos_set_cmd_direction(enum nic_pfc_dir dir);
 #endif /* HIKP_NIC_QOS_H */
diff --git a/net/nic/nic_queue/hikp_nic_queue.c b/net/nic/nic_queue/hikp_nic_queue.c
index dafa05e..5bb4335 100644
--- a/net/nic/nic_queue/hikp_nic_queue.c
+++ b/net/nic/nic_queue/hikp_nic_queue.c
@@ -32,6 +32,14 @@ static const struct queue_feature_cmd g_queue_feature_cmd[] = {
 	{"func_map",   QUEUE_FUNC_MAP,   hikp_nic_queue_show_func_map},
 };
 
+void hikp_nic_queue_cmd_set_param(int feature_idx, int qid, enum nic_queue_dir dir)
+{
+	g_queue_param.is_display_all = true;
+	g_queue_param.qid = qid;
+	g_queue_param.dir = dir;
+	g_queue_param.feature_idx = feature_idx;
+}
+
 static int hikp_nic_queue_cmd_help(struct major_cmd_ctrl *self, const char *argv)
 {
 	printf("\n  Usage: %s %s\n", self->cmd_ptr->name, "-i <device>");
@@ -340,7 +348,7 @@ static bool hikp_nic_queue_check_feature_para_vaild(const struct queue_feature_c
 	return valid;
 }
 
-static void hikp_nic_queue_cmd_execute(struct major_cmd_ctrl *self)
+void hikp_nic_queue_cmd_execute(struct major_cmd_ctrl *self)
 {
 	const struct queue_feature_cmd *queue_cmd;
 	union nic_queue_feature_info *queue_data;
@@ -387,7 +395,7 @@ out:
 	free(queue_data);
 }
 
-static int hikp_nic_cmd_get_queue_target(struct major_cmd_ctrl *self, const char *argv)
+int hikp_nic_cmd_get_queue_target(struct major_cmd_ctrl *self, const char *argv)
 {
 	self->err_no = tool_check_and_get_valid_bdf_id(argv, &(g_queue_param.target));
 	if (self->err_no != 0) {
diff --git a/net/nic/nic_queue/hikp_nic_queue.h b/net/nic/nic_queue/hikp_nic_queue.h
index fac39a0..ca3541a 100644
--- a/net/nic/nic_queue/hikp_nic_queue.h
+++ b/net/nic/nic_queue/hikp_nic_queue.h
@@ -152,4 +152,8 @@ struct queue_feature_cmd {
 	uint32_t sub_cmd_code;
 	void (*show)(const void *data);
 };
+
+int hikp_nic_cmd_get_queue_target(struct major_cmd_ctrl *self, const char *argv);
+void hikp_nic_queue_cmd_execute(struct major_cmd_ctrl *self);
+void hikp_nic_queue_cmd_set_param(int feature_idx, int qid, enum nic_queue_dir dir);
 #endif /* HIKP_NIC_QUEUE_H */
diff --git a/net/nic/nic_rss/hikp_nic_rss.c b/net/nic/nic_rss/hikp_nic_rss.c
index 65336ff..a7448e4 100644
--- a/net/nic/nic_rss/hikp_nic_rss.c
+++ b/net/nic/nic_rss/hikp_nic_rss.c
@@ -132,6 +132,11 @@ static const struct rss_feature_cmd g_rss_feature_cmd[] = {
 	{"tc_mode", RSS_TC_MODE_DUMP, hikp_nic_rss_show_tc_mode},
 };
 
+void hikp_nic_rss_cmd_set_feature_idx(int feature_idx)
+{
+	g_rss_param.feature_idx = feature_idx;
+}
+
 static int hikp_nic_rss_cmd_help(struct major_cmd_ctrl *self, const char *argv)
 {
 	printf("\n  Usage: %s %s\n", self->cmd_ptr->name, "-i <device>");
@@ -417,7 +422,7 @@ static int hikp_nic_query_rss_feature(struct hikp_cmd_header *req_header, const
 	return ret;
 }
 
-static void hikp_nic_rss_cmd_execute(struct major_cmd_ctrl *self)
+void hikp_nic_rss_cmd_execute(struct major_cmd_ctrl *self)
 {
 	union nic_rss_feature_info rss_data = {0};
 	const struct rss_feature_cmd *rss_cmd;
@@ -446,7 +451,7 @@ static void hikp_nic_rss_cmd_execute(struct major_cmd_ctrl *self)
 	printf("#################### END #######################\n");
 }
 
-static int hikp_nic_cmd_get_rss_target(struct major_cmd_ctrl *self, const char *argv)
+int hikp_nic_cmd_get_rss_target(struct major_cmd_ctrl *self, const char *argv)
 {
 	self->err_no = tool_check_and_get_valid_bdf_id(argv, &(g_rss_param.target));
 	if (self->err_no != 0) {
diff --git a/net/nic/nic_rss/hikp_nic_rss.h b/net/nic/nic_rss/hikp_nic_rss.h
index 39b3300..47aa2b9 100644
--- a/net/nic/nic_rss/hikp_nic_rss.h
+++ b/net/nic/nic_rss/hikp_nic_rss.h
@@ -91,4 +91,7 @@ struct rss_feature_cmd {
 	void (*show)(const void *data);
 };
 
+int hikp_nic_cmd_get_rss_target(struct major_cmd_ctrl *self, const char *argv);
+void hikp_nic_rss_cmd_execute(struct major_cmd_ctrl *self);
+void hikp_nic_rss_cmd_set_feature_idx(int feature_idx);
 #endif /* HIKP_NIC_RSS_H */
diff --git a/net/nic/nic_torus/hikp_nic_torus.c b/net/nic/nic_torus/hikp_nic_torus.c
index 5208bdc..d5e22b1 100644
--- a/net/nic/nic_torus/hikp_nic_torus.c
+++ b/net/nic/nic_torus/hikp_nic_torus.c
@@ -130,7 +130,7 @@ static void hikp_nic_torus_show(const struct nic_torus_info *info)
 	printf("#################### END ##########################\n");
 }
 
-static void hikp_nic_torus_cmd_execute(struct major_cmd_ctrl *self)
+void hikp_nic_torus_cmd_execute(struct major_cmd_ctrl *self)
 {
 	struct bdf_t *bdf = &g_torus_target.bdf;
 	struct nic_torus_info info = { 0 };
@@ -158,7 +158,7 @@ static int hikp_nic_torus_cmd_help(struct major_cmd_ctrl *self, const char *argv
 	return 0;
 }
 
-static int hikp_nic_torus_get_target(struct major_cmd_ctrl *self, const char *argv)
+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) {
diff --git a/net/nic/nic_torus/hikp_nic_torus.h b/net/nic/nic_torus/hikp_nic_torus.h
index e6b6552..064ffa3 100644
--- a/net/nic/nic_torus/hikp_nic_torus.h
+++ b/net/nic/nic_torus/hikp_nic_torus.h
@@ -73,4 +73,6 @@ struct nic_torus_info {
 	uint32_t ets_tcg0_mapping;
 };
 
+int hikp_nic_torus_get_target(struct major_cmd_ctrl *self, const char *argv);
+void hikp_nic_torus_cmd_execute(struct major_cmd_ctrl *self);
 #endif /* HIKP_NIC_TORUS_H */
diff --git a/net/roce/roce_bond/hikp_roce_bond.c b/net/roce/roce_bond/hikp_roce_bond.c
index 8434a0b..5256804 100644
--- a/net/roce/roce_bond/hikp_roce_bond.c
+++ b/net/roce/roce_bond/hikp_roce_bond.c
@@ -15,6 +15,12 @@
 
 static struct cmd_roce_bond_param g_roce_bond_param = { 0 };
 
+int hikp_roce_set_bond_bdf(char *nic_name)
+{
+	return tool_check_and_get_valid_bdf_id(nic_name,
+					       &g_roce_bond_param.target);
+}
+
 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");
@@ -60,7 +66,7 @@ static int hikp_roce_bond_get_data(struct hikp_cmd_ret **cmd_ret,
 	return ret;
 }
 
-static void hikp_roce_bond_execute(struct major_cmd_ctrl *self)
+void hikp_roce_bond_execute(struct major_cmd_ctrl *self)
 {
 	hikp_roce_ext_execute(self, GET_ROCEE_BOND_CMD, hikp_roce_bond_get_data);
 }
diff --git a/net/roce/roce_bond/hikp_roce_bond.h b/net/roce/roce_bond/hikp_roce_bond.h
index 5e18723..2f61727 100644
--- a/net/roce/roce_bond/hikp_roce_bond.h
+++ b/net/roce/roce_bond/hikp_roce_bond.h
@@ -26,4 +26,7 @@ struct roce_bond_req_param {
 	uint32_t block_id;
 };
 
+int hikp_roce_set_bond_bdf(char *nic_name);
+void hikp_roce_bond_execute(struct major_cmd_ctrl *self);
+
 #endif /* HIKP_ROCE_BOND_H */
diff --git a/net/roce/roce_caep/hikp_roce_caep.c b/net/roce/roce_caep/hikp_roce_caep.c
index a52cd54..95795d1 100644
--- a/net/roce/roce_caep/hikp_roce_caep.c
+++ b/net/roce/roce_caep/hikp_roce_caep.c
@@ -15,6 +15,17 @@
 
 static struct cmd_roce_caep_param_t g_roce_caep_param_t = { 0 };
 
+int hikp_roce_set_caep_bdf(char *nic_name)
+{
+	return tool_check_and_get_valid_bdf_id(nic_name,
+					       &g_roce_caep_param_t.target);
+}
+
+void hikp_roce_set_caep_mode(uint32_t mode)
+{
+	g_roce_caep_param_t.sub_cmd = mode;
+}
+
 static int hikp_roce_caep_help(struct major_cmd_ctrl *self, const char *argv)
 {
 	printf("\n  Usage: %s %s\n", self->cmd_ptr->name, "-i <interface>\n");
@@ -102,7 +113,7 @@ exec_error:
 	hikp_cmd_free(&cmd_ret);
 }
 
-static void hikp_roce_caep_execute(struct major_cmd_ctrl *self)
+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);
diff --git a/net/roce/roce_caep/hikp_roce_caep.h b/net/roce/roce_caep/hikp_roce_caep.h
index becb332..770e2ab 100644
--- a/net/roce/roce_caep/hikp_roce_caep.h
+++ b/net/roce/roce_caep/hikp_roce_caep.h
@@ -48,4 +48,8 @@ enum roce_caep_cmd_type {
 	CAEP_EXT,
 };
 
+int hikp_roce_set_caep_bdf(char *nic_name);
+void hikp_roce_set_caep_mode(uint32_t mode);
+void hikp_roce_caep_execute(struct major_cmd_ctrl *self);
+
 #endif /* HIKP_ROCE_CAEP_H */
diff --git a/net/roce/roce_global_cfg/hikp_roce_global_cfg.c b/net/roce/roce_global_cfg/hikp_roce_global_cfg.c
index 18df065..ca42dfa 100644
--- a/net/roce/roce_global_cfg/hikp_roce_global_cfg.c
+++ b/net/roce/roce_global_cfg/hikp_roce_global_cfg.c
@@ -15,6 +15,12 @@
 
 static struct cmd_roce_global_cfg_param g_roce_global_cfg_param = { 0 };
 
+int hikp_roce_set_global_cfg_bdf(char *nic_name)
+{
+	return tool_check_and_get_valid_bdf_id(nic_name,
+					       &g_roce_global_cfg_param.target);
+}
+
 static int hikp_roce_global_cfg_help(struct major_cmd_ctrl *self,
 				     const char *argv)
 {
@@ -63,7 +69,7 @@ static int hikp_roce_global_cfg_get_data(struct hikp_cmd_ret **cmd_ret,
 	return ret;
 }
 
-static void hikp_roce_global_cfg_execute(struct major_cmd_ctrl *self)
+void hikp_roce_global_cfg_execute(struct major_cmd_ctrl *self)
 {
 	enum roce_global_cfg_cmd_type sub_cmds[] = {
 		ROCE_GLB_GENAC,
diff --git a/net/roce/roce_global_cfg/hikp_roce_global_cfg.h b/net/roce/roce_global_cfg/hikp_roce_global_cfg.h
index aa1db92..eb6f359 100644
--- a/net/roce/roce_global_cfg/hikp_roce_global_cfg.h
+++ b/net/roce/roce_global_cfg/hikp_roce_global_cfg.h
@@ -37,4 +37,7 @@ enum roce_global_cfg_cmd_type {
 	ROCE_GLB_NICL,
 };
 
+int hikp_roce_set_global_cfg_bdf(char *nic_name);
+void hikp_roce_global_cfg_execute(struct major_cmd_ctrl *self);
+
 #endif /* HIKP_ROCE_GLOBAL_CFG_H */
diff --git a/net/roce/roce_gmv/hikp_roce_gmv.c b/net/roce/roce_gmv/hikp_roce_gmv.c
index 1b7db32..5f96451 100644
--- a/net/roce/roce_gmv/hikp_roce_gmv.c
+++ b/net/roce/roce_gmv/hikp_roce_gmv.c
@@ -16,6 +16,17 @@
 
 static struct cmd_roce_gmv_param g_roce_gmv_param = { 0 };
 
+int hikp_roce_set_gmv_bdf(char *nic_name)
+{
+	return tool_check_and_get_valid_bdf_id(nic_name,
+					       &g_roce_gmv_param.target);
+}
+
+void hikp_roce_set_gmv_index(uint32_t gmv_index)
+{
+	g_roce_gmv_param.gmv_index = gmv_index;
+}
+
 static int hikp_roce_gmv_help(struct major_cmd_ctrl *self, const char *argv)
 {
 	printf("\n  Usage: %s %s\n", self->cmd_ptr->name, "-i <interface>\n");
@@ -83,7 +94,7 @@ static void hikp_roce_gmv_print(uint32_t reg_num, struct roce_gmv_rsp_data *gmv_
 	printf("*******************************************\n");
 }
 
-static void hikp_roce_gmv_execute(struct major_cmd_ctrl *self)
+void hikp_roce_gmv_execute(struct major_cmd_ctrl *self)
 {
 	struct roce_gmv_req_para req_data = { 0 };
 	struct roce_gmv_rsp_data *gmv_rsp = NULL;
diff --git a/net/roce/roce_gmv/hikp_roce_gmv.h b/net/roce/roce_gmv/hikp_roce_gmv.h
index 8bc49d0..29c2e6d 100644
--- a/net/roce/roce_gmv/hikp_roce_gmv.h
+++ b/net/roce/roce_gmv/hikp_roce_gmv.h
@@ -38,4 +38,8 @@ enum roce_gmv_cmd_type {
 	GMV_SHOW = 0x0,
 };
 
+int hikp_roce_set_gmv_bdf(char *nic_name);
+void hikp_roce_set_gmv_index(uint32_t gmv_index);
+void hikp_roce_gmv_execute(struct major_cmd_ctrl *self);
+
 #endif /* HIKP_ROCE_GMV_H */
diff --git a/net/roce/roce_mdb/hikp_roce_mdb.c b/net/roce/roce_mdb/hikp_roce_mdb.c
index a578c87..e0a7cc5 100644
--- a/net/roce/roce_mdb/hikp_roce_mdb.c
+++ b/net/roce/roce_mdb/hikp_roce_mdb.c
@@ -16,6 +16,17 @@
 
 static struct cmd_roce_mdb_param g_roce_mdb_param = { 0 };
 
+int hikp_roce_set_mdb_bdf(char *nic_name)
+{
+	return tool_check_and_get_valid_bdf_id(nic_name,
+					       &g_roce_mdb_param.target);
+}
+
+void hikp_roce_set_mdb_mode(uint8_t mode)
+{
+	g_roce_mdb_param.flag = mode;
+}
+
 static int hikp_roce_mdb_help(struct major_cmd_ctrl *self, const char *argv)
 {
 	printf("\n  Usage: %s %s\n", self->cmd_ptr->name, "-i <interface>\n");
@@ -155,7 +166,7 @@ exec_error:
 	hikp_cmd_free(&cmd_ret);
 }
 
-static void hikp_roce_mdb_execute(struct major_cmd_ctrl *self)
+void hikp_roce_mdb_execute(struct major_cmd_ctrl *self)
 {
 	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) ?
diff --git a/net/roce/roce_mdb/hikp_roce_mdb.h b/net/roce/roce_mdb/hikp_roce_mdb.h
index e8dfcca..b95bb56 100644
--- a/net/roce/roce_mdb/hikp_roce_mdb.h
+++ b/net/roce/roce_mdb/hikp_roce_mdb.h
@@ -20,6 +20,7 @@
 #define ROCE_HIKP_REG_SWICTH 2
 
 #define ROCE_MDB_CMD_CLEAR (1 << 0)
+#define ROCE_MDB_CMD 0
 #define ROCE_MDB_CMD_EXT (1 << 1)
 
 struct cmd_roce_mdb_param {
@@ -49,4 +50,8 @@ enum roce_mdb_cmd_type {
 	MDB_CLEAR_EXT,
 };
 
+int hikp_roce_set_mdb_bdf(char *nic_name);
+void hikp_roce_set_mdb_mode(uint8_t mode);
+void hikp_roce_mdb_execute(struct major_cmd_ctrl *self);
+
 #endif /* HIKP_ROCE_MDB_H */
diff --git a/net/roce/roce_pkt/hikp_roce_pkt.c b/net/roce/roce_pkt/hikp_roce_pkt.c
index 81bdae6..5a6b268 100644
--- a/net/roce/roce_pkt/hikp_roce_pkt.c
+++ b/net/roce/roce_pkt/hikp_roce_pkt.c
@@ -15,6 +15,12 @@
 
 static struct cmd_roce_pkt_param_t g_roce_pkt_param_t = { 0 };
 
+int hikp_roce_set_pkt_bdf(char *nic_name)
+{
+	return tool_check_and_get_valid_bdf_id(nic_name,
+					       &g_roce_pkt_param_t.target);
+}
+
 static int hikp_roce_pkt_help(struct major_cmd_ctrl *self, const char *argv)
 {
 	printf("\n  Usage: %s %s\n", self->cmd_ptr->name, "-i <interface>\n");
@@ -96,7 +102,7 @@ static void hikp_roce_pkt_print(uint32_t total_block_num,
 	printf("***********************************\n");
 }
 
-static void hikp_roce_pkt_execute(struct major_cmd_ctrl *self)
+void hikp_roce_pkt_execute(struct major_cmd_ctrl *self)
 {
 	struct roce_pkt_req_param req_data = { 0 };
 	struct roce_pkt_res_param *roce_pkt_res;
diff --git a/net/roce/roce_pkt/hikp_roce_pkt.h b/net/roce/roce_pkt/hikp_roce_pkt.h
index 05d464e..7d23c8f 100644
--- a/net/roce/roce_pkt/hikp_roce_pkt.h
+++ b/net/roce/roce_pkt/hikp_roce_pkt.h
@@ -39,4 +39,7 @@ struct roce_pkt_res_param {
 	struct roce_pkt_res reg_data;
 };
 
+int hikp_roce_set_pkt_bdf(char *nic_name);
+void hikp_roce_pkt_execute(struct major_cmd_ctrl *self);
+
 #endif /* HIKP_ROCE_PKT_H */
diff --git a/net/roce/roce_qmm/hikp_roce_qmm.c b/net/roce/roce_qmm/hikp_roce_qmm.c
index 8140080..30caa5a 100644
--- a/net/roce/roce_qmm/hikp_roce_qmm.c
+++ b/net/roce/roce_qmm/hikp_roce_qmm.c
@@ -16,6 +16,22 @@
 
 static struct cmd_roce_qmm_param_t g_roce_qmm_param = { 0 };
 
+int hikp_roce_set_qmm_bdf(char *nic_name)
+{
+	return tool_check_and_get_valid_bdf_id(nic_name,
+					       &g_roce_qmm_param.target);
+}
+
+void hikp_roce_set_qmm_ext_flag(bool ext_flag)
+{
+	g_roce_qmm_param.ext_flag = ext_flag;
+}
+
+void hikp_roce_set_qmm_bankid(uint32_t bank_id)
+{
+	g_roce_qmm_param.bank_id = bank_id;
+}
+
 static int hikp_roce_qmm_help(struct major_cmd_ctrl *self, const char *argv)
 {
 	printf("\n  Usage: %s %s\n", self->cmd_ptr->name, "-i <interface>\n");
@@ -249,7 +265,7 @@ exec_error:
 	hikp_cmd_free(&cmd_ret);
 }
 
-static void hikp_roce_qmm_execute(struct major_cmd_ctrl *self)
+void hikp_roce_qmm_execute(struct major_cmd_ctrl *self)
 {
 	static const struct cmd_type_info {
 		enum roce_qmm_cmd_type sub_cmd;
diff --git a/net/roce/roce_qmm/hikp_roce_qmm.h b/net/roce/roce_qmm/hikp_roce_qmm.h
index eb7722b..b13a716 100644
--- a/net/roce/roce_qmm/hikp_roce_qmm.h
+++ b/net/roce/roce_qmm/hikp_roce_qmm.h
@@ -51,4 +51,9 @@ enum roce_qmm_cmd_type {
 	QMM_SHOW_TOP_EXT,
 };
 
+int hikp_roce_set_qmm_bdf(char *nic_name);
+void hikp_roce_set_qmm_ext_flag(bool ext_flag);
+void hikp_roce_set_qmm_bankid(uint32_t bank_id);
+void hikp_roce_qmm_execute(struct major_cmd_ctrl *self);
+
 #endif /* HIKP_ROCE_QMM_H */
diff --git a/net/roce/roce_rst/hikp_roce_rst.c b/net/roce/roce_rst/hikp_roce_rst.c
index 570e7f4..cfccc47 100644
--- a/net/roce/roce_rst/hikp_roce_rst.c
+++ b/net/roce/roce_rst/hikp_roce_rst.c
@@ -15,6 +15,12 @@
 
 static struct cmd_roce_rst_param g_roce_rst_param = { 0 };
 
+int hikp_roce_set_rst_bdf(char *nic_name)
+{
+	return tool_check_and_get_valid_bdf_id(nic_name,
+					       &g_roce_rst_param.target);
+}
+
 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");
@@ -60,7 +66,7 @@ static int hikp_roce_rst_get_data(struct hikp_cmd_ret **cmd_ret,
 	return ret;
 }
 
-static void hikp_roce_rst_execute(struct major_cmd_ctrl *self)
+void hikp_roce_rst_execute(struct major_cmd_ctrl *self)
 {
 	hikp_roce_ext_execute(self, GET_ROCEE_RST_CMD, hikp_roce_rst_get_data);
 }
diff --git a/net/roce/roce_rst/hikp_roce_rst.h b/net/roce/roce_rst/hikp_roce_rst.h
index e864b68..782d0ff 100644
--- a/net/roce/roce_rst/hikp_roce_rst.h
+++ b/net/roce/roce_rst/hikp_roce_rst.h
@@ -26,4 +26,7 @@ struct roce_rst_req_param {
 	uint32_t block_id;
 };
 
+int hikp_roce_set_rst_bdf(char *nic_name);
+void hikp_roce_rst_execute(struct major_cmd_ctrl *self);
+
 #endif /* HIKP_ROCE_RST_H */
diff --git a/net/roce/roce_scc/hikp_roce_scc.c b/net/roce/roce_scc/hikp_roce_scc.c
index f330e97..c660799 100644
--- a/net/roce/roce_scc/hikp_roce_scc.c
+++ b/net/roce/roce_scc/hikp_roce_scc.c
@@ -15,7 +15,7 @@
 
 struct cmd_roce_scc_param_t g_roce_scc_param_t = { 0 };
 struct roce_scc_module g_roce_scc_module[] = {
-	ROCE_SCC_HANDLE(COMMON),
+	{ "COMMON", SCC_COMMON },
 	ROCE_SCC_HANDLE(DCQCN),
 	ROCE_SCC_HANDLE(DIP),
 	ROCE_SCC_HANDLE(HC3),
@@ -23,6 +23,17 @@ struct roce_scc_module g_roce_scc_module[] = {
 	ROCE_SCC_HANDLE(CFG),
 };
 
+int hikp_roce_set_scc_bdf(char *nic_name)
+{
+	return tool_check_and_get_valid_bdf_id(nic_name,
+					       &g_roce_scc_param_t.target);
+}
+
+void hikp_roce_set_scc_submodule(uint32_t module)
+{
+	g_roce_scc_param_t.sub_cmd = module;
+}
+
 static int hikp_roce_scc_help(struct major_cmd_ctrl *self, const char *argv)
 {
 	printf("\n  Usage: %s %s\n", self->cmd_ptr->name, "-i <interface>\n");
@@ -78,7 +89,7 @@ static int hikp_roce_scc_clear_set(struct major_cmd_ctrl *self, const char *argv
 
 static int hikp_roce_scc_clear_module_check(void)
 {
-	if (g_roce_scc_param_t.sub_cmd == COMMON)
+	if (g_roce_scc_param_t.sub_cmd == SCC_COMMON)
 		return 0;
 
 	return -EINVAL;
@@ -292,7 +303,7 @@ static const struct reg_name_info {
 	const char **reg_name;
 	uint8_t arr_len;
 } g_scc_reg_name_info_table[] = {
-	{COMMON, g_scc_common_reg_name, HIKP_ARRAY_SIZE(g_scc_common_reg_name)},
+	{SCC_COMMON, g_scc_common_reg_name, HIKP_ARRAY_SIZE(g_scc_common_reg_name)},
 	{DCQCN, g_scc_dcqcn_reg_name, HIKP_ARRAY_SIZE(g_scc_dcqcn_reg_name)},
 	{DIP, g_scc_dip_reg_name, HIKP_ARRAY_SIZE(g_scc_dip_reg_name)},
 	{HC3, g_scc_hc3_reg_name, HIKP_ARRAY_SIZE(g_scc_hc3_reg_name)},
@@ -330,7 +341,7 @@ static void hikp_roce_scc_print(uint8_t total_block_num,
 	printf("***********************************\n");
 }
 
-static void hikp_roce_scc_execute(struct major_cmd_ctrl *self)
+void hikp_roce_scc_execute(struct major_cmd_ctrl *self)
 {
 	struct roce_scc_head res_head;
 	uint32_t *offset_start = NULL;
diff --git a/net/roce/roce_scc/hikp_roce_scc.h b/net/roce/roce_scc/hikp_roce_scc.h
index 9b5c0c5..b86b59a 100644
--- a/net/roce/roce_scc/hikp_roce_scc.h
+++ b/net/roce/roce_scc/hikp_roce_scc.h
@@ -58,7 +58,7 @@ struct roce_scc_module {
 };
 
 enum roce_scc_type {
-	COMMON = 1,
+	SCC_COMMON = 1,
 	DCQCN,
 	DIP,
 	HC3,
@@ -66,4 +66,8 @@ enum roce_scc_type {
 	CFG,
 };
 
+int hikp_roce_set_scc_bdf(char *nic_name);
+void hikp_roce_set_scc_submodule(uint32_t module);
+void hikp_roce_scc_execute(struct major_cmd_ctrl *self);
+
 #endif /* HIKP_ROCE_SCC_H */
diff --git a/net/roce/roce_timer/hikp_roce_timer.c b/net/roce/roce_timer/hikp_roce_timer.c
index 962127b..a6af959 100644
--- a/net/roce/roce_timer/hikp_roce_timer.c
+++ b/net/roce/roce_timer/hikp_roce_timer.c
@@ -15,6 +15,12 @@
 
 static struct cmd_roce_timer_params g_roce_timer_param = { 0 };
 
+int hikp_roce_set_timer_bdf(char *nic_name)
+{
+	return tool_check_and_get_valid_bdf_id(nic_name,
+					       &g_roce_timer_param.target);
+}
+
 static int hikp_roce_timer_help(struct major_cmd_ctrl *self, const char *argv)
 {
 	printf("\n  Usage: %s %s\n", self->cmd_ptr->name, "-i <interface>\n");
@@ -192,7 +198,7 @@ static int hikp_roce_timer_clear(struct major_cmd_ctrl *self)
 	return 0;
 }
 
-static void hikp_roce_timer_execute(struct major_cmd_ctrl *self)
+void hikp_roce_timer_execute(struct major_cmd_ctrl *self)
 {
 	int (*func[])(struct major_cmd_ctrl *self) = {
 		hikp_roce_timer_show_cqc, hikp_roce_timer_show_qpc
diff --git a/net/roce/roce_timer/hikp_roce_timer.h b/net/roce/roce_timer/hikp_roce_timer.h
index 314547e..f82afe1 100644
--- a/net/roce/roce_timer/hikp_roce_timer.h
+++ b/net/roce/roce_timer/hikp_roce_timer.h
@@ -40,4 +40,7 @@ struct roce_timer_rsp_data {
 	uint32_t timer_content[ROCE_HIKP_TIMER_REG_NUM][2];
 };
 
+int hikp_roce_set_timer_bdf(char *nic_name);
+void hikp_roce_timer_execute(struct major_cmd_ctrl *self);
+
 #endif /* HIKP_ROCE_TIMER_H */
diff --git a/net/roce/roce_trp/hikp_roce_trp.c b/net/roce/roce_trp/hikp_roce_trp.c
index 68c4cf2..9b1ddb1 100644
--- a/net/roce/roce_trp/hikp_roce_trp.c
+++ b/net/roce/roce_trp/hikp_roce_trp.c
@@ -18,9 +18,25 @@ struct roce_trp_module g_roce_trp_module[] = {
 	ROCE_TRP_HANDLE(TRP_RX),
 	ROCE_TRP_HANDLE(GEN_AC),
 	ROCE_TRP_HANDLE(PAYL),
-	ROCE_TRP_HANDLE(COMMON),
+	{ "COMMON", TRP_COMMON },
 };
 
+int hikp_roce_set_trp_bdf(char *nic_name)
+{
+	return tool_check_and_get_valid_bdf_id(nic_name,
+					       &g_roce_trp_param_t.target);
+}
+
+void hikp_roce_set_trp_bankid(uint32_t bank_id)
+{
+	g_roce_trp_param_t.bank_id = bank_id;
+}
+
+void hikp_roce_set_trp_submodule(uint32_t module)
+{
+	g_roce_trp_param_t.sub_cmd = module;
+}
+
 static int hikp_roce_trp_help(struct major_cmd_ctrl *self, const char *argv)
 {
 	printf("\n  Usage: %s %s\n", self->cmd_ptr->name, "-i <interface>\n");
@@ -86,7 +102,7 @@ static int hikp_roce_trp_bank_get(struct major_cmd_ctrl *self, const char *argv)
 static int hikp_roce_trp_bank_check(void)
 {
 	switch (g_roce_trp_param_t.sub_cmd) {
-	case (COMMON):
+	case (TRP_COMMON):
 		if (g_roce_trp_param_t.bank_id > TRP_MAX_BANK_NUM)
 			return -EINVAL;
 		break;
@@ -341,7 +357,7 @@ static const struct reg_name_info {
 	const char **reg_name;
 	uint8_t arr_len;
 } g_trp_reg_name_info_table[] = {
-	{COMMON, g_trp_common_reg_name, HIKP_ARRAY_SIZE(g_trp_common_reg_name)},
+	{TRP_COMMON, g_trp_common_reg_name, HIKP_ARRAY_SIZE(g_trp_common_reg_name)},
 	{TRP_RX, g_trp_trp_rx_reg_name, HIKP_ARRAY_SIZE(g_trp_trp_rx_reg_name)},
 	{GEN_AC, g_trp_gen_ac_reg_name, HIKP_ARRAY_SIZE(g_trp_gen_ac_reg_name)},
 	{PAYL, g_trp_payl_reg_name, HIKP_ARRAY_SIZE(g_trp_payl_reg_name)},
@@ -377,7 +393,7 @@ static void hikp_roce_trp_print(uint8_t total_block_num,
 	printf("***********************************\n");
 }
 
-static void hikp_roce_trp_execute(struct major_cmd_ctrl *self)
+void hikp_roce_trp_execute(struct major_cmd_ctrl *self)
 {
 	struct roce_trp_head res_head;
 	uint32_t *offset_start = NULL;
diff --git a/net/roce/roce_trp/hikp_roce_trp.h b/net/roce/roce_trp/hikp_roce_trp.h
index 212d36f..023e290 100644
--- a/net/roce/roce_trp/hikp_roce_trp.h
+++ b/net/roce/roce_trp/hikp_roce_trp.h
@@ -67,7 +67,12 @@ enum roce_trp_type {
 	TRP_RX = 1,
 	GEN_AC,
 	PAYL,
-	COMMON,
+	TRP_COMMON,
 };
 
+void hikp_roce_set_trp_submodule(uint32_t module);
+void hikp_roce_set_trp_bankid(uint32_t bank_id);
+int hikp_roce_set_trp_bdf(char *nic_name);
+void hikp_roce_trp_execute(struct major_cmd_ctrl *self);
+
 #endif /* HIKP_ROCE_TRP_H */
diff --git a/net/roce/roce_tsp/hikp_roce_tsp.c b/net/roce/roce_tsp/hikp_roce_tsp.c
index 9dd7956..e07e882 100644
--- a/net/roce/roce_tsp/hikp_roce_tsp.c
+++ b/net/roce/roce_tsp/hikp_roce_tsp.c
@@ -15,11 +15,27 @@
 
 static struct cmd_roce_tsp_param_t g_roce_tsp_param_t = { 0 };
 static struct roce_tsp_module g_roce_tsp_module[] = {
-	TSP_HANDLE(COMMON),
+	{ "COMMON", TSP_COMMON },
 	TSP_HANDLE(TDP),
 	TSP_HANDLE(TGP_TMP),
 };
 
+int hikp_roce_set_tsp_bdf(char *nic_name)
+{
+	return tool_check_and_get_valid_bdf_id(nic_name,
+					       &g_roce_tsp_param_t.target);
+}
+
+void hikp_roce_set_tsp_bankid(uint32_t bank_id)
+{
+	g_roce_tsp_param_t.bank_id = bank_id;
+}
+
+void hikp_roce_set_tsp_submodule(uint32_t module)
+{
+	g_roce_tsp_param_t.sub_cmd_code = module;
+}
+
 static int hikp_roce_tsp_help(struct major_cmd_ctrl *self, const char *argv)
 {
 	printf("\n  Usage: %s %s\n", self->cmd_ptr->name, "-i <interface>\n");
@@ -85,7 +101,7 @@ static int hikp_roce_tsp_bank_get(struct major_cmd_ctrl *self, const char *argv)
 static int hikp_roce_tsp_bank_check(void)
 {
 	switch (g_roce_tsp_param_t.sub_cmd_code) {
-	case (COMMON):
+	case (TSP_COMMON):
 		if (g_roce_tsp_param_t.bank_id > MAX_TSP_BANK_NUM)
 			return -EINVAL;
 		break;
@@ -194,9 +210,11 @@ static const struct reg_name_info {
 	const char **reg_name;
 	uint8_t arr_len;
 } g_tsp_reg_name_info_table[] = {
-	{COMMON, g_tsp_common_reg_name, HIKP_ARRAY_SIZE(g_tsp_common_reg_name)},
+	{TSP_COMMON, g_tsp_common_reg_name,
+	 HIKP_ARRAY_SIZE(g_tsp_common_reg_name)},
 	{TDP, g_tsp_tdp_reg_name, HIKP_ARRAY_SIZE(g_tsp_tdp_reg_name)},
-	{TGP_TMP, g_tsp_tgp_tmp_reg_name, HIKP_ARRAY_SIZE(g_tsp_tgp_tmp_reg_name)},
+	{TGP_TMP, g_tsp_tgp_tmp_reg_name,
+	 HIKP_ARRAY_SIZE(g_tsp_tgp_tmp_reg_name)},
 };
 
 static void hikp_roce_tsp_print(uint32_t total_block_num,
@@ -229,7 +247,7 @@ static void hikp_roce_tsp_print(uint32_t total_block_num,
 	printf("***********************************\n");
 }
 
-static void hikp_roce_tsp_execute(struct major_cmd_ctrl *self)
+void hikp_roce_tsp_execute(struct major_cmd_ctrl *self)
 {
 	struct roce_tsp_res_param *roce_tsp_res;
 	struct roce_tsp_req_param req_data;
diff --git a/net/roce/roce_tsp/hikp_roce_tsp.h b/net/roce/roce_tsp/hikp_roce_tsp.h
index a35f869..12bd0a3 100644
--- a/net/roce/roce_tsp/hikp_roce_tsp.h
+++ b/net/roce/roce_tsp/hikp_roce_tsp.h
@@ -56,9 +56,14 @@ struct roce_tsp_module {
 };
 
 enum roce_tsp_sub_cmd_code {
-	COMMON = 1,
+	TSP_COMMON = 1,
 	TDP,
 	TGP_TMP,
 };
 
+int hikp_roce_set_tsp_bdf(char *nic_name);
+void hikp_roce_set_tsp_bankid(uint32_t bank_id);
+void hikp_roce_set_tsp_submodule(uint32_t module);
+void hikp_roce_tsp_execute(struct major_cmd_ctrl *self);
+
 #endif /* HIKP_ROCE_TSP_H */
diff --git a/pcie/func_lib/pcie_func/pcie_link_ltssm.c b/pcie/func_lib/pcie_func/pcie_link_ltssm.c
index d3534f5..695d40f 100644
--- a/pcie/func_lib/pcie_func/pcie_link_ltssm.c
+++ b/pcie/func_lib/pcie_func/pcie_link_ltssm.c
@@ -69,7 +69,7 @@ union pm_state_reg {
 	uint64_t val;
 };
 
-static int pcie_get_ltssm_trace(uint32_t port_id, uint64_t *ltssm_status, uint32_t *ltssm_num)
+int pcie_get_ltssm_trace(uint32_t port_id, uint64_t *ltssm_status, uint32_t *ltssm_num)
 {
 	struct hikp_cmd_header req_header;
 	struct hikp_cmd_ret *cmd_ret = NULL;
diff --git a/pcie/func_lib/pcie_func/pcie_link_ltssm.h b/pcie/func_lib/pcie_func/pcie_link_ltssm.h
index 278f3e4..9d02557 100644
--- a/pcie/func_lib/pcie_func/pcie_link_ltssm.h
+++ b/pcie/func_lib/pcie_func/pcie_link_ltssm.h
@@ -59,5 +59,6 @@ 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);
+int pcie_get_ltssm_trace(uint32_t port_id, uint64_t *ltssm_status, uint32_t *ltssm_num);
 
 #endif /* PCIE_LINK_LTSSM_H */
diff --git a/pcie/func_lib/pcie_func/pcie_reg_dump.c b/pcie/func_lib/pcie_func/pcie_reg_dump.c
index abf0e26..0ce2e5d 100644
--- a/pcie/func_lib/pcie_func/pcie_reg_dump.c
+++ b/pcie/func_lib/pcie_func/pcie_reg_dump.c
@@ -17,13 +17,13 @@
 #include <string.h>
 #include <errno.h>
 #include <sys/stat.h>
-#include "tool_lib.h"
 #include "hikptdev_plug.h"
 #include "os_common.h"
 #include "pcie_common.h"
 #include "pcie_reg_dump.h"
 
 int g_pcie_dumpreg_fd;
+char dumpreg_log_file[MAX_LOG_NAME_LEN + 1] = {0};
 
 struct pcie_dumpreg_info g_reg_table_tl[] = {
 	{0, "TL_ASPM_IDLE_CNT"},
@@ -412,6 +412,9 @@ static int pcie_create_dumpreg_log_file(uint32_t port_id, uint32_t dump_level)
 	if (ret)
 		return -EINVAL;
 
+	memset(dumpreg_log_file, 0, sizeof(dumpreg_log_file));
+	(void)strncpy((char *)dumpreg_log_file, file_name, MAX_LOG_NAME_LEN + 1);
+
 	(void)remove((const char *)file_name);
 	/* Add write permission to the file */
 	fd_file = open(file_name, O_RDWR | O_SYNC | O_CREAT, 0600);
@@ -558,7 +561,7 @@ int pcie_dumpreg_do_dump(uint32_t port_id, uint32_t dump_level)
 	struct pcie_dump_req_para req_data = { 0 };
 	int ret = 0;
 
-	Info("pcie reg dump start.\n");
+	Info("hikptool pcie_dumpreg -i %u -l %u -d\n", port_id, dump_level);
 
 	req_data.port_id = port_id;
 	req_data.level = dump_level;
diff --git a/pcie/func_lib/pcie_func/pcie_reg_dump.h b/pcie/func_lib/pcie_func/pcie_reg_dump.h
index aaf22ba..3c52a6e 100644
--- a/pcie/func_lib/pcie_func/pcie_reg_dump.h
+++ b/pcie/func_lib/pcie_func/pcie_reg_dump.h
@@ -15,10 +15,12 @@
 #define PCIE_REG_DUMP_H
 
 #include "pcie_common_api.h"
+#include "tool_lib.h"
 
 #define PCIE_REG_NAME_LEN 60
 #define MAX_STR_LEN 80
 #define PCIE_DUMPREG_LOGFILE_NAME "pcie_dumpreg"
+#define LOG_FILE_PATH_MAX_LEN	512
 
 #define HIKP_PCIE_PCS_LANE_TBL_ENTRY(name) \
 	{0, STR(CONTACT(name, _00))}, {0, STR(CONTACT(name, _01))}, \
@@ -54,6 +56,8 @@ struct pcie_dumpreg_table {
 	struct pcie_dumpreg_info *dump_info;
 };
 
+extern char dumpreg_log_file[MAX_LOG_NAME_LEN + 1];
 int pcie_dumpreg_do_dump(uint32_t port_id, uint32_t dump_level);
 
+
 #endif /* PCIE_REG_DUMP_H */
diff --git a/pcie/func_lib/pcie_func/pcie_statistics.c b/pcie/func_lib/pcie_func/pcie_statistics.c
index be187f2..c7fee0b 100644
--- a/pcie/func_lib/pcie_func/pcie_statistics.c
+++ b/pcie/func_lib/pcie_func/pcie_statistics.c
@@ -29,7 +29,7 @@ static const char *g_global_ndie_name[] = {
 	"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)
+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;
 	struct pcie_port_info *port_info = NULL;
diff --git a/pcie/func_lib/pcie_func/pcie_statistics.h b/pcie/func_lib/pcie_func/pcie_statistics.h
index c373573..d7a68e2 100644
--- a/pcie/func_lib/pcie_func/pcie_statistics.h
+++ b/pcie/func_lib/pcie_func/pcie_statistics.h
@@ -15,6 +15,7 @@
 #define PCIE_STATISTICS_H
 
 #include "pcie_common_api.h"
+#include "hikptdev_plug.h"
 
 #define GLOBAL_WIDTH_TABLE_SIZE 5
 #define MAX_MACRO_ONEPORT 3
@@ -126,5 +127,6 @@ struct pcie_info_req_para {
 int pcie_port_distribution_get(uint32_t chip_id);
 int pcie_error_state_get(uint32_t port_id);
 int pcie_error_state_clear(uint32_t port_id);
+int port_distribution_rsp_data_check(const struct hikp_cmd_ret *cmd_ret, uint32_t *port_num);
 
 #endif /* PCIE_STATISTICS_H */
diff --git a/sas/sas_func/sas_common.h b/sas/sas_func/sas_common.h
index eed0fa5..78edf2e 100644
--- a/sas/sas_func/sas_common.h
+++ b/sas/sas_func/sas_common.h
@@ -16,7 +16,7 @@
 
 #define RESP_MAX_NUM 60
 #define SAS_MAX_PHY_NUM 7
-#define SAS_MAX_ERR_NUM 6
+#define SAS_MAX_ERR_NUM 5
 #define SAS_ERR_NUM 4
 #define SAS_QUEUE_NUM 16
 #define IPTT_ICT_STATUS 29
diff --git a/serdes/hikp_serdes.c b/serdes/hikp_serdes.c
index 92e380e..2367382 100644
--- a/serdes/hikp_serdes.c
+++ b/serdes/hikp_serdes.c
@@ -24,6 +24,10 @@ static struct cmd_serdes_param g_serdes_param = {0xff, 0xff, 0xff, 0xff, 0xff, 0
 
 #define SERDES_OUTPUT_MAX_SIZE 2560
 static char g_serdes_data_out_buf[SERDES_OUTPUT_MAX_SIZE] = {0};
+static struct hilink_cmd_out g_out_put = {0};
+
+static void hikp_serdes_info_print(struct cmd_serdes_param *cmd);
+static void hikp_serdes_dump_print(struct cmd_serdes_param *cmd);
 
 static int cmd_serdes_maininfo_help(struct major_cmd_ctrl *self, const char *argv)
 {
@@ -120,12 +124,12 @@ static int cmd_serdes_key_info_pro(struct major_cmd_ctrl *self, const char *argv
 }
 
 #define USEMODE_SSC_STR_MAXLEN 20
-static void hikp_serdes_brief_info_print(struct major_cmd_ctrl *self,
-					 const struct hilink_brief_info *data, uint32_t data_size)
+static void hikp_serdes_brief_info_print(struct cmd_serdes_param *cmd,
+	const struct hilink_brief_info *data, uint32_t data_size)
 {
 	uint8_t ds_id;
-	uint8_t start_sds_id = g_serdes_param.start_sds_id;
-	uint8_t sds_num = g_serdes_param.sds_num;
+	uint8_t start_sds_id = cmd->start_sds_id;
+	uint8_t sds_num = cmd->sds_num;
 	char usemode_ssc_str[USEMODE_SSC_STR_MAXLEN] = {0};
 	const char *usemode_array[HILINK_USE_MODE_END] = {
 		"default", "pcie", "sata", "sas", "hccs",
@@ -136,26 +140,20 @@ static void hikp_serdes_brief_info_print(struct major_cmd_ctrl *self,
 	};
 
 	if (data_size != sds_num) {
-		self->err_no = -EINVAL;
-		snprintf(self->err_str, sizeof(self->err_str),
-			 "serdes brief info data size is wrong.");
+		printf("serdes brief info data size is wrong.\n");
 		return;
 	}
 
 	for (ds_id = 0; ds_id < sds_num; ds_id++) {
 		if (data[ds_id].usemode >= HILINK_USE_MODE_END) {
-			self->err_no = -EINVAL;
-			snprintf(self->err_str, sizeof(self->err_str),
-				 "usemode[%u] is out of range.", data[ds_id].usemode);
+			printf("usemode[%u] is out of range.\n", data[ds_id].usemode);
 			return;
 		}
 		strncpy(usemode_ssc_str, usemode_array[data[ds_id].usemode],
 			sizeof(usemode_ssc_str) - 1);
 
 		if (data[ds_id].ssc_type >= HILINK_SSC_TYPE_END) {
-			self->err_no = -EINVAL;
-			snprintf(self->err_str, sizeof(self->err_str),
-				 "ssc_type[%u] is out of range.", data[ds_id].ssc_type);
+			printf("ssc_type[%u] is out of range.\n", data[ds_id].ssc_type);
 			return;
 		}
 		if (data[ds_id].usemode < HILINK_USE_MODE_HCCS) {
@@ -165,7 +163,7 @@ static void hikp_serdes_brief_info_print(struct major_cmd_ctrl *self,
 		}
 		printf("chip%u (M%u,ds%d) pll(%u, %u) pn(%u, %u) power(%u, %u)"
 		       "(refclk_sel:%u) rate(%u, %u Mhz) usemode(%s)\n",
-		       g_serdes_param.chip_id, g_serdes_param.macro_id,
+		       cmd->chip_id, cmd->macro_id,
 		       ds_id + start_sds_id, data[ds_id].tx_cs_sel, data[ds_id].rx_cs_sel,
 		       data[ds_id].tx_pn, data[ds_id].rx_pn,
 		       data[ds_id].tx_power, data[ds_id].rx_power,
@@ -200,25 +198,22 @@ static void hikp_serdes_brief_info_print(struct major_cmd_ctrl *self,
 	 "-------------------------------------------------"			\
 	 "--------------------------------\n")
 
-static void hikp_serdes_detail_info_print(struct major_cmd_ctrl *self,
-					  const struct hilink_detail_info *data,
-					  uint32_t data_size)
+static void hikp_serdes_detail_info_print(struct cmd_serdes_param *cmd,
+	const struct hilink_detail_info *data, uint32_t data_size)
 {
 	uint32_t i;
 	uint8_t ds_id;
-	uint8_t start_sds_id = g_serdes_param.start_sds_id;
-	uint8_t sds_num = g_serdes_param.sds_num;
+	uint8_t start_sds_id = cmd->start_sds_id;
+	uint8_t sds_num = cmd->sds_num;
 
 	if (data_size != sds_num) {
-		self->err_no = -EINVAL;
-		snprintf(self->err_str, sizeof(self->err_str),
-			 "serdes detail info data size is wrong.");
+		printf("serdes detail info data size is wrong.\n");
 		return;
 	}
 	printf(KEY_INFO_TITLE);
 	for (ds_id = 0; ds_id < sds_num; ds_id++) {
 		printf("chip%u (M%u,ds%d) [%3d,%3d,%3u,%3d,%3d]",
-		       g_serdes_param.chip_id, g_serdes_param.macro_id, ds_id + start_sds_id,
+		       cmd->chip_id, cmd->macro_id, ds_id + start_sds_id,
 		       data[ds_id].tx_cfg.fir_pre2, data[ds_id].tx_cfg.fir_pre1,
 		       data[ds_id].tx_cfg.fir_main, data[ds_id].tx_cfg.fir_post1,
 		       data[ds_id].tx_cfg.fir_post2);
@@ -243,6 +238,8 @@ static void hikp_serdes_detail_info_print(struct major_cmd_ctrl *self,
 static void hikp_serdes_logout_init(struct hilink_cmd_out *logout, char *buffer,
 				    uint32_t size, uint32_t type)
 {
+	memset(buffer, 0, size);
+
 	logout->str_len = size;
 	logout->result_offset = 0;
 	logout->out_str = buffer;
@@ -282,67 +279,88 @@ static int hikp_serdes_info_para_check(struct major_cmd_ctrl *self)
 	return 0;
 }
 
-static void hikp_serdes_info_cmd_execute(struct major_cmd_ctrl *self)
+static void hikp_serdes_print(struct cmd_serdes_param *cmd)
+{
+	if (cmd->cmd_type == SERDES_KEY_INFO)
+		hikp_serdes_info_print(cmd);
+	else if (cmd->cmd_type == SERDES_DUMP_REG)
+		hikp_serdes_dump_print(cmd);
+}
+
+int hikp_serdes_get_reponse(struct cmd_serdes_param *cmd)
 {
 	struct hikp_cmd_header req_header = {0};
 	struct hikp_cmd_ret *cmd_ret;
 	struct hilink_cmd_in hilink_cmd = {0};
-	struct hilink_brief_info *brief_info_data = NULL;
-	struct hilink_detail_info *detail_info_data = NULL;
-	struct hilink_cmd_out out_put;
 	size_t out_out_header_size;
-	int ret;
-
-	ret = hikp_serdes_info_para_check(self);
-	if (ret != 0)
-		return;
 
-	hikp_serdes_logout_init(&out_put, g_serdes_data_out_buf, SERDES_OUTPUT_MAX_SIZE, 0);
+	hilink_cmd.cmd_type              = cmd->cmd_type;
+	hilink_cmd.sub_cmd               = cmd->sub_cmd;
+	hilink_cmd.cmd_para.chip_id      = cmd->chip_id;
+	hilink_cmd.cmd_para.macro_id     = cmd->macro_id;
+	hilink_cmd.cmd_para.start_sds_id = cmd->start_sds_id;
+	hilink_cmd.cmd_para.sds_num      = cmd->sds_num;
 
-	hilink_cmd.cmd_type              = SERDES_KEY_INFO;
-	hilink_cmd.sub_cmd               = g_serdes_param.sub_cmd;
-	hilink_cmd.cmd_para.chip_id      = g_serdes_param.chip_id;
-	hilink_cmd.cmd_para.macro_id     = g_serdes_param.macro_id;
-	hilink_cmd.cmd_para.start_sds_id = g_serdes_param.start_sds_id;
-	hilink_cmd.cmd_para.sds_num      = g_serdes_param.sds_num;
+	hikp_serdes_logout_init(&g_out_put, g_serdes_data_out_buf, SERDES_OUTPUT_MAX_SIZE, 0);
 
-	hikp_cmd_init(&req_header, SERDES_MOD, SERDES_KEY_INFO, g_serdes_param.sub_cmd);
+	hikp_cmd_init(&req_header, SERDES_MOD, cmd->cmd_type, cmd->sub_cmd);
 	cmd_ret = hikp_cmd_alloc(&req_header, &hilink_cmd, sizeof(hilink_cmd));
 	if (cmd_ret == NULL || cmd_ret->status != 0) {
-		snprintf(self->err_str, sizeof(self->err_str), "hikp_cmd_alloc err.");
-		self->err_no = -EINVAL;
-		goto err_out;
+		printf("hikp_cmd_alloc err.\n");
+		hikp_cmd_free(&cmd_ret);
+		return -EINVAL;
 	}
-	out_out_header_size = sizeof(out_put.str_len) + sizeof(out_put.result_offset) +
-			      sizeof(out_put.type) + sizeof(out_put.ret_val);
-	memcpy(&out_put, cmd_ret->rsp_data, out_out_header_size);
+	out_out_header_size = sizeof(g_out_put.str_len) + sizeof(g_out_put.result_offset) +
+			      sizeof(g_out_put.type) + sizeof(g_out_put.ret_val);
+	memcpy(&g_out_put, cmd_ret->rsp_data, out_out_header_size);
 
-	if ((cmd_ret->rsp_data_num * sizeof(uint32_t) - out_out_header_size) >
-	    SERDES_OUTPUT_MAX_SIZE) {
-		self->err_no = -EINVAL;
-		snprintf(self->err_str, sizeof(self->err_str),
-			"serdes_info rsp_data data copy size error, data size:0x%zx max size:0x%x.",
+	if ((cmd_ret->rsp_data_num * sizeof(uint32_t) - out_out_header_size) > SERDES_OUTPUT_MAX_SIZE) {
+		printf("serdes_info rsp_data data copy size error, data size:0x%zx max size:0x%x.",
 			(cmd_ret->rsp_data_num * sizeof(uint32_t) - out_out_header_size),
 			SERDES_OUTPUT_MAX_SIZE);
-		goto err_out;
+		hikp_cmd_free(&cmd_ret);
+		return -EINVAL;
 	}
-	memcpy(out_put.out_str, cmd_ret->rsp_data + out_out_header_size / sizeof(uint32_t),
+	memcpy(g_out_put.out_str, cmd_ret->rsp_data + out_out_header_size / sizeof(uint32_t),
 		cmd_ret->rsp_data_num * sizeof(uint32_t) - out_out_header_size);
+	hikp_cmd_free(&cmd_ret);
+
+	hikp_serdes_print(cmd);
+
+	return 0;
+}
 
-	if (g_serdes_param.sub_cmd > 0) {
-		detail_info_data = (struct hilink_detail_info *)out_put.out_str;
-		hikp_serdes_detail_info_print(self, detail_info_data,
-					      out_put.result_offset /
-					      sizeof(struct hilink_detail_info));
+static void hikp_serdes_info_print(struct cmd_serdes_param *cmd)
+{
+	struct hilink_brief_info *brief_info_data = NULL;
+	struct hilink_detail_info *detail_info_data = NULL;
+
+	if (cmd->sub_cmd > 0) {
+		detail_info_data = (struct hilink_detail_info *)g_out_put.out_str;
+		hikp_serdes_detail_info_print(cmd, detail_info_data,
+			g_out_put.result_offset / sizeof(struct hilink_detail_info));
 	} else {
-		brief_info_data = (struct hilink_brief_info *)out_put.out_str;
-		hikp_serdes_brief_info_print(self, brief_info_data,
-					     out_put.result_offset /
-					     sizeof(struct hilink_brief_info));
+		brief_info_data = (struct hilink_brief_info *)g_out_put.out_str;
+		hikp_serdes_brief_info_print(cmd, brief_info_data,
+			g_out_put.result_offset / sizeof(struct hilink_brief_info));
 	}
+}
 
-err_out:
-	hikp_cmd_free(&cmd_ret);
+static void hikp_serdes_info_cmd_execute(struct major_cmd_ctrl *self)
+{
+	int ret;
+
+	ret = hikp_serdes_info_para_check(self);
+	if (ret != 0)
+		return;
+
+	g_serdes_param.cmd_type = SERDES_KEY_INFO;
+	ret = hikp_serdes_get_reponse(&g_serdes_param);
+	if (ret != 0) {
+		self->err_no = ret;
+		snprintf(self->err_str, sizeof(self->err_str), "serdes_info hikp_serdes_get_reponse err\n");
+		return;
+	}
 }
 
 static void cmd_serdes_maininfo_init(void)
@@ -393,22 +411,27 @@ _SERDES_DUMP_SUBCMD_PRO_:
 	return 0;
 }
 
-static void hikp_serdes_dump_print(struct major_cmd_ctrl *self,
-				   const uint32_t *data, uint32_t data_size)
+static void hikp_serdes_dump_print(struct cmd_serdes_param *cmd)
 {
+	uint32_t *dump_data = (uint32_t *)g_out_put.out_str;
+	uint32_t data_size = g_out_put.result_offset / sizeof(uint32_t);
 	uint32_t i;
 
+	if (g_out_put.type == 1) { /* 0:data; 1:string */
+		printf("serdes dump data type is string, buffer is not enough.\n");
+		return;
+	}
+
 	/* 2: Check whether addresses and values are paired */
 	if (data_size == 0 || data_size % 2 != 0) {
-		self->err_no = -EINVAL;
-		snprintf(self->err_str, sizeof(self->err_str), "serdes dump data size is wrong.");
+		printf("serdes dump data size is wrong.\n");
 		return;
 	}
 
 	printf("\n[-------Macro%uCS/DS%u-------]\nAddr   Value",
-		g_serdes_param.macro_id, g_serdes_param.start_sds_id);
+		cmd->macro_id, cmd->start_sds_id);
 	for (i = 0; i < data_size; i += 2) { /* 2: Addresses and values are paired */
-		printf("\n0x%04x 0x%08x", data[i], data[i + 1]);
+		printf("\n0x%04x 0x%08x", dump_data[i], dump_data[i + 1]);
 	}
 	printf("\n");
 }
@@ -444,59 +467,19 @@ static int hikp_serdes_dump_para_check(struct major_cmd_ctrl *self)
 
 static void hikp_serdes_dump_cmd_execute(struct major_cmd_ctrl *self)
 {
-	struct hikp_cmd_header req_header = {0};
-	struct hikp_cmd_ret *cmd_ret;
-	struct hilink_cmd_in hilink_cmd = {0};
-	uint32_t *dump_data = NULL;
-	struct hilink_cmd_out out_put;
-	size_t out_out_header_size;
 	int ret;
 
 	ret = hikp_serdes_dump_para_check(self);
 	if (ret != 0)
 		return;
 
-	hikp_serdes_logout_init(&out_put, g_serdes_data_out_buf, SERDES_OUTPUT_MAX_SIZE, 0);
-
-	hilink_cmd.cmd_type              = SERDES_DUMP_REG;
-	hilink_cmd.sub_cmd               = g_serdes_param.sub_cmd;
-	hilink_cmd.cmd_para.chip_id      = g_serdes_param.chip_id;
-	hilink_cmd.cmd_para.macro_id     = g_serdes_param.macro_id;
-	hilink_cmd.cmd_para.start_sds_id = g_serdes_param.start_sds_id;
-
-	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 || cmd_ret->status != 0) {
-		self->err_no = -EINVAL;
-		snprintf(self->err_str, sizeof(self->err_str), "hikp_cmd_alloc err.");
-		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);
-	memcpy(&out_put, cmd_ret->rsp_data, out_out_header_size);
-
-	if ((cmd_ret->rsp_data_num * sizeof(uint32_t) - out_out_header_size) >
-	    SERDES_OUTPUT_MAX_SIZE) {
-		self->err_no = -EINVAL;
-		snprintf(self->err_str, sizeof(self->err_str),
-			"serdes_dump rsp_data data copy size error, data size:0x%zx max size:0x%x.",
-			(cmd_ret->rsp_data_num * sizeof(uint32_t) - out_out_header_size),
-			SERDES_OUTPUT_MAX_SIZE);
-		goto err_out;
-	}
-	memcpy(out_put.out_str, cmd_ret->rsp_data + out_out_header_size / sizeof(uint32_t),
-		cmd_ret->rsp_data_num * sizeof(uint32_t) - out_out_header_size);
-	if (out_put.type == 1) { /* 0:data; 1:string */
-		self->err_no = -EINVAL;
-		snprintf(self->err_str, sizeof(self->err_str),
-			 "serdes dump data type is string, buffer is not enough.");
-		goto err_out;
+	g_serdes_param.cmd_type = SERDES_DUMP_REG;
+	ret = hikp_serdes_get_reponse(&g_serdes_param);
+	if (ret != 0) {
+		self->err_no = ret;
+		snprintf(self->err_str, sizeof(self->err_str), "serdes_dump hikp_serdes_get_reponse err\n");
+		return;
 	}
-
-	dump_data = (uint32_t *)out_put.out_str;
-	hikp_serdes_dump_print(self, dump_data, out_put.result_offset / sizeof(uint32_t));
-err_out:
-	hikp_cmd_free(&cmd_ret);
 }
 
 static void cmd_serdes_dump_init(void)
diff --git a/serdes/hikp_serdes.h b/serdes/hikp_serdes.h
index 2c04e8a..4ea969d 100644
--- a/serdes/hikp_serdes.h
+++ b/serdes/hikp_serdes.h
@@ -113,7 +113,7 @@ struct cmd_serdes_param {
 	uint8_t sds_num;
 	uint8_t val;
 	uint8_t sub_cmd;
-	uint8_t rsvd1;
+	uint8_t cmd_type;
 	uint8_t rsvd2;
 };
 
@@ -210,4 +210,6 @@ struct hilink_brief_info {
 	uint32_t rsvd_1;
 };
 
+int hikp_serdes_get_reponse(struct cmd_serdes_param *cmd);
+
 #endif /* HIKP_SERDES_H */
diff --git a/socip/hikp_socip.h b/socip/hikp_socip.h
index 8d3f31b..0b82f90 100644
--- a/socip/hikp_socip.h
+++ b/socip/hikp_socip.h
@@ -46,4 +46,5 @@ struct socip_dump_reg_req_data_t {
 	uint8_t controller_id;
 };
 
+void dump_reg_info(const uint32_t *reg_data, uint32_t data_num);
 #endif /* HIKP_SOCIP_H */
diff --git a/socip/hikp_socip_dumpreg.c b/socip/hikp_socip_dumpreg.c
index 4b6b70c..a3a20cb 100644
--- a/socip/hikp_socip_dumpreg.c
+++ b/socip/hikp_socip_dumpreg.c
@@ -105,7 +105,7 @@ static bool check_socip_dumpreg_param(void)
 	return ret;
 }
 
-static void dump_reg_info(const uint32_t *reg_data, uint32_t data_num)
+void dump_reg_info(const uint32_t *reg_data, uint32_t data_num)
 {
 #define ONE_LINE_PRINT_DATA_NUM 4
 	uint32_t i;
diff --git a/tool_lib/tool_lib.c b/tool_lib/tool_lib.c
index 4d02bdd..62f5fbb 100644
--- a/tool_lib/tool_lib.c
+++ b/tool_lib/tool_lib.c
@@ -16,6 +16,46 @@
 #include <errno.h>
 #include <time.h>
 
+uint32_t get_chip_type(void)
+{
+	char part_num_str[MIDR_BUFFER_SIZE] = {0};
+	char midr_buffer[MIDR_BUFFER_SIZE] = {0};
+	uint32_t chip_type = CHIP_UNKNOW;
+	uint64_t midr_el1;
+	uint32_t part_num;
+	FILE *file;
+
+	file = fopen(MIDR_EL1_PATH, "r");
+	if (file == NULL) {
+		HIKP_ERROR_PRINT("Open file: %s failed\n", MIDR_EL1_PATH);
+		return chip_type;
+	}
+
+	if (fgets(midr_buffer, MIDR_BUFFER_SIZE, file) == NULL) {
+		HIKP_ERROR_PRINT("Read file: %s failed\n", MIDR_EL1_PATH);
+		fclose(file);
+		return chip_type;
+	}
+
+	fclose(file);
+	midr_el1 = strtoul(midr_buffer, NULL, MIDR_HEX_TYPE);
+	part_num = (midr_el1 & 0xffff) >> PART_NUM_OFFSET;
+	(void)snprintf(part_num_str, MIDR_BUFFER_SIZE, "%x", part_num);
+
+	if (strcmp(part_num_str, "d02") == 0)
+		chip_type = CHIP_HIP09;
+	else if (strcmp(part_num_str, "d03") == 0)
+		chip_type = CHIP_HIP10;
+	else if (strcmp(part_num_str, "d45") == 0)
+		chip_type = CHIP_HIP10C;
+	else if (strcmp(part_num_str, "d22") == 0)
+		chip_type = CHIP_HIP11;
+	else
+		chip_type = CHIP_UNKNOW;
+
+	return chip_type;
+}
+
 int string_toui(const char *nptr, uint32_t *value)
 {
 	char *endptr = NULL;
diff --git a/tool_lib/tool_lib.h b/tool_lib/tool_lib.h
index 34cc3e8..3bf7bf8 100644
--- a/tool_lib/tool_lib.h
+++ b/tool_lib/tool_lib.h
@@ -90,6 +90,22 @@ struct type_trans {
 #define HIKP_WARN_PRINT(x, args...) HIKP_LOG_PRINT("[ WARN ] " x, ##args)
 #define HIKP_INFO_PRINT(x, args...) HIKP_LOG_PRINT("[ INFO ] " x, ##args)
 #define HIKP_DBG_PRINT(x, args...) HIKP_LOG_PRINT("[ DBG ] " x, ##args)
+#define HIKP_SET_USED(x) (void)(x)
+
+#define MIDR_EL1_PATH "/sys/devices/system/cpu/cpu0/regs/identification/midr_el1"
+#define MIDR_BUFFER_SIZE 20
+#define PART_NUM_OFFSET 4
+#define MIDR_HEX_TYPE 16
+
+enum chip_type {
+	CHIP_HIP09,
+	CHIP_HIP10,
+	CHIP_HIP10C,
+	CHIP_HIP11,
+	CHIP_UNKNOW,
+};
+
+uint32_t get_chip_type(void);
 
 int string_toui(const char *nptr, uint32_t *value);
 int string_toub(const char *nptr, uint8_t *value);
-- 
2.45.0.windows.1

