diff options
author | Ethan Jackson <ethan@nicira.com> | 2011-04-18 15:13:34 -0700 |
---|---|---|
committer | Ethan Jackson <ethan@nicira.com> | 2011-04-19 10:33:19 -0700 |
commit | 206018136a10d00b275d85386c5744a555584151 (patch) | |
tree | 8ec516e1214a92105b1ad92a8e6c2ba45b33d553 | |
parent | eb45889342dc2856b7225d129e2f3400950b2636 (diff) | |
download | openvswitch-206018136a10d00b275d85386c5744a555584151.tar.gz |
lacp: New "strict" lacp mode.
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.
-rw-r--r-- | lib/lacp.c | 24 | ||||
-rw-r--r-- | lib/lacp.h | 1 | ||||
-rw-r--r-- | vswitchd/bridge.c | 3 | ||||
-rw-r--r-- | vswitchd/vswitch.xml | 9 |
4 files changed, 30 insertions, 7 deletions
diff --git a/lib/lacp.c b/lib/lacp.c index a842fbe42..3c7b1caab 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; } @@ -348,7 +351,7 @@ lacp_wait(struct lacp *lacp) /* Static Helpers. */ -/* Updates the attached status of all slaves controlled b 'lacp' and sets its +/* Updates the attached status of all slaves controlled by 'lacp' and sets its * negotiated parameter to true if any slaves are attachable. */ static void lacp_update_attached(struct lacp *lacp) @@ -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 2992bcfd7..ad8211efc 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 8b82de80f..78c0a09a0 100644 --- a/vswitchd/bridge.c +++ b/vswitchd/bridge.c @@ -3135,6 +3135,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 566e6cf69..6031b5a0e 100644 --- a/vswitchd/vswitch.xml +++ b/vswitchd/vswitch.xml @@ -577,8 +577,8 @@ <column name="lacp"> <p>Configures LACP on this port. LACP allows directly connected - switches to negotiate which links may be bonded. LACP may be enabled - on non-bonded ports for the benefit of any switches they may be + switchs to negotiate which links may be bonded. LACP may be enabled + on non-bonded ports for the benefit of any switchs they may be connected to. <code>active</code> ports are allowed to initiate LACP negotiations. <code>passive</code> ports are allowed to participate in LACP negotiations initiated by a remote switch, but not allowed to @@ -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> |