diff options
author | Robert Love <robert.w.love@intel.com> | 2009-06-10 15:31:10 -0700 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2009-06-21 11:07:08 -0500 |
commit | 7414705ea4aef9ce438e547f3138a680d2d1096c (patch) | |
tree | c8c14a80e31dbecbd6a9d083369f3e5e11105756 /include/scsi | |
parent | 650bd12b9e31ec51d7ad0df3c4f94d863b827976 (diff) | |
download | linux-7414705ea4aef9ce438e547f3138a680d2d1096c.tar.bz2 |
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')
-rw-r--r-- | include/scsi/fc_encode.h | 2 | ||||
-rw-r--r-- | include/scsi/libfc.h | 77 |
2 files changed, 66 insertions, 13 deletions
diff --git a/include/scsi/fc_encode.h b/include/scsi/fc_encode.h index 6300f556bce5..a0ff61c3e935 100644 --- a/include/scsi/fc_encode.h +++ b/include/scsi/fc_encode.h @@ -107,7 +107,6 @@ static inline int fc_ct_fill(struct fc_lport *lport, struct fc_frame *fp, break; default: - FC_DBG("Invalid op code %x \n", op); return -EINVAL; } *r_ctl = FC_RCTL_DD_UNSOL_CTL; @@ -298,7 +297,6 @@ static inline int fc_els_fill(struct fc_lport *lport, struct fc_rport *rport, break; default: - FC_DBG("Invalid op code %x \n", op); return -EINVAL; } 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 @@ #include <scsi/fc_frame.h> -#define LIBFC_DEBUG - -#ifdef LIBFC_DEBUG -/* Log messages */ -#define FC_DBG(fmt, args...) \ - do { \ - printk(KERN_INFO "%s " fmt, __func__, ##args); \ - } while (0) -#else -#define FC_DBG(fmt, args...) -#endif +#define FC_LIBFC_LOGGING 0x01 /* General logging, not categorized */ +#define FC_LPORT_LOGGING 0x02 /* lport layer logging */ +#define FC_DISC_LOGGING 0x04 /* discovery layer logging */ +#define FC_RPORT_LOGGING 0x08 /* rport layer logging */ +#define FC_FCP_LOGGING 0x10 /* I/O path logging */ +#define FC_EM_LOGGING 0x20 /* Exchange Manager logging */ +#define FC_EXCH_LOGGING 0x40 /* Exchange/Sequence logging */ +#define FC_SCSI_LOGGING 0x80 /* SCSI logging (mostly error handling) */ + +extern unsigned int fc_debug_logging; + +#define FC_CHECK_LOGGING(LEVEL, CMD) \ +do { \ + if (unlikely(fc_debug_logging & LEVEL)) \ + do { \ + CMD; \ + } while (0); \ +} while (0); + +#define FC_LIBFC_DBG(fmt, args...) \ + FC_CHECK_LOGGING(FC_LIBFC_LOGGING, \ + printk(KERN_INFO "libfc: " fmt, ##args);) + +#define FC_LPORT_DBG(lport, fmt, args...) \ + FC_CHECK_LOGGING(FC_LPORT_LOGGING, \ + printk(KERN_INFO "lport: %6x: " fmt, \ + fc_host_port_id(lport->host), ##args);) + +#define FC_DISC_DBG(disc, fmt, args...) \ + FC_CHECK_LOGGING(FC_DISC_LOGGING, \ + printk(KERN_INFO "disc: %6x: " fmt, \ + fc_host_port_id(disc->lport->host), \ + ##args);) + +#define FC_RPORT_DBG(rport, fmt, args...) \ +do { \ + struct fc_rport_libfc_priv *rdata = rport->dd_data; \ + struct fc_lport *lport = rdata->local_port; \ + FC_CHECK_LOGGING(FC_RPORT_LOGGING, \ + printk(KERN_INFO "rport: %6x: %6x: " fmt, \ + fc_host_port_id(lport->host), \ + rport->port_id, ##args);) \ +} while (0); + +#define FC_FCP_DBG(pkt, fmt, args...) \ + FC_CHECK_LOGGING(FC_FCP_LOGGING, \ + printk(KERN_INFO "fcp: %6x: %6x: " fmt, \ + fc_host_port_id(pkt->lp->host), \ + pkt->rport->port_id, ##args);) + +#define FC_EM_DBG(em, fmt, args...) \ + FC_CHECK_LOGGING(FC_EM_LOGGING, \ + printk(KERN_INFO "em: %6x: " fmt, \ + fc_host_port_id(em->lp->host), \ + ##args);) + +#define FC_EXCH_DBG(exch, fmt, args...) \ + FC_CHECK_LOGGING(FC_EXCH_LOGGING, \ + printk(KERN_INFO "exch: %6x: %4x: " fmt, \ + fc_host_port_id(exch->lp->host), \ + exch->xid, ##args);) + +#define FC_SCSI_DBG(lport, fmt, args...) \ + FC_CHECK_LOGGING(FC_SCSI_LOGGING, \ + printk(KERN_INFO "scsi: %6x: " fmt, \ + fc_host_port_id(lport->host), ##args);) /* * libfc error codes |