From 269340fac3602303e30d46181652a7c90bde0e5e Mon Sep 17 00:00:00 2001 From: Ethan Jackson Date: Tue, 8 Mar 2011 16:34:20 -0800 Subject: [PATCH] lacp: Enable "fast" lacp timing mode. --- lib/lacp.c | 12 ++++++++++-- lib/lacp.h | 2 +- vswitchd/bridge.c | 6 +++++- vswitchd/vswitch.xml | 7 +++++++ 4 files changed, 23 insertions(+), 4 deletions(-) diff --git a/lib/lacp.c b/lib/lacp.c index de860e0d..25416230 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. */ }; @@ -127,7 +128,7 @@ lacp_destroy(struct lacp *lacp) void lacp_configure(struct lacp *lacp, const char *name, 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); @@ -137,6 +138,7 @@ lacp_configure(struct lacp *lacp, const char *name, 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 @@ -149,7 +151,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; @@ -431,6 +435,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 6c7ff3f5..60abadde 100644 --- a/lib/lacp.h +++ b/lib/lacp.h @@ -32,7 +32,7 @@ void lacp_init(void); struct lacp *lacp_create(void); void lacp_destroy(struct lacp *); void lacp_configure(struct lacp *, const char *name, uint8_t sys_id[8], - uint16_t sys_priority, bool active); + 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 c8b50d71..6b8df983 100644 --- a/vswitchd/bridge.c +++ b/vswitchd/bridge.c @@ -185,6 +185,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. */ @@ -4132,6 +4133,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")); @@ -4290,7 +4294,7 @@ port_update_lacp(struct port *port) lacp_configure(port->lacp, port->name, 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 ad1bffa3..cea198a9 100644 --- a/vswitchd/vswitch.xml +++ b/vswitchd/vswitch.xml @@ -637,6 +637,13 @@ LACP negotiations, link status decisions are made by the system with the numerically lower priority. Must be a number between 1 and 65535. +
lacp-time
+
The LACP timing which should be used on this + . Possible values are fast and + slow. By default slow is used. When + configured to be fast more frequent LACP heartbeats + will be requested causing connectivity problems to be detected more + quickly.
-- 2.30.2