Signed-off-by: Robert Love <[EMAIL PROTECTED]>
---

 drivers/scsi/libfc/fc_rport.c |   75 +++++++++++++++++------------------------
 1 files changed, 32 insertions(+), 43 deletions(-)

diff --git a/drivers/scsi/libfc/fc_rport.c b/drivers/scsi/libfc/fc_rport.c
index 9a4570c..9bfdf87 100644
--- a/drivers/scsi/libfc/fc_rport.c
+++ b/drivers/scsi/libfc/fc_rport.c
@@ -627,57 +627,50 @@ void fc_rport_reset_list(struct fc_lport *lp)
        spin_unlock_irqrestore(shost->host_lock, flags);
 }
 
-/*
- * Handle exchange reject or retry exhaustion in various states.
+/**
+ * fc_rport_reject - Handle rejections when retries are exhausted
+ * @rp: The fc_rport that has failed
+ *
+ * Locking Note: The lock is expected to be held before calling
+ * this routine
  */
-static void fc_rport_reject(struct fc_rport *rport)
+static void fc_rport_reject(struct fc_rport *rp)
 {
-       struct fc_rport_libfc_priv *rp = rport->dd_data;
-       struct fc_lport *lp = rp->local_port;
-       switch (rp->rp_state) {
+       struct fc_rport_libfc_priv *rpp = rp->dd_data;
+       struct fc_lport *lp = rpp->local_port;
+
+       switch (rpp->rp_state) {
        case RPORT_ST_GPN_ID:
        case RPORT_ST_GNN_ID:
        case RPORT_ST_PLOGI:
        case RPORT_ST_PRLI:
-               fc_rport_state_enter(rport, RPORT_ST_ERROR);
-               if (rport == lp->dns_rp &&
-                   lp->state != LPORT_ST_RESET) {
-                       fc_lport_lock(lp);
-                       del_timer(&lp->state_timer);
-                       lp->dns_rp = NULL;
-                       if (lp->state == LPORT_ST_DNS_STOP) {
-                               fc_lport_unlock(lp);
-                               lp->tt.lport_logout(lp);
-                       } else {
-                               lp->tt.lport_login(lp);
-                               fc_lport_unlock(lp);
-                       }
-                       fc_remote_port_delete(rport);
-               }
+               fc_rport_state_enter(rp, RPORT_ST_ERROR);
+
+               if (fc_rp_debug)
+                       FC_DBG("remote %6x closed\n", rp->port_id);
+
+               if (rp->port_id == FC_FID_DIR_SERV)
+                       lp->tt.lport_event_callback(lp, rp,
+                                                   LPORT_EV_RPORT_FAILED);
+               fc_remote_port_delete(rp);
                break;
        case RPORT_ST_RTV:
-               fc_rport_state_enter(rport, RPORT_ST_READY);
+               fc_rport_state_enter(rp, RPORT_ST_READY);
+
                if (fc_rp_debug)
-                       FC_DBG("remote %6x ready\n", rport->port_id);
+                       FC_DBG("remote %6x ready\n", rp->port_id);
                break;
        case RPORT_ST_LOGO:
-               fc_rport_state_enter(rport, RPORT_ST_INIT);
+               fc_rport_state_enter(rp, RPORT_ST_INIT);
+
                if (fc_rp_debug)
-                       FC_DBG("remote %6x closed\n", rport->port_id);
-               if (rport == lp->dns_rp &&
-                   lp->state != LPORT_ST_RESET) {
-                       fc_lport_lock(lp);
-                       del_timer(&lp->state_timer);
-                       lp->dns_rp = NULL;
-                       if (lp->state == LPORT_ST_DNS_STOP) {
-                               fc_lport_unlock(lp);
-                               lp->tt.lport_logout(lp);
-                       } else {
-                               lp->tt.lport_login(lp);
-                               fc_lport_unlock(lp);
-                       }
-                       fc_remote_port_delete(rport);
-               }
+                       FC_DBG("remote %6x closed\n", rp->port_id);
+
+               if (rp->port_id == FC_FID_DIR_SERV)
+                       lp->tt.lport_event_callback(lp, rp,
+                                                   LPORT_EV_RPORT_LOGO);
+
+               fc_remote_port_delete(rp);
                break;
        case RPORT_ST_NONE:
        case RPORT_ST_READY:
@@ -689,10 +682,6 @@ static void fc_rport_reject(struct fc_rport *rport)
        return;
 }
 
-/*
- * Timeout handler for retrying after allocation failures or exchange timeout.
- */
-
 /**
  * fc_rport_timeout - Handler for the retry_work timer.
  *  Simply determine what should be done next.

_______________________________________________
devel mailing list
[email protected]
http://www.open-fcoe.org/mailman/listinfo/devel

Reply via email to