diff options
author | Joe Eykholt <jeykholt@cisco.com> | 2009-08-25 17:03:21 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2009-09-10 13:07:59 -0400 |
commit | f657d299cf05883e23e12a69e86842da1df378ad (patch) | |
tree | 3593d2054bd361f28593eea12c83868709013b0c /drivers/scsi/libfc | |
parent | 25b37b981e706c6df72c28c94f7787c3ea0cd343 (diff) |
[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')
-rw-r--r-- | drivers/scsi/libfc/fc_elsct.c | 38 | ||||
-rw-r--r-- | drivers/scsi/libfc/fc_lport.c | 20 | ||||
-rw-r--r-- | drivers/scsi/libfc/fc_rport.c | 8 |
3 files changed, 52 insertions, 14 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 | } |
72 | EXPORT_SYMBOL(fc_elsct_init); | 72 | EXPORT_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 | */ | ||
78 | const 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 | } | ||
diff --git a/drivers/scsi/libfc/fc_lport.c b/drivers/scsi/libfc/fc_lport.c index d3f4e0c34f5c..3f2f72390145 100644 --- a/drivers/scsi/libfc/fc_lport.c +++ b/drivers/scsi/libfc/fc_lport.c | |||
@@ -1006,13 +1006,13 @@ static void fc_lport_rft_id_resp(struct fc_seq *sp, struct fc_frame *fp, | |||
1006 | struct fc_frame_header *fh; | 1006 | struct fc_frame_header *fh; |
1007 | struct fc_ct_hdr *ct; | 1007 | struct fc_ct_hdr *ct; |
1008 | 1008 | ||
1009 | FC_LPORT_DBG(lport, "Received a RFT_ID %s\n", fc_els_resp_type(fp)); | ||
1010 | |||
1009 | if (fp == ERR_PTR(-FC_EX_CLOSED)) | 1011 | if (fp == ERR_PTR(-FC_EX_CLOSED)) |
1010 | return; | 1012 | return; |
1011 | 1013 | ||
1012 | mutex_lock(&lport->lp_mutex); | 1014 | mutex_lock(&lport->lp_mutex); |
1013 | 1015 | ||
1014 | FC_LPORT_DBG(lport, "Received a RFT_ID response\n"); | ||
1015 | |||
1016 | if (lport->state != LPORT_ST_RFT_ID) { | 1016 | if (lport->state != LPORT_ST_RFT_ID) { |
1017 | FC_LPORT_DBG(lport, "Received a RFT_ID response, but in state " | 1017 | FC_LPORT_DBG(lport, "Received a RFT_ID response, but in state " |
1018 | "%s\n", fc_lport_state(lport)); | 1018 | "%s\n", fc_lport_state(lport)); |
@@ -1060,13 +1060,13 @@ static void fc_lport_rpn_id_resp(struct fc_seq *sp, struct fc_frame *fp, | |||
1060 | struct fc_frame_header *fh; | 1060 | struct fc_frame_header *fh; |
1061 | struct fc_ct_hdr *ct; | 1061 | struct fc_ct_hdr *ct; |
1062 | 1062 | ||
1063 | FC_LPORT_DBG(lport, "Received a RPN_ID %s\n", fc_els_resp_type(fp)); | ||
1064 | |||
1063 | if (fp == ERR_PTR(-FC_EX_CLOSED)) | 1065 | if (fp == ERR_PTR(-FC_EX_CLOSED)) |
1064 | return; | 1066 | return; |
1065 | 1067 | ||
1066 | mutex_lock(&lport->lp_mutex); | 1068 | mutex_lock(&lport->lp_mutex); |
1067 | 1069 | ||
1068 | FC_LPORT_DBG(lport, "Received a RPN_ID response\n"); | ||
1069 | |||
1070 | if (lport->state != LPORT_ST_RPN_ID) { | 1070 | if (lport->state != LPORT_ST_RPN_ID) { |
1071 | FC_LPORT_DBG(lport, "Received a RPN_ID response, but in state " | 1071 | FC_LPORT_DBG(lport, "Received a RPN_ID response, but in state " |
1072 | "%s\n", fc_lport_state(lport)); | 1072 | "%s\n", fc_lport_state(lport)); |
@@ -1112,13 +1112,13 @@ static void fc_lport_scr_resp(struct fc_seq *sp, struct fc_frame *fp, | |||
1112 | struct fc_lport *lport = lp_arg; | 1112 | struct fc_lport *lport = lp_arg; |
1113 | u8 op; | 1113 | u8 op; |
1114 | 1114 | ||
1115 | FC_LPORT_DBG(lport, "Received a SCR %s\n", fc_els_resp_type(fp)); | ||
1116 | |||
1115 | if (fp == ERR_PTR(-FC_EX_CLOSED)) | 1117 | if (fp == ERR_PTR(-FC_EX_CLOSED)) |
1116 | return; | 1118 | return; |
1117 | 1119 | ||
1118 | mutex_lock(&lport->lp_mutex); | 1120 | mutex_lock(&lport->lp_mutex); |
1119 | 1121 | ||
1120 | FC_LPORT_DBG(lport, "Received a SCR response\n"); | ||
1121 | |||
1122 | if (lport->state != LPORT_ST_SCR) { | 1122 | if (lport->state != LPORT_ST_SCR) { |
1123 | FC_LPORT_DBG(lport, "Received a SCR response, but in state " | 1123 | FC_LPORT_DBG(lport, "Received a SCR response, but in state " |
1124 | "%s\n", fc_lport_state(lport)); | 1124 | "%s\n", fc_lport_state(lport)); |
@@ -1333,13 +1333,13 @@ static void fc_lport_logo_resp(struct fc_seq *sp, struct fc_frame *fp, | |||
1333 | struct fc_lport *lport = lp_arg; | 1333 | struct fc_lport *lport = lp_arg; |
1334 | u8 op; | 1334 | u8 op; |
1335 | 1335 | ||
1336 | FC_LPORT_DBG(lport, "Received a LOGO %s\n", fc_els_resp_type(fp)); | ||
1337 | |||
1336 | if (fp == ERR_PTR(-FC_EX_CLOSED)) | 1338 | if (fp == ERR_PTR(-FC_EX_CLOSED)) |
1337 | return; | 1339 | return; |
1338 | 1340 | ||
1339 | mutex_lock(&lport->lp_mutex); | 1341 | mutex_lock(&lport->lp_mutex); |
1340 | 1342 | ||
1341 | FC_LPORT_DBG(lport, "Received a LOGO response\n"); | ||
1342 | |||
1343 | if (lport->state != LPORT_ST_LOGO) { | 1343 | if (lport->state != LPORT_ST_LOGO) { |
1344 | FC_LPORT_DBG(lport, "Received a LOGO response, but in state " | 1344 | FC_LPORT_DBG(lport, "Received a LOGO response, but in state " |
1345 | "%s\n", fc_lport_state(lport)); | 1345 | "%s\n", fc_lport_state(lport)); |
@@ -1415,13 +1415,13 @@ static void fc_lport_flogi_resp(struct fc_seq *sp, struct fc_frame *fp, | |||
1415 | unsigned int e_d_tov; | 1415 | unsigned int e_d_tov; |
1416 | u16 mfs; | 1416 | u16 mfs; |
1417 | 1417 | ||
1418 | FC_LPORT_DBG(lport, "Received a FLOGI %s\n", fc_els_resp_type(fp)); | ||
1419 | |||
1418 | if (fp == ERR_PTR(-FC_EX_CLOSED)) | 1420 | if (fp == ERR_PTR(-FC_EX_CLOSED)) |
1419 | return; | 1421 | return; |
1420 | 1422 | ||
1421 | mutex_lock(&lport->lp_mutex); | 1423 | mutex_lock(&lport->lp_mutex); |
1422 | 1424 | ||
1423 | FC_LPORT_DBG(lport, "Received a FLOGI response\n"); | ||
1424 | |||
1425 | if (lport->state != LPORT_ST_FLOGI) { | 1425 | if (lport->state != LPORT_ST_FLOGI) { |
1426 | FC_LPORT_DBG(lport, "Received a FLOGI response, but in state " | 1426 | FC_LPORT_DBG(lport, "Received a FLOGI response, but in state " |
1427 | "%s\n", fc_lport_state(lport)); | 1427 | "%s\n", fc_lport_state(lport)); |
diff --git a/drivers/scsi/libfc/fc_rport.c b/drivers/scsi/libfc/fc_rport.c index 02200b26d897..d014b285cd1a 100644 --- a/drivers/scsi/libfc/fc_rport.c +++ b/drivers/scsi/libfc/fc_rport.c | |||
@@ -544,7 +544,7 @@ static void fc_rport_plogi_resp(struct fc_seq *sp, struct fc_frame *fp, | |||
544 | 544 | ||
545 | mutex_lock(&rdata->rp_mutex); | 545 | mutex_lock(&rdata->rp_mutex); |
546 | 546 | ||
547 | FC_RPORT_DBG(rdata, "Received a PLOGI response\n"); | 547 | FC_RPORT_DBG(rdata, "Received a PLOGI %s\n", fc_els_resp_type(fp)); |
548 | 548 | ||
549 | if (rdata->rp_state != RPORT_ST_PLOGI) { | 549 | if (rdata->rp_state != RPORT_ST_PLOGI) { |
550 | FC_RPORT_DBG(rdata, "Received a PLOGI response, but in state " | 550 | FC_RPORT_DBG(rdata, "Received a PLOGI response, but in state " |
@@ -651,7 +651,7 @@ static void fc_rport_prli_resp(struct fc_seq *sp, struct fc_frame *fp, | |||
651 | 651 | ||
652 | mutex_lock(&rdata->rp_mutex); | 652 | mutex_lock(&rdata->rp_mutex); |
653 | 653 | ||
654 | FC_RPORT_DBG(rdata, "Received a PRLI response\n"); | 654 | FC_RPORT_DBG(rdata, "Received a PRLI %s\n", fc_els_resp_type(fp)); |
655 | 655 | ||
656 | if (rdata->rp_state != RPORT_ST_PRLI) { | 656 | if (rdata->rp_state != RPORT_ST_PRLI) { |
657 | FC_RPORT_DBG(rdata, "Received a PRLI response, but in state " | 657 | FC_RPORT_DBG(rdata, "Received a PRLI response, but in state " |
@@ -717,7 +717,7 @@ static void fc_rport_logo_resp(struct fc_seq *sp, struct fc_frame *fp, | |||
717 | 717 | ||
718 | mutex_lock(&rdata->rp_mutex); | 718 | mutex_lock(&rdata->rp_mutex); |
719 | 719 | ||
720 | FC_RPORT_DBG(rdata, "Received a LOGO response\n"); | 720 | FC_RPORT_DBG(rdata, "Received a LOGO %s\n", fc_els_resp_type(fp)); |
721 | 721 | ||
722 | if (rdata->rp_state != RPORT_ST_LOGO) { | 722 | if (rdata->rp_state != RPORT_ST_LOGO) { |
723 | FC_RPORT_DBG(rdata, "Received a LOGO response, but in state " | 723 | FC_RPORT_DBG(rdata, "Received a LOGO response, but in state " |
@@ -801,7 +801,7 @@ static void fc_rport_rtv_resp(struct fc_seq *sp, struct fc_frame *fp, | |||
801 | 801 | ||
802 | mutex_lock(&rdata->rp_mutex); | 802 | mutex_lock(&rdata->rp_mutex); |
803 | 803 | ||
804 | FC_RPORT_DBG(rdata, "Received a RTV response\n"); | 804 | FC_RPORT_DBG(rdata, "Received a RTV %s\n", fc_els_resp_type(fp)); |
805 | 805 | ||
806 | if (rdata->rp_state != RPORT_ST_RTV) { | 806 | if (rdata->rp_state != RPORT_ST_RTV) { |
807 | FC_RPORT_DBG(rdata, "Received a RTV response, but in state " | 807 | FC_RPORT_DBG(rdata, "Received a RTV response, but in state " |