xref: /linux/drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.h (revision fd7d598270724cc787982ea48bbe17ad383a8b7f)
1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /* Copyright (c) 2021 Hisilicon Limited. */
3 
4 #ifndef __HNS3_DEBUGFS_H
5 #define __HNS3_DEBUGFS_H
6 
7 #include "hnae3.h"
8 
9 #define HNS3_DBG_READ_LEN	65536
10 #define HNS3_DBG_READ_LEN_128KB	0x20000
11 #define HNS3_DBG_READ_LEN_1MB	0x100000
12 #define HNS3_DBG_READ_LEN_4MB	0x400000
13 #define HNS3_DBG_READ_LEN_5MB	0x500000
14 #define HNS3_DBG_WRITE_LEN	1024
15 
16 #define HNS3_DBG_DATA_STR_LEN	32
17 #define HNS3_DBG_INFO_LEN	256
18 #define HNS3_DBG_ITEM_NAME_LEN	32
19 #define HNS3_DBG_FILE_NAME_LEN	16
20 
21 struct hns3_dbg_item {
22 	char name[HNS3_DBG_ITEM_NAME_LEN];
23 	u16 interval; /* blank numbers after the item */
24 };
25 
26 struct hns3_dbg_data {
27 	struct hnae3_handle *handle;
28 	enum hnae3_dbg_cmd cmd;
29 	u16 qid;
30 };
31 
32 enum hns3_dbg_dentry_type {
33 	HNS3_DBG_DENTRY_TM,
34 	HNS3_DBG_DENTRY_TX_BD,
35 	HNS3_DBG_DENTRY_RX_BD,
36 	HNS3_DBG_DENTRY_MAC,
37 	HNS3_DBG_DENTRY_REG,
38 	HNS3_DBG_DENTRY_QUEUE,
39 	HNS3_DBG_DENTRY_FD,
40 	HNS3_DBG_DENTRY_COMMON,
41 };
42 
43 struct hns3_dbg_dentry_info {
44 	const char *name;
45 	struct dentry *dentry;
46 };
47 
48 struct hns3_dbg_cmd_info {
49 	const char *name;
50 	enum hnae3_dbg_cmd cmd;
51 	enum hns3_dbg_dentry_type dentry;
52 	u32 buf_len;
53 	int (*init)(struct hnae3_handle *handle, unsigned int cmd);
54 };
55 
56 struct hns3_dbg_func {
57 	enum hnae3_dbg_cmd cmd;
58 	int (*dbg_dump)(struct hnae3_handle *handle, char *buf, int len);
59 	int (*dbg_dump_bd)(struct hns3_dbg_data *data, char *buf, int len);
60 };
61 
62 struct hns3_dbg_cap_info {
63 	const char *name;
64 	enum HNAE3_DEV_CAP_BITS cap_bit;
65 };
66 
67 #endif
68