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