blob: 3416d9a746c71320ca73310dc3a077ba2a144bd3 [file] [log] [blame]
Bhanu Gollapudi853e2bd2011-02-04 12:10:34 -08001#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
12extern 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 Gollapudib2a554f2011-06-27 23:30:53 -070024 printk(KERN_INFO PFX fmt, ##arg))
Bhanu Gollapudi853e2bd2011-02-04 12:10:34 -080025
26#define BNX2FC_MISC_DBG(fmt, arg...) \
27 BNX2FC_CHK_LOGGING(LOG_MISC, \
Bhanu Prakash Gollapudib2a554f2011-06-27 23:30:53 -070028 printk(KERN_INFO PFX fmt, ##arg))
Bhanu Gollapudi853e2bd2011-02-04 12:10:34 -080029
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 Gollapudib2a554f2011-06-27 23:30:53 -070035 printk(KERN_INFO PFX "NULL " fmt, ##arg)); \
Bhanu Gollapudi853e2bd2011-02-04 12:10:34 -080036 else \
37 BNX2FC_CHK_LOGGING(LOG_IO, \
Bhanu Prakash Gollapudib2a554f2011-06-27 23:30:53 -070038 shost_printk(KERN_INFO, \
Bhanu Gollapudi853e2bd2011-02-04 12:10:34 -080039 (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 Gollapudib2a554f2011-06-27 23:30:53 -070049 printk(KERN_INFO PFX "NULL " fmt, ##arg)); \
Bhanu Gollapudi853e2bd2011-02-04 12:10:34 -080050 else \
51 BNX2FC_CHK_LOGGING(LOG_TGT, \
Bhanu Prakash Gollapudib2a554f2011-06-27 23:30:53 -070052 shost_printk(KERN_INFO, \
Bhanu Gollapudi853e2bd2011-02-04 12:10:34 -080053 (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 Gollapudib2a554f2011-06-27 23:30:53 -070063 printk(KERN_INFO PFX "NULL " fmt, ##arg)); \
Bhanu Gollapudi853e2bd2011-02-04 12:10:34 -080064 else \
65 BNX2FC_CHK_LOGGING(LOG_HBA, \
Bhanu Prakash Gollapudib2a554f2011-06-27 23:30:53 -070066 shost_printk(KERN_INFO, lport->host, \
Bhanu Gollapudi853e2bd2011-02-04 12:10:34 -080067 PFX fmt, ##arg)); \
68 } while (0)
69
70#endif