[Open-FCoE] [RFC PATCH 11/15] libfc: Add a READY state

Robert Love robert.w.love at intel.com
Tue Sep 2 22:37:50 UTC 2008


Signed-off-by: Robert Love <robert.w.love at intel.com>
---

 drivers/scsi/libfc/fc_rport.c |   31 ++++++++++++++++++++++---------
 1 files changed, 22 insertions(+), 9 deletions(-)

diff --git a/drivers/scsi/libfc/fc_rport.c b/drivers/scsi/libfc/fc_rport.c
index 7b6dc15..27f485a 100644
--- a/drivers/scsi/libfc/fc_rport.c
+++ b/drivers/scsi/libfc/fc_rport.c
@@ -47,7 +47,9 @@ static void fc_rport_enter_gnn_id(struct fc_rport *);
 static void fc_rport_enter_plogi(struct fc_rport *);
 static void fc_rport_enter_prli(struct fc_rport *);
 static void fc_rport_enter_rtv(struct fc_rport *);
+static void fc_rport_enter_ready(struct fc_rport *);
 static void fc_rport_enter_logo(struct fc_rport *);
+
 static void fc_rport_recv_plogi_req(struct fc_rport *,
 				    struct fc_seq *, struct fc_frame *);
 static void fc_rport_recv_prli_req(struct fc_rport *,
@@ -69,8 +71,8 @@ static const char *fc_rport_state_names[] = {
 	[RPORT_ST_PLOGI_RECV] = "PLOGI recv",
 	[RPORT_ST_PRLI] = "PRLI",
 	[RPORT_ST_RTV] = "RTV",
-	[RPORT_ST_ERROR] = "Error",
 	[RPORT_ST_READY] = "Ready",
+	[RPORT_ST_ERROR] = "Error",
 	[RPORT_ST_LOGO] = "LOGO",
 };
 
@@ -193,6 +195,24 @@ static void fc_rport_state_enter(struct fc_rport *rport,
 }
 
 /**
+ * fc_rport_enter_ready - Enter the ready state
+ * @rp: The remote port that should become ready
+ */
+static void fc_rport_enter_ready(struct fc_rport *rp)
+{
+	struct fc_rport_libfc_priv *rpp = rp->dd_data;
+	struct fc_lport *lp = rpp->local_port;
+
+	if (fc_rp_debug)
+		FC_DBG("Entered Ready for port (%6x)\n", rp->port_id);
+
+	fc_rport_state_enter(rp, RPORT_ST_READY);
+
+	if (rp->port_id == FC_FID_DIR_SERV)
+		lp->tt.lport_event_callback(lp, rp, LPORT_EV_RPORT_CREATED);
+}
+
+/**
  * fc_rport_enter_gpn_id - Send Get Port Name by ID (GPN_ID) request
  * @work: The work member of the fc_ns_port structure
  *
@@ -967,14 +987,7 @@ static void fc_rport_enter_prli(struct fc_rport *rport)
 	 * This should be made more general, possibly moved to the FCP layer.
 	 */
 	if (rport->port_id >= FC_FID_DOM_MGR) {
-		fc_rport_state_enter(rport, RPORT_ST_READY);
-		if (fc_rp_debug)
-			FC_DBG("remote %6x ready\n", rport->port_id);
-
-		fc_lport_lock(lp);
-		del_timer(&lp->state_timer);
-		lp->tt.lport_event_callback(lp, rport, LPORT_EV_RPORT_CREATED);
-		fc_lport_unlock(lp);
+		fc_rport_enter_ready(rport);
 		return;
 	}
 	fp = fc_frame_alloc(lp, sizeof(*pp));




More information about the devel mailing list