Commit 907c07d4 authored by Vasu Dev's avatar Vasu Dev Committed by James Bottomley

[SCSI] libfc: improve flogi retries to avoid lport stuck

Adds more cases to do flogi retry, now also retry
on getting bad response due to either no ELS response
or flogi response payload length not large enough.
In those cases flogi was not retried and that
was leaving lport offline.
Signed-off-by: default avatarVasu Dev <vasu.dev@intel.com>
Tested-by: default avatarBhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: default avatarYi Zou <yi.zou@intel.com>
Signed-off-by: default avatarJames Bottomley <JBottomley@Parallels.com>
parent b6e3c840
...@@ -2347,13 +2347,10 @@ static void fcoe_flogi_resp(struct fc_seq *seq, struct fc_frame *fp, void *arg) ...@@ -2347,13 +2347,10 @@ static void fcoe_flogi_resp(struct fc_seq *seq, struct fc_frame *fp, void *arg)
goto done; goto done;
mac = fr_cb(fp)->granted_mac; mac = fr_cb(fp)->granted_mac;
if (is_zero_ether_addr(mac)) {
/* pre-FIP */ /* pre-FIP */
if (fcoe_ctlr_recv_flogi(fip, lport, fp)) { if (is_zero_ether_addr(mac))
fc_frame_free(fp); fcoe_ctlr_recv_flogi(fip, lport, fp);
return; if (!is_zero_ether_addr(mac))
}
}
fcoe_update_src_mac(lport, mac); fcoe_update_src_mac(lport, mac);
done: done:
fc_lport_flogi_resp(seq, fp, lport); fc_lport_flogi_resp(seq, fp, lport);
......
...@@ -1473,6 +1473,7 @@ void fc_lport_flogi_resp(struct fc_seq *sp, struct fc_frame *fp, ...@@ -1473,6 +1473,7 @@ void fc_lport_flogi_resp(struct fc_seq *sp, struct fc_frame *fp,
void *lp_arg) void *lp_arg)
{ {
struct fc_lport *lport = lp_arg; struct fc_lport *lport = lp_arg;
struct fc_frame_header *fh;
struct fc_els_flogi *flp; struct fc_els_flogi *flp;
u32 did; u32 did;
u16 csp_flags; u16 csp_flags;
...@@ -1500,10 +1501,22 @@ void fc_lport_flogi_resp(struct fc_seq *sp, struct fc_frame *fp, ...@@ -1500,10 +1501,22 @@ void fc_lport_flogi_resp(struct fc_seq *sp, struct fc_frame *fp,
goto err; goto err;
} }
fh = fc_frame_header_get(fp);
did = fc_frame_did(fp); did = fc_frame_did(fp);
if (fc_frame_payload_op(fp) == ELS_LS_ACC && did) { if (fh->fh_r_ctl != FC_RCTL_ELS_REP || did == 0 ||
fc_frame_payload_op(fp) != ELS_LS_ACC) {
FC_LPORT_DBG(lport, "FLOGI not accepted or bad response\n");
fc_lport_error(lport, fp);
goto err;
}
flp = fc_frame_payload_get(fp, sizeof(*flp)); flp = fc_frame_payload_get(fp, sizeof(*flp));
if (flp) { if (!flp) {
FC_LPORT_DBG(lport, "FLOGI bad response\n");
fc_lport_error(lport, fp);
goto err;
}
mfs = ntohs(flp->fl_csp.sp_bb_data) & mfs = ntohs(flp->fl_csp.sp_bb_data) &
FC_SP_BB_DATA_MASK; FC_SP_BB_DATA_MASK;
if (mfs >= FC_SP_MIN_MAX_PAYLOAD && if (mfs >= FC_SP_MIN_MAX_PAYLOAD &&
...@@ -1539,11 +1552,6 @@ void fc_lport_flogi_resp(struct fc_seq *sp, struct fc_frame *fp, ...@@ -1539,11 +1552,6 @@ void fc_lport_flogi_resp(struct fc_seq *sp, struct fc_frame *fp,
fc_lport_set_port_id(lport, did, fp); fc_lport_set_port_id(lport, did, fp);
fc_lport_enter_dns(lport); fc_lport_enter_dns(lport);
} }
}
} else {
FC_LPORT_DBG(lport, "FLOGI RJT or bad response\n");
fc_lport_error(lport, fp);
}
out: out:
fc_frame_free(fp); fc_frame_free(fp);
......
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