From 206018136a10d00b275d85386c5744a555584151 Mon Sep 17 00:00:00 2001 From: Ethan Jackson Date: Mon, 18 Apr 2011 15:13:34 -0700 Subject: [PATCH] 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. --- lib/lacp.c | 24 +++++++++++++++++++----- lib/lacp.h | 1 + vswitchd/bridge.c | 3 +++ vswitchd/vswitch.xml | 9 +++++++-- 4 files changed, 30 insertions(+), 7 deletions(-) diff --git a/lib/lacp.c b/lib/lacp.c index a842fbe4..3c7b1caa 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 2992bcfd..ad8211ef 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 8b82de80..78c0a09a 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 566e6cf6..6031b5a0 100644 --- a/vswitchd/vswitch.xml +++ b/vswitchd/vswitch.xml @@ -577,8 +577,8 @@

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. active ports are allowed to initiate LACP negotiations. passive ports are allowed to participate in LACP negotiations initiated by a remote switch, but not allowed to @@ -659,6 +659,11 @@ configured to be fast more frequent LACP heartbeats will be requested causing connectivity problems to be detected more quickly. +

lacp-strict
+
When true, configures this to + require successful LACP negotiations to enable any slaves. + Defaults to false which safely allows LACP to be used + with switchs that do not support the protocol.
-- 2.30.2