1dea3101eS /******************************************************************* 2dea3101eS * This file is part of the Emulex Linux Device Driver for * 3c44ce173SJames.Smart@Emulex.Com * Fibre Channel Host Bus Adapters. * 4*b93f9eb8SJustin Tee * Copyright (C) 2017-2023 Broadcom. All Rights Reserved. The term * 54ae2ebdeSJames Smart * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. * 6d8e93df1SJames Smart * Copyright (C) 2004-2009 Emulex. All rights reserved. * 7c44ce173SJames.Smart@Emulex.Com * EMULEX and SLI are trademarks of Emulex. * 8d080abe0SJames Smart * www.broadcom.com * 9dea3101eS * * 10dea3101eS * This program is free software; you can redistribute it and/or * 11c44ce173SJames.Smart@Emulex.Com * modify it under the terms of version 2 of the GNU General * 12c44ce173SJames.Smart@Emulex.Com * Public License as published by the Free Software Foundation. * 13c44ce173SJames.Smart@Emulex.Com * This program is distributed in the hope that it will be useful. * 14c44ce173SJames.Smart@Emulex.Com * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND * 15c44ce173SJames.Smart@Emulex.Com * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, * 16c44ce173SJames.Smart@Emulex.Com * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT, ARE * 17c44ce173SJames.Smart@Emulex.Com * DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD * 18c44ce173SJames.Smart@Emulex.Com * TO BE LEGALLY INVALID. See the GNU General Public License for * 19c44ce173SJames.Smart@Emulex.Com * more details, a copy of which can be found in the file COPYING * 20c44ce173SJames.Smart@Emulex.Com * included with this package. * 21dea3101eS *******************************************************************/ 22dea3101eS 23f4b4c68fSJames Smart #define LOG_ELS 0x00000001 /* ELS events */ 24f4b4c68fSJames Smart #define LOG_DISCOVERY 0x00000002 /* Link discovery events */ 25f4b4c68fSJames Smart #define LOG_MBOX 0x00000004 /* Mailbox events */ 26f4b4c68fSJames Smart #define LOG_INIT 0x00000008 /* Initialization events */ 27f4b4c68fSJames Smart #define LOG_LINK_EVENT 0x00000010 /* Link events */ 28f4b4c68fSJames Smart #define LOG_IP 0x00000020 /* IP traffic history */ 29f4b4c68fSJames Smart #define LOG_FCP 0x00000040 /* FCP traffic history */ 30f4b4c68fSJames Smart #define LOG_NODE 0x00000080 /* Node table events */ 31f4b4c68fSJames Smart #define LOG_TEMP 0x00000100 /* Temperature sensor events */ 32f4b4c68fSJames Smart #define LOG_BG 0x00000200 /* BlockGuard events */ 33f4b4c68fSJames Smart #define LOG_MISC 0x00000400 /* Miscellaneous events */ 34f4b4c68fSJames Smart #define LOG_SLI 0x00000800 /* SLI events */ 35f4b4c68fSJames Smart #define LOG_FCP_ERROR 0x00001000 /* log errors, not underruns */ 36f4b4c68fSJames Smart #define LOG_LIBDFC 0x00002000 /* Libdfc events */ 37f4b4c68fSJames Smart #define LOG_VPORT 0x00004000 /* NPIV events */ 38dbb1e2ffSJames Smart #define LOG_LDS_EVENT 0x00008000 /* Link Degrade Signaling events */ 39f4b4c68fSJames Smart #define LOG_EVENT 0x00010000 /* CT,TEMP,DUMP, logging */ 400c9ab6f5SJames Smart #define LOG_FIP 0x00020000 /* FIP events */ 4173d91e50SJames Smart #define LOG_FCP_UNDER 0x00040000 /* FCP underruns errors */ 42737d4248SJames Smart #define LOG_SCSI_CMD 0x00080000 /* ALL SCSI commands */ 43895427bdSJames Smart #define LOG_NVME 0x00100000 /* NVME general events. */ 44895427bdSJames Smart #define LOG_NVME_DISC 0x00200000 /* NVME Discovery/Connect events. */ 45895427bdSJames Smart #define LOG_NVME_ABTS 0x00400000 /* NVME ABTS events. */ 46895427bdSJames Smart #define LOG_NVME_IOERR 0x00800000 /* NVME IO Error events. */ 47c6a5c747SJames Smart #define LOG_RSVD1 0x01000000 /* Reserved */ 48c6a5c747SJames Smart #define LOG_RSVD2 0x02000000 /* Reserved */ 49c6a5c747SJames Smart #define LOG_CGN_MGMT 0x04000000 /* Congestion Mgmt events */ 50372c187bSDick Kennedy #define LOG_TRACE_EVENT 0x80000000 /* Dmp the DBG log on this err */ 51372c187bSDick Kennedy #define LOG_ALL_MSG 0x7fffffff /* LOG all messages */ 52372c187bSDick Kennedy 53372c187bSDick Kennedy void lpfc_dmp_dbg(struct lpfc_hba *phba); 54372c187bSDick Kennedy void lpfc_dbg_print(struct lpfc_hba *phba, const char *fmt, ...); 55dea3101eS 56b1dfa541SJames Smart /* generate message by verbose log setting or severity */ 57b1dfa541SJames Smart #define lpfc_vlog_msg(vport, level, mask, fmt, arg...) \ 58b9951e1cSJustin Tee { if (((mask) & (vport)->cfg_log_verbose) || (level[1] <= '5')) \ 59b1dfa541SJames Smart dev_printk(level, &((vport)->phba->pcidev)->dev, "%d:(%d):" \ 60b1dfa541SJames Smart fmt, (vport)->phba->brd_no, vport->vpi, ##arg); } 61b1dfa541SJames Smart 62b1dfa541SJames Smart #define lpfc_log_msg(phba, level, mask, fmt, arg...) \ 63b1dfa541SJames Smart do { \ 64b1dfa541SJames Smart { uint32_t log_verbose = (phba)->pport ? \ 65b1dfa541SJames Smart (phba)->pport->cfg_log_verbose : \ 66b1dfa541SJames Smart (phba)->cfg_log_verbose; \ 67b9951e1cSJustin Tee if (((mask) & log_verbose) || (level[1] <= '5')) \ 68b1dfa541SJames Smart dev_printk(level, &((phba)->pcidev)->dev, "%d:" \ 69b1dfa541SJames Smart fmt, phba->brd_no, ##arg); \ 70b1dfa541SJames Smart } \ 71b1dfa541SJames Smart } while (0) 72b1dfa541SJames Smart 73e8b62011SJames Smart #define lpfc_printf_vlog(vport, level, mask, fmt, arg...) \ 747f5f3d0dSJames Smart do { \ 75372c187bSDick Kennedy { if (((mask) & (vport)->cfg_log_verbose) || (level[1] <= '3')) { \ 76e294647bSJames Smart if ((mask) & LOG_TRACE_EVENT && !(vport)->cfg_log_verbose) \ 77372c187bSDick Kennedy lpfc_dmp_dbg((vport)->phba); \ 78e8b62011SJames Smart dev_printk(level, &((vport)->phba->pcidev)->dev, "%d:(%d):" \ 79372c187bSDick Kennedy fmt, (vport)->phba->brd_no, vport->vpi, ##arg); \ 80372c187bSDick Kennedy } else if (!(vport)->cfg_log_verbose) \ 81372c187bSDick Kennedy lpfc_dbg_print((vport)->phba, "%d:(%d):" fmt, \ 82372c187bSDick Kennedy (vport)->phba->brd_no, (vport)->vpi, ##arg); \ 83372c187bSDick Kennedy } \ 847f5f3d0dSJames Smart } while (0) 85e8b62011SJames Smart 86dea3101eS #define lpfc_printf_log(phba, level, mask, fmt, arg...) \ 877f5f3d0dSJames Smart do { \ 88f4b4c68fSJames Smart { uint32_t log_verbose = (phba)->pport ? \ 89f4b4c68fSJames Smart (phba)->pport->cfg_log_verbose : \ 90f4b4c68fSJames Smart (phba)->cfg_log_verbose; \ 91372c187bSDick Kennedy if (((mask) & log_verbose) || (level[1] <= '3')) { \ 92e294647bSJames Smart if ((mask) & LOG_TRACE_EVENT && !log_verbose) \ 93372c187bSDick Kennedy lpfc_dmp_dbg(phba); \ 94e8b62011SJames Smart dev_printk(level, &((phba)->pcidev)->dev, "%d:" \ 95f4b4c68fSJames Smart fmt, phba->brd_no, ##arg); \ 96e294647bSJames Smart } else if (!log_verbose)\ 97372c187bSDick Kennedy lpfc_dbg_print(phba, "%d:" fmt, phba->brd_no, ##arg); \ 98f4b4c68fSJames Smart } \ 997f5f3d0dSJames Smart } while (0) 100