From 70aa337d733c274c93cf43c68c00eb85ca28075b Mon Sep 17 00:00:00 2001 From: Ethan Jackson Date: Fri, 14 Oct 2011 17:29:35 -0700 Subject: [PATCH] vswitchd: Update link_state instantly. With this patch, instead of updating an interface's link_state once every 5 seconds, it's updated immediately when changed. To avoid stressing the database, these updates are rate limited to once per second. --- vswitchd/bridge.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c index 1adf06f2..b3c62187 100644 --- a/vswitchd/bridge.c +++ b/vswitchd/bridge.c @@ -1274,11 +1274,6 @@ iface_refresh_status(struct iface *iface) ovsrec_interface_set_link_speed(iface->cfg, NULL, 0); } - ovsrec_interface_set_link_state(iface->cfg, - (netdev_get_carrier(iface->netdev) - ? "up" - : "down")); - error = netdev_get_mtu(iface->netdev, &mtu); if (!error) { mtu_64 = mtu; @@ -1578,6 +1573,7 @@ bridge_run(void) struct iface *iface; HMAP_FOR_EACH (iface, name_node, &br->iface_by_name) { + const char *link_state; int current; if (iface_is_synthetic(iface)) { @@ -1592,6 +1588,9 @@ bridge_run(void) } else { ovsrec_interface_set_lacp_current(iface->cfg, NULL, 0); } + + link_state = netdev_get_carrier(iface->netdev) ? "up" : "down"; + ovsrec_interface_set_link_state(iface->cfg, link_state); } } -- 2.30.2