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