lpfc_debugfs.h 19 KB

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