From: Guolin Yang <gy...@nicira.com>

There are two models in OVS in configure datapath port:
1. Datapath port created before user space bridge is configured.
   In this model, datapath can be deleted or added independent of
   user-space.
2. Datapath port created when ovsdb is requested to add the relevant
   port.

Traditionally OVS supports the second model which is used in Linux
platform.

With more platform support, OVS requires to support first model. In
this case, datapath port change detected by ofproto layer need to trigger
brdige to reconfigure so that bridge and ofproto layers can be
synchronized.

This change introduced a API for ofproto to request reconfiguration and
for bridge to detect the request.

Signed-off-by: Guolin Yang <gy...@nicira.com>
---
 ofproto/ofproto-dpif.c |   14 ++++++++++++++
 vswitchd/bridge.c      |    7 ++++++-
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
index b52d4ee..0036081 100644
--- a/ofproto/ofproto-dpif.c
+++ b/ofproto/ofproto-dpif.c
@@ -527,6 +527,9 @@ static bool clogged;
  * may be disabled with the "ovs-appctl dpif/disable-megaflows" command. */
 static bool enable_megaflows = true;
 
+/* ofproto require bridge reconfigure */
+static bool need_reconfigure = false;
+
 /* All existing ofproto_dpif instances, indexed by ->up.name. */
 static struct hmap all_ofproto_dpifs = HMAP_INITIALIZER(&all_ofproto_dpifs);
 
@@ -899,6 +902,17 @@ type_run(const char *type)
     return 0;
 }
 
+void
+ofproto_set_need_reconfigure(bool need)
+{
+        need_reconfigure = need;
+}
+
+bool
+ofproto_need_reconfigure(void) {
+        return need_reconfigure;
+}
+
 /* Check for and handle port changes in 'backer''s dpif. */
 static void
 process_dpif_port_changes(struct dpif_backer *backer)
diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
index 5e54e0b..878ab3a 100644
--- a/vswitchd/bridge.c
+++ b/vswitchd/bridge.c
@@ -2405,7 +2405,9 @@ bridge_run(void)
             }
         }
 
-        if (ovsdb_idl_get_seqno(idl) != idl_seqno || vlan_splinters_changed) {
+        if (ovsdb_idl_get_seqno(idl) != idl_seqno || vlan_splinters_changed ||
+            ofproto_need_reconfigure()) {
+            ofproto_set_need_reconfigure(false);
             idl_seqno = ovsdb_idl_get_seqno(idl);
             if (cfg) {
                 reconf_txn = ovsdb_idl_txn_create(idl);
@@ -2514,6 +2516,9 @@ bridge_wait(void)
         poll_immediate_wake();
     }
 
+    if (ofproto_need_reconfigure()) {
+        poll_immediate_wake();
+    }
     sset_init(&types);
     ofproto_enumerate_types(&types);
     SSET_FOR_EACH (type, &types) {
-- 
1.7.9.5

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

Reply via email to