[ovs-dev] [lacp 09/10] lacp: Enable "fast" lacp timing mode.
Ethan Jackson
ethan at nicira.com
Tue Mar 15 23:03:22 UTC 2011
---
lib/lacp.c | 12 ++++++++++--
lib/lacp.h | 3 ++-
vswitchd/bridge.c | 6 +++++-
vswitchd/vswitch.xml | 6 ++++++
4 files changed, 23 insertions(+), 4 deletions(-)
diff --git a/lib/lacp.c b/lib/lacp.c
index 020dd9c..7c71335 100644
--- a/lib/lacp.c
+++ b/lib/lacp.c
@@ -47,6 +47,7 @@ struct lacp {
struct hmap slaves; /* Slaves this LACP object controls. */
struct slave *key_slave; /* Slave whose ID will be the aggregation key. */
+ bool fast; /* Fast or Slow LACP time. */
bool negotiated; /* True if LACP negotiations were successful. */
bool update; /* True if lacp_update() needs to be called. */
@@ -128,7 +129,7 @@ lacp_destroy(struct lacp *lacp)
void
lacp_configure(struct lacp *lacp, const char *name, lacp_send_pdu *send_pdu,
uint8_t sys_id[ETH_ADDR_LEN], uint16_t sys_priority,
- bool active)
+ bool active, bool fast)
{
if (!lacp->name || strcmp(name, lacp->name)) {
free(lacp->name);
@@ -139,6 +140,7 @@ lacp_configure(struct lacp *lacp, const char *name, lacp_send_pdu *send_pdu,
memcpy(lacp->sys_id, sys_id, ETH_ADDR_LEN);
lacp->sys_priority = sys_priority;
lacp->active = active;
+ lacp->fast = fast;
}
/* Processes 'pdu', a parsed LACP packet received on 'slave_'. This function
@@ -151,7 +153,9 @@ lacp_process_pdu(struct lacp *lacp, const void *slave_,
struct slave *slave = slave_lookup(lacp, slave_);
slave->status = LACP_CURRENT;
- slave->rx = time_msec() + LACP_SLOW_TIME_RX;
+ slave->rx = time_msec() + (lacp->fast
+ ? LACP_FAST_TIME_RX
+ : LACP_SLOW_TIME_RX);
slave->ntt_actor = pdu->partner;
@@ -443,6 +447,10 @@ slave_get_actor(struct slave *slave, struct lacp_info *actor)
state |= LACP_STATE_ACT;
}
+ if (slave->lacp->fast) {
+ state |= LACP_STATE_TIME;
+ }
+
if (slave->attached) {
state |= LACP_STATE_SYNC;
}
diff --git a/lib/lacp.h b/lib/lacp.h
index d1716c9..8d8c876 100644
--- a/lib/lacp.h
+++ b/lib/lacp.h
@@ -32,7 +32,8 @@ void lacp_init(void);
struct lacp *lacp_create(void);
void lacp_destroy(struct lacp *);
void lacp_configure(struct lacp *, const char *name, lacp_send_pdu *,
- uint8_t sys_id[8], uint16_t sys_priority, bool active);
+ uint8_t sys_id[8], uint16_t sys_priority,
+ bool active, bool fast);
void lacp_process_pdu(struct lacp *, const void *slave,
const struct lacp_pdu *);
bool lacp_negotiated(const struct lacp *);
diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
index d5e14c6..08da17e 100644
--- a/vswitchd/bridge.c
+++ b/vswitchd/bridge.c
@@ -190,6 +190,7 @@ struct port {
/* LACP information. */
struct lacp *lacp; /* LACP object. NULl if LACP is disabled. */
bool lacp_active; /* True if LACP is active */
+ bool lacp_fast; /* True if LACP is in fast mode. */
uint16_t lacp_priority; /* LACP system priority. */
/* SLB specific bonding info. */
@@ -4133,6 +4134,9 @@ port_reconfigure(struct port *port, const struct ovsrec_port *cfg)
}
shash_destroy(&new_ifaces);
+ port->lacp_fast = !strcmp(get_port_other_config(cfg, "lacp-time", "slow"),
+ "fast");
+
lacp_priority =
atoi(get_port_other_config(cfg, "lacp-system-priority", "0"));
@@ -4313,7 +4317,7 @@ port_update_lacp(struct port *port)
lacp_configure(port->lacp, port->name, lacp_send_pdu_cb,
port->bridge->ea, port->lacp_priority,
- port->lacp_active);
+ port->lacp_active, port->lacp_fast);
for (i = 0; i < port->n_ifaces; i++) {
struct iface *iface = port->ifaces[i];
diff --git a/vswitchd/vswitch.xml b/vswitchd/vswitch.xml
index 470f389..cafe360 100644
--- a/vswitchd/vswitch.xml
+++ b/vswitchd/vswitch.xml
@@ -637,6 +637,12 @@
LACP negotiations, link status decisions are made by the system
with the numerically lower priority. Must be a number between 1
and 65535.</dd>
+ <dt><code>lacp-time</code></dt>
+ <dd> The LACP timing which should be used on this
+ <ref table="Port"/>. Possible values are <code>fast</code> and
+ <code>slow</code>. When configured to be <code>fast</code> more
+ frequent LACP heartbeats will be requested causing connectivity
+ problems to be detected more quickly.</dd>
</dl>
</column>
</group>
--
1.7.4.1
More information about the dev
mailing list