From 9f5e376f3cf16bdd83d731fdc02a877e78a75c26 Mon Sep 17 00:00:00 2001 From: Hannes Reinecke Date: Tue, 19 Nov 2013 20:26:06 +0000 Subject: [PATCH 09/17] fipvlan: Update wait loop to wait for VLANs The wait loop should be waiting for any VLAN to become activated, otherwise we might fail too early. Signed-off-by: Hannes Reinecke Signed-off-by: Robert Love --- fipvlan.c | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/fipvlan.c b/fipvlan.c index 9261b1d..e7a0016 100644 --- a/fipvlan.c +++ b/fipvlan.c @@ -845,7 +845,7 @@ static 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: skipped += send_vlan_requests(); if (skipped && skip_retry_count++ < config.link_retry) { @@ -856,13 +856,38 @@ retry: goto retry; } recv_loop(200); - 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) { + if (iff->req_sent && !iff->resp_recv) { FIP_LOG_DBG("VLAN discovery RETRY [%d]", retry_count); - goto retry; + 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; + } } static void cleanup_interfaces(void) -- 1.8.1.4