1 /*******************************************************************
2 * This file is part of the Emulex Linux Device Driver for *
3 * Fibre Channel Host Bus Adapters. *
4 * Copyright (C) 2017-2025 Broadcom. All Rights Reserved. The term *
5 * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. *
6 * Copyright (C) 2007-2011 Emulex. All rights reserved. *
7 * EMULEX and SLI are trademarks of Emulex. *
8 * www.broadcom.com *
9 * *
10 * This program is free software; you can redistribute it and/or *
11 * modify it under the terms of version 2 of the GNU General *
12 * Public License as published by the Free Software Foundation. *
13 * This program is distributed in the hope that it will be useful. *
14 * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND *
15 * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, *
16 * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT, ARE *
17 * DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD *
18 * TO BE LEGALLY INVALID. See the GNU General Public License for *
19 * more details, a copy of which can be found in the file COPYING *
20 * included with this package. *
21 *******************************************************************/
22
23 #ifndef _H_LPFC_DEBUG_FS
24 #define _H_LPFC_DEBUG_FS
25
26 #ifdef CONFIG_SCSI_LPFC_DEBUG_FS
27
28 /* size of output line, for discovery_trace and slow_ring_trace */
29 #define LPFC_DEBUG_TRC_ENTRY_SIZE 100
30
31 /* nodelist output buffer size */
32 #define LPFC_NODELIST_SIZE 8192
33 #define LPFC_NODELIST_ENTRY_SIZE 120
34
35 /* dumpHBASlim output buffer size */
36 #define LPFC_DUMPHBASLIM_SIZE 4096
37
38 /* dumpHostSlim output buffer size */
39 #define LPFC_DUMPHOSTSLIM_SIZE 4096
40
41 /* dumpSLIqinfo output buffer size */
42 #define LPFC_DUMPSLIQINFO_SIZE 4096
43
44 /* hbqinfo output buffer size */
45 #define LPFC_HBQINFO_SIZE 8192
46
47 /* hdwqinfo output buffer size */
48 #define LPFC_HDWQINFO_SIZE 8192
49
50 /* nvmestat output buffer size */
51 #define LPFC_NVMESTAT_SIZE 8192
52 #define LPFC_IOKTIME_SIZE 8192
53 #define LPFC_NVMEIO_TRC_SIZE 8192
54
55 /* scsistat output buffer size */
56 #define LPFC_SCSISTAT_SIZE 8192
57
58 /* Congestion Info Buffer size */
59 #define LPFC_CGN_BUF_SIZE 8192
60
61 #define LPFC_DEBUG_OUT_LINE_SZ 80
62
63 /*
64 * For SLI4 iDiag debugfs diagnostics tool
65 */
66
67 /* pciConf */
68 #define LPFC_PCI_CFG_BROWSE 0xffff
69 #define LPFC_PCI_CFG_RD_CMD_ARG 2
70 #define LPFC_PCI_CFG_WR_CMD_ARG 3
71 #define LPFC_PCI_CFG_SIZE 4096
72 #define LPFC_PCI_CFG_RD_SIZE (LPFC_PCI_CFG_SIZE/4)
73
74 #define IDIAG_PCICFG_WHERE_INDX 0
75 #define IDIAG_PCICFG_COUNT_INDX 1
76 #define IDIAG_PCICFG_VALUE_INDX 2
77
78 /* barAcc */
79 #define LPFC_PCI_BAR_BROWSE 0xffff
80 #define LPFC_PCI_BAR_RD_CMD_ARG 3
81 #define LPFC_PCI_BAR_WR_CMD_ARG 3
82
83 #define LPFC_PCI_IF0_BAR0_SIZE (1024 * 16)
84 #define LPFC_PCI_IF0_BAR1_SIZE (1024 * 128)
85 #define LPFC_PCI_IF0_BAR2_SIZE (1024 * 128)
86 #define LPFC_PCI_IF2_BAR0_SIZE (1024 * 32)
87
88 #define LPFC_PCI_BAR_RD_BUF_SIZE 4096
89 #define LPFC_PCI_BAR_RD_SIZE (LPFC_PCI_BAR_RD_BUF_SIZE/4)
90
91 #define LPFC_PCI_IF0_BAR0_RD_SIZE (LPFC_PCI_IF0_BAR0_SIZE/4)
92 #define LPFC_PCI_IF0_BAR1_RD_SIZE (LPFC_PCI_IF0_BAR1_SIZE/4)
93 #define LPFC_PCI_IF0_BAR2_RD_SIZE (LPFC_PCI_IF0_BAR2_SIZE/4)
94 #define LPFC_PCI_IF2_BAR0_RD_SIZE (LPFC_PCI_IF2_BAR0_SIZE/4)
95
96 #define IDIAG_BARACC_BAR_NUM_INDX 0
97 #define IDIAG_BARACC_OFF_SET_INDX 1
98 #define IDIAG_BARACC_ACC_MOD_INDX 2
99 #define IDIAG_BARACC_REG_VAL_INDX 2
100 #define IDIAG_BARACC_BAR_SZE_INDX 3
101
102 #define IDIAG_BARACC_BAR_0 0
103 #define IDIAG_BARACC_BAR_1 1
104 #define IDIAG_BARACC_BAR_2 2
105
106 #define SINGLE_WORD 1
107
108 /* queue info */
109 #define LPFC_QUE_INFO_GET_BUF_SIZE 4096
110
111 /* queue acc */
112 #define LPFC_QUE_ACC_BROWSE 0xffff
113 #define LPFC_QUE_ACC_RD_CMD_ARG 4
114 #define LPFC_QUE_ACC_WR_CMD_ARG 6
115 #define LPFC_QUE_ACC_BUF_SIZE 4096
116 #define LPFC_QUE_ACC_SIZE (LPFC_QUE_ACC_BUF_SIZE/2)
117
118 #define LPFC_IDIAG_EQ 1
119 #define LPFC_IDIAG_CQ 2
120 #define LPFC_IDIAG_MQ 3
121 #define LPFC_IDIAG_WQ 4
122 #define LPFC_IDIAG_RQ 5
123
124 #define IDIAG_QUEACC_QUETP_INDX 0
125 #define IDIAG_QUEACC_QUEID_INDX 1
126 #define IDIAG_QUEACC_INDEX_INDX 2
127 #define IDIAG_QUEACC_COUNT_INDX 3
128 #define IDIAG_QUEACC_OFFST_INDX 4
129 #define IDIAG_QUEACC_VALUE_INDX 5
130
131 /* doorbell register acc */
132 #define LPFC_DRB_ACC_ALL 0xffff
133 #define LPFC_DRB_ACC_RD_CMD_ARG 1
134 #define LPFC_DRB_ACC_WR_CMD_ARG 2
135 #define LPFC_DRB_ACC_BUF_SIZE 256
136
137 #define LPFC_DRB_EQ 1
138 #define LPFC_DRB_CQ 2
139 #define LPFC_DRB_MQ 3
140 #define LPFC_DRB_WQ 4
141 #define LPFC_DRB_RQ 5
142
143 #define LPFC_DRB_MAX 5
144
145 #define IDIAG_DRBACC_REGID_INDX 0
146 #define IDIAG_DRBACC_VALUE_INDX 1
147
148 /* control register acc */
149 #define LPFC_CTL_ACC_ALL 0xffff
150 #define LPFC_CTL_ACC_RD_CMD_ARG 1
151 #define LPFC_CTL_ACC_WR_CMD_ARG 2
152 #define LPFC_CTL_ACC_BUF_SIZE 256
153
154 #define LPFC_CTL_PORT_SEM 1
155 #define LPFC_CTL_PORT_STA 2
156 #define LPFC_CTL_PORT_CTL 3
157 #define LPFC_CTL_PORT_ER1 4
158 #define LPFC_CTL_PORT_ER2 5
159 #define LPFC_CTL_PDEV_CTL 6
160
161 #define LPFC_CTL_MAX 6
162
163 #define IDIAG_CTLACC_REGID_INDX 0
164 #define IDIAG_CTLACC_VALUE_INDX 1
165
166 /* mailbox access */
167 #define LPFC_MBX_DMP_ARG 4
168
169 #define LPFC_MBX_ACC_BUF_SIZE 512
170 #define LPFC_MBX_ACC_LBUF_SZ 128
171
172 #define LPFC_MBX_DMP_MBX_WORD 0x00000001
173 #define LPFC_MBX_DMP_MBX_BYTE 0x00000002
174 #define LPFC_MBX_DMP_MBX_ALL (LPFC_MBX_DMP_MBX_WORD | LPFC_MBX_DMP_MBX_BYTE)
175
176 #define LPFC_BSG_DMP_MBX_RD_MBX 0x00000001
177 #define LPFC_BSG_DMP_MBX_RD_BUF 0x00000002
178 #define LPFC_BSG_DMP_MBX_WR_MBX 0x00000004
179 #define LPFC_BSG_DMP_MBX_WR_BUF 0x00000008
180 #define LPFC_BSG_DMP_MBX_ALL (LPFC_BSG_DMP_MBX_RD_MBX | \
181 LPFC_BSG_DMP_MBX_RD_BUF | \
182 LPFC_BSG_DMP_MBX_WR_MBX | \
183 LPFC_BSG_DMP_MBX_WR_BUF)
184
185 #define LPFC_MBX_DMP_ALL 0xffff
186 #define LPFC_MBX_ALL_CMD 0xff
187
188 #define IDIAG_MBXACC_MBCMD_INDX 0
189 #define IDIAG_MBXACC_DPMAP_INDX 1
190 #define IDIAG_MBXACC_DPCNT_INDX 2
191 #define IDIAG_MBXACC_WDCNT_INDX 3
192
193 /* extents access */
194 #define LPFC_EXT_ACC_CMD_ARG 1
195 #define LPFC_EXT_ACC_BUF_SIZE 4096
196
197 #define LPFC_EXT_ACC_AVAIL 0x1
198 #define LPFC_EXT_ACC_ALLOC 0x2
199 #define LPFC_EXT_ACC_DRIVR 0x4
200 #define LPFC_EXT_ACC_ALL (LPFC_EXT_ACC_DRIVR | \
201 LPFC_EXT_ACC_AVAIL | \
202 LPFC_EXT_ACC_ALLOC)
203
204 #define IDIAG_EXTACC_EXMAP_INDX 0
205
206 #define SIZE_U8 sizeof(uint8_t)
207 #define SIZE_U16 sizeof(uint16_t)
208 #define SIZE_U32 sizeof(uint32_t)
209
210 #define lpfc_nvmeio_data(phba, fmt, arg...) \
211 { \
212 if (phba->nvmeio_trc_on) \
213 lpfc_debugfs_nvme_trc(phba, fmt, ##arg); \
214 }
215
216 struct lpfc_debug {
217 char *i_private;
218 char op;
219 #define LPFC_IDIAG_OP_RD 1
220 #define LPFC_IDIAG_OP_WR 2
221 char *buffer;
222 int len;
223 };
224
225 struct lpfc_debugfs_trc {
226 char *fmt;
227 uint32_t data1;
228 uint32_t data2;
229 uint32_t data3;
230 uint32_t seq_cnt;
231 unsigned long jif;
232 };
233
234 struct lpfc_debugfs_nvmeio_trc {
235 char *fmt;
236 uint16_t data1;
237 uint16_t data2;
238 uint32_t data3;
239 };
240
241 struct lpfc_idiag_offset {
242 uint32_t last_rd;
243 };
244
245 #define LPFC_IDIAG_CMD_DATA_SIZE 8
246 struct lpfc_idiag_cmd {
247 uint32_t opcode;
248 #define LPFC_IDIAG_CMD_PCICFG_RD 0x00000001
249 #define LPFC_IDIAG_CMD_PCICFG_WR 0x00000002
250 #define LPFC_IDIAG_CMD_PCICFG_ST 0x00000003
251 #define LPFC_IDIAG_CMD_PCICFG_CL 0x00000004
252
253 #define LPFC_IDIAG_CMD_BARACC_RD 0x00000008
254 #define LPFC_IDIAG_CMD_BARACC_WR 0x00000009
255 #define LPFC_IDIAG_CMD_BARACC_ST 0x0000000a
256 #define LPFC_IDIAG_CMD_BARACC_CL 0x0000000b
257
258 #define LPFC_IDIAG_CMD_QUEACC_RD 0x00000011
259 #define LPFC_IDIAG_CMD_QUEACC_WR 0x00000012
260 #define LPFC_IDIAG_CMD_QUEACC_ST 0x00000013
261 #define LPFC_IDIAG_CMD_QUEACC_CL 0x00000014
262
263 #define LPFC_IDIAG_CMD_DRBACC_RD 0x00000021
264 #define LPFC_IDIAG_CMD_DRBACC_WR 0x00000022
265 #define LPFC_IDIAG_CMD_DRBACC_ST 0x00000023
266 #define LPFC_IDIAG_CMD_DRBACC_CL 0x00000024
267
268 #define LPFC_IDIAG_CMD_CTLACC_RD 0x00000031
269 #define LPFC_IDIAG_CMD_CTLACC_WR 0x00000032
270 #define LPFC_IDIAG_CMD_CTLACC_ST 0x00000033
271 #define LPFC_IDIAG_CMD_CTLACC_CL 0x00000034
272
273 #define LPFC_IDIAG_CMD_MBXACC_DP 0x00000041
274 #define LPFC_IDIAG_BSG_MBXACC_DP 0x00000042
275
276 #define LPFC_IDIAG_CMD_EXTACC_RD 0x00000051
277
278 uint32_t data[LPFC_IDIAG_CMD_DATA_SIZE];
279 };
280
281 struct lpfc_idiag {
282 uint32_t active;
283 struct lpfc_idiag_cmd cmd;
284 struct lpfc_idiag_offset offset;
285 void *ptr_private;
286 };
287
288 #define MAX_DEBUGFS_RX_INFO_SIZE (128 * LPFC_MAX_RXMONITOR_ENTRY)
289 struct lpfc_rx_monitor_debug {
290 char *i_private;
291 char *buffer;
292 };
293
294 #else
295
296 #define lpfc_nvmeio_data(phba, fmt, arg...) \
297 no_printk(fmt, ##arg)
298
299 #endif
300
301 /* multixripool output buffer size */
302 #define LPFC_DUMP_MULTIXRIPOOL_SIZE 8192
303
304 enum {
305 DUMP_IO,
306 DUMP_MBX,
307 DUMP_ELS,
308 DUMP_NVMELS,
309 };
310
311 /* Mask for discovery_trace */
312 #define LPFC_DISC_TRC_ELS_CMD 0x1 /* Trace ELS commands */
313 #define LPFC_DISC_TRC_ELS_RSP 0x2 /* Trace ELS response */
314 #define LPFC_DISC_TRC_ELS_UNSOL 0x4 /* Trace ELS rcv'ed */
315 #define LPFC_DISC_TRC_ELS_ALL 0x7 /* Trace ELS */
316 #define LPFC_DISC_TRC_MBOX_VPORT 0x8 /* Trace vport MBOXs */
317 #define LPFC_DISC_TRC_MBOX 0x10 /* Trace other MBOXs */
318 #define LPFC_DISC_TRC_MBOX_ALL 0x18 /* Trace all MBOXs */
319 #define LPFC_DISC_TRC_CT 0x20 /* Trace disc CT requests */
320 #define LPFC_DISC_TRC_DSM 0x40 /* Trace DSM events */
321 #define LPFC_DISC_TRC_RPORT 0x80 /* Trace rport events */
322 #define LPFC_DISC_TRC_NODE 0x100 /* Trace ndlp state changes */
323
324 #define LPFC_DISC_TRC_DISCOVERY 0xef /* common mask for general
325 * discovery */
326 #endif /* H_LPFC_DEBUG_FS */
327
328 enum {
329 writeGuard = 1,
330 writeApp,
331 writeRef,
332 readGuard,
333 readApp,
334 readRef,
335 InjErrLBA,
336 InjErrNPortID,
337 InjErrWWPN,
338 };
339
340 /*
341 * Driver debug utility routines outside of debugfs. The debug utility
342 * routines implemented here is intended to be used in the instrumented
343 * debug driver for debugging host or port issues.
344 */
345
346 /**
347 * lpfc_debug_dump_qe - dump an specific entry from a queue
348 * @q: Pointer to the queue descriptor.
349 * @idx: Index to the entry on the queue.
350 *
351 * This function dumps an entry indexed by @idx from a queue specified by the
352 * queue descriptor @q.
353 **/
354 static void
lpfc_debug_dump_qe(struct lpfc_queue * q,uint32_t idx)355 lpfc_debug_dump_qe(struct lpfc_queue *q, uint32_t idx)
356 {
357 char line_buf[LPFC_LBUF_SZ];
358 int i, esize, qe_word_cnt, len;
359 uint32_t *pword;
360
361 /* sanity checks */
362 if (!q)
363 return;
364 if (idx >= q->entry_count)
365 return;
366
367 esize = q->entry_size;
368 qe_word_cnt = esize / sizeof(uint32_t);
369 pword = lpfc_sli4_qe(q, idx);
370
371 len = 0;
372 len += scnprintf(line_buf+len, LPFC_LBUF_SZ-len, "QE[%04d]: ", idx);
373 if (qe_word_cnt > 8)
374 printk(KERN_ERR "%s\n", line_buf);
375
376 for (i = 0; i < qe_word_cnt; i++) {
377 if (!(i % 8)) {
378 if (i != 0)
379 printk(KERN_ERR "%s\n", line_buf);
380 if (qe_word_cnt > 8) {
381 len = 0;
382 memset(line_buf, 0, LPFC_LBUF_SZ);
383 len += scnprintf(line_buf+len, LPFC_LBUF_SZ-len,
384 "%03d: ", i);
385 }
386 }
387 len += scnprintf(line_buf+len, LPFC_LBUF_SZ-len, "%08x ",
388 ((uint32_t)*pword) & 0xffffffff);
389 pword++;
390 }
391 if (qe_word_cnt <= 8 || (i - 1) % 8)
392 printk(KERN_ERR "%s\n", line_buf);
393 }
394
395 /**
396 * lpfc_debug_dump_q - dump all entries from an specific queue
397 * @q: Pointer to the queue descriptor.
398 *
399 * This function dumps all entries from a queue specified by the queue
400 * descriptor @q.
401 **/
402 static inline void
lpfc_debug_dump_q(struct lpfc_queue * q)403 lpfc_debug_dump_q(struct lpfc_queue *q)
404 {
405 int idx, entry_count;
406
407 /* sanity check */
408 if (!q)
409 return;
410
411 dev_printk(KERN_ERR, &(((q->phba))->pcidev)->dev,
412 "%d: [qid:%d, type:%d, subtype:%d, "
413 "qe_size:%d, qe_count:%d, "
414 "host_index:%d, port_index:%d]\n",
415 (q->phba)->brd_no,
416 q->queue_id, q->type, q->subtype,
417 q->entry_size, q->entry_count,
418 q->host_index, q->hba_index);
419 entry_count = q->entry_count;
420 for (idx = 0; idx < entry_count; idx++)
421 lpfc_debug_dump_qe(q, idx);
422 printk(KERN_ERR "\n");
423 }
424
425 /**
426 * lpfc_debug_dump_wq - dump all entries from the fcp or nvme work queue
427 * @phba: Pointer to HBA context object.
428 * @wqidx: Index to a FCP or NVME work queue.
429 *
430 * This function dumps all entries from a FCP or NVME work queue specified
431 * by the wqidx.
432 **/
433 static inline void
lpfc_debug_dump_wq(struct lpfc_hba * phba,int qtype,int wqidx)434 lpfc_debug_dump_wq(struct lpfc_hba *phba, int qtype, int wqidx)
435 {
436 struct lpfc_queue *wq;
437 char *qtypestr;
438
439 if (qtype == DUMP_IO) {
440 wq = phba->sli4_hba.hdwq[wqidx].io_wq;
441 qtypestr = "IO";
442 } else if (qtype == DUMP_MBX) {
443 wq = phba->sli4_hba.mbx_wq;
444 qtypestr = "MBX";
445 } else if (qtype == DUMP_ELS) {
446 wq = phba->sli4_hba.els_wq;
447 qtypestr = "ELS";
448 } else if (qtype == DUMP_NVMELS) {
449 wq = phba->sli4_hba.nvmels_wq;
450 qtypestr = "NVMELS";
451 } else
452 return;
453
454 if (qtype == DUMP_IO)
455 pr_err("%s WQ: WQ[Idx:%d|Qid:%d]\n",
456 qtypestr, wqidx, wq->queue_id);
457 else
458 pr_err("%s WQ: WQ[Qid:%d]\n",
459 qtypestr, wq->queue_id);
460
461 lpfc_debug_dump_q(wq);
462 }
463
464 /**
465 * lpfc_debug_dump_cq - dump all entries from a fcp or nvme work queue's
466 * cmpl queue
467 * @phba: Pointer to HBA context object.
468 * @wqidx: Index to a FCP work queue.
469 *
470 * This function dumps all entries from a FCP or NVME completion queue
471 * which is associated to the work queue specified by the @wqidx.
472 **/
473 static inline void
lpfc_debug_dump_cq(struct lpfc_hba * phba,int qtype,int wqidx)474 lpfc_debug_dump_cq(struct lpfc_hba *phba, int qtype, int wqidx)
475 {
476 struct lpfc_queue *wq, *cq, *eq;
477 char *qtypestr;
478 int eqidx;
479
480 /* io wq and cq are 1:1, thus same indexes */
481 eq = NULL;
482
483 if (qtype == DUMP_IO) {
484 wq = phba->sli4_hba.hdwq[wqidx].io_wq;
485 cq = phba->sli4_hba.hdwq[wqidx].io_cq;
486 qtypestr = "IO";
487 } else if (qtype == DUMP_MBX) {
488 wq = phba->sli4_hba.mbx_wq;
489 cq = phba->sli4_hba.mbx_cq;
490 qtypestr = "MBX";
491 } else if (qtype == DUMP_ELS) {
492 wq = phba->sli4_hba.els_wq;
493 cq = phba->sli4_hba.els_cq;
494 qtypestr = "ELS";
495 } else if (qtype == DUMP_NVMELS) {
496 wq = phba->sli4_hba.nvmels_wq;
497 cq = phba->sli4_hba.nvmels_cq;
498 qtypestr = "NVMELS";
499 } else
500 return;
501
502 for (eqidx = 0; eqidx < phba->cfg_hdw_queue; eqidx++) {
503 eq = phba->sli4_hba.hdwq[eqidx].hba_eq;
504 if (cq->assoc_qid == eq->queue_id)
505 break;
506 }
507 if (eqidx == phba->cfg_hdw_queue) {
508 pr_err("Couldn't find EQ for CQ. Using EQ[0]\n");
509 eqidx = 0;
510 eq = phba->sli4_hba.hdwq[0].hba_eq;
511 }
512
513 if (qtype == DUMP_IO)
514 pr_err("%s CQ: WQ[Idx:%d|Qid%d]->CQ[Idx%d|Qid%d]"
515 "->EQ[Idx:%d|Qid:%d]:\n",
516 qtypestr, wqidx, wq->queue_id, wqidx, cq->queue_id,
517 eqidx, eq->queue_id);
518 else
519 pr_err("%s CQ: WQ[Qid:%d]->CQ[Qid:%d]"
520 "->EQ[Idx:%d|Qid:%d]:\n",
521 qtypestr, wq->queue_id, cq->queue_id,
522 eqidx, eq->queue_id);
523
524 lpfc_debug_dump_q(cq);
525 }
526
527 /**
528 * lpfc_debug_dump_hba_eq - dump all entries from a fcp work queue's evt queue
529 * @phba: Pointer to HBA context object.
530 * @fcp_wqidx: Index to a FCP work queue.
531 *
532 * This function dumps all entries from a FCP event queue which is
533 * associated to the FCP work queue specified by the @fcp_wqidx.
534 **/
535 static inline void
lpfc_debug_dump_hba_eq(struct lpfc_hba * phba,int qidx)536 lpfc_debug_dump_hba_eq(struct lpfc_hba *phba, int qidx)
537 {
538 struct lpfc_queue *qp;
539
540 qp = phba->sli4_hba.hdwq[qidx].hba_eq;
541
542 pr_err("EQ[Idx:%d|Qid:%d]\n", qidx, qp->queue_id);
543
544 lpfc_debug_dump_q(qp);
545 }
546
547 /**
548 * lpfc_debug_dump_dat_rq - dump all entries from the receive data queue
549 * @phba: Pointer to HBA context object.
550 *
551 * This function dumps all entries from the receive data queue.
552 **/
553 static inline void
lpfc_debug_dump_dat_rq(struct lpfc_hba * phba)554 lpfc_debug_dump_dat_rq(struct lpfc_hba *phba)
555 {
556 printk(KERN_ERR "DAT RQ: RQ[Qid:%d]\n",
557 phba->sli4_hba.dat_rq->queue_id);
558 lpfc_debug_dump_q(phba->sli4_hba.dat_rq);
559 }
560
561 /**
562 * lpfc_debug_dump_hdr_rq - dump all entries from the receive header queue
563 * @phba: Pointer to HBA context object.
564 *
565 * This function dumps all entries from the receive header queue.
566 **/
567 static inline void
lpfc_debug_dump_hdr_rq(struct lpfc_hba * phba)568 lpfc_debug_dump_hdr_rq(struct lpfc_hba *phba)
569 {
570 printk(KERN_ERR "HDR RQ: RQ[Qid:%d]\n",
571 phba->sli4_hba.hdr_rq->queue_id);
572 lpfc_debug_dump_q(phba->sli4_hba.hdr_rq);
573 }
574
575 /**
576 * lpfc_debug_dump_wq_by_id - dump all entries from a work queue by queue id
577 * @phba: Pointer to HBA context object.
578 * @qid: Work queue identifier.
579 *
580 * This function dumps all entries from a work queue identified by the queue
581 * identifier.
582 **/
583 static inline void
lpfc_debug_dump_wq_by_id(struct lpfc_hba * phba,int qid)584 lpfc_debug_dump_wq_by_id(struct lpfc_hba *phba, int qid)
585 {
586 int wq_idx;
587
588 for (wq_idx = 0; wq_idx < phba->cfg_hdw_queue; wq_idx++)
589 if (phba->sli4_hba.hdwq[wq_idx].io_wq->queue_id == qid)
590 break;
591 if (wq_idx < phba->cfg_hdw_queue) {
592 pr_err("IO WQ[Idx:%d|Qid:%d]\n", wq_idx, qid);
593 lpfc_debug_dump_q(phba->sli4_hba.hdwq[wq_idx].io_wq);
594 return;
595 }
596
597 if (phba->sli4_hba.els_wq->queue_id == qid) {
598 pr_err("ELS WQ[Qid:%d]\n", qid);
599 lpfc_debug_dump_q(phba->sli4_hba.els_wq);
600 return;
601 }
602
603 if (phba->sli4_hba.nvmels_wq->queue_id == qid) {
604 pr_err("NVME LS WQ[Qid:%d]\n", qid);
605 lpfc_debug_dump_q(phba->sli4_hba.nvmels_wq);
606 }
607 }
608
609 /**
610 * lpfc_debug_dump_mq_by_id - dump all entries from a mbox queue by queue id
611 * @phba: Pointer to HBA context object.
612 * @qid: Mbox work queue identifier.
613 *
614 * This function dumps all entries from a mbox work queue identified by the
615 * queue identifier.
616 **/
617 static inline void
lpfc_debug_dump_mq_by_id(struct lpfc_hba * phba,int qid)618 lpfc_debug_dump_mq_by_id(struct lpfc_hba *phba, int qid)
619 {
620 if (phba->sli4_hba.mbx_wq->queue_id == qid) {
621 printk(KERN_ERR "MBX WQ[Qid:%d]\n", qid);
622 lpfc_debug_dump_q(phba->sli4_hba.mbx_wq);
623 }
624 }
625
626 /**
627 * lpfc_debug_dump_rq_by_id - dump all entries from a receive queue by queue id
628 * @phba: Pointer to HBA context object.
629 * @qid: Receive queue identifier.
630 *
631 * This function dumps all entries from a receive queue identified by the
632 * queue identifier.
633 **/
634 static inline void
lpfc_debug_dump_rq_by_id(struct lpfc_hba * phba,int qid)635 lpfc_debug_dump_rq_by_id(struct lpfc_hba *phba, int qid)
636 {
637 if (phba->sli4_hba.hdr_rq->queue_id == qid) {
638 printk(KERN_ERR "HDR RQ[Qid:%d]\n", qid);
639 lpfc_debug_dump_q(phba->sli4_hba.hdr_rq);
640 return;
641 }
642 if (phba->sli4_hba.dat_rq->queue_id == qid) {
643 printk(KERN_ERR "DAT RQ[Qid:%d]\n", qid);
644 lpfc_debug_dump_q(phba->sli4_hba.dat_rq);
645 }
646 }
647
648 /**
649 * lpfc_debug_dump_cq_by_id - dump all entries from a cmpl queue by queue id
650 * @phba: Pointer to HBA context object.
651 * @qid: Complete queue identifier.
652 *
653 * This function dumps all entries from a complete queue identified by the
654 * queue identifier.
655 **/
656 static inline void
lpfc_debug_dump_cq_by_id(struct lpfc_hba * phba,int qid)657 lpfc_debug_dump_cq_by_id(struct lpfc_hba *phba, int qid)
658 {
659 int cq_idx;
660
661 for (cq_idx = 0; cq_idx < phba->cfg_hdw_queue; cq_idx++)
662 if (phba->sli4_hba.hdwq[cq_idx].io_cq->queue_id == qid)
663 break;
664
665 if (cq_idx < phba->cfg_hdw_queue) {
666 pr_err("IO CQ[Idx:%d|Qid:%d]\n", cq_idx, qid);
667 lpfc_debug_dump_q(phba->sli4_hba.hdwq[cq_idx].io_cq);
668 return;
669 }
670
671 if (phba->sli4_hba.els_cq->queue_id == qid) {
672 pr_err("ELS CQ[Qid:%d]\n", qid);
673 lpfc_debug_dump_q(phba->sli4_hba.els_cq);
674 return;
675 }
676
677 if (phba->sli4_hba.nvmels_cq->queue_id == qid) {
678 pr_err("NVME LS CQ[Qid:%d]\n", qid);
679 lpfc_debug_dump_q(phba->sli4_hba.nvmels_cq);
680 return;
681 }
682
683 if (phba->sli4_hba.mbx_cq->queue_id == qid) {
684 pr_err("MBX CQ[Qid:%d]\n", qid);
685 lpfc_debug_dump_q(phba->sli4_hba.mbx_cq);
686 }
687 }
688
689 /**
690 * lpfc_debug_dump_eq_by_id - dump all entries from an event queue by queue id
691 * @phba: Pointer to HBA context object.
692 * @qid: Complete queue identifier.
693 *
694 * This function dumps all entries from an event queue identified by the
695 * queue identifier.
696 **/
697 static inline void
lpfc_debug_dump_eq_by_id(struct lpfc_hba * phba,int qid)698 lpfc_debug_dump_eq_by_id(struct lpfc_hba *phba, int qid)
699 {
700 int eq_idx;
701
702 for (eq_idx = 0; eq_idx < phba->cfg_hdw_queue; eq_idx++)
703 if (phba->sli4_hba.hdwq[eq_idx].hba_eq->queue_id == qid)
704 break;
705
706 if (eq_idx < phba->cfg_hdw_queue) {
707 printk(KERN_ERR "FCP EQ[Idx:%d|Qid:%d]\n", eq_idx, qid);
708 lpfc_debug_dump_q(phba->sli4_hba.hdwq[eq_idx].hba_eq);
709 return;
710 }
711 }
712
713 void lpfc_debug_dump_all_queues(struct lpfc_hba *);
714