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

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

Commit Message

Numan Siddique March 16, 2020, 11:15 a.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 +++++++++++++++++++++++++-
 tests/ovn-performance.at    |  8 +++++---
 2 files changed, 30 insertions(+), 4 deletions(-)

Patch
diff mbox series

diff --git a/controller/ovn-controller.c b/controller/ovn-controller.c
index 6841be29d..07823f020 100644
--- a/controller/ovn-controller.c
+++ b/controller/ovn-controller.c
@@ -1194,6 +1194,29 @@  runtime_data_sb_port_binding_handler(struct engine_node *node, void *data)
     return true;
 }
 
+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)];
@@ -1940,7 +1963,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);
 
diff --git a/tests/ovn-performance.at b/tests/ovn-performance.at
index a8a15f8fe..5c21f6dd7 100644
--- a/tests/ovn-performance.at
+++ b/tests/ovn-performance.at
@@ -239,8 +239,10 @@  for i in 1 2; do
     ovn_attach n1 br-phys 192.168.0.$i
 done
 
+ovn-nbctl --wait=hv sync
+
 # Add router lr1
-OVN_CONTROLLER_EXPECT_HIT(
+OVN_CONTROLLER_EXPECT_NO_HIT(
     [hv1 hv2], [lflow_run],
     [ovn-nbctl --wait=hv lr-add lr1]
 )
@@ -251,7 +253,7 @@  for i in 1 2; do
     lrp=lr1-$ls
 
     # Add switch $ls
-    OVN_CONTROLLER_EXPECT_HIT(
+    OVN_CONTROLLER_EXPECT_NO_HIT(
         [hv1 hv2], [lflow_run],
         [ovn-nbctl --wait=hv ls-add $ls]
     )
@@ -414,7 +416,7 @@  for i in 1 2; do
 done
 
 # Delete router lr1
-OVN_CONTROLLER_EXPECT_HIT(
+OVN_CONTROLLER_EXPECT_NO_HIT(
     [hv1 hv2], [lflow_run],
     [ovn-nbctl --wait=hv lr-del lr1]
 )