summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/libfc/fc_elsct.c
diff options
context:
space:
mode:
authorJoe Eykholt <jeykholt@cisco.com>2009-08-25 14:03:21 -0700
committerJames Bottomley <James.Bottomley@suse.de>2009-09-10 12:07:59 -0500
commitf657d299cf05883e23e12a69e86842da1df378ad (patch)
tree3593d2054bd361f28593eea12c83868709013b0c /drivers/scsi/libfc/fc_elsct.c
parent25b37b981e706c6df72c28c94f7787c3ea0cd343 (diff)
downloadlinux-stable-f657d299cf05883e23e12a69e86842da1df378ad.tar.gz
linux-stable-f657d299cf05883e23e12a69e86842da1df378ad.tar.bz2
linux-stable-f657d299cf05883e23e12a69e86842da1df378ad.zip
[SCSI] libfc: improve debug messages for ELS response handlers
Improve lport and rport debug messages to indicate whether the response is LS_ACC, LS_RJT, closed, or timeout. Signed-off-by: Joe Eykholt <jeykholt@cisco.com> Signed-off-by: Robert Love <robert.w.love@intel.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/libfc/fc_elsct.c')
-rw-r--r--drivers/scsi/libfc/fc_elsct.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/drivers/scsi/libfc/fc_elsct.c b/drivers/scsi/libfc/fc_elsct.c
index 5e8b011af50e..d655924d46b6 100644
--- a/drivers/scsi/libfc/fc_elsct.c
+++ b/drivers/scsi/libfc/fc_elsct.c
@@ -70,3 +70,41 @@ int fc_elsct_init(struct fc_lport *lport)
return 0;
}
EXPORT_SYMBOL(fc_elsct_init);
+
+/**
+ * fc_els_resp_type() - return string describing ELS response for debug.
+ * @fp: frame pointer with possible error code.
+ */
+const char *fc_els_resp_type(struct fc_frame *fp)
+{
+ const char *msg;
+ if (IS_ERR(fp)) {
+ switch (-PTR_ERR(fp)) {
+ case FC_NO_ERR:
+ msg = "response no error";
+ break;
+ case FC_EX_TIMEOUT:
+ msg = "response timeout";
+ break;
+ case FC_EX_CLOSED:
+ msg = "response closed";
+ break;
+ default:
+ msg = "response unknown error";
+ break;
+ }
+ } else {
+ switch (fc_frame_payload_op(fp)) {
+ case ELS_LS_ACC:
+ msg = "accept";
+ break;
+ case ELS_LS_RJT:
+ msg = "reject";
+ break;
+ default:
+ msg = "response unknown ELS";
+ break;
+ }
+ }
+ return msg;
+}