This patch no longer rate limits database updates due to CFM
changes.  Due to recent changes, the fault status of CFM only
changes once per 3.5 tx_interval seconds.  There doesn't seem to be
a good reason to add an additional rate limit on top of this.
---
 vswitchd/bridge.c |   36 +++++++++++++++++++-----------------
 1 files changed, 19 insertions(+), 17 deletions(-)

diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
index ada82ff..00157e1 100644
--- a/vswitchd/bridge.c
+++ b/vswitchd/bridge.c
@@ -197,7 +197,7 @@ static void iface_set_mac(struct iface *);
 static void iface_set_ofport(const struct ovsrec_interface *, int64_t ofport);
 static void iface_configure_qos(struct iface *, const struct ovsrec_qos *);
 static void iface_configure_cfm(struct iface *);
-static bool iface_refresh_cfm_stats(struct iface *);
+static void iface_refresh_cfm_stats(struct iface *);
 static void iface_refresh_stats(struct iface *);
 static void iface_refresh_status(struct iface *);
 static bool iface_get_carrier(const struct iface *);
@@ -1258,27 +1258,18 @@ iface_refresh_status(struct iface *iface)
 
 /* Writes 'iface''s CFM statistics to the database.  Returns true if anything
  * changed, false otherwise. */
-static bool
+static void
 iface_refresh_cfm_stats(struct iface *iface)
 {
     const struct ovsrec_interface *cfg = iface->cfg;
-    bool changed = false;
     int fault;
 
     fault = ofproto_port_get_cfm_fault(iface->port->bridge->ofproto,
                                        iface->ofp_port);
-
-    if (fault < 0) {
-        return false;
-    }
-
-    if (cfg->n_cfm_fault != 1 || cfg->cfm_fault[0] != fault) {
+    if (fault >= 0) {
         bool fault_bool = fault;
         ovsrec_interface_set_cfm_fault(cfg, &fault_bool, 1);
-        changed = true;
     }
-
-    return changed;
 }
 
 static bool
@@ -1427,6 +1418,7 @@ bridge_run(void)
 {
     const struct ovsrec_open_vswitch *cfg;
 
+    struct ovsdb_idl_txn *txn;
     bool datapath_destroyed;
     bool database_changed;
     struct bridge *br;
@@ -1476,7 +1468,7 @@ bridge_run(void)
 
     if (database_changed || datapath_destroyed) {
         if (cfg) {
-            struct ovsdb_idl_txn *txn = ovsdb_idl_txn_create(idl);
+            txn = ovsdb_idl_txn_create(idl);
 
             bridge_reconfigure(cfg);
 
@@ -1495,8 +1487,6 @@ bridge_run(void)
     /* Refresh system and interface stats if necessary. */
     if (time_msec() >= stats_timer) {
         if (cfg) {
-            struct ovsdb_idl_txn *txn;
-
             txn = ovsdb_idl_txn_create(idl);
             HMAP_FOR_EACH (br, node, &all_bridges) {
                 struct port *port;
@@ -1520,7 +1510,6 @@ bridge_run(void)
     }
 
     if (time_msec() >= db_limiter) {
-        struct ovsdb_idl_txn *txn;
         bool changed = false;
 
         txn = ovsdb_idl_txn_create(idl);
@@ -1531,7 +1520,9 @@ bridge_run(void)
                 struct iface *iface;
 
                 LIST_FOR_EACH (iface, port_elem, &port->ifaces) {
-                    changed = iface_refresh_cfm_stats(iface) || changed;
+                    /* XXX: Eventually we need to remove the lacp_current flag
+                     * from the database so that we can completely get rid of
+                     * this rate limiter code. */
                     changed = iface_refresh_lacp_stats(iface) || changed;
                 }
             }
@@ -1544,6 +1535,17 @@ bridge_run(void)
         ovsdb_idl_txn_commit(txn);
         ovsdb_idl_txn_destroy(txn);
     }
+
+    txn = ovsdb_idl_txn_create(idl);
+    HMAP_FOR_EACH (br, node, &all_bridges) {
+        struct iface *iface;
+
+        HMAP_FOR_EACH (iface, name_node, &br->iface_by_name) {
+            iface_refresh_cfm_stats(iface);
+        }
+    }
+    ovsdb_idl_txn_commit(txn);
+    ovsdb_idl_txn_destroy(txn);
 }
 
 void
-- 
1.7.6.1

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to