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