Skip to content

Commit 9e1545b

Browse files
liuyonglong86kuba-moo
authored andcommitted
net: hns3: use seq_file for files in common/ of hclge layer
This patch use seq_file for the following nodes: mng_tbl/loopback/interrupt_info/reset_info/imp_info/ncl_config/ mac_tnl_status/service_task_info/vlan_config/ptp_info This patch is the last modification to debugfs file of hclge layer. Unused functions and variables are removed together. Signed-off-by: Yonglong Liu <[email protected]> Signed-off-by: Jijie Shao <[email protected]> Reviewed-by: Andrew Lunn <[email protected]> Acked-by: Arnd Bergmann <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 3945d94 commit 9e1545b

File tree

5 files changed

+200
-344
lines changed

5 files changed

+200
-344
lines changed

drivers/net/ethernet/hisilicon/hns3/hnae3.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -587,8 +587,6 @@ typedef int (*read_func)(struct seq_file *s, void *data);
587587
* Delete clsflower rule
588588
* cls_flower_active
589589
* Check if any cls flower rule exist
590-
* dbg_read_cmd
591-
* Execute debugfs read command.
592590
* set_tx_hwts_info
593591
* Save information for 1588 tx packet
594592
* get_rx_hwts
@@ -757,8 +755,6 @@ struct hnae3_ae_ops {
757755
void (*enable_fd)(struct hnae3_handle *handle, bool enable);
758756
int (*add_arfs_entry)(struct hnae3_handle *handle, u16 queue_id,
759757
u16 flow_id, struct flow_keys *fkeys);
760-
int (*dbg_read_cmd)(struct hnae3_handle *handle, enum hnae3_dbg_cmd cmd,
761-
char *buf, int len);
762758
pci_ers_result_t (*handle_hw_ras_error)(struct hnae3_ae_dev *ae_dev);
763759
bool (*get_hw_reset_stat)(struct hnae3_handle *handle);
764760
bool (*ae_dev_resetting)(struct hnae3_handle *handle);

drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c

Lines changed: 12 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ static struct hns3_dbg_dentry_info hns3_dbg_dentry[] = {
4141
};
4242

4343
static int hns3_dbg_bd_file_init(struct hnae3_handle *handle, u32 cmd);
44-
static int hns3_dbg_common_file_init(struct hnae3_handle *handle, u32 cmd);
4544
static int hns3_dbg_common_init_t1(struct hnae3_handle *handle, u32 cmd);
4645
static int hns3_dbg_common_init_t2(struct hnae3_handle *handle, u32 cmd);
4746

@@ -163,49 +162,49 @@ static struct hns3_dbg_cmd_info hns3_dbg_cmd[] = {
163162
.cmd = HNAE3_DBG_CMD_MNG_TBL,
164163
.dentry = HNS3_DBG_DENTRY_COMMON,
165164
.buf_len = HNS3_DBG_READ_LEN,
166-
.init = hns3_dbg_common_file_init,
165+
.init = hns3_dbg_common_init_t2,
167166
},
168167
{
169168
.name = "loopback",
170169
.cmd = HNAE3_DBG_CMD_LOOPBACK,
171170
.dentry = HNS3_DBG_DENTRY_COMMON,
172171
.buf_len = HNS3_DBG_READ_LEN,
173-
.init = hns3_dbg_common_file_init,
172+
.init = hns3_dbg_common_init_t2,
174173
},
175174
{
176175
.name = "interrupt_info",
177176
.cmd = HNAE3_DBG_CMD_INTERRUPT_INFO,
178177
.dentry = HNS3_DBG_DENTRY_COMMON,
179178
.buf_len = HNS3_DBG_READ_LEN,
180-
.init = hns3_dbg_common_file_init,
179+
.init = hns3_dbg_common_init_t2,
181180
},
182181
{
183182
.name = "reset_info",
184183
.cmd = HNAE3_DBG_CMD_RESET_INFO,
185184
.dentry = HNS3_DBG_DENTRY_COMMON,
186185
.buf_len = HNS3_DBG_READ_LEN,
187-
.init = hns3_dbg_common_file_init,
186+
.init = hns3_dbg_common_init_t2,
188187
},
189188
{
190189
.name = "imp_info",
191190
.cmd = HNAE3_DBG_CMD_IMP_INFO,
192191
.dentry = HNS3_DBG_DENTRY_COMMON,
193192
.buf_len = HNS3_DBG_READ_LEN,
194-
.init = hns3_dbg_common_file_init,
193+
.init = hns3_dbg_common_init_t2,
195194
},
196195
{
197196
.name = "ncl_config",
198197
.cmd = HNAE3_DBG_CMD_NCL_CONFIG,
199198
.dentry = HNS3_DBG_DENTRY_COMMON,
200199
.buf_len = HNS3_DBG_READ_LEN_128KB,
201-
.init = hns3_dbg_common_file_init,
200+
.init = hns3_dbg_common_init_t2,
202201
},
203202
{
204203
.name = "mac_tnl_status",
205204
.cmd = HNAE3_DBG_CMD_MAC_TNL_STATUS,
206205
.dentry = HNS3_DBG_DENTRY_COMMON,
207206
.buf_len = HNS3_DBG_READ_LEN,
208-
.init = hns3_dbg_common_file_init,
207+
.init = hns3_dbg_common_init_t2,
209208
},
210209
{
211210
.name = "bios_common",
@@ -317,21 +316,21 @@ static struct hns3_dbg_cmd_info hns3_dbg_cmd[] = {
317316
.cmd = HNAE3_DBG_CMD_SERV_INFO,
318317
.dentry = HNS3_DBG_DENTRY_COMMON,
319318
.buf_len = HNS3_DBG_READ_LEN,
320-
.init = hns3_dbg_common_file_init,
319+
.init = hns3_dbg_common_init_t2,
321320
},
322321
{
323322
.name = "vlan_config",
324323
.cmd = HNAE3_DBG_CMD_VLAN_CONFIG,
325324
.dentry = HNS3_DBG_DENTRY_COMMON,
326325
.buf_len = HNS3_DBG_READ_LEN,
327-
.init = hns3_dbg_common_file_init,
326+
.init = hns3_dbg_common_init_t2,
328327
},
329328
{
330329
.name = "ptp_info",
331330
.cmd = HNAE3_DBG_CMD_PTP_INFO,
332331
.dentry = HNS3_DBG_DENTRY_COMMON,
333332
.buf_len = HNS3_DBG_READ_LEN,
334-
.init = hns3_dbg_common_file_init,
333+
.init = hns3_dbg_common_init_t2,
335334
},
336335
{
337336
.name = "fd_counter",
@@ -345,7 +344,7 @@ static struct hns3_dbg_cmd_info hns3_dbg_cmd[] = {
345344
.cmd = HNAE3_DBG_CMD_UMV_INFO,
346345
.dentry = HNS3_DBG_DENTRY_COMMON,
347346
.buf_len = HNS3_DBG_READ_LEN,
348-
.init = hns3_dbg_common_file_init,
347+
.init = hns3_dbg_common_init_t2,
349348
},
350349
{
351350
.name = "page_pool_info",
@@ -986,7 +985,6 @@ static const struct hns3_dbg_func hns3_dbg_cmd_func[] = {
986985
static int hns3_dbg_read_cmd(struct hns3_dbg_data *dbg_data,
987986
enum hnae3_dbg_cmd cmd, char *buf, int len)
988987
{
989-
const struct hnae3_ae_ops *ops = hns3_get_ops(dbg_data->handle);
990988
const struct hns3_dbg_func *cmd_func;
991989
u32 i;
992990

@@ -1002,10 +1000,7 @@ static int hns3_dbg_read_cmd(struct hns3_dbg_data *dbg_data,
10021000
}
10031001
}
10041002

1005-
if (!ops->dbg_read_cmd)
1006-
return -EOPNOTSUPP;
1007-
1008-
return ops->dbg_read_cmd(dbg_data->handle, cmd, buf, len);
1003+
return -EOPNOTSUPP;
10091004
}
10101005

10111006
static ssize_t hns3_dbg_read(struct file *filp, char __user *buffer,
@@ -1090,25 +1085,6 @@ static int hns3_dbg_bd_file_init(struct hnae3_handle *handle, u32 cmd)
10901085
return 0;
10911086
}
10921087

1093-
static int
1094-
hns3_dbg_common_file_init(struct hnae3_handle *handle, u32 cmd)
1095-
{
1096-
struct hns3_dbg_data *data;
1097-
struct dentry *entry_dir;
1098-
1099-
data = devm_kzalloc(&handle->pdev->dev, sizeof(*data), GFP_KERNEL);
1100-
if (!data)
1101-
return -ENOMEM;
1102-
1103-
data->handle = handle;
1104-
data->cmd = hns3_dbg_cmd[cmd].cmd;
1105-
entry_dir = hns3_dbg_dentry[hns3_dbg_cmd[cmd].dentry].dentry;
1106-
debugfs_create_file(hns3_dbg_cmd[cmd].name, 0400, entry_dir,
1107-
data, &hns3_dbg_fops);
1108-
1109-
return 0;
1110-
}
1111-
11121088
static int hns3_dbg_common_init_t1(struct hnae3_handle *handle, u32 cmd)
11131089
{
11141090
struct device *dev = &handle->pdev->dev;

0 commit comments

Comments
 (0)