Currently logo response handler goes through fc_lport_reset_locked while no lport logo request during lport reset, so this patch optimizes these code paths to use fc_lport_reset_locked to send logo and then use this common code path for both lport reset and fc_fabric_logoff during i/f destroy.
This completely removes fc_lport_enter_disabled as its porocessing is now covered by fc_lport_reset_locked code paths. Signed-off-by: Vasu Dev <[email protected]> --- drivers/scsi/libfc/fc_lport.c | 52 ++++++++++------------------------------- 1 files changed, 13 insertions(+), 39 deletions(-) diff --git a/drivers/scsi/libfc/fc_lport.c b/drivers/scsi/libfc/fc_lport.c index c5a10f9..903a5db 100644 --- a/drivers/scsi/libfc/fc_lport.c +++ b/drivers/scsi/libfc/fc_lport.c @@ -114,6 +114,7 @@ static void fc_lport_enter_ns(struct fc_lport *, enum fc_lport_state); static void fc_lport_enter_scr(struct fc_lport *); static void fc_lport_enter_ready(struct fc_lport *); static void fc_lport_enter_logo(struct fc_lport *); +static void fc_lport_reset_locked(struct fc_lport *); static const char *fc_lport_state_names[] = { [LPORT_ST_DISABLED] = "disabled", @@ -600,13 +601,9 @@ int fc_fabric_logoff(struct fc_lport *lport) { lport->tt.disc_stop_final(lport); mutex_lock(&lport->lp_mutex); - if (lport->dns_rdata) - lport->tt.rport_logoff(lport->dns_rdata); + fc_lport_reset_locked(lport); mutex_unlock(&lport->lp_mutex); lport->tt.rport_flush_queue(); - mutex_lock(&lport->lp_mutex); - fc_lport_enter_logo(lport); - mutex_unlock(&lport->lp_mutex); cancel_delayed_work_sync(&lport->retry_work); return 0; } @@ -944,10 +941,11 @@ static void fc_lport_reset_locked(struct fc_lport *lport) lport->tt.rport_logoff(lport->ptp_rdata); kref_put(&lport->ptp_rdata->kref, lport->tt.rport_destroy); lport->ptp_rdata = NULL; + } else { + lport->tt.disc_stop(lport); + fc_lport_enter_logo(lport); } - lport->tt.disc_stop(lport); - lport->tt.exch_mgr_reset(lport, 0, 0); fc_host_fabric_name(lport->host) = 0; @@ -984,23 +982,6 @@ static void fc_lport_enter_reset(struct fc_lport *lport) } /** - * fc_lport_enter_disabled() - Disable the local port - * @lport: The local port to be reset - * - * Locking Note: The lport lock is expected to be held before calling - * this routine. - */ -static void fc_lport_enter_disabled(struct fc_lport *lport) -{ - FC_LPORT_DBG(lport, "Entered disabled state from %s state\n", - fc_lport_state(lport)); - - fc_lport_state_enter(lport, LPORT_ST_DISABLED); - fc_vports_linkchange(lport); - fc_lport_reset_locked(lport); -} - -/** * fc_lport_error() - Handler for any errors * @lport: The local port that the error was on * @fp: The error code encoded in a frame pointer @@ -1353,28 +1334,21 @@ void fc_lport_logo_resp(struct fc_seq *sp, struct fc_frame *fp, mutex_lock(&lport->lp_mutex); + if (IS_ERR(fp)) + goto err; + if (lport->state != LPORT_ST_LOGO) { FC_LPORT_DBG(lport, "Received a LOGO response, but in state " "%s\n", fc_lport_state(lport)); - if (IS_ERR(fp)) - goto err; - goto out; - } - - if (IS_ERR(fp)) { - fc_lport_error(lport, fp); - goto err; + } else { + op = fc_frame_payload_op(fp); + if (op == ELS_LS_ACC) + fc_lport_state_enter(lport, LPORT_ST_DISABLED); } - op = fc_frame_payload_op(fp); - if (op == ELS_LS_ACC) - fc_lport_enter_disabled(lport); - else - fc_lport_error(lport, fp); - -out: fc_frame_free(fp); err: + fc_lport_error(lport, fp); mutex_unlock(&lport->lp_mutex); } EXPORT_SYMBOL(fc_lport_logo_resp); _______________________________________________ devel mailing list [email protected] https://lists.open-fcoe.org/mailman/listinfo/devel
