Merge remote-tracking branch 's5p/for-next'
[linux-2.6/next.git] / drivers / scsi / bnx2fc / bnx2fc_debug.h
blob3416d9a746c71320ca73310dc3a077ba2a144bd3
1 #ifndef __BNX2FC_DEBUG__
2 #define __BNX2FC_DEBUG__
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 */
12 extern unsigned int bnx2fc_debug_level;
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)
22 #define BNX2FC_ELS_DBG(fmt, arg...) \
23 BNX2FC_CHK_LOGGING(LOG_ELS, \
24 printk(KERN_INFO PFX fmt, ##arg))
26 #define BNX2FC_MISC_DBG(fmt, arg...) \
27 BNX2FC_CHK_LOGGING(LOG_MISC, \
28 printk(KERN_INFO PFX fmt, ##arg))
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, \
35 printk(KERN_INFO PFX "NULL " fmt, ##arg)); \
36 else \
37 BNX2FC_CHK_LOGGING(LOG_IO, \
38 shost_printk(KERN_INFO, \
39 (io_req)->port->lport->host, \
40 PFX "xid:0x%x " fmt, \
41 (io_req)->xid, ##arg)); \
42 } while (0)
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, \
49 printk(KERN_INFO PFX "NULL " fmt, ##arg)); \
50 else \
51 BNX2FC_CHK_LOGGING(LOG_TGT, \
52 shost_printk(KERN_INFO, \
53 (tgt)->port->lport->host, \
54 PFX "port:%x " fmt, \
55 (tgt)->rport->port_id, ##arg)); \
56 } while (0)
59 #define BNX2FC_HBA_DBG(lport, fmt, arg...) \
60 do { \
61 if (!lport || !lport->host) \
62 BNX2FC_CHK_LOGGING(LOG_HBA, \
63 printk(KERN_INFO PFX "NULL " fmt, ##arg)); \
64 else \
65 BNX2FC_CHK_LOGGING(LOG_HBA, \
66 shost_printk(KERN_INFO, lport->host, \
67 PFX fmt, ##arg)); \
68 } while (0)
70 #endif