[Open-FCoE] [PATCH 18/28] libfc: Add a READY state to the LP state machine

Robert Love robert.w.love at intel.com
Tue Sep 30 18:26:24 UTC 2008


Add a state where the lport is ready. At this point the ready
state doesn't do anything except print a debug statement and
change the state variable. This change is to try and make
the lport state machine similar to the rport state machine.

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

 drivers/scsi/libfc/fc_lport.c |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/libfc/fc_lport.c b/drivers/scsi/libfc/fc_lport.c
index cf7be00..0ff3db0 100644
--- a/drivers/scsi/libfc/fc_lport.c
+++ b/drivers/scsi/libfc/fc_lport.c
@@ -41,6 +41,7 @@ static void fc_lport_enter_dns(struct fc_lport *);
 static void fc_lport_enter_reg_pn(struct fc_lport *);
 static void fc_lport_enter_reg_ft(struct fc_lport *);
 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 const char *fc_lport_state_names[] = {
@@ -50,7 +51,7 @@ static const char *fc_lport_state_names[] = {
 	[LPORT_ST_REG_PN] =   "REG_PN",
 	[LPORT_ST_REG_FT] =   "REG_FT",
 	[LPORT_ST_SCR] =      "SCR",
-	[LPORT_ST_READY] =    "ready",
+	[LPORT_ST_READY] =    "Ready",
 	[LPORT_ST_DNS_STOP] = "stop",
 	[LPORT_ST_LOGO] =     "LOGO",
 	[LPORT_ST_RESET] =    "reset",
@@ -121,7 +122,7 @@ static void fc_lport_ptp_setup(struct fc_lport *lp,
 		if (lp->ptp_rp)
 			fc_remote_port_delete(lp->ptp_rp);
 		lp->ptp_rp = rport;
-		fc_lport_state_enter(lp, LPORT_ST_READY);
+		fc_lport_enter_ready(lp);
 	}
 }
 
@@ -528,6 +529,15 @@ int fc_set_mfs(struct fc_lport *lp, u32 mfs)
 }
 EXPORT_SYMBOL(fc_set_mfs);
 
+static void fc_lport_enter_ready(struct fc_lport *lport)
+{
+	if (fc_lport_debug)
+		FC_DBG("Port (%6x) entered Ready from state %s\n",
+		       lport->fid, fc_lport_state(lport));
+
+	fc_lport_state_enter(lport, LPORT_ST_READY);
+}
+
 /*
  * re-enter state for retrying a request after a timeout or alloc failure.
  */
@@ -860,7 +870,7 @@ static void fc_lport_scr_resp(struct fc_seq *sp, struct fc_frame *fp,
 		fc_lport_error(lport, fp);
 	else {
 		fc_lport_lock(lport);
-		fc_lport_state_enter(lport, LPORT_ST_READY);
+		fc_lport_enter_ready(lport);
 		fc_lport_unlock(lport);
 		err = lport->tt.disc_start(lport);
 		if (err)




More information about the devel mailing list