After trying vlan discovery 10 times fcoemon disables auto_vlan on the
port and falls back to the physical interface. bnx2fc does not support
this. By setting VLAN_DISC_FOREVER option in the cfg-ethx for bnx2fc
interfaces, the vlan discovery will continue until a vlan is discovered.

Signed-off-by: Nithin Nayak Sujir <[email protected]>
---
 doc/fcoemon.txt |   10 +++++++++-
 etc/cfg-ethx    |    5 +++++
 fcoemon.c       |   19 ++++++++++++++++++-
 3 files changed, 32 insertions(+), 2 deletions(-)

diff --git a/doc/fcoemon.txt b/doc/fcoemon.txt
index 117b2d0..99756f9 100644
--- a/doc/fcoemon.txt
+++ b/doc/fcoemon.txt
@@ -168,7 +168,7 @@ of the *fcoe* service.
 These files are read by *fcoemon* on initialization. They are used to
 indicate which Ethernet or VLAN interfaces should have FCoE instances
 created. The default options in this file are: *FCOE_ENABLE="yes"*,
-*DCB_REQUIRED="yes"*, and *AUTO_VLAN="yes"*.
+*DCB_REQUIRED="yes"*, *AUTO_VLAN="yes"* and *VLAN_DISC_FOREVER="no"*.
 
 _FCOE_ENABLE_::
        is used to enable/disable creation of the FCoE instance.  If
@@ -188,6 +188,14 @@ _AUTO_VLAN_::
        interfaces.  If the network interface specified by the filename is
        already a VLAN interface, the AUTO_VLAN setting is ignored.
 
+_VLAN_DISC_FOREVER_::
+       indicates that the vlan discovery should be retried until a vlan id
+       is obtained. If VLAN_DISC_FOREVER is set to "yes", then vlan
+       discovery will be retried forever until a vlan id is obtained. If
+       set to "no", fcoemon will stop discovery after a finite number (10)
+       of attempts.
+
+
 Note that the attached Ethernet peer device (e.g. FCoE capable switch port)
 must have compatible settings For DCB and FCoE to function properly.
 
diff --git a/etc/cfg-ethx b/etc/cfg-ethx
index b7274ac..ed8cf5f 100644
--- a/etc/cfg-ethx
+++ b/etc/cfg-ethx
@@ -12,3 +12,8 @@ DCB_REQUIRED="yes"
 ## Default:    yes
 # Indicate if VLAN discovery should be handled by fcoemon
 AUTO_VLAN="yes"
+
+## Type:       yes/no
+## Default:    no
+# Indicates if VLAN discovery should be retried forever
+VLAN_DISC_FOREVER="no"
diff --git a/fcoemon.c b/fcoemon.c
index 5f8806b..b12c8da 100644
--- a/fcoemon.c
+++ b/fcoemon.c
@@ -112,6 +112,8 @@ struct fcoe_port {
        int dcb_required;
        int auto_vlan;
        int auto_created;
+       int vlan_disc_forever;/* The port does not support fcoe on physical
+                                interface */
 
        /* following track data required to manage FCoE interface state */
        enum fcp_action action;      /* current state */
@@ -385,6 +387,21 @@ static int fcm_read_config_files(void)
                if (!strncasecmp(val, "yes", 3) && rc == 1)
                        next->auto_vlan = 1;
 
+               /* VLAN_DISC_FOREVER */
+               rc = fcm_read_config_variable(file, val, sizeof(val),
+                                             fp, "VLAN_DISC_FOREVER");
+               if (rc < 0) {
+                       FCM_LOG("%s invalid format for VLAN_DISC_FOREVER \
+                                       setting");
+                       fclose(fp);
+                       free(next);
+                       continue;
+               }
+               /* if not found, default to "no" */
+               if (!strncasecmp(val, "yes", 3) && rc == 1)
+                       next->vlan_disc_forever = 1;
+
+
                fclose(fp);
 
                if (!fcoe_config.port) {
@@ -1989,7 +2006,7 @@ void fcm_vlan_disc_timeout(void *arg)
        struct fcoe_port *p = arg;
        FCM_LOG_DBG("%s: VLAN discovery TIMEOUT [%d]",
                    p->ifname, p->vlan_disc_count);
-       if (++(p->vlan_disc_count) > FCM_VLAN_DISC_MAX) {
+       if (!p->vlan_disc_forever && (++(p->vlan_disc_count) > 
FCM_VLAN_DISC_MAX)) {
                FCM_LOG("%s: VLAN discovery failed after %d attempts",
                        p->ifname, FCM_VLAN_DISC_MAX);
                FCM_LOG("%s: disabling VLAN discovery, trying FCoE on %s",
-- 
1.7.1




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

Reply via email to