1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /* Copyright (c) 2018-2019 Hisilicon Limited. */
3 
4 #ifndef __HCLGE_DEBUGFS_H
5 #define __HCLGE_DEBUGFS_H
6 
7 #include <linux/etherdevice.h>
8 #include "hclge_cmd.h"
9 
10 #define HCLGE_DBG_MNG_TBL_MAX	   64
11 
12 #define HCLGE_DBG_MNG_VLAN_MASK_B  BIT(0)
13 #define HCLGE_DBG_MNG_MAC_MASK_B   BIT(1)
14 #define HCLGE_DBG_MNG_ETHER_MASK_B BIT(2)
15 #define HCLGE_DBG_MNG_E_TYPE_B	   BIT(11)
16 #define HCLGE_DBG_MNG_DROP_B	   BIT(13)
17 #define HCLGE_DBG_MNG_VLAN_TAG	   0x0FFF
18 #define HCLGE_DBG_MNG_PF_ID	   0x0007
19 #define HCLGE_DBG_MNG_VF_ID	   0x00FF
20 
21 /* Get DFX BD number offset */
22 #define HCLGE_DBG_DFX_BIOS_OFFSET  1
23 #define HCLGE_DBG_DFX_SSU_0_OFFSET 2
24 #define HCLGE_DBG_DFX_SSU_1_OFFSET 3
25 #define HCLGE_DBG_DFX_IGU_OFFSET   4
26 #define HCLGE_DBG_DFX_RPU_0_OFFSET 5
27 
28 #define HCLGE_DBG_DFX_RPU_1_OFFSET 6
29 #define HCLGE_DBG_DFX_NCSI_OFFSET  7
30 #define HCLGE_DBG_DFX_RTC_OFFSET   8
31 #define HCLGE_DBG_DFX_PPP_OFFSET   9
32 #define HCLGE_DBG_DFX_RCB_OFFSET   10
33 #define HCLGE_DBG_DFX_TQP_OFFSET   11
34 
35 #define HCLGE_DBG_DFX_SSU_2_OFFSET 12
36 
37 struct hclge_qos_pri_map_cmd {
38 	u8 pri0_tc  : 4,
39 	   pri1_tc  : 4;
40 	u8 pri2_tc  : 4,
41 	   pri3_tc  : 4;
42 	u8 pri4_tc  : 4,
43 	   pri5_tc  : 4;
44 	u8 pri6_tc  : 4,
45 	   pri7_tc  : 4;
46 	u8 vlan_pri : 4,
47 	   rev	    : 4;
48 };
49 
50 struct hclge_dbg_bitmap_cmd {
51 	union {
52 		u8 bitmap;
53 		struct {
54 			u8 bit0 : 1,
55 			   bit1 : 1,
56 			   bit2 : 1,
57 			   bit3 : 1,
58 			   bit4 : 1,
59 			   bit5 : 1,
60 			   bit6 : 1,
61 			   bit7 : 1;
62 		};
63 	};
64 };
65 
66 struct hclge_dbg_reg_common_msg {
67 	int msg_num;
68 	int offset;
69 	enum hclge_opcode_type cmd;
70 };
71 
72 struct hclge_dbg_tcam_msg {
73 	u8 stage;
74 	u32 loc;
75 };
76 
77 #define	HCLGE_DBG_MAX_DFX_MSG_LEN	60
78 struct hclge_dbg_dfx_message {
79 	int flag;
80 	char message[HCLGE_DBG_MAX_DFX_MSG_LEN];
81 };
82 
83 #define HCLGE_DBG_MAC_REG_TYPE_LEN	32
84 struct hclge_dbg_reg_type_info {
85 	enum hnae3_dbg_cmd cmd;
86 	const struct hclge_dbg_dfx_message *dfx_msg;
87 	struct hclge_dbg_reg_common_msg reg_msg;
88 };
89 
90 struct hclge_dbg_func {
91 	enum hnae3_dbg_cmd cmd;
92 	int (*dbg_dump)(struct hclge_dev *hdev, char *buf, int len);
93 	int (*dbg_dump_reg)(struct hclge_dev *hdev, enum hnae3_dbg_cmd cmd,
94 			    char *buf, int len);
95 };
96 
97 static const struct hclge_dbg_dfx_message hclge_dbg_bios_common_reg[] = {
98 	{false, "Reserved"},
99 	{true,	"BP_CPU_STATE"},
100 	{true,	"DFX_MSIX_INFO_NIC_0"},
101 	{true,	"DFX_MSIX_INFO_NIC_1"},
102 	{true,	"DFX_MSIX_INFO_NIC_2"},
103 	{true,	"DFX_MSIX_INFO_NIC_3"},
104 
105 	{true,	"DFX_MSIX_INFO_ROC_0"},
106 	{true,	"DFX_MSIX_INFO_ROC_1"},
107 	{true,	"DFX_MSIX_INFO_ROC_2"},
108 	{true,	"DFX_MSIX_INFO_ROC_3"},
109 	{false, "Reserved"},
110 	{false, "Reserved"},
111 };
112 
113 static const struct hclge_dbg_dfx_message hclge_dbg_ssu_reg_0[] = {
114 	{false, "Reserved"},
115 	{true,	"SSU_ETS_PORT_STATUS"},
116 	{true,	"SSU_ETS_TCG_STATUS"},
117 	{false, "Reserved"},
118 	{false, "Reserved"},
119 	{true,	"SSU_BP_STATUS_0"},
120 
121 	{true,	"SSU_BP_STATUS_1"},
122 	{true,	"SSU_BP_STATUS_2"},
123 	{true,	"SSU_BP_STATUS_3"},
124 	{true,	"SSU_BP_STATUS_4"},
125 	{true,	"SSU_BP_STATUS_5"},
126 	{true,	"SSU_MAC_TX_PFC_IND"},
127 
128 	{true,	"MAC_SSU_RX_PFC_IND"},
129 	{true,	"BTMP_AGEING_ST_B0"},
130 	{true,	"BTMP_AGEING_ST_B1"},
131 	{true,	"BTMP_AGEING_ST_B2"},
132 	{false, "Reserved"},
133 	{false, "Reserved"},
134 
135 	{true,	"FULL_DROP_NUM"},
136 	{true,	"PART_DROP_NUM"},
137 	{true,	"PPP_KEY_DROP_NUM"},
138 	{true,	"PPP_RLT_DROP_NUM"},
139 	{true,	"LO_PRI_UNICAST_RLT_DROP_NUM"},
140 	{true,	"HI_PRI_MULTICAST_RLT_DROP_NUM"},
141 
142 	{true,	"LO_PRI_MULTICAST_RLT_DROP_NUM"},
143 	{true,	"NCSI_PACKET_CURR_BUFFER_CNT"},
144 	{true,	"BTMP_AGEING_RLS_CNT_BANK0"},
145 	{true,	"BTMP_AGEING_RLS_CNT_BANK1"},
146 	{true,	"BTMP_AGEING_RLS_CNT_BANK2"},
147 	{true,	"SSU_MB_RD_RLT_DROP_CNT"},
148 
149 	{true,	"SSU_PPP_MAC_KEY_NUM_L"},
150 	{true,	"SSU_PPP_MAC_KEY_NUM_H"},
151 	{true,	"SSU_PPP_HOST_KEY_NUM_L"},
152 	{true,	"SSU_PPP_HOST_KEY_NUM_H"},
153 	{true,	"PPP_SSU_MAC_RLT_NUM_L"},
154 	{true,	"PPP_SSU_MAC_RLT_NUM_H"},
155 
156 	{true,	"PPP_SSU_HOST_RLT_NUM_L"},
157 	{true,	"PPP_SSU_HOST_RLT_NUM_H"},
158 	{true,	"NCSI_RX_PACKET_IN_CNT_L"},
159 	{true,	"NCSI_RX_PACKET_IN_CNT_H"},
160 	{true,	"NCSI_TX_PACKET_OUT_CNT_L"},
161 	{true,	"NCSI_TX_PACKET_OUT_CNT_H"},
162 
163 	{true,	"SSU_KEY_DROP_NUM"},
164 	{true,	"MB_UNCOPY_NUM"},
165 	{true,	"RX_OQ_DROP_PKT_CNT"},
166 	{true,	"TX_OQ_DROP_PKT_CNT"},
167 	{true,	"BANK_UNBALANCE_DROP_CNT"},
168 	{true,	"BANK_UNBALANCE_RX_DROP_CNT"},
169 
170 	{true,	"NIC_L2_ERR_DROP_PKT_CNT"},
171 	{true,	"ROC_L2_ERR_DROP_PKT_CNT"},
172 	{true,	"NIC_L2_ERR_DROP_PKT_CNT_RX"},
173 	{true,	"ROC_L2_ERR_DROP_PKT_CNT_RX"},
174 	{true,	"RX_OQ_GLB_DROP_PKT_CNT"},
175 	{false, "Reserved"},
176 
177 	{true,	"LO_PRI_UNICAST_CUR_CNT"},
178 	{true,	"HI_PRI_MULTICAST_CUR_CNT"},
179 	{true,	"LO_PRI_MULTICAST_CUR_CNT"},
180 	{false, "Reserved"},
181 	{false, "Reserved"},
182 	{false, "Reserved"},
183 };
184 
185 static const struct hclge_dbg_dfx_message hclge_dbg_ssu_reg_1[] = {
186 	{true,	"prt_id"},
187 	{true,	"PACKET_TC_CURR_BUFFER_CNT_0"},
188 	{true,	"PACKET_TC_CURR_BUFFER_CNT_1"},
189 	{true,	"PACKET_TC_CURR_BUFFER_CNT_2"},
190 	{true,	"PACKET_TC_CURR_BUFFER_CNT_3"},
191 	{true,	"PACKET_TC_CURR_BUFFER_CNT_4"},
192 
193 	{true,	"PACKET_TC_CURR_BUFFER_CNT_5"},
194 	{true,	"PACKET_TC_CURR_BUFFER_CNT_6"},
195 	{true,	"PACKET_TC_CURR_BUFFER_CNT_7"},
196 	{true,	"PACKET_CURR_BUFFER_CNT"},
197 	{false, "Reserved"},
198 	{false, "Reserved"},
199 
200 	{true,	"RX_PACKET_IN_CNT_L"},
201 	{true,	"RX_PACKET_IN_CNT_H"},
202 	{true,	"RX_PACKET_OUT_CNT_L"},
203 	{true,	"RX_PACKET_OUT_CNT_H"},
204 	{true,	"TX_PACKET_IN_CNT_L"},
205 	{true,	"TX_PACKET_IN_CNT_H"},
206 
207 	{true,	"TX_PACKET_OUT_CNT_L"},
208 	{true,	"TX_PACKET_OUT_CNT_H"},
209 	{true,	"ROC_RX_PACKET_IN_CNT_L"},
210 	{true,	"ROC_RX_PACKET_IN_CNT_H"},
211 	{true,	"ROC_TX_PACKET_OUT_CNT_L"},
212 	{true,	"ROC_TX_PACKET_OUT_CNT_H"},
213 
214 	{true,	"RX_PACKET_TC_IN_CNT_0_L"},
215 	{true,	"RX_PACKET_TC_IN_CNT_0_H"},
216 	{true,	"RX_PACKET_TC_IN_CNT_1_L"},
217 	{true,	"RX_PACKET_TC_IN_CNT_1_H"},
218 	{true,	"RX_PACKET_TC_IN_CNT_2_L"},
219 	{true,	"RX_PACKET_TC_IN_CNT_2_H"},
220 
221 	{true,	"RX_PACKET_TC_IN_CNT_3_L"},
222 	{true,	"RX_PACKET_TC_IN_CNT_3_H"},
223 	{true,	"RX_PACKET_TC_IN_CNT_4_L"},
224 	{true,	"RX_PACKET_TC_IN_CNT_4_H"},
225 	{true,	"RX_PACKET_TC_IN_CNT_5_L"},
226 	{true,	"RX_PACKET_TC_IN_CNT_5_H"},
227 
228 	{true,	"RX_PACKET_TC_IN_CNT_6_L"},
229 	{true,	"RX_PACKET_TC_IN_CNT_6_H"},
230 	{true,	"RX_PACKET_TC_IN_CNT_7_L"},
231 	{true,	"RX_PACKET_TC_IN_CNT_7_H"},
232 	{true,	"RX_PACKET_TC_OUT_CNT_0_L"},
233 	{true,	"RX_PACKET_TC_OUT_CNT_0_H"},
234 
235 	{true,	"RX_PACKET_TC_OUT_CNT_1_L"},
236 	{true,	"RX_PACKET_TC_OUT_CNT_1_H"},
237 	{true,	"RX_PACKET_TC_OUT_CNT_2_L"},
238 	{true,	"RX_PACKET_TC_OUT_CNT_2_H"},
239 	{true,	"RX_PACKET_TC_OUT_CNT_3_L"},
240 	{true,	"RX_PACKET_TC_OUT_CNT_3_H"},
241 
242 	{true,	"RX_PACKET_TC_OUT_CNT_4_L"},
243 	{true,	"RX_PACKET_TC_OUT_CNT_4_H"},
244 	{true,	"RX_PACKET_TC_OUT_CNT_5_L"},
245 	{true,	"RX_PACKET_TC_OUT_CNT_5_H"},
246 	{true,	"RX_PACKET_TC_OUT_CNT_6_L"},
247 	{true,	"RX_PACKET_TC_OUT_CNT_6_H"},
248 
249 	{true,	"RX_PACKET_TC_OUT_CNT_7_L"},
250 	{true,	"RX_PACKET_TC_OUT_CNT_7_H"},
251 	{true,	"TX_PACKET_TC_IN_CNT_0_L"},
252 	{true,	"TX_PACKET_TC_IN_CNT_0_H"},
253 	{true,	"TX_PACKET_TC_IN_CNT_1_L"},
254 	{true,	"TX_PACKET_TC_IN_CNT_1_H"},
255 
256 	{true,	"TX_PACKET_TC_IN_CNT_2_L"},
257 	{true,	"TX_PACKET_TC_IN_CNT_2_H"},
258 	{true,	"TX_PACKET_TC_IN_CNT_3_L"},
259 	{true,	"TX_PACKET_TC_IN_CNT_3_H"},
260 	{true,	"TX_PACKET_TC_IN_CNT_4_L"},
261 	{true,	"TX_PACKET_TC_IN_CNT_4_H"},
262 
263 	{true,	"TX_PACKET_TC_IN_CNT_5_L"},
264 	{true,	"TX_PACKET_TC_IN_CNT_5_H"},
265 	{true,	"TX_PACKET_TC_IN_CNT_6_L"},
266 	{true,	"TX_PACKET_TC_IN_CNT_6_H"},
267 	{true,	"TX_PACKET_TC_IN_CNT_7_L"},
268 	{true,	"TX_PACKET_TC_IN_CNT_7_H"},
269 
270 	{true,	"TX_PACKET_TC_OUT_CNT_0_L"},
271 	{true,	"TX_PACKET_TC_OUT_CNT_0_H"},
272 	{true,	"TX_PACKET_TC_OUT_CNT_1_L"},
273 	{true,	"TX_PACKET_TC_OUT_CNT_1_H"},
274 	{true,	"TX_PACKET_TC_OUT_CNT_2_L"},
275 	{true,	"TX_PACKET_TC_OUT_CNT_2_H"},
276 
277 	{true,	"TX_PACKET_TC_OUT_CNT_3_L"},
278 	{true,	"TX_PACKET_TC_OUT_CNT_3_H"},
279 	{true,	"TX_PACKET_TC_OUT_CNT_4_L"},
280 	{true,	"TX_PACKET_TC_OUT_CNT_4_H"},
281 	{true,	"TX_PACKET_TC_OUT_CNT_5_L"},
282 	{true,	"TX_PACKET_TC_OUT_CNT_5_H"},
283 
284 	{true,	"TX_PACKET_TC_OUT_CNT_6_L"},
285 	{true,	"TX_PACKET_TC_OUT_CNT_6_H"},
286 	{true,	"TX_PACKET_TC_OUT_CNT_7_L"},
287 	{true,	"TX_PACKET_TC_OUT_CNT_7_H"},
288 	{false, "Reserved"},
289 	{false, "Reserved"},
290 };
291 
292 static const struct hclge_dbg_dfx_message hclge_dbg_ssu_reg_2[] = {
293 	{true,	"OQ_INDEX"},
294 	{true,	"QUEUE_CNT"},
295 	{false, "Reserved"},
296 	{false, "Reserved"},
297 	{false, "Reserved"},
298 	{false, "Reserved"},
299 };
300 
301 static const struct hclge_dbg_dfx_message hclge_dbg_igu_egu_reg[] = {
302 	{true,	"prt_id"},
303 	{true,	"IGU_RX_ERR_PKT"},
304 	{true,	"IGU_RX_NO_SOF_PKT"},
305 	{true,	"EGU_TX_1588_SHORT_PKT"},
306 	{true,	"EGU_TX_1588_PKT"},
307 	{true,	"EGU_TX_ERR_PKT"},
308 
309 	{true,	"IGU_RX_OUT_L2_PKT"},
310 	{true,	"IGU_RX_OUT_L3_PKT"},
311 	{true,	"IGU_RX_OUT_L4_PKT"},
312 	{true,	"IGU_RX_IN_L2_PKT"},
313 	{true,	"IGU_RX_IN_L3_PKT"},
314 	{true,	"IGU_RX_IN_L4_PKT"},
315 
316 	{true,	"IGU_RX_EL3E_PKT"},
317 	{true,	"IGU_RX_EL4E_PKT"},
318 	{true,	"IGU_RX_L3E_PKT"},
319 	{true,	"IGU_RX_L4E_PKT"},
320 	{true,	"IGU_RX_ROCEE_PKT"},
321 	{true,	"IGU_RX_OUT_UDP0_PKT"},
322 
323 	{true,	"IGU_RX_IN_UDP0_PKT"},
324 	{false, "Reserved"},
325 	{false, "Reserved"},
326 	{false, "Reserved"},
327 	{false, "Reserved"},
328 	{false, "Reserved"},
329 
330 	{true,	"IGU_RX_OVERSIZE_PKT_L"},
331 	{true,	"IGU_RX_OVERSIZE_PKT_H"},
332 	{true,	"IGU_RX_UNDERSIZE_PKT_L"},
333 	{true,	"IGU_RX_UNDERSIZE_PKT_H"},
334 	{true,	"IGU_RX_OUT_ALL_PKT_L"},
335 	{true,	"IGU_RX_OUT_ALL_PKT_H"},
336 
337 	{true,	"IGU_TX_OUT_ALL_PKT_L"},
338 	{true,	"IGU_TX_OUT_ALL_PKT_H"},
339 	{true,	"IGU_RX_UNI_PKT_L"},
340 	{true,	"IGU_RX_UNI_PKT_H"},
341 	{true,	"IGU_RX_MULTI_PKT_L"},
342 	{true,	"IGU_RX_MULTI_PKT_H"},
343 
344 	{true,	"IGU_RX_BROAD_PKT_L"},
345 	{true,	"IGU_RX_BROAD_PKT_H"},
346 	{true,	"EGU_TX_OUT_ALL_PKT_L"},
347 	{true,	"EGU_TX_OUT_ALL_PKT_H"},
348 	{true,	"EGU_TX_UNI_PKT_L"},
349 	{true,	"EGU_TX_UNI_PKT_H"},
350 
351 	{true,	"EGU_TX_MULTI_PKT_L"},
352 	{true,	"EGU_TX_MULTI_PKT_H"},
353 	{true,	"EGU_TX_BROAD_PKT_L"},
354 	{true,	"EGU_TX_BROAD_PKT_H"},
355 	{true,	"IGU_TX_KEY_NUM_L"},
356 	{true,	"IGU_TX_KEY_NUM_H"},
357 
358 	{true,	"IGU_RX_NON_TUN_PKT_L"},
359 	{true,	"IGU_RX_NON_TUN_PKT_H"},
360 	{true,	"IGU_RX_TUN_PKT_L"},
361 	{true,	"IGU_RX_TUN_PKT_H"},
362 	{false,	"Reserved"},
363 	{false,	"Reserved"},
364 };
365 
366 static const struct hclge_dbg_dfx_message hclge_dbg_rpu_reg_0[] = {
367 	{true, "tc_queue_num"},
368 	{true, "FSM_DFX_ST0"},
369 	{true, "FSM_DFX_ST1"},
370 	{true, "RPU_RX_PKT_DROP_CNT"},
371 	{true, "BUF_WAIT_TIMEOUT"},
372 	{true, "BUF_WAIT_TIMEOUT_QID"},
373 };
374 
375 static const struct hclge_dbg_dfx_message hclge_dbg_rpu_reg_1[] = {
376 	{false, "Reserved"},
377 	{true,	"FIFO_DFX_ST0"},
378 	{true,	"FIFO_DFX_ST1"},
379 	{true,	"FIFO_DFX_ST2"},
380 	{true,	"FIFO_DFX_ST3"},
381 	{true,	"FIFO_DFX_ST4"},
382 
383 	{true,	"FIFO_DFX_ST5"},
384 	{false, "Reserved"},
385 	{false, "Reserved"},
386 	{false, "Reserved"},
387 	{false, "Reserved"},
388 	{false, "Reserved"},
389 };
390 
391 static const struct hclge_dbg_dfx_message hclge_dbg_ncsi_reg[] = {
392 	{false, "Reserved"},
393 	{true,	"NCSI_EGU_TX_FIFO_STS"},
394 	{true,	"NCSI_PAUSE_STATUS"},
395 	{true,	"NCSI_RX_CTRL_DMAC_ERR_CNT"},
396 	{true,	"NCSI_RX_CTRL_SMAC_ERR_CNT"},
397 	{true,	"NCSI_RX_CTRL_CKS_ERR_CNT"},
398 
399 	{true,	"NCSI_RX_CTRL_PKT_CNT"},
400 	{true,	"NCSI_RX_PT_DMAC_ERR_CNT"},
401 	{true,	"NCSI_RX_PT_SMAC_ERR_CNT"},
402 	{true,	"NCSI_RX_PT_PKT_CNT"},
403 	{true,	"NCSI_RX_FCS_ERR_CNT"},
404 	{true,	"NCSI_TX_CTRL_DMAC_ERR_CNT"},
405 
406 	{true,	"NCSI_TX_CTRL_SMAC_ERR_CNT"},
407 	{true,	"NCSI_TX_CTRL_PKT_CNT"},
408 	{true,	"NCSI_TX_PT_DMAC_ERR_CNT"},
409 	{true,	"NCSI_TX_PT_SMAC_ERR_CNT"},
410 	{true,	"NCSI_TX_PT_PKT_CNT"},
411 	{true,	"NCSI_TX_PT_PKT_TRUNC_CNT"},
412 
413 	{true,	"NCSI_TX_PT_PKT_ERR_CNT"},
414 	{true,	"NCSI_TX_CTRL_PKT_ERR_CNT"},
415 	{true,	"NCSI_RX_CTRL_PKT_TRUNC_CNT"},
416 	{true,	"NCSI_RX_CTRL_PKT_CFLIT_CNT"},
417 	{false, "Reserved"},
418 	{false, "Reserved"},
419 
420 	{true,	"NCSI_MAC_RX_OCTETS_OK"},
421 	{true,	"NCSI_MAC_RX_OCTETS_BAD"},
422 	{true,	"NCSI_MAC_RX_UC_PKTS"},
423 	{true,	"NCSI_MAC_RX_MC_PKTS"},
424 	{true,	"NCSI_MAC_RX_BC_PKTS"},
425 	{true,	"NCSI_MAC_RX_PKTS_64OCTETS"},
426 
427 	{true,	"NCSI_MAC_RX_PKTS_65TO127OCTETS"},
428 	{true,	"NCSI_MAC_RX_PKTS_128TO255OCTETS"},
429 	{true,	"NCSI_MAC_RX_PKTS_255TO511OCTETS"},
430 	{true,	"NCSI_MAC_RX_PKTS_512TO1023OCTETS"},
431 	{true,	"NCSI_MAC_RX_PKTS_1024TO1518OCTETS"},
432 	{true,	"NCSI_MAC_RX_PKTS_1519TOMAXOCTETS"},
433 
434 	{true,	"NCSI_MAC_RX_FCS_ERRORS"},
435 	{true,	"NCSI_MAC_RX_LONG_ERRORS"},
436 	{true,	"NCSI_MAC_RX_JABBER_ERRORS"},
437 	{true,	"NCSI_MAC_RX_RUNT_ERR_CNT"},
438 	{true,	"NCSI_MAC_RX_SHORT_ERR_CNT"},
439 	{true,	"NCSI_MAC_RX_FILT_PKT_CNT"},
440 
441 	{true,	"NCSI_MAC_RX_OCTETS_TOTAL_FILT"},
442 	{true,	"NCSI_MAC_TX_OCTETS_OK"},
443 	{true,	"NCSI_MAC_TX_OCTETS_BAD"},
444 	{true,	"NCSI_MAC_TX_UC_PKTS"},
445 	{true,	"NCSI_MAC_TX_MC_PKTS"},
446 	{true,	"NCSI_MAC_TX_BC_PKTS"},
447 
448 	{true,	"NCSI_MAC_TX_PKTS_64OCTETS"},
449 	{true,	"NCSI_MAC_TX_PKTS_65TO127OCTETS"},
450 	{true,	"NCSI_MAC_TX_PKTS_128TO255OCTETS"},
451 	{true,	"NCSI_MAC_TX_PKTS_256TO511OCTETS"},
452 	{true,	"NCSI_MAC_TX_PKTS_512TO1023OCTETS"},
453 	{true,	"NCSI_MAC_TX_PKTS_1024TO1518OCTETS"},
454 
455 	{true,	"NCSI_MAC_TX_PKTS_1519TOMAXOCTETS"},
456 	{true,	"NCSI_MAC_TX_UNDERRUN"},
457 	{true,	"NCSI_MAC_TX_CRC_ERROR"},
458 	{true,	"NCSI_MAC_TX_PAUSE_FRAMES"},
459 	{true,	"NCSI_MAC_RX_PAD_PKTS"},
460 	{true,	"NCSI_MAC_RX_PAUSE_FRAMES"},
461 };
462 
463 static const struct hclge_dbg_dfx_message hclge_dbg_rtc_reg[] = {
464 	{false, "Reserved"},
465 	{true,	"LGE_IGU_AFIFO_DFX_0"},
466 	{true,	"LGE_IGU_AFIFO_DFX_1"},
467 	{true,	"LGE_IGU_AFIFO_DFX_2"},
468 	{true,	"LGE_IGU_AFIFO_DFX_3"},
469 	{true,	"LGE_IGU_AFIFO_DFX_4"},
470 
471 	{true,	"LGE_IGU_AFIFO_DFX_5"},
472 	{true,	"LGE_IGU_AFIFO_DFX_6"},
473 	{true,	"LGE_IGU_AFIFO_DFX_7"},
474 	{true,	"LGE_EGU_AFIFO_DFX_0"},
475 	{true,	"LGE_EGU_AFIFO_DFX_1"},
476 	{true,	"LGE_EGU_AFIFO_DFX_2"},
477 
478 	{true,	"LGE_EGU_AFIFO_DFX_3"},
479 	{true,	"LGE_EGU_AFIFO_DFX_4"},
480 	{true,	"LGE_EGU_AFIFO_DFX_5"},
481 	{true,	"LGE_EGU_AFIFO_DFX_6"},
482 	{true,	"LGE_EGU_AFIFO_DFX_7"},
483 	{true,	"CGE_IGU_AFIFO_DFX_0"},
484 
485 	{true,	"CGE_IGU_AFIFO_DFX_1"},
486 	{true,	"CGE_EGU_AFIFO_DFX_0"},
487 	{true,	"CGE_EGU_AFIFO_DFX_1"},
488 	{false, "Reserved"},
489 	{false, "Reserved"},
490 	{false, "Reserved"},
491 };
492 
493 static const struct hclge_dbg_dfx_message hclge_dbg_ppp_reg[] = {
494 	{false, "Reserved"},
495 	{true,	"DROP_FROM_PRT_PKT_CNT"},
496 	{true,	"DROP_FROM_HOST_PKT_CNT"},
497 	{true,	"DROP_TX_VLAN_PROC_CNT"},
498 	{true,	"DROP_MNG_CNT"},
499 	{true,	"DROP_FD_CNT"},
500 
501 	{true,	"DROP_NO_DST_CNT"},
502 	{true,	"DROP_MC_MBID_FULL_CNT"},
503 	{true,	"DROP_SC_FILTERED"},
504 	{true,	"PPP_MC_DROP_PKT_CNT"},
505 	{true,	"DROP_PT_CNT"},
506 	{true,	"DROP_MAC_ANTI_SPOOF_CNT"},
507 
508 	{true,	"DROP_IG_VFV_CNT"},
509 	{true,	"DROP_IG_PRTV_CNT"},
510 	{true,	"DROP_CNM_PFC_PAUSE_CNT"},
511 	{true,	"DROP_TORUS_TC_CNT"},
512 	{true,	"DROP_TORUS_LPBK_CNT"},
513 	{true,	"PPP_HFS_STS"},
514 
515 	{true,	"PPP_MC_RSLT_STS"},
516 	{true,	"PPP_P3U_STS"},
517 	{true,	"PPP_RSLT_DESCR_STS"},
518 	{true,	"PPP_UMV_STS_0"},
519 	{true,	"PPP_UMV_STS_1"},
520 	{true,	"PPP_VFV_STS"},
521 
522 	{true,	"PPP_GRO_KEY_CNT"},
523 	{true,	"PPP_GRO_INFO_CNT"},
524 	{true,	"PPP_GRO_DROP_CNT"},
525 	{true,	"PPP_GRO_OUT_CNT"},
526 	{true,	"PPP_GRO_KEY_MATCH_DATA_CNT"},
527 	{true,	"PPP_GRO_KEY_MATCH_TCAM_CNT"},
528 
529 	{true,	"PPP_GRO_INFO_MATCH_CNT"},
530 	{true,	"PPP_GRO_FREE_ENTRY_CNT"},
531 	{true,	"PPP_GRO_INNER_DFX_SIGNAL"},
532 	{false, "Reserved"},
533 	{false, "Reserved"},
534 	{false, "Reserved"},
535 
536 	{true,	"GET_RX_PKT_CNT_L"},
537 	{true,	"GET_RX_PKT_CNT_H"},
538 	{true,	"GET_TX_PKT_CNT_L"},
539 	{true,	"GET_TX_PKT_CNT_H"},
540 	{true,	"SEND_UC_PRT2HOST_PKT_CNT_L"},
541 	{true,	"SEND_UC_PRT2HOST_PKT_CNT_H"},
542 
543 	{true,	"SEND_UC_PRT2PRT_PKT_CNT_L"},
544 	{true,	"SEND_UC_PRT2PRT_PKT_CNT_H"},
545 	{true,	"SEND_UC_HOST2HOST_PKT_CNT_L"},
546 	{true,	"SEND_UC_HOST2HOST_PKT_CNT_H"},
547 	{true,	"SEND_UC_HOST2PRT_PKT_CNT_L"},
548 	{true,	"SEND_UC_HOST2PRT_PKT_CNT_H"},
549 
550 	{true,	"SEND_MC_FROM_PRT_CNT_L"},
551 	{true,	"SEND_MC_FROM_PRT_CNT_H"},
552 	{true,	"SEND_MC_FROM_HOST_CNT_L"},
553 	{true,	"SEND_MC_FROM_HOST_CNT_H"},
554 	{true,	"SSU_MC_RD_CNT_L"},
555 	{true,	"SSU_MC_RD_CNT_H"},
556 
557 	{true,	"SSU_MC_DROP_CNT_L"},
558 	{true,	"SSU_MC_DROP_CNT_H"},
559 	{true,	"SSU_MC_RD_PKT_CNT_L"},
560 	{true,	"SSU_MC_RD_PKT_CNT_H"},
561 	{true,	"PPP_MC_2HOST_PKT_CNT_L"},
562 	{true,	"PPP_MC_2HOST_PKT_CNT_H"},
563 
564 	{true,	"PPP_MC_2PRT_PKT_CNT_L"},
565 	{true,	"PPP_MC_2PRT_PKT_CNT_H"},
566 	{true,	"NTSNOS_PKT_CNT_L"},
567 	{true,	"NTSNOS_PKT_CNT_H"},
568 	{true,	"NTUP_PKT_CNT_L"},
569 	{true,	"NTUP_PKT_CNT_H"},
570 
571 	{true,	"NTLCL_PKT_CNT_L"},
572 	{true,	"NTLCL_PKT_CNT_H"},
573 	{true,	"NTTGT_PKT_CNT_L"},
574 	{true,	"NTTGT_PKT_CNT_H"},
575 	{true,	"RTNS_PKT_CNT_L"},
576 	{true,	"RTNS_PKT_CNT_H"},
577 
578 	{true,	"RTLPBK_PKT_CNT_L"},
579 	{true,	"RTLPBK_PKT_CNT_H"},
580 	{true,	"NR_PKT_CNT_L"},
581 	{true,	"NR_PKT_CNT_H"},
582 	{true,	"RR_PKT_CNT_L"},
583 	{true,	"RR_PKT_CNT_H"},
584 
585 	{true,	"MNG_TBL_HIT_CNT_L"},
586 	{true,	"MNG_TBL_HIT_CNT_H"},
587 	{true,	"FD_TBL_HIT_CNT_L"},
588 	{true,	"FD_TBL_HIT_CNT_H"},
589 	{true,	"FD_LKUP_CNT_L"},
590 	{true,	"FD_LKUP_CNT_H"},
591 
592 	{true,	"BC_HIT_CNT_L"},
593 	{true,	"BC_HIT_CNT_H"},
594 	{true,	"UM_TBL_UC_HIT_CNT_L"},
595 	{true,	"UM_TBL_UC_HIT_CNT_H"},
596 	{true,	"UM_TBL_MC_HIT_CNT_L"},
597 	{true,	"UM_TBL_MC_HIT_CNT_H"},
598 
599 	{true,	"UM_TBL_VMDQ1_HIT_CNT_L"},
600 	{true,	"UM_TBL_VMDQ1_HIT_CNT_H"},
601 	{true,	"MTA_TBL_HIT_CNT_L"},
602 	{true,	"MTA_TBL_HIT_CNT_H"},
603 	{true,	"FWD_BONDING_HIT_CNT_L"},
604 	{true,	"FWD_BONDING_HIT_CNT_H"},
605 
606 	{true,	"PROMIS_TBL_HIT_CNT_L"},
607 	{true,	"PROMIS_TBL_HIT_CNT_H"},
608 	{true,	"GET_TUNL_PKT_CNT_L"},
609 	{true,	"GET_TUNL_PKT_CNT_H"},
610 	{true,	"GET_BMC_PKT_CNT_L"},
611 	{true,	"GET_BMC_PKT_CNT_H"},
612 
613 	{true,	"SEND_UC_PRT2BMC_PKT_CNT_L"},
614 	{true,	"SEND_UC_PRT2BMC_PKT_CNT_H"},
615 	{true,	"SEND_UC_HOST2BMC_PKT_CNT_L"},
616 	{true,	"SEND_UC_HOST2BMC_PKT_CNT_H"},
617 	{true,	"SEND_UC_BMC2HOST_PKT_CNT_L"},
618 	{true,	"SEND_UC_BMC2HOST_PKT_CNT_H"},
619 
620 	{true,	"SEND_UC_BMC2PRT_PKT_CNT_L"},
621 	{true,	"SEND_UC_BMC2PRT_PKT_CNT_H"},
622 	{true,	"PPP_MC_2BMC_PKT_CNT_L"},
623 	{true,	"PPP_MC_2BMC_PKT_CNT_H"},
624 	{true,	"VLAN_MIRR_CNT_L"},
625 	{true,	"VLAN_MIRR_CNT_H"},
626 
627 	{true,	"IG_MIRR_CNT_L"},
628 	{true,	"IG_MIRR_CNT_H"},
629 	{true,	"EG_MIRR_CNT_L"},
630 	{true,	"EG_MIRR_CNT_H"},
631 	{true,	"RX_DEFAULT_HOST_HIT_CNT_L"},
632 	{true,	"RX_DEFAULT_HOST_HIT_CNT_H"},
633 
634 	{true,	"LAN_PAIR_CNT_L"},
635 	{true,	"LAN_PAIR_CNT_H"},
636 	{true,	"UM_TBL_MC_HIT_PKT_CNT_L"},
637 	{true,	"UM_TBL_MC_HIT_PKT_CNT_H"},
638 	{true,	"MTA_TBL_HIT_PKT_CNT_L"},
639 	{true,	"MTA_TBL_HIT_PKT_CNT_H"},
640 
641 	{true,	"PROMIS_TBL_HIT_PKT_CNT_L"},
642 	{true,	"PROMIS_TBL_HIT_PKT_CNT_H"},
643 	{false, "Reserved"},
644 	{false, "Reserved"},
645 	{false, "Reserved"},
646 	{false, "Reserved"},
647 };
648 
649 static const struct hclge_dbg_dfx_message hclge_dbg_rcb_reg[] = {
650 	{false, "Reserved"},
651 	{true,	"FSM_DFX_ST0"},
652 	{true,	"FSM_DFX_ST1"},
653 	{true,	"FSM_DFX_ST2"},
654 	{true,	"FIFO_DFX_ST0"},
655 	{true,	"FIFO_DFX_ST1"},
656 
657 	{true,	"FIFO_DFX_ST2"},
658 	{true,	"FIFO_DFX_ST3"},
659 	{true,	"FIFO_DFX_ST4"},
660 	{true,	"FIFO_DFX_ST5"},
661 	{true,	"FIFO_DFX_ST6"},
662 	{true,	"FIFO_DFX_ST7"},
663 
664 	{true,	"FIFO_DFX_ST8"},
665 	{true,	"FIFO_DFX_ST9"},
666 	{true,	"FIFO_DFX_ST10"},
667 	{true,	"FIFO_DFX_ST11"},
668 	{true,	"Q_CREDIT_VLD_0"},
669 	{true,	"Q_CREDIT_VLD_1"},
670 
671 	{true,	"Q_CREDIT_VLD_2"},
672 	{true,	"Q_CREDIT_VLD_3"},
673 	{true,	"Q_CREDIT_VLD_4"},
674 	{true,	"Q_CREDIT_VLD_5"},
675 	{true,	"Q_CREDIT_VLD_6"},
676 	{true,	"Q_CREDIT_VLD_7"},
677 
678 	{true,	"Q_CREDIT_VLD_8"},
679 	{true,	"Q_CREDIT_VLD_9"},
680 	{true,	"Q_CREDIT_VLD_10"},
681 	{true,	"Q_CREDIT_VLD_11"},
682 	{true,	"Q_CREDIT_VLD_12"},
683 	{true,	"Q_CREDIT_VLD_13"},
684 
685 	{true,	"Q_CREDIT_VLD_14"},
686 	{true,	"Q_CREDIT_VLD_15"},
687 	{true,	"Q_CREDIT_VLD_16"},
688 	{true,	"Q_CREDIT_VLD_17"},
689 	{true,	"Q_CREDIT_VLD_18"},
690 	{true,	"Q_CREDIT_VLD_19"},
691 
692 	{true,	"Q_CREDIT_VLD_20"},
693 	{true,	"Q_CREDIT_VLD_21"},
694 	{true,	"Q_CREDIT_VLD_22"},
695 	{true,	"Q_CREDIT_VLD_23"},
696 	{true,	"Q_CREDIT_VLD_24"},
697 	{true,	"Q_CREDIT_VLD_25"},
698 
699 	{true,	"Q_CREDIT_VLD_26"},
700 	{true,	"Q_CREDIT_VLD_27"},
701 	{true,	"Q_CREDIT_VLD_28"},
702 	{true,	"Q_CREDIT_VLD_29"},
703 	{true,	"Q_CREDIT_VLD_30"},
704 	{true,	"Q_CREDIT_VLD_31"},
705 
706 	{true,	"GRO_BD_SERR_CNT"},
707 	{true,	"GRO_CONTEXT_SERR_CNT"},
708 	{true,	"RX_STASH_CFG_SERR_CNT"},
709 	{true,	"AXI_RD_FBD_SERR_CNT"},
710 	{true,	"GRO_BD_MERR_CNT"},
711 	{true,	"GRO_CONTEXT_MERR_CNT"},
712 
713 	{true,	"RX_STASH_CFG_MERR_CNT"},
714 	{true,	"AXI_RD_FBD_MERR_CNT"},
715 	{false, "Reserved"},
716 	{false, "Reserved"},
717 	{false, "Reserved"},
718 	{false, "Reserved"},
719 };
720 
721 static const struct hclge_dbg_dfx_message hclge_dbg_tqp_reg[] = {
722 	{true, "q_num"},
723 	{true, "RCB_CFG_RX_RING_TAIL"},
724 	{true, "RCB_CFG_RX_RING_HEAD"},
725 	{true, "RCB_CFG_RX_RING_FBDNUM"},
726 	{true, "RCB_CFG_RX_RING_OFFSET"},
727 	{true, "RCB_CFG_RX_RING_FBDOFFSET"},
728 
729 	{true, "RCB_CFG_RX_RING_PKTNUM_RECORD"},
730 	{true, "RCB_CFG_TX_RING_TAIL"},
731 	{true, "RCB_CFG_TX_RING_HEAD"},
732 	{true, "RCB_CFG_TX_RING_FBDNUM"},
733 	{true, "RCB_CFG_TX_RING_OFFSET"},
734 	{true, "RCB_CFG_TX_RING_EBDNUM"},
735 };
736 
737 #define HCLGE_DBG_INFO_LEN			256
738 #define HCLGE_DBG_VLAN_FLTR_INFO_LEN		256
739 #define HCLGE_DBG_VLAN_OFFLOAD_INFO_LEN		512
740 #define HCLGE_DBG_ID_LEN			16
741 #define HCLGE_DBG_ITEM_NAME_LEN			32
742 #define HCLGE_DBG_DATA_STR_LEN			32
743 #define HCLGE_DBG_TM_INFO_LEN			256
744 
745 #define HCLGE_BILLION_NANO_SECONDS	1000000000
746 
747 struct hclge_dbg_item {
748 	char name[HCLGE_DBG_ITEM_NAME_LEN];
749 	u16 interval; /* blank numbers after the item */
750 };
751 
752 struct hclge_dbg_vlan_cfg {
753 	u16 pvid;
754 	u8 accept_tag1;
755 	u8 accept_tag2;
756 	u8 accept_untag1;
757 	u8 accept_untag2;
758 	u8 insert_tag1;
759 	u8 insert_tag2;
760 	u8 shift_tag;
761 	u8 strip_tag1;
762 	u8 strip_tag2;
763 	u8 drop_tag1;
764 	u8 drop_tag2;
765 	u8 pri_only1;
766 	u8 pri_only2;
767 };
768 
769 #endif
770