Back to home page

OSCL-LXR

 
 

    


0001 /*******************************************************************
0002  * This file is part of the Emulex Linux Device Driver for         *
0003  * Fibre Channel Host Bus Adapters.                                *
0004  * Copyright (C) 2017-2022 Broadcom. All Rights Reserved. The term *
0005  * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries.     *
0006  * Copyright (C) 2004-2009 Emulex.  All rights reserved.           *
0007  * EMULEX and SLI are trademarks of Emulex.                        *
0008  * www.broadcom.com                                                *
0009  *                                                                 *
0010  * This program is free software; you can redistribute it and/or   *
0011  * modify it under the terms of version 2 of the GNU General       *
0012  * Public License as published by the Free Software Foundation.    *
0013  * This program is distributed in the hope that it will be useful. *
0014  * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND          *
0015  * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY,  *
0016  * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT, ARE      *
0017  * DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD *
0018  * TO BE LEGALLY INVALID.  See the GNU General Public License for  *
0019  * more details, a copy of which can be found in the file COPYING  *
0020  * included with this package.                                     *
0021  *******************************************************************/
0022 
0023 #define LOG_ELS     0x00000001  /* ELS events */
0024 #define LOG_DISCOVERY   0x00000002  /* Link discovery events */
0025 #define LOG_MBOX    0x00000004  /* Mailbox events */
0026 #define LOG_INIT    0x00000008  /* Initialization events */
0027 #define LOG_LINK_EVENT  0x00000010  /* Link events */
0028 #define LOG_IP      0x00000020  /* IP traffic history */
0029 #define LOG_FCP     0x00000040  /* FCP traffic history */
0030 #define LOG_NODE    0x00000080  /* Node table events */
0031 #define LOG_TEMP    0x00000100  /* Temperature sensor events */
0032 #define LOG_BG      0x00000200  /* BlockGuard events */
0033 #define LOG_MISC    0x00000400  /* Miscellaneous events */
0034 #define LOG_SLI     0x00000800  /* SLI events */
0035 #define LOG_FCP_ERROR   0x00001000  /* log errors, not underruns */
0036 #define LOG_LIBDFC  0x00002000  /* Libdfc events */
0037 #define LOG_VPORT   0x00004000  /* NPIV events */
0038 #define LOG_SECURITY    0x00008000  /* Security events */
0039 #define LOG_EVENT   0x00010000  /* CT,TEMP,DUMP, logging */
0040 #define LOG_FIP     0x00020000  /* FIP events */
0041 #define LOG_FCP_UNDER   0x00040000  /* FCP underruns errors */
0042 #define LOG_SCSI_CMD    0x00080000  /* ALL SCSI commands */
0043 #define LOG_NVME    0x00100000  /* NVME general events. */
0044 #define LOG_NVME_DISC   0x00200000      /* NVME Discovery/Connect events. */
0045 #define LOG_NVME_ABTS   0x00400000      /* NVME ABTS events. */
0046 #define LOG_NVME_IOERR  0x00800000      /* NVME IO Error events. */
0047 #define LOG_RSVD1   0x01000000  /* Reserved */
0048 #define LOG_RSVD2   0x02000000  /* Reserved */
0049 #define LOG_CGN_MGMT    0x04000000  /* Congestion Mgmt events */
0050 #define LOG_TRACE_EVENT 0x80000000  /* Dmp the DBG log on this err */
0051 #define LOG_ALL_MSG 0x7fffffff  /* LOG all messages */
0052 
0053 void lpfc_dmp_dbg(struct lpfc_hba *phba);
0054 void lpfc_dbg_print(struct lpfc_hba *phba, const char *fmt, ...);
0055 
0056 /* generate message by verbose log setting or severity */
0057 #define lpfc_vlog_msg(vport, level, mask, fmt, arg...) \
0058 { if (((mask) & (vport)->cfg_log_verbose) || (level[1] <= '4')) \
0059     dev_printk(level, &((vport)->phba->pcidev)->dev, "%d:(%d):" \
0060            fmt, (vport)->phba->brd_no, vport->vpi, ##arg); }
0061 
0062 #define lpfc_log_msg(phba, level, mask, fmt, arg...) \
0063 do { \
0064     { uint32_t log_verbose = (phba)->pport ? \
0065                  (phba)->pport->cfg_log_verbose : \
0066                  (phba)->cfg_log_verbose; \
0067     if (((mask) & log_verbose) || (level[1] <= '4')) \
0068         dev_printk(level, &((phba)->pcidev)->dev, "%d:" \
0069                fmt, phba->brd_no, ##arg); \
0070     } \
0071 } while (0)
0072 
0073 #define lpfc_printf_vlog(vport, level, mask, fmt, arg...) \
0074 do { \
0075     { if (((mask) & (vport)->cfg_log_verbose) || (level[1] <= '3')) { \
0076         if ((mask) & LOG_TRACE_EVENT && !(vport)->cfg_log_verbose) \
0077             lpfc_dmp_dbg((vport)->phba); \
0078         dev_printk(level, &((vport)->phba->pcidev)->dev, "%d:(%d):" \
0079                fmt, (vport)->phba->brd_no, vport->vpi, ##arg);  \
0080         } else if (!(vport)->cfg_log_verbose) \
0081             lpfc_dbg_print((vport)->phba, "%d:(%d):" fmt, \
0082                 (vport)->phba->brd_no, (vport)->vpi, ##arg); \
0083     } \
0084 } while (0)
0085 
0086 #define lpfc_printf_log(phba, level, mask, fmt, arg...) \
0087 do { \
0088     { uint32_t log_verbose = (phba)->pport ? \
0089                  (phba)->pport->cfg_log_verbose : \
0090                  (phba)->cfg_log_verbose; \
0091     if (((mask) & log_verbose) || (level[1] <= '3')) { \
0092         if ((mask) & LOG_TRACE_EVENT && !log_verbose) \
0093             lpfc_dmp_dbg(phba); \
0094         dev_printk(level, &((phba)->pcidev)->dev, "%d:" \
0095             fmt, phba->brd_no, ##arg); \
0096     } else if (!log_verbose)\
0097         lpfc_dbg_print(phba, "%d:" fmt, phba->brd_no, ##arg); \
0098     } \
0099 } while (0)