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