^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /*******************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) * This file is part of the Emulex Linux Device Driver for *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Fibre Channel Host Bus Adapters. *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * Copyright (C) 2017-2018 Broadcom. All Rights Reserved. The term *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * Copyright (C) 2004-2009 Emulex. All rights reserved. *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) * EMULEX and SLI are trademarks of Emulex. *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) * www.broadcom.com *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) * *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) * This program is free software; you can redistribute it and/or *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) * modify it under the terms of version 2 of the GNU General *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) * Public License as published by the Free Software Foundation. *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) * This program is distributed in the hope that it will be useful. *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT, ARE *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) * DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) * TO BE LEGALLY INVALID. See the GNU General Public License for *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) * more details, a copy of which can be found in the file COPYING *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) * included with this package. *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) *******************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) #define LOG_ELS 0x00000001 /* ELS events */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) #define LOG_DISCOVERY 0x00000002 /* Link discovery events */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) #define LOG_MBOX 0x00000004 /* Mailbox events */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) #define LOG_INIT 0x00000008 /* Initialization events */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) #define LOG_LINK_EVENT 0x00000010 /* Link events */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) #define LOG_IP 0x00000020 /* IP traffic history */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) #define LOG_FCP 0x00000040 /* FCP traffic history */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) #define LOG_NODE 0x00000080 /* Node table events */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) #define LOG_TEMP 0x00000100 /* Temperature sensor events */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) #define LOG_BG 0x00000200 /* BlockGuard events */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) #define LOG_MISC 0x00000400 /* Miscellaneous events */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) #define LOG_SLI 0x00000800 /* SLI events */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) #define LOG_FCP_ERROR 0x00001000 /* log errors, not underruns */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) #define LOG_LIBDFC 0x00002000 /* Libdfc events */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) #define LOG_VPORT 0x00004000 /* NPIV events */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) #define LOG_SECURITY 0x00008000 /* Security events */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) #define LOG_EVENT 0x00010000 /* CT,TEMP,DUMP, logging */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) #define LOG_FIP 0x00020000 /* FIP events */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) #define LOG_FCP_UNDER 0x00040000 /* FCP underruns errors */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) #define LOG_SCSI_CMD 0x00080000 /* ALL SCSI commands */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) #define LOG_NVME 0x00100000 /* NVME general events. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) #define LOG_NVME_DISC 0x00200000 /* NVME Discovery/Connect events. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) #define LOG_NVME_ABTS 0x00400000 /* NVME ABTS events. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) #define LOG_NVME_IOERR 0x00800000 /* NVME IO Error events. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) #define LOG_TRACE_EVENT 0x80000000 /* Dmp the DBG log on this err */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) #define LOG_ALL_MSG 0x7fffffff /* LOG all messages */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) void lpfc_dmp_dbg(struct lpfc_hba *phba);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) void lpfc_dbg_print(struct lpfc_hba *phba, const char *fmt, ...);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) /* generate message by verbose log setting or severity */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) #define lpfc_vlog_msg(vport, level, mask, fmt, arg...) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) { if (((mask) & (vport)->cfg_log_verbose) || (level[1] <= '4')) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) dev_printk(level, &((vport)->phba->pcidev)->dev, "%d:(%d):" \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) fmt, (vport)->phba->brd_no, vport->vpi, ##arg); }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) #define lpfc_log_msg(phba, level, mask, fmt, arg...) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) do { \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) { uint32_t log_verbose = (phba)->pport ? \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) (phba)->pport->cfg_log_verbose : \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) (phba)->cfg_log_verbose; \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) if (((mask) & log_verbose) || (level[1] <= '4')) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) dev_printk(level, &((phba)->pcidev)->dev, "%d:" \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) fmt, phba->brd_no, ##arg); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) } \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) } while (0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) #define lpfc_printf_vlog(vport, level, mask, fmt, arg...) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) do { \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) { if (((mask) & (vport)->cfg_log_verbose) || (level[1] <= '3')) { \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) if ((mask) & LOG_TRACE_EVENT) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) lpfc_dmp_dbg((vport)->phba); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) dev_printk(level, &((vport)->phba->pcidev)->dev, "%d:(%d):" \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) fmt, (vport)->phba->brd_no, vport->vpi, ##arg); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) } else if (!(vport)->cfg_log_verbose) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) lpfc_dbg_print((vport)->phba, "%d:(%d):" fmt, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) (vport)->phba->brd_no, (vport)->vpi, ##arg); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) } \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) } while (0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) #define lpfc_printf_log(phba, level, mask, fmt, arg...) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) do { \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) { uint32_t log_verbose = (phba)->pport ? \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) (phba)->pport->cfg_log_verbose : \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) (phba)->cfg_log_verbose; \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) if (((mask) & log_verbose) || (level[1] <= '3')) { \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) if ((mask) & LOG_TRACE_EVENT) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) lpfc_dmp_dbg(phba); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) dev_printk(level, &((phba)->pcidev)->dev, "%d:" \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) fmt, phba->brd_no, ##arg); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) } else if (!(phba)->cfg_log_verbose)\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) lpfc_dbg_print(phba, "%d:" fmt, phba->brd_no, ##arg); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) } \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) } while (0)