lpfc_logmsg.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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) 2004-2009 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. #define LOG_ELS 0x00000001 /* ELS events */
  23. #define LOG_DISCOVERY 0x00000002 /* Link discovery events */
  24. #define LOG_MBOX 0x00000004 /* Mailbox events */
  25. #define LOG_INIT 0x00000008 /* Initialization events */
  26. #define LOG_LINK_EVENT 0x00000010 /* Link events */
  27. #define LOG_IP 0x00000020 /* IP traffic history */
  28. #define LOG_FCP 0x00000040 /* FCP traffic history */
  29. #define LOG_NODE 0x00000080 /* Node table events */
  30. #define LOG_TEMP 0x00000100 /* Temperature sensor events */
  31. #define LOG_BG 0x00000200 /* BlockGuard events */
  32. #define LOG_MISC 0x00000400 /* Miscellaneous events */
  33. #define LOG_SLI 0x00000800 /* SLI events */
  34. #define LOG_FCP_ERROR 0x00001000 /* log errors, not underruns */
  35. #define LOG_LIBDFC 0x00002000 /* Libdfc events */
  36. #define LOG_VPORT 0x00004000 /* NPIV events */
  37. #define LOG_LDS_EVENT 0x00008000 /* Link Degrade Signaling events */
  38. #define LOG_EVENT 0x00010000 /* CT,TEMP,DUMP, logging */
  39. #define LOG_FIP 0x00020000 /* FIP events */
  40. #define LOG_FCP_UNDER 0x00040000 /* FCP underruns errors */
  41. #define LOG_SCSI_CMD 0x00080000 /* ALL SCSI commands */
  42. #define LOG_NVME 0x00100000 /* NVME general events. */
  43. #define LOG_NVME_DISC 0x00200000 /* NVME Discovery/Connect events. */
  44. #define LOG_NVME_ABTS 0x00400000 /* NVME ABTS events. */
  45. #define LOG_NVME_IOERR 0x00800000 /* NVME IO Error events. */
  46. #define LOG_RSVD1 0x01000000 /* Reserved */
  47. #define LOG_RSVD2 0x02000000 /* Reserved */
  48. #define LOG_CGN_MGMT 0x04000000 /* Congestion Mgmt events */
  49. #define LOG_TRACE_EVENT 0x80000000 /* Dmp the DBG log on this err */
  50. #define LOG_ALL_MSG 0x7fffffff /* LOG all messages */
  51. void lpfc_dmp_dbg(struct lpfc_hba *phba);
  52. void lpfc_dbg_print(struct lpfc_hba *phba, const char *fmt, ...);
  53. /* generate message by verbose log setting or severity */
  54. #define lpfc_vlog_msg(vport, level, mask, fmt, arg...) \
  55. { if (((mask) & (vport)->cfg_log_verbose) || (level[1] <= '4')) \
  56. dev_printk(level, &((vport)->phba->pcidev)->dev, "%d:(%d):" \
  57. fmt, (vport)->phba->brd_no, vport->vpi, ##arg); }
  58. #define lpfc_log_msg(phba, level, mask, fmt, arg...) \
  59. do { \
  60. { uint32_t log_verbose = (phba)->pport ? \
  61. (phba)->pport->cfg_log_verbose : \
  62. (phba)->cfg_log_verbose; \
  63. if (((mask) & log_verbose) || (level[1] <= '4')) \
  64. dev_printk(level, &((phba)->pcidev)->dev, "%d:" \
  65. fmt, phba->brd_no, ##arg); \
  66. } \
  67. } while (0)
  68. #define lpfc_printf_vlog(vport, level, mask, fmt, arg...) \
  69. do { \
  70. { if (((mask) & (vport)->cfg_log_verbose) || (level[1] <= '3')) { \
  71. if ((mask) & LOG_TRACE_EVENT && !(vport)->cfg_log_verbose) \
  72. lpfc_dmp_dbg((vport)->phba); \
  73. dev_printk(level, &((vport)->phba->pcidev)->dev, "%d:(%d):" \
  74. fmt, (vport)->phba->brd_no, vport->vpi, ##arg); \
  75. } else if (!(vport)->cfg_log_verbose) \
  76. lpfc_dbg_print((vport)->phba, "%d:(%d):" fmt, \
  77. (vport)->phba->brd_no, (vport)->vpi, ##arg); \
  78. } \
  79. } while (0)
  80. #define lpfc_printf_log(phba, level, mask, fmt, arg...) \
  81. do { \
  82. { uint32_t log_verbose = (phba)->pport ? \
  83. (phba)->pport->cfg_log_verbose : \
  84. (phba)->cfg_log_verbose; \
  85. if (((mask) & log_verbose) || (level[1] <= '3')) { \
  86. if ((mask) & LOG_TRACE_EVENT && !log_verbose) \
  87. lpfc_dmp_dbg(phba); \
  88. dev_printk(level, &((phba)->pcidev)->dev, "%d:" \
  89. fmt, phba->brd_no, ##arg); \
  90. } else if (!log_verbose)\
  91. lpfc_dbg_print(phba, "%d:" fmt, phba->brd_no, ##arg); \
  92. } \
  93. } while (0)