1*853e2bd2SBhanu Gollapudi #ifndef __BNX2FC_DEBUG__ 2*853e2bd2SBhanu Gollapudi #define __BNX2FC_DEBUG__ 3*853e2bd2SBhanu Gollapudi 4*853e2bd2SBhanu Gollapudi /* Log level bit mask */ 5*853e2bd2SBhanu Gollapudi #define LOG_IO 0x01 /* scsi cmd error, cleanup */ 6*853e2bd2SBhanu Gollapudi #define LOG_TGT 0x02 /* Session setup, cleanup, etc' */ 7*853e2bd2SBhanu Gollapudi #define LOG_HBA 0x04 /* lport events, link, mtu, etc' */ 8*853e2bd2SBhanu Gollapudi #define LOG_ELS 0x08 /* ELS logs */ 9*853e2bd2SBhanu Gollapudi #define LOG_MISC 0x10 /* fcoe L2 frame related logs*/ 10*853e2bd2SBhanu Gollapudi #define LOG_ALL 0xff /* LOG all messages */ 11*853e2bd2SBhanu Gollapudi 12*853e2bd2SBhanu Gollapudi extern unsigned int bnx2fc_debug_level; 13*853e2bd2SBhanu Gollapudi 14*853e2bd2SBhanu Gollapudi #define BNX2FC_CHK_LOGGING(LEVEL, CMD) \ 15*853e2bd2SBhanu Gollapudi do { \ 16*853e2bd2SBhanu Gollapudi if (unlikely(bnx2fc_debug_level & LEVEL)) \ 17*853e2bd2SBhanu Gollapudi do { \ 18*853e2bd2SBhanu Gollapudi CMD; \ 19*853e2bd2SBhanu Gollapudi } while (0); \ 20*853e2bd2SBhanu Gollapudi } while (0) 21*853e2bd2SBhanu Gollapudi 22*853e2bd2SBhanu Gollapudi #define BNX2FC_ELS_DBG(fmt, arg...) \ 23*853e2bd2SBhanu Gollapudi BNX2FC_CHK_LOGGING(LOG_ELS, \ 24*853e2bd2SBhanu Gollapudi printk(KERN_ALERT PFX fmt, ##arg)) 25*853e2bd2SBhanu Gollapudi 26*853e2bd2SBhanu Gollapudi #define BNX2FC_MISC_DBG(fmt, arg...) \ 27*853e2bd2SBhanu Gollapudi BNX2FC_CHK_LOGGING(LOG_MISC, \ 28*853e2bd2SBhanu Gollapudi printk(KERN_ALERT PFX fmt, ##arg)) 29*853e2bd2SBhanu Gollapudi 30*853e2bd2SBhanu Gollapudi #define BNX2FC_IO_DBG(io_req, fmt, arg...) \ 31*853e2bd2SBhanu Gollapudi do { \ 32*853e2bd2SBhanu Gollapudi if (!io_req || !io_req->port || !io_req->port->lport || \ 33*853e2bd2SBhanu Gollapudi !io_req->port->lport->host) \ 34*853e2bd2SBhanu Gollapudi BNX2FC_CHK_LOGGING(LOG_IO, \ 35*853e2bd2SBhanu Gollapudi printk(KERN_ALERT PFX "NULL " fmt, ##arg)); \ 36*853e2bd2SBhanu Gollapudi else \ 37*853e2bd2SBhanu Gollapudi BNX2FC_CHK_LOGGING(LOG_IO, \ 38*853e2bd2SBhanu Gollapudi shost_printk(KERN_ALERT, \ 39*853e2bd2SBhanu Gollapudi (io_req)->port->lport->host, \ 40*853e2bd2SBhanu Gollapudi PFX "xid:0x%x " fmt, \ 41*853e2bd2SBhanu Gollapudi (io_req)->xid, ##arg)); \ 42*853e2bd2SBhanu Gollapudi } while (0) 43*853e2bd2SBhanu Gollapudi 44*853e2bd2SBhanu Gollapudi #define BNX2FC_TGT_DBG(tgt, fmt, arg...) \ 45*853e2bd2SBhanu Gollapudi do { \ 46*853e2bd2SBhanu Gollapudi if (!tgt || !tgt->port || !tgt->port->lport || \ 47*853e2bd2SBhanu Gollapudi !tgt->port->lport->host || !tgt->rport) \ 48*853e2bd2SBhanu Gollapudi BNX2FC_CHK_LOGGING(LOG_TGT, \ 49*853e2bd2SBhanu Gollapudi printk(KERN_ALERT PFX "NULL " fmt, ##arg)); \ 50*853e2bd2SBhanu Gollapudi else \ 51*853e2bd2SBhanu Gollapudi BNX2FC_CHK_LOGGING(LOG_TGT, \ 52*853e2bd2SBhanu Gollapudi shost_printk(KERN_ALERT, \ 53*853e2bd2SBhanu Gollapudi (tgt)->port->lport->host, \ 54*853e2bd2SBhanu Gollapudi PFX "port:%x " fmt, \ 55*853e2bd2SBhanu Gollapudi (tgt)->rport->port_id, ##arg)); \ 56*853e2bd2SBhanu Gollapudi } while (0) 57*853e2bd2SBhanu Gollapudi 58*853e2bd2SBhanu Gollapudi 59*853e2bd2SBhanu Gollapudi #define BNX2FC_HBA_DBG(lport, fmt, arg...) \ 60*853e2bd2SBhanu Gollapudi do { \ 61*853e2bd2SBhanu Gollapudi if (!lport || !lport->host) \ 62*853e2bd2SBhanu Gollapudi BNX2FC_CHK_LOGGING(LOG_HBA, \ 63*853e2bd2SBhanu Gollapudi printk(KERN_ALERT PFX "NULL " fmt, ##arg)); \ 64*853e2bd2SBhanu Gollapudi else \ 65*853e2bd2SBhanu Gollapudi BNX2FC_CHK_LOGGING(LOG_HBA, \ 66*853e2bd2SBhanu Gollapudi shost_printk(KERN_ALERT, lport->host, \ 67*853e2bd2SBhanu Gollapudi PFX fmt, ##arg)); \ 68*853e2bd2SBhanu Gollapudi } while (0) 69*853e2bd2SBhanu Gollapudi 70*853e2bd2SBhanu Gollapudi #endif 71