[ovs-dev] [PATCH 2/2] lacp: New "strict" lacp mode.

Ethan Jackson ethan at nicira.com
Mon Apr 18 22:39:15 UTC 2011


When LACP negotiations are unsuccessful, OVS falls back to standard
balance-slb bonding.  In some cases, users may want to require
successful LACP negotiations for any slaves to be enabled at all.
This patch implements a new "strict" mode which disables all slaves
when LACP negotiations are unsuccessful.
---
 lib/lacp.c           |   22 ++++++++++++++++++----
 lib/lacp.h           |    1 +
 vswitchd/bridge.c    |    3 +++
 vswitchd/vswitch.xml |    5 +++++
 4 files changed, 27 insertions(+), 4 deletions(-)

diff --git a/lib/lacp.c b/lib/lacp.c
index a842fbe..a42f11f 100644
--- a/lib/lacp.c
+++ b/lib/lacp.c
@@ -49,6 +49,7 @@ struct lacp {
     struct slave *key_slave; /* Slave whose ID will be the aggregation key. */
 
     bool fast;                /* Fast or Slow LACP time. */
+    bool strict;             /* True if in strict mode. */
     bool negotiated;         /* True if LACP negotiations were successful. */
     bool update;             /* True if lacp_update() needs to be called. */
 };
@@ -133,9 +134,11 @@ lacp_configure(struct lacp *lacp, const struct lacp_settings *s)
     }
 
     if (!eth_addr_equals(lacp->sys_id, s->id)
-        || lacp->sys_priority != s->priority) {
+        || lacp->sys_priority != s->priority
+        || lacp->strict != s->strict) {
         memcpy(lacp->sys_id, s->id, ETH_ADDR_LEN);
         lacp->sys_priority = s->priority;
+        lacp->strict = s->strict;
         lacp->update = true;
     }
 
@@ -397,6 +400,10 @@ lacp_update_attached(struct lacp *lacp)
                 slave->attached = false;
             }
         }
+    } else if (lacp->strict) {
+        HMAP_FOR_EACH (slave, node, &lacp->slaves) {
+            slave->attached = false;
+        }
     }
 }
 
@@ -620,9 +627,16 @@ lacp_unixctl_show(struct unixctl_conn *conn,
     }
 
     ds_put_format(&ds, "lacp: %s\n", lacp->name);
-    ds_put_format(&ds, "\tstatus: %s %s\n",
-                  lacp->active ? "active" : "passive",
-                  lacp->negotiated ? "negotiated" : "");
+
+    ds_put_format(&ds, "\tstatus: %s", lacp->active ? "active" : "passive");
+    if (lacp->strict) {
+        ds_put_cstr(&ds, " strict");
+    }
+    if (lacp->negotiated) {
+        ds_put_cstr(&ds, " negotiated");
+    }
+    ds_put_cstr(&ds, "\n");
+
     ds_put_format(&ds, "\tsys_id: " ETH_ADDR_FMT "\n", ETH_ADDR_ARGS(lacp->sys_id));
     ds_put_format(&ds, "\tsys_priority: %u\n", lacp->sys_priority);
     ds_put_cstr(&ds, "\taggregation key: ");
diff --git a/lib/lacp.h b/lib/lacp.h
index 2992bcf..ad8211e 100644
--- a/lib/lacp.h
+++ b/lib/lacp.h
@@ -27,6 +27,7 @@ struct lacp_settings {
     uint16_t priority;
     bool active;
     bool fast;
+    bool strict;
 };
 
 void lacp_init(void);
diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
index a0762fe..f4b0f48 100644
--- a/vswitchd/bridge.c
+++ b/vswitchd/bridge.c
@@ -3137,6 +3137,9 @@ port_reconfigure_lacp(struct port *port)
 
     s.fast = !strcmp(get_port_other_config(port->cfg, "lacp-time", "slow"),
                      "fast");
+    s.strict = !strcmp(get_port_other_config(port->cfg, "lacp-strict",
+                                             "false"),
+                       "true");
 
     if (!port->lacp) {
         port->lacp = lacp_create();
diff --git a/vswitchd/vswitch.xml b/vswitchd/vswitch.xml
index 566e6cf..057a1b3 100644
--- a/vswitchd/vswitch.xml
+++ b/vswitchd/vswitch.xml
@@ -659,6 +659,11 @@
             configured to be <code>fast</code> more frequent LACP heartbeats
             will be requested causing connectivity problems to be detected more
             quickly.</dd>
+          <dt><code>lacp-strict</code></dt>
+          <dd> When <code>true</code>, configures this <ref table="Port"/> to
+            require successful LACP negotiations to enable any slaves.
+            Defaults to <code>false</code> which safely allows LACP to be used
+            with switchs that do not support the protocol.</dd>
         </dl>
       </column>
     </group>
-- 
1.7.4.2




More information about the dev mailing list