@@ -43,84 +43,85 @@ static struct hns3_dbg_dentry_info hns3_dbg_dentry[] = {
43
43
static int hns3_dbg_bd_file_init (struct hnae3_handle * handle , u32 cmd );
44
44
static int hns3_dbg_common_file_init (struct hnae3_handle * handle , u32 cmd );
45
45
static int hns3_dbg_common_init_t1 (struct hnae3_handle * handle , u32 cmd );
46
+ static int hns3_dbg_common_init_t2 (struct hnae3_handle * handle , u32 cmd );
46
47
47
48
static struct hns3_dbg_cmd_info hns3_dbg_cmd [] = {
48
49
{
49
50
.name = "tm_nodes" ,
50
51
.cmd = HNAE3_DBG_CMD_TM_NODES ,
51
52
.dentry = HNS3_DBG_DENTRY_TM ,
52
53
.buf_len = HNS3_DBG_READ_LEN ,
53
- .init = hns3_dbg_common_file_init ,
54
+ .init = hns3_dbg_common_init_t2 ,
54
55
},
55
56
{
56
57
.name = "tm_priority" ,
57
58
.cmd = HNAE3_DBG_CMD_TM_PRI ,
58
59
.dentry = HNS3_DBG_DENTRY_TM ,
59
60
.buf_len = HNS3_DBG_READ_LEN ,
60
- .init = hns3_dbg_common_file_init ,
61
+ .init = hns3_dbg_common_init_t2 ,
61
62
},
62
63
{
63
64
.name = "tm_qset" ,
64
65
.cmd = HNAE3_DBG_CMD_TM_QSET ,
65
66
.dentry = HNS3_DBG_DENTRY_TM ,
66
67
.buf_len = HNS3_DBG_READ_LEN_1MB ,
67
- .init = hns3_dbg_common_file_init ,
68
+ .init = hns3_dbg_common_init_t2 ,
68
69
},
69
70
{
70
71
.name = "tm_map" ,
71
72
.cmd = HNAE3_DBG_CMD_TM_MAP ,
72
73
.dentry = HNS3_DBG_DENTRY_TM ,
73
74
.buf_len = HNS3_DBG_READ_LEN_1MB ,
74
- .init = hns3_dbg_common_file_init ,
75
+ .init = hns3_dbg_common_init_t2 ,
75
76
},
76
77
{
77
78
.name = "tm_pg" ,
78
79
.cmd = HNAE3_DBG_CMD_TM_PG ,
79
80
.dentry = HNS3_DBG_DENTRY_TM ,
80
81
.buf_len = HNS3_DBG_READ_LEN ,
81
- .init = hns3_dbg_common_file_init ,
82
+ .init = hns3_dbg_common_init_t2 ,
82
83
},
83
84
{
84
85
.name = "tm_port" ,
85
86
.cmd = HNAE3_DBG_CMD_TM_PORT ,
86
87
.dentry = HNS3_DBG_DENTRY_TM ,
87
88
.buf_len = HNS3_DBG_READ_LEN ,
88
- .init = hns3_dbg_common_file_init ,
89
+ .init = hns3_dbg_common_init_t2 ,
89
90
},
90
91
{
91
92
.name = "tc_sch_info" ,
92
93
.cmd = HNAE3_DBG_CMD_TC_SCH_INFO ,
93
94
.dentry = HNS3_DBG_DENTRY_TM ,
94
95
.buf_len = HNS3_DBG_READ_LEN ,
95
- .init = hns3_dbg_common_file_init ,
96
+ .init = hns3_dbg_common_init_t2 ,
96
97
},
97
98
{
98
99
.name = "qos_pause_cfg" ,
99
100
.cmd = HNAE3_DBG_CMD_QOS_PAUSE_CFG ,
100
101
.dentry = HNS3_DBG_DENTRY_TM ,
101
102
.buf_len = HNS3_DBG_READ_LEN ,
102
- .init = hns3_dbg_common_file_init ,
103
+ .init = hns3_dbg_common_init_t2 ,
103
104
},
104
105
{
105
106
.name = "qos_pri_map" ,
106
107
.cmd = HNAE3_DBG_CMD_QOS_PRI_MAP ,
107
108
.dentry = HNS3_DBG_DENTRY_TM ,
108
109
.buf_len = HNS3_DBG_READ_LEN ,
109
- .init = hns3_dbg_common_file_init ,
110
+ .init = hns3_dbg_common_init_t2 ,
110
111
},
111
112
{
112
113
.name = "qos_dscp_map" ,
113
114
.cmd = HNAE3_DBG_CMD_QOS_DSCP_MAP ,
114
115
.dentry = HNS3_DBG_DENTRY_TM ,
115
116
.buf_len = HNS3_DBG_READ_LEN ,
116
- .init = hns3_dbg_common_file_init ,
117
+ .init = hns3_dbg_common_init_t2 ,
117
118
},
118
119
{
119
120
.name = "qos_buf_cfg" ,
120
121
.cmd = HNAE3_DBG_CMD_QOS_BUF_CFG ,
121
122
.dentry = HNS3_DBG_DENTRY_TM ,
122
123
.buf_len = HNS3_DBG_READ_LEN ,
123
- .init = hns3_dbg_common_file_init ,
124
+ .init = hns3_dbg_common_init_t2 ,
124
125
},
125
126
{
126
127
.name = "dev_info" ,
@@ -1144,6 +1145,28 @@ static int hns3_dbg_common_init_t1(struct hnae3_handle *handle, u32 cmd)
1144
1145
return 0 ;
1145
1146
}
1146
1147
1148
+ static int hns3_dbg_common_init_t2 (struct hnae3_handle * handle , u32 cmd )
1149
+ {
1150
+ const struct hnae3_ae_ops * ops = hns3_get_ops (handle );
1151
+ struct device * dev = & handle -> pdev -> dev ;
1152
+ struct dentry * entry_dir ;
1153
+ read_func func ;
1154
+ int ret ;
1155
+
1156
+ if (!ops -> dbg_get_read_func )
1157
+ return 0 ;
1158
+
1159
+ ret = ops -> dbg_get_read_func (handle , hns3_dbg_cmd [cmd ].cmd , & func );
1160
+ if (ret )
1161
+ return ret ;
1162
+
1163
+ entry_dir = hns3_dbg_dentry [hns3_dbg_cmd [cmd ].dentry ].dentry ;
1164
+ debugfs_create_devm_seqfile (dev , hns3_dbg_cmd [cmd ].name , entry_dir ,
1165
+ func );
1166
+
1167
+ return 0 ;
1168
+ }
1169
+
1147
1170
int hns3_dbg_init (struct hnae3_handle * handle )
1148
1171
{
1149
1172
struct hnae3_ae_dev * ae_dev = hns3_get_ae_dev (handle );
0 commit comments