[ovs-dev,RFC,OVN,4/4] ovn-controller: I-P for datapath binding
diff mbox series

Message ID 20200213152340.47973-1-numans@ovn.org
State Superseded
Headers show
Series
  • Incremental processing improvements.
Related show

Commit Message

Numan Siddique Feb. 13, 2020, 3:23 p.m. UTC
From: Numan Siddique <numans@ovn.org>

This patch adds partial support of incremental processing of datapath binding.
If a datapath is deleted, then a full recompute is triggered.

Signed-off-by: Numan Siddique <numans@ovn.org>
---
 controller/ovn-controller.c | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

Patch
diff mbox series

diff --git a/controller/ovn-controller.c b/controller/ovn-controller.c
index 73ac114a3..91be9dbf9 100644
--- a/controller/ovn-controller.c
+++ b/controller/ovn-controller.c
@@ -1188,6 +1188,29 @@  runtime_data_sb_port_binding_handler(struct engine_node *node, void *data)
     return binding_handle_port_binding_changes(&b_ctx_in, &b_ctx_out);
 }
 
+static bool
+runtime_data_sb_datapath_binding_handler(struct engine_node *node OVS_UNUSED,
+                                         void *data OVS_UNUSED)
+{
+    struct sbrec_datapath_binding_table *dp_table =
+        (struct sbrec_datapath_binding_table *)EN_OVSDB_GET(
+            engine_get_input("SB_datapath_binding", node));
+    const struct sbrec_datapath_binding *dp;
+    struct ed_type_runtime_data *rt_data = data;
+
+    SBREC_DATAPATH_BINDING_TABLE_FOR_EACH_TRACKED (dp, dp_table) {
+        if (sbrec_datapath_binding_is_deleted(dp)) {
+            if (get_local_datapath(&rt_data->local_datapaths,
+                                   dp->tunnel_key)) {
+                return false;
+            }
+        }
+    }
+
+    engine_set_node_state(node, EN_VALID);
+    return true;
+}
+
 /* Connection tracking zones. */
 struct ed_type_ct_zones {
     unsigned long bitmap[BITMAP_N_LONGS(MAX_CT_ZONES)];
@@ -1936,7 +1959,8 @@  main(int argc, char *argv[])
     engine_add_input(&en_runtime_data, &en_ovs_qos, NULL);
 
     engine_add_input(&en_runtime_data, &en_sb_chassis, NULL);
-    engine_add_input(&en_runtime_data, &en_sb_datapath_binding, NULL);
+    engine_add_input(&en_runtime_data, &en_sb_datapath_binding,
+                     runtime_data_sb_datapath_binding_handler);
     engine_add_input(&en_runtime_data, &en_sb_port_binding,
                      runtime_data_sb_port_binding_handler);