[Open-FCoE] [PATCH 04/28] libfc: remove the RPORT_ST_STARTED state

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


This was an unnecessary state between INIT and PLOGI.

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

 drivers/scsi/libfc/fc_rport.c |   33 ++-------------------------------
 include/scsi/libfc/libfc.h    |    1 -
 2 files changed, 2 insertions(+), 32 deletions(-)

diff --git a/drivers/scsi/libfc/fc_rport.c b/drivers/scsi/libfc/fc_rport.c
index 39eb7e4..f8e5909 100644
--- a/drivers/scsi/libfc/fc_rport.c
+++ b/drivers/scsi/libfc/fc_rport.c
@@ -39,7 +39,6 @@ static int fc_rp_debug;
 /*
  * static functions.
  */
-static void fc_rport_enter_start(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 *);
@@ -221,7 +220,8 @@ int fc_rport_login(struct fc_rport *rport)
 	fc_rport_lock(rport);
 	if (rp->rp_state == RPORT_ST_INIT) {
 		fc_rport_unlock(rport);
-		fc_rport_enter_start(rport);
+		if (rport == lp->dns_rp || fc_lport_test_ready(lp))
+			fc_rport_enter_plogi(rport);
 	} else if (rp->rp_state == RPORT_ST_ERROR) {
 		fc_rport_state_enter(rport, RPORT_ST_INIT);
 		fc_rport_unlock(rport);
@@ -357,21 +357,6 @@ static void fc_rport_enter_ready(struct fc_rport *rport)
 	lport->tt.lport_event(lport, rport, LPORT_EV_RPORT_CREATED);
 }
 
-static void fc_rport_enter_start(struct fc_rport *rport)
-{
-	struct fc_rport_libfc_priv *rp = rport->dd_data;
-	struct fc_lport *lp = rp->local_port;
-
-	/*
-	 * If the local port is already logged on, advance to next state.
-	 * Otherwise the local port will be logged on by fc_rport_unlock().
-	 */
-	fc_rport_state_enter(rport, RPORT_ST_STARTED);
-
-	if (rport == lp->dns_rp || fc_lport_test_ready(lp))
-		fc_rport_enter_plogi(rport);
-}
-
 /*
  * Handle exchange reject or retry exhaustion in various states.
  */
@@ -424,7 +409,6 @@ static void fc_rport_reject(struct fc_rport *rport)
 	case RPORT_ST_READY:
 	case RPORT_ST_ERROR:
 	case RPORT_ST_PLOGI_RECV:
-	case RPORT_ST_STARTED:
 	case RPORT_ST_INIT:
 		BUG();
 		break;
@@ -460,7 +444,6 @@ static void fc_rport_timeout(struct work_struct *work)
 		break;
 	case RPORT_ST_NONE:
 	case RPORT_ST_PLOGI_RECV:
-	case RPORT_ST_STARTED:
 		BUG();
 		break;
 	}
@@ -980,18 +963,6 @@ static void fc_rport_recv_plogi_req(struct fc_rport *rport,
 			       "- reject\n", sid, wwpn);
 		reject = ELS_RJT_UNSUP;
 		break;
-	case RPORT_ST_STARTED:
-		/*
-		 * we'll only accept a login if the port name
-		 * matches or was unknown.
-		 */
-		if (rport->port_name != -1 &&
-		    rport->port_name != wwpn) {
-			FC_DBG("incoming PLOGI from name %llx expected %llx\n",
-			       wwpn, rport->port_name);
-			reject = ELS_RJT_UNAB;
-		}
-		break;
 	case RPORT_ST_PLOGI:
 		if (fc_rp_debug)
 			FC_DBG("incoming PLOGI from %x in PLOGI state %d\n",
diff --git a/include/scsi/libfc/libfc.h b/include/scsi/libfc/libfc.h
index c525d4c..2457f2a 100644
--- a/include/scsi/libfc/libfc.h
+++ b/include/scsi/libfc/libfc.h
@@ -109,7 +109,6 @@ enum fc_lport_event {
 enum fc_rport_state {
 	RPORT_ST_NONE = 0,
 	RPORT_ST_INIT,		/* initialized */
-	RPORT_ST_STARTED,	/* started */
 	RPORT_ST_PLOGI,		/* waiting for PLOGI completion */
 	RPORT_ST_PLOGI_RECV,	/* received PLOGI (as target) */
 	RPORT_ST_PRLI,		/* waiting for PRLI completion */




More information about the devel mailing list