aboutsummaryrefslogtreecommitdiffstats
path: root/include/scsi/libfc.h
diff options
context:
space:
mode:
authorRobert Love <robert.w.love@intel.com>2009-06-10 18:31:10 -0400
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2009-06-21 12:07:08 -0400
commit7414705ea4aef9ce438e547f3138a680d2d1096c (patch)
treec8c14a80e31dbecbd6a9d083369f3e5e11105756 /include/scsi/libfc.h
parent650bd12b9e31ec51d7ad0df3c4f94d863b827976 (diff)
libfc: Add runtime debugging with debug_logging module parameter
This patch adds the /sys/module/libfc/parameters/debug_logging file to sysfs as a module parameter. It accepts an integer bitmask for logging. Currently it supports: bit LSB 0 = general libfc debugging 1 = lport debugging 2 = disc debugging 3 = rport debugging 4 = fcp debugging 5 = EM debugging 6 = exch/seq debugging 7 = scsi logging (mostly error handling) the other bits are not used at this time. The patch converts all of the libfc source files to use these new macros and removes the old FC_DBG macro. Signed-off-by: Robert Love <robert.w.love@intel.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'include/scsi/libfc.h')
-rw-r--r--include/scsi/libfc.h77
1 files changed, 66 insertions, 11 deletions
diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h
index ebdd9f4cf070..b92584a8843a 100644
--- a/include/scsi/libfc.h
+++ b/include/scsi/libfc.h
@@ -34,17 +34,72 @@
34 34
35#include <scsi/fc_frame.h> 35#include <scsi/fc_frame.h>
36 36
37#define LIBFC_DEBUG 37#define FC_LIBFC_LOGGING 0x01 /* General logging, not categorized */
38 38#define FC_LPORT_LOGGING 0x02 /* lport layer logging */
39#ifdef LIBFC_DEBUG 39#define FC_DISC_LOGGING 0x04 /* discovery layer logging */
40/* Log messages */ 40#define FC_RPORT_LOGGING 0x08 /* rport layer logging */
41#define FC_DBG(fmt, args...) \ 41#define FC_FCP_LOGGING 0x10 /* I/O path logging */
42 do { \ 42#define FC_EM_LOGGING 0x20 /* Exchange Manager logging */
43 printk(KERN_INFO "%s " fmt, __func__, ##args); \ 43#define FC_EXCH_LOGGING 0x40 /* Exchange/Sequence logging */
44 } while (0) 44#define FC_SCSI_LOGGING 0x80 /* SCSI logging (mostly error handling) */
45#else 45
46#define FC_DBG(fmt, args...) 46extern unsigned int fc_debug_logging;
47#endif 47
48#define FC_CHECK_LOGGING(LEVEL, CMD) \
49do { \
50 if (unlikely(fc_debug_logging & LEVEL)) \
51 do { \
52 CMD; \
53 } while (0); \
54} while (0);
55
56#define FC_LIBFC_DBG(fmt, args...) \
57 FC_CHECK_LOGGING(FC_LIBFC_LOGGING, \
58 printk(KERN_INFO "libfc: " fmt, ##args);)
59
60#define FC_LPORT_DBG(lport, fmt, args...) \
61 FC_CHECK_LOGGING(FC_LPORT_LOGGING, \
62 printk(KERN_INFO "lport: %6x: " fmt, \
63 fc_host_port_id(lport->host), ##args);)
64
65#define FC_DISC_DBG(disc, fmt, args...) \
66 FC_CHECK_LOGGING(FC_DISC_LOGGING, \
67 printk(KERN_INFO "disc: %6x: " fmt, \
68 fc_host_port_id(disc->lport->host), \
69 ##args);)
70
71#define FC_RPORT_DBG(rport, fmt, args...) \
72do { \
73 struct fc_rport_libfc_priv *rdata = rport->dd_data; \
74 struct fc_lport *lport = rdata->local_port; \
75 FC_CHECK_LOGGING(FC_RPORT_LOGGING, \
76 printk(KERN_INFO "rport: %6x: %6x: " fmt, \
77 fc_host_port_id(lport->host), \
78 rport->port_id, ##args);) \
79} while (0);
80
81#define FC_FCP_DBG(pkt, fmt, args...) \
82 FC_CHECK_LOGGING(FC_FCP_LOGGING, \
83 printk(KERN_INFO "fcp: %6x: %6x: " fmt, \
84 fc_host_port_id(pkt->lp->host), \
85 pkt->rport->port_id, ##args);)
86
87#define FC_EM_DBG(em, fmt, args...) \
88 FC_CHECK_LOGGING(FC_EM_LOGGING, \
89 printk(KERN_INFO "em: %6x: " fmt, \
90 fc_host_port_id(em->lp->host), \
91 ##args);)
92
93#define FC_EXCH_DBG(exch, fmt, args...) \
94 FC_CHECK_LOGGING(FC_EXCH_LOGGING, \
95 printk(KERN_INFO "exch: %6x: %4x: " fmt, \
96 fc_host_port_id(exch->lp->host), \
97 exch->xid, ##args);)
98
99#define FC_SCSI_DBG(lport, fmt, args...) \
100 FC_CHECK_LOGGING(FC_SCSI_LOGGING, \
101 printk(KERN_INFO "scsi: %6x: " fmt, \
102 fc_host_port_id(lport->host), ##args);)
48 103
49/* 104/*
50 * libfc error codes 105 * libfc error codes