Commit 52a6690d authored by Joe Eykholt's avatar Joe Eykholt Committed by James Bottomley

[SCSI] libfc: fix fc_els_resp_type to correct display of CT responses

Local port debug messages were using fc_els_resp_type() which showed
all CT responses as rejects.

Handle CT responses correctly based by inspecting fh_type.

I decided not to rename the function to keep the patch smaller.
We could call it just fc_resp_type() or fc_elsct_resp_type().
Signed-off-by: default avatarJoe Eykholt <jeykholt@cisco.com>
Signed-off-by: default avatarRobert Love <robert.w.love@intel.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@suse.de>
parent 5f9a056d
...@@ -90,6 +90,9 @@ EXPORT_SYMBOL(fc_elsct_init); ...@@ -90,6 +90,9 @@ EXPORT_SYMBOL(fc_elsct_init);
const char *fc_els_resp_type(struct fc_frame *fp) const char *fc_els_resp_type(struct fc_frame *fp)
{ {
const char *msg; const char *msg;
struct fc_frame_header *fh;
struct fc_ct_hdr *ct;
if (IS_ERR(fp)) { if (IS_ERR(fp)) {
switch (-PTR_ERR(fp)) { switch (-PTR_ERR(fp)) {
case FC_NO_ERR: case FC_NO_ERR:
...@@ -106,15 +109,41 @@ const char *fc_els_resp_type(struct fc_frame *fp) ...@@ -106,15 +109,41 @@ const char *fc_els_resp_type(struct fc_frame *fp)
break; break;
} }
} else { } else {
switch (fc_frame_payload_op(fp)) { fh = fc_frame_header_get(fp);
case ELS_LS_ACC: switch (fh->fh_type) {
msg = "accept"; case FC_TYPE_ELS:
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;
}
break; break;
case ELS_LS_RJT: case FC_TYPE_CT:
msg = "reject"; ct = fc_frame_payload_get(fp, sizeof(*ct));
if (ct) {
switch (ntohs(ct->ct_cmd)) {
case FC_FS_ACC:
msg = "CT accept";
break;
case FC_FS_RJT:
msg = "CT reject";
break;
default:
msg = "response unknown CT";
break;
}
} else {
msg = "short CT response";
}
break; break;
default: default:
msg = "response unknown ELS"; msg = "response not ELS or CT";
break; break;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment