aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/libfc/fc_elsct.c
diff options
context:
space:
mode:
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)
70 return 0; 70 return 0;
71} 71}
72EXPORT_SYMBOL(fc_elsct_init); 72EXPORT_SYMBOL(fc_elsct_init);
73
74/**
75 * fc_els_resp_type() - return string describing ELS response for debug.
76 * @fp: frame pointer with possible error code.
77 */
78const char *fc_els_resp_type(struct fc_frame *fp)
79{
80 const char *msg;
81 if (IS_ERR(fp)) {
82 switch (-PTR_ERR(fp)) {
83 case FC_NO_ERR:
84 msg = "response no error";
85 break;
86 case FC_EX_TIMEOUT:
87 msg = "response timeout";
88 break;
89 case FC_EX_CLOSED:
90 msg = "response closed";
91 break;
92 default:
93 msg = "response unknown error";
94 break;
95 }
96 } else {
97 switch (fc_frame_payload_op(fp)) {
98 case ELS_LS_ACC:
99 msg = "accept";
100 break;
101 case ELS_LS_RJT:
102 msg = "reject";
103 break;
104 default:
105 msg = "response unknown ELS";
106 break;
107 }
108 }
109 return msg;
110}