Commit 586bf69b authored by Joe Eykholt's avatar Joe Eykholt Committed by James Bottomley

[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: 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 fc66b948
...@@ -70,3 +70,41 @@ int fc_elsct_init(struct fc_lport *lport) ...@@ -70,3 +70,41 @@ int fc_elsct_init(struct fc_lport *lport)
return 0; return 0;
} }
EXPORT_SYMBOL(fc_elsct_init); 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;
}
...@@ -1006,13 +1006,13 @@ static void fc_lport_rft_id_resp(struct fc_seq *sp, struct fc_frame *fp, ...@@ -1006,13 +1006,13 @@ static void fc_lport_rft_id_resp(struct fc_seq *sp, struct fc_frame *fp,
struct fc_frame_header *fh; struct fc_frame_header *fh;
struct fc_ct_hdr *ct; struct fc_ct_hdr *ct;
FC_LPORT_DBG(lport, "Received a RFT_ID %s\n", fc_els_resp_type(fp));
if (fp == ERR_PTR(-FC_EX_CLOSED)) if (fp == ERR_PTR(-FC_EX_CLOSED))
return; return;
mutex_lock(&lport->lp_mutex); mutex_lock(&lport->lp_mutex);
FC_LPORT_DBG(lport, "Received a RFT_ID response\n");
if (lport->state != LPORT_ST_RFT_ID) { if (lport->state != LPORT_ST_RFT_ID) {
FC_LPORT_DBG(lport, "Received a RFT_ID response, but in state " FC_LPORT_DBG(lport, "Received a RFT_ID response, but in state "
"%s\n", fc_lport_state(lport)); "%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,13 +1060,13 @@ static void fc_lport_rpn_id_resp(struct fc_seq *sp, struct fc_frame *fp,
struct fc_frame_header *fh; struct fc_frame_header *fh;
struct fc_ct_hdr *ct; struct fc_ct_hdr *ct;
FC_LPORT_DBG(lport, "Received a RPN_ID %s\n", fc_els_resp_type(fp));
if (fp == ERR_PTR(-FC_EX_CLOSED)) if (fp == ERR_PTR(-FC_EX_CLOSED))
return; return;
mutex_lock(&lport->lp_mutex); mutex_lock(&lport->lp_mutex);
FC_LPORT_DBG(lport, "Received a RPN_ID response\n");
if (lport->state != LPORT_ST_RPN_ID) { if (lport->state != LPORT_ST_RPN_ID) {
FC_LPORT_DBG(lport, "Received a RPN_ID response, but in state " FC_LPORT_DBG(lport, "Received a RPN_ID response, but in state "
"%s\n", fc_lport_state(lport)); "%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,13 +1112,13 @@ static void fc_lport_scr_resp(struct fc_seq *sp, struct fc_frame *fp,
struct fc_lport *lport = lp_arg; struct fc_lport *lport = lp_arg;
u8 op; u8 op;
FC_LPORT_DBG(lport, "Received a SCR %s\n", fc_els_resp_type(fp));
if (fp == ERR_PTR(-FC_EX_CLOSED)) if (fp == ERR_PTR(-FC_EX_CLOSED))
return; return;
mutex_lock(&lport->lp_mutex); mutex_lock(&lport->lp_mutex);
FC_LPORT_DBG(lport, "Received a SCR response\n");
if (lport->state != LPORT_ST_SCR) { if (lport->state != LPORT_ST_SCR) {
FC_LPORT_DBG(lport, "Received a SCR response, but in state " FC_LPORT_DBG(lport, "Received a SCR response, but in state "
"%s\n", fc_lport_state(lport)); "%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,13 +1333,13 @@ static void fc_lport_logo_resp(struct fc_seq *sp, struct fc_frame *fp,
struct fc_lport *lport = lp_arg; struct fc_lport *lport = lp_arg;
u8 op; u8 op;
FC_LPORT_DBG(lport, "Received a LOGO %s\n", fc_els_resp_type(fp));
if (fp == ERR_PTR(-FC_EX_CLOSED)) if (fp == ERR_PTR(-FC_EX_CLOSED))
return; return;
mutex_lock(&lport->lp_mutex); mutex_lock(&lport->lp_mutex);
FC_LPORT_DBG(lport, "Received a LOGO response\n");
if (lport->state != LPORT_ST_LOGO) { if (lport->state != LPORT_ST_LOGO) {
FC_LPORT_DBG(lport, "Received a LOGO response, but in state " FC_LPORT_DBG(lport, "Received a LOGO response, but in state "
"%s\n", fc_lport_state(lport)); "%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,13 +1415,13 @@ static void fc_lport_flogi_resp(struct fc_seq *sp, struct fc_frame *fp,
unsigned int e_d_tov; unsigned int e_d_tov;
u16 mfs; u16 mfs;
FC_LPORT_DBG(lport, "Received a FLOGI %s\n", fc_els_resp_type(fp));
if (fp == ERR_PTR(-FC_EX_CLOSED)) if (fp == ERR_PTR(-FC_EX_CLOSED))
return; return;
mutex_lock(&lport->lp_mutex); mutex_lock(&lport->lp_mutex);
FC_LPORT_DBG(lport, "Received a FLOGI response\n");
if (lport->state != LPORT_ST_FLOGI) { if (lport->state != LPORT_ST_FLOGI) {
FC_LPORT_DBG(lport, "Received a FLOGI response, but in state " FC_LPORT_DBG(lport, "Received a FLOGI response, but in state "
"%s\n", fc_lport_state(lport)); "%s\n", fc_lport_state(lport));
......
...@@ -544,7 +544,7 @@ static void fc_rport_plogi_resp(struct fc_seq *sp, struct fc_frame *fp, ...@@ -544,7 +544,7 @@ static void fc_rport_plogi_resp(struct fc_seq *sp, struct fc_frame *fp,
mutex_lock(&rdata->rp_mutex); mutex_lock(&rdata->rp_mutex);
FC_RPORT_DBG(rdata, "Received a PLOGI response\n"); FC_RPORT_DBG(rdata, "Received a PLOGI %s\n", fc_els_resp_type(fp));
if (rdata->rp_state != RPORT_ST_PLOGI) { if (rdata->rp_state != RPORT_ST_PLOGI) {
FC_RPORT_DBG(rdata, "Received a PLOGI response, but in state " 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,7 +651,7 @@ static void fc_rport_prli_resp(struct fc_seq *sp, struct fc_frame *fp,
mutex_lock(&rdata->rp_mutex); mutex_lock(&rdata->rp_mutex);
FC_RPORT_DBG(rdata, "Received a PRLI response\n"); FC_RPORT_DBG(rdata, "Received a PRLI %s\n", fc_els_resp_type(fp));
if (rdata->rp_state != RPORT_ST_PRLI) { if (rdata->rp_state != RPORT_ST_PRLI) {
FC_RPORT_DBG(rdata, "Received a PRLI response, but in state " 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,7 +717,7 @@ static void fc_rport_logo_resp(struct fc_seq *sp, struct fc_frame *fp,
mutex_lock(&rdata->rp_mutex); mutex_lock(&rdata->rp_mutex);
FC_RPORT_DBG(rdata, "Received a LOGO response\n"); FC_RPORT_DBG(rdata, "Received a LOGO %s\n", fc_els_resp_type(fp));
if (rdata->rp_state != RPORT_ST_LOGO) { if (rdata->rp_state != RPORT_ST_LOGO) {
FC_RPORT_DBG(rdata, "Received a LOGO response, but in state " 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,7 +801,7 @@ static void fc_rport_rtv_resp(struct fc_seq *sp, struct fc_frame *fp,
mutex_lock(&rdata->rp_mutex); mutex_lock(&rdata->rp_mutex);
FC_RPORT_DBG(rdata, "Received a RTV response\n"); FC_RPORT_DBG(rdata, "Received a RTV %s\n", fc_els_resp_type(fp));
if (rdata->rp_state != RPORT_ST_RTV) { if (rdata->rp_state != RPORT_ST_RTV) {
FC_RPORT_DBG(rdata, "Received a RTV response, but in state " FC_RPORT_DBG(rdata, "Received a RTV response, but in state "
......
...@@ -1084,4 +1084,9 @@ void fc_destroy_exch_mgr(void); ...@@ -1084,4 +1084,9 @@ void fc_destroy_exch_mgr(void);
int fc_setup_rport(void); int fc_setup_rport(void);
void fc_destroy_rport(void); void fc_destroy_rport(void);
/*
* Internal libfc functions.
*/
const char *fc_els_resp_type(struct fc_frame *);
#endif /* _LIBFC_H_ */ #endif /* _LIBFC_H_ */
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