2005-04-18 01:05:31 +04:00
/*******************************************************************
* This file is part of the Emulex Linux Device Driver for *
2005-06-25 18:34:39 +04:00
* Fibre Channel Host Bus Adapters . *
2023-05-23 21:32:06 +03:00
* Copyright ( C ) 2017 - 2023 Broadcom . All Rights Reserved . The term *
2018-06-26 18:24:31 +03:00
* “ Broadcom ” refers to Broadcom Inc . and / or its subsidiaries . *
2009-05-22 22:53:05 +04:00
* Copyright ( C ) 2004 - 2009 Emulex . All rights reserved . *
2005-06-25 18:34:39 +04:00
* EMULEX and SLI are trademarks of Emulex . *
2017-02-13 00:52:39 +03:00
* www . broadcom . com *
2005-04-18 01:05:31 +04:00
* *
* This program is free software ; you can redistribute it and / or *
2005-06-25 18:34:39 +04:00
* modify it under the terms of version 2 of the GNU General *
* Public License as published by the Free Software Foundation . *
* This program is distributed in the hope that it will be useful . *
* ALL EXPRESS OR IMPLIED CONDITIONS , REPRESENTATIONS AND *
* WARRANTIES , INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY , *
* FITNESS FOR A PARTICULAR PURPOSE , OR NON - INFRINGEMENT , ARE *
* DISCLAIMED , EXCEPT TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD *
* TO BE LEGALLY INVALID . See the GNU General Public License for *
* more details , a copy of which can be found in the file COPYING *
* included with this package . *
2005-04-18 01:05:31 +04:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2009-05-22 22:53:12 +04:00
# define LOG_ELS 0x00000001 /* ELS events */
# define LOG_DISCOVERY 0x00000002 /* Link discovery events */
# define LOG_MBOX 0x00000004 /* Mailbox events */
# define LOG_INIT 0x00000008 /* Initialization events */
# define LOG_LINK_EVENT 0x00000010 /* Link events */
2023-10-09 19:18:11 +03:00
# define LOG_NODE_VERBOSE 0x00000020 /* Node verbose events */
2009-05-22 22:53:12 +04:00
# define LOG_FCP 0x00000040 /* FCP traffic history */
# define LOG_NODE 0x00000080 /* Node table events */
# define LOG_TEMP 0x00000100 /* Temperature sensor events */
# define LOG_BG 0x00000200 /* BlockGuard events */
# define LOG_MISC 0x00000400 /* Miscellaneous events */
# define LOG_SLI 0x00000800 /* SLI events */
# define LOG_FCP_ERROR 0x00001000 /* log errors, not underruns */
# define LOG_LIBDFC 0x00002000 /* Libdfc events */
# define LOG_VPORT 0x00004000 /* NPIV events */
2022-09-12 01:15:03 +03:00
# define LOG_LDS_EVENT 0x00008000 /* Link Degrade Signaling events */
2009-05-22 22:53:12 +04:00
# define LOG_EVENT 0x00010000 /* CT,TEMP,DUMP, logging */
2010-02-26 22:15:57 +03:00
# define LOG_FIP 0x00020000 /* FIP events */
2011-10-11 05:32:10 +04:00
# define LOG_FCP_UNDER 0x00040000 /* FCP underruns errors */
2013-04-18 04:14:49 +04:00
# define LOG_SCSI_CMD 0x00080000 /* ALL SCSI commands */
2017-02-13 00:52:30 +03:00
# define LOG_NVME 0x00100000 /* NVME general events. */
# define LOG_NVME_DISC 0x00200000 /* NVME Discovery/Connect events. */
# define LOG_NVME_ABTS 0x00400000 /* NVME ABTS events. */
# define LOG_NVME_IOERR 0x00800000 /* NVME IO Error events. */
2021-08-16 19:28:48 +03:00
# define LOG_RSVD1 0x01000000 /* Reserved */
# define LOG_RSVD2 0x02000000 /* Reserved */
# define LOG_CGN_MGMT 0x04000000 /* Congestion Mgmt events */
2020-07-01 00:50:00 +03:00
# define LOG_TRACE_EVENT 0x80000000 /* Dmp the DBG log on this err */
# define LOG_ALL_MSG 0x7fffffff /* LOG all messages */
void lpfc_dmp_dbg ( struct lpfc_hba * phba ) ;
void lpfc_dbg_print ( struct lpfc_hba * phba , const char * fmt , . . . ) ;
2005-04-18 01:05:31 +04:00
2019-10-19 00:18:28 +03:00
/* generate message by verbose log setting or severity */
# define lpfc_vlog_msg(vport, level, mask, fmt, arg...) \
2023-05-23 21:32:02 +03:00
{ if ( ( ( mask ) & ( vport ) - > cfg_log_verbose ) | | ( level [ 1 ] < = ' 5 ' ) ) \
2019-10-19 00:18:28 +03:00
dev_printk ( level , & ( ( vport ) - > phba - > pcidev ) - > dev , " %d:(%d): " \
fmt , ( vport ) - > phba - > brd_no , vport - > vpi , # # arg ) ; }
# define lpfc_log_msg(phba, level, mask, fmt, arg...) \
do { \
{ uint32_t log_verbose = ( phba ) - > pport ? \
( phba ) - > pport - > cfg_log_verbose : \
( phba ) - > cfg_log_verbose ; \
2023-05-23 21:32:02 +03:00
if ( ( ( mask ) & log_verbose ) | | ( level [ 1 ] < = ' 5 ' ) ) \
2019-10-19 00:18:28 +03:00
dev_printk ( level , & ( ( phba ) - > pcidev ) - > dev , " %d: " \
fmt , phba - > brd_no , # # arg ) ; \
} \
} while ( 0 )
2007-08-02 19:10:09 +04:00
# define lpfc_printf_vlog(vport, level, mask, fmt, arg...) \
2009-05-22 22:53:12 +04:00
do { \
2020-07-01 00:50:00 +03:00
{ if ( ( ( mask ) & ( vport ) - > cfg_log_verbose ) | | ( level [ 1 ] < = ' 3 ' ) ) { \
2022-04-13 01:19:44 +03:00
if ( ( mask ) & LOG_TRACE_EVENT & & ! ( vport ) - > cfg_log_verbose ) \
2020-07-01 00:50:00 +03:00
lpfc_dmp_dbg ( ( vport ) - > phba ) ; \
2007-08-02 19:10:09 +04:00
dev_printk ( level , & ( ( vport ) - > phba - > pcidev ) - > dev , " %d:(%d): " \
2020-07-01 00:50:00 +03:00
fmt , ( vport ) - > phba - > brd_no , vport - > vpi , # # arg ) ; \
} else if ( ! ( vport ) - > cfg_log_verbose ) \
lpfc_dbg_print ( ( vport ) - > phba , " %d:(%d): " fmt , \
( vport ) - > phba - > brd_no , ( vport ) - > vpi , # # arg ) ; \
} \
2009-05-22 22:53:12 +04:00
} while ( 0 )
2007-08-02 19:10:09 +04:00
2005-04-18 01:05:31 +04:00
# define lpfc_printf_log(phba, level, mask, fmt, arg...) \
2009-05-22 22:53:12 +04:00
do { \
{ uint32_t log_verbose = ( phba ) - > pport ? \
( phba ) - > pport - > cfg_log_verbose : \
( phba ) - > cfg_log_verbose ; \
2020-07-01 00:50:00 +03:00
if ( ( ( mask ) & log_verbose ) | | ( level [ 1 ] < = ' 3 ' ) ) { \
2022-04-13 01:19:44 +03:00
if ( ( mask ) & LOG_TRACE_EVENT & & ! log_verbose ) \
2020-07-01 00:50:00 +03:00
lpfc_dmp_dbg ( phba ) ; \
2007-08-02 19:10:09 +04:00
dev_printk ( level , & ( ( phba ) - > pcidev ) - > dev , " %d: " \
2020-07-01 00:50:00 +03:00
fmt , phba - > brd_no , # # arg ) ; \
2022-04-13 01:19:44 +03:00
} else if ( ! log_verbose ) \
2020-07-01 00:50:00 +03:00
lpfc_dbg_print ( phba , " %d: " fmt , phba - > brd_no , # # arg ) ; \
2009-05-22 22:53:12 +04:00
} \
} while ( 0 )