Signed-off-by: Felix Huettner <felix.huettner@stackit.cloud>
---
 northd/en-routes-sync.c  | 23 +++++++++++++++++++++++
 northd/en-routes-sync.h  |  2 ++
 northd/inc-proc-northd.c |  3 ++-
 3 files changed, 27 insertions(+), 1 deletion(-)

diff --git a/northd/en-routes-sync.c b/northd/en-routes-sync.c
index dd0c914dd..f53d581ab 100644
--- a/northd/en-routes-sync.c
+++ b/northd/en-routes-sync.c
@@ -53,6 +53,29 @@ routes_sync_destroy(struct routes_sync_data *data)
     hmap_destroy(&data->parsed_routes);
 }
 
+bool
+routes_sync_northd_change_handler(struct engine_node *node,
+                                  void *data OVS_UNUSED)
+{
+    struct northd_data *northd_data = engine_get_input_data("northd", node);
+    if (!northd_has_tracked_data(&northd_data->trk_data)) {
+        return false;
+    }
+
+    /* This node uses the below data from the en_northd engine node.
+     * See (lr_stateful_get_input_data())
+     *   1. northd_data->lr_datapaths
+     *   2. northd_data->lr_ports
+     *      This data gets updated when a logical router or logical router port
+     *      is created or deleted.
+     *      Northd engine node presently falls back to full recompute when
+     *      this happens and so does this node.
+     *      Note: When we add I-P to the created/deleted logical routers or
+     *      logical router ports, we need to revisit this handler.
+     */
+    return true;
+}
+
 void
 *en_routes_sync_init(struct engine_node *node OVS_UNUSED,
                      struct engine_arg *arg OVS_UNUSED)
diff --git a/northd/en-routes-sync.h b/northd/en-routes-sync.h
index d784d38d7..391f17452 100644
--- a/northd/en-routes-sync.h
+++ b/northd/en-routes-sync.h
@@ -16,6 +16,8 @@
 
 #include "lib/inc-proc-eng.h"
 
+bool routes_sync_northd_change_handler(struct engine_node *node,
+                                       void *data OVS_UNUSED);
 void *en_routes_sync_init(struct engine_node *, struct engine_arg *);
 void en_routes_sync_cleanup(void *data);
 void en_routes_sync_run(struct engine_node *, void *data);
diff --git a/northd/inc-proc-northd.c b/northd/inc-proc-northd.c
index 5ce9832ea..ad4a25fa0 100644
--- a/northd/inc-proc-northd.c
+++ b/northd/inc-proc-northd.c
@@ -270,7 +270,8 @@ void inc_proc_northd_init(struct ovsdb_idl_loop *nb,
 
     engine_add_input(&en_routes_sync, &en_routes, NULL);
     engine_add_input(&en_routes_sync, &en_sb_route, NULL);
-    engine_add_input(&en_routes_sync, &en_northd, NULL);
+    engine_add_input(&en_routes_sync, &en_northd,
+                     routes_sync_northd_change_handler);
     engine_add_input(&en_routes_sync, &en_lr_stateful, NULL);
 
     engine_add_input(&en_sync_meters, &en_nb_acl, NULL);
-- 
2.47.0

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to