lpfc_debugfs.h 19 KB

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