The wait loop should be waiting for any VLAN to become activated,
otherwise we might fail too early.

Signed-off-by: Hannes Reinecke <[email protected]>
---
 fipvlan.c |   52 +++++++++++++++++++++++++++++++++-------------------
 1 file changed, 33 insertions(+), 19 deletions(-)

diff --git a/fipvlan.c b/fipvlan.c
index 6352070..6cdc142 100644
--- a/fipvlan.c
+++ b/fipvlan.c
@@ -676,11 +676,7 @@ int send_vlan_requests(struct iff *iff)
        if (iff->resp_recv)
                return 0;
        if (!iff->running) {
-               if (iff->linkup_sent) {
-                       FIP_LOG_DBG("if %d not running, "
-                                   "waiting for link up",
-                                   iff->ifindex);
-               } else {
+               if (!iff->linkup_sent) {
                        FIP_LOG_DBG("if %d not running, "
                                    "starting",
                                    iff->ifindex);
@@ -709,8 +705,7 @@ void do_vlan_discovery(void)
 {
        struct iff *iff;
        int retry_count = 0;
-       int skip_retry_count = 0;
-       int skipped = 0;
+       int skipped = 0, retry_iff = 0;
 retry:
        if (config.automode) {
                TAILQ_FOREACH(iff, &interfaces, list_node) {
@@ -724,20 +719,39 @@ retry:
                        skipped += send_vlan_requests(iff);
                }
        }
-       if (skipped && skip_retry_count++ < config.link_retry) {
-               FIP_LOG_DBG("waiting for IFF_RUNNING [%d]\n", skip_retry_count);
-               recv_loop(500);
-               skipped = 0;
-               retry_count = 0;
-               goto retry;
-       }
-       TAILQ_FOREACH(iff, &interfaces, list_node)
+       TAILQ_FOREACH(iff, &interfaces, list_node) {
+               if (!iff->running && iff->linkup_sent) {
+                       FIP_LOG_DBG("if %d: waiting for IFF_RUNNING [%d]\n",
+                                   iff->ifindex, retry_count);
+                       retry_iff++;
+                       continue;
+               }
                /* if we did not receive a response, retry */
-               if (iff->req_sent && !iff->resp_recv &&
-                   retry_count++ < MAX_VLAN_RETRIES) {
-                       FIP_LOG_DBG("VLAN discovery RETRY [%d]", retry_count);
-                       goto retry;
+               if (iff->req_sent && !iff->resp_recv) {
+                       FIP_LOG_DBG("if %d: VLAN discovery RETRY [%d]",
+                                   iff->ifindex, retry_count);
+                       retry_iff++;
+                       continue;
+               }
+               if (config.create) {
+                       struct iff *vlan;
+
+                       TAILQ_FOREACH(vlan, &iff->vlans, list_node) {
+                               if (!vlan->running) {
+                                       FIP_LOG_DBG("vlan %d: waiting for "
+                                                   "IFF_RUNNING [%d]",
+                                                   vlan->ifindex, retry_count);
+                                       retry_iff++;
+                                       continue;
+                               }
+                       }
                }
+       }
+       if (retry_iff && retry_count++ < config.link_retry) {
+               recv_loop(1000);
+               retry_iff = 0;
+               goto retry;
+       }
 }
 
 void cleanup_interfaces(void)
-- 
1.7.10.4

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

Reply via email to