Commit a582b78d authored by Zhongzhu Liu's avatar Zhongzhu Liu Committed by David S. Miller

net: hns3: code optimization for debugfs related to "dump reg"

For making the code more readable, this patch uses a array to
keep the information about the dumping register, and then uses
it to parse the parameter cmd_buf which passing into
hclge_dbg_dump_reg_cmd().

Also replaces parameter "base" of kstrtouint with 0 in the
hclge_dbg_dump_reg_common(), which makes it more flexible.
Signed-off-by: default avatarZhongzhu Liu <liuzhongzhu@huawei.com>
Signed-off-by: default avatarGuangbin Huang <huangguangbin2@huawei.com>
Signed-off-by: default avatarHuazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 8eb3cef8
...@@ -4,6 +4,9 @@ ...@@ -4,6 +4,9 @@
#ifndef __HCLGE_DEBUGFS_H #ifndef __HCLGE_DEBUGFS_H
#define __HCLGE_DEBUGFS_H #define __HCLGE_DEBUGFS_H
#include <linux/etherdevice.h>
#include "hclge_cmd.h"
#define HCLGE_DBG_BUF_LEN 256 #define HCLGE_DBG_BUF_LEN 256
#define HCLGE_DBG_MNG_TBL_MAX 64 #define HCLGE_DBG_MNG_TBL_MAX 64
...@@ -63,11 +66,24 @@ struct hclge_dbg_bitmap_cmd { ...@@ -63,11 +66,24 @@ struct hclge_dbg_bitmap_cmd {
}; };
}; };
struct hclge_dbg_reg_common_msg {
int msg_num;
int offset;
enum hclge_opcode_type cmd;
};
struct hclge_dbg_dfx_message { struct hclge_dbg_dfx_message {
int flag; int flag;
char message[60]; char message[60];
}; };
#define HCLGE_DBG_MAC_REG_TYPE_LEN 32
struct hclge_dbg_reg_type_info {
const char *reg_type;
struct hclge_dbg_dfx_message *dfx_msg;
struct hclge_dbg_reg_common_msg reg_msg;
};
#pragma pack() #pragma pack()
static struct hclge_dbg_dfx_message hclge_dbg_bios_common_reg[] = { static struct hclge_dbg_dfx_message hclge_dbg_bios_common_reg[] = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment