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

 drivers/scsi/libfc/fc_lport.c |   67 ++++++++++++++++++++++++++++++++++++++--
 drivers/scsi/libfc/fc_ns.c    |   69 ++---------------------------------------
 2 files changed, 67 insertions(+), 69 deletions(-)

diff --git a/drivers/scsi/libfc/fc_lport.c b/drivers/scsi/libfc/fc_lport.c
index 079cc56..538529d 100644
--- a/drivers/scsi/libfc/fc_lport.c
+++ b/drivers/scsi/libfc/fc_lport.c
@@ -38,6 +38,7 @@ static int fc_lport_debug;
 
 static void fc_lport_enter_flogi(struct fc_lport *);
 static void fc_lport_enter_logo(struct fc_lport *);
+static void fc_lport_enter_dns(struct fc_lport *);
 
 static const char *fc_lport_state_names[] = {
        [LPORT_ST_NONE] =     "none",
@@ -430,13 +431,15 @@ static void fc_lport_enter_retry(struct fc_lport *lp)
        case LPORT_ST_NONE:
        case LPORT_ST_READY:
        case LPORT_ST_RESET:
-       case LPORT_ST_DNS:
        case LPORT_ST_DNS_STOP:
        case LPORT_ST_REG_PN:
        case LPORT_ST_REG_FT:
        case LPORT_ST_SCR:
                WARN_ON(1);
                break;
+       case LPORT_ST_DNS:
+               fc_lport_enter_dns(lp);
+               break;
        case LPORT_ST_FLOGI:
                fc_lport_enter_flogi(lp);
                break;
@@ -460,9 +463,11 @@ static void fc_lport_enter_reject(struct fc_lport *lp)
        case LPORT_ST_REG_FT:
        case LPORT_ST_SCR:
        case LPORT_ST_DNS_STOP:
-       case LPORT_ST_DNS:
                WARN_ON(1);
                break;
+       case LPORT_ST_DNS:
+               lp->tt.lport_reset(lp);
+               break;
        case LPORT_ST_FLOGI:
                fc_lport_enter_flogi(lp);
                break;
@@ -493,6 +498,62 @@ static void fc_lport_retry(struct fc_lport *lp)
 }
 
 /*
+ * Setup session to dNS if not already set up.
+ */
+static void fc_lport_enter_dns(struct fc_lport *lp)
+{
+       struct fc_rport *rport;
+       struct fc_rport_libfc_priv *rp;
+       struct fc_rport_identifiers ids = {
+               .port_id = FC_FID_DIR_SERV,
+               .port_name = -1,
+               .node_name = -1,
+               .roles = FC_RPORT_ROLE_UNKNOWN,
+       };
+
+       if (fc_lport_debug)
+               FC_DBG("Processing DNS state");
+
+       fc_lport_state_enter(lp, LPORT_ST_DNS);
+
+       if (!lp->dns_rp) {
+               /*
+                * Set up remote port to directory server. We are
+                * called with the state_lock, but if rport_lookup_create
+                * needs to create a rport then it will sleep.
+                */
+               fc_lport_unlock(lp);
+               rport = lp->tt.rport_lookup(lp, ids.port_id);
+               if (rport == NULL)
+                       rport = lp->tt.rport_create(lp, &ids);
+               fc_lport_lock(lp);
+               if (!rport)
+                       goto err;
+               lp->dns_rp = rport;
+       }
+
+       rport = lp->dns_rp;
+       rp = rport->dd_data;
+
+       /*
+        * If dNS session isn't ready, start its logon.
+        */
+       if (rp->rp_state != RPORT_ST_READY) {
+               lp->tt.rport_login(rport);
+       } else {
+               del_timer(&lp->state_timer);
+               lp->tt.dns_register(lp);
+       }
+       return;
+
+       /*
+        * Resource allocation problem (malloc).  Try again in 500 mS.
+        */
+err:
+       fc_lport_retry(lp);
+}
+
+/*
  * A received FLOGI request indicates a point-to-point connection.
  * Accept it with the common service parameters indicating our N port.
  * Set up to do a PLOGI if we have the higher-number WWPN.
@@ -830,7 +891,7 @@ fc_lport_flogi_resp(struct fc_seq *sp, struct fc_frame *fp, 
void *lp_arg)
                        } else {
                                lp->e_d_tov = e_d_tov;
                                lp->r_a_tov = r_a_tov;
-                               lp->tt.dns_register(lp);
+                               fc_lport_enter_dns(lp);
                        }
                }
                fc_lport_unlock(lp);
diff --git a/drivers/scsi/libfc/fc_ns.c b/drivers/scsi/libfc/fc_ns.c
index d354fbe..4edf561 100644
--- a/drivers/scsi/libfc/fc_ns.c
+++ b/drivers/scsi/libfc/fc_ns.c
@@ -284,6 +284,7 @@ static void fc_ns_enter_reject(struct fc_lport *lp)
        case LPORT_ST_RESET:
        case LPORT_ST_FLOGI:
        case LPORT_ST_LOGO:
+       case LPORT_ST_DNS:
                WARN_ON(1);
                break;
        case LPORT_ST_REG_PN:
@@ -296,9 +297,6 @@ static void fc_ns_enter_reject(struct fc_lport *lp)
        case LPORT_ST_DNS_STOP:
                lp->tt.disc_stop(lp);
                break;
-       case LPORT_ST_DNS:
-               lp->tt.lport_reset(lp);
-               break;
        }
 }
 
@@ -310,10 +308,8 @@ static void fc_ns_enter_retry(struct fc_lport *lp)
        case LPORT_ST_READY:
        case LPORT_ST_FLOGI:
        case LPORT_ST_LOGO:
-               WARN_ON(1);
-               break;
        case LPORT_ST_DNS:
-               lp->tt.dns_register(lp);
+               WARN_ON(1);
                break;
        case LPORT_ST_DNS_STOP:
                lp->tt.disc_stop(lp);
@@ -1019,65 +1015,6 @@ static void fc_ns_gpn_id_error(struct fc_ns_port *dp, 
struct fc_frame *fp)
 }
 
 /*
- * Setup session to dNS if not already set up.
- */
-static void fc_ns_enter_dns(struct fc_lport *lp)
-{
-       struct fc_rport *rport;
-       struct fc_rport_libfc_priv *rp;
-       struct fc_rport_identifiers ids = {
-               .port_id = FC_FID_DIR_SERV,
-               .port_name = -1,
-               .node_name = -1,
-               .roles = FC_RPORT_ROLE_UNKNOWN,
-       };
-
-       if (fc_ns_debug)
-               FC_DBG("Processing DNS state");
-
-       fc_lport_state_enter(lp, LPORT_ST_DNS);
-
-       if (!lp->dns_rp) {
-               /*
-                * Set up remote port to directory server.
-                */
-
-               /*
-                * we are called with the state_lock, but if rport_lookup_create
-                * needs to create a rport then it will sleep.
-                */
-               fc_lport_unlock(lp);
-               rport = lp->tt.rport_lookup(lp, ids.port_id);
-               if (rport == NULL)
-                       rport = lp->tt.rport_create(lp, &ids);
-               fc_lport_lock(lp);
-               if (!rport)
-                       goto err;
-               lp->dns_rp = rport;
-       }
-
-       rport = lp->dns_rp;
-       rp = rport->dd_data;
-
-       /*
-        * If dNS session isn't ready, start its logon.
-        */
-       if (rp->rp_state != RPORT_ST_READY) {
-               lp->tt.rport_login(rport);
-       } else {
-               del_timer(&lp->state_timer);
-               fc_ns_enter_reg_pn(lp);
-       }
-       return;
-
-       /*
-        * Resource allocation problem (malloc).  Try again in 500 mS.
-        */
-err:
-       fc_ns_retry(lp);
-}
-
-/*
  * Logoff DNS session.
  * We should get an event call when the session has been logged out.
  */
@@ -1156,7 +1093,7 @@ int fc_ns_init(struct fc_lport *lp)
                lp->tt.disc_recv_req = fc_ns_recv_req;
 
        if (!lp->tt.dns_register)
-               lp->tt.dns_register = fc_ns_enter_dns;
+               lp->tt.dns_register = fc_ns_enter_reg_pn;
 
        if (!lp->tt.disc_stop)
                lp->tt.disc_stop = fc_ns_enter_dns_stop;

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

Reply via email to