From: Ethan Jackson Date: Sat, 15 Oct 2011 00:29:35 +0000 (-0700) Subject: vswitchd: Update link_state instantly. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=70aa337d733c274c93cf43c68c00eb85ca28075b;p=openvswitch 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. --- 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); } }