diff mbox series

[ovs-dev,7/7] en_lflow: Generate logical flows

Message ID 20210929172341.719131-8-mark.d.gray@redhat.com
State Superseded
Delegated to: Han Zhou
Headers show
Series northd: Introduce incremental processing framework | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success

Commit Message

Mark Gray Sept. 29, 2021, 5:23 p.m. UTC
Generate logical flows using 'en_flow' incremental processing node.
This node uses output data from 'en_northd' in order to generate
logical flows.

Signed-off-by: Mark Gray <mark.d.gray@redhat.com>
---
 northd/en-lflow.c | 12 ++++++++++++
 northd/northd.c   |  6 +-----
 northd/northd.h   |  1 +
 3 files changed, 14 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/northd/en-lflow.c b/northd/en-lflow.c
index 46072cb0162e..e24c00e039c3 100644
--- a/northd/en-lflow.c
+++ b/northd/en-lflow.c
@@ -23,12 +23,24 @@ 
 
 #include "lib/inc-proc-eng.h"
 #include "northd.h"
+#include "stopwatch.h"
+#include "lib/stopwatch-names.h"
+#include "timeval.h"
 #include "openvswitch/vlog.h"
 
 VLOG_DEFINE_THIS_MODULE(en_lflow);
 
 void en_lflow_run(struct engine_node *node, void *data OVS_UNUSED)
 {
+    const struct engine_context *eng_ctx = engine_get_context();
+    struct northd_idl_context *ctx = eng_ctx->client_ctx;
+
+    struct ed_type_northd *northd_data = engine_get_input_data("northd", node);
+
+    stopwatch_start(BUILD_LFLOWS_STOPWATCH_NAME, time_msec());
+    build_lflows(ctx, northd_data->data);
+    stopwatch_stop(BUILD_LFLOWS_STOPWATCH_NAME, time_msec());
+
     engine_set_node_state(node, EN_UPDATED);
 }
 void *en_lflow_init(struct engine_node *node OVS_UNUSED,
diff --git a/northd/northd.c b/northd/northd.c
index 6699b8a3ffc1..94620d243dec 100644
--- a/northd/northd.c
+++ b/northd/northd.c
@@ -13209,8 +13209,7 @@  static bool reset_parallel = false;
 
 /* Updates the Logical_Flow and Multicast_Group tables in the OVN_SB database,
  * constructing their contents based on the OVN_NB database. */
-static void
-build_lflows(struct northd_idl_context *ctx, struct northd_data *data)
+void build_lflows(struct northd_idl_context *ctx, struct northd_data *data)
 {
     struct hmap lflows;
 
@@ -14396,9 +14395,6 @@  ovnnb_db_run(struct northd_data *data,
     build_meter_groups(ctx, &data->meter_groups);
     build_bfd_table(ctx, &data->bfd_connections, &data->ports);
     stopwatch_stop(BUILD_LFLOWS_CTX_STOPWATCH_NAME, time_msec());
-    stopwatch_start(BUILD_LFLOWS_STOPWATCH_NAME, time_msec());
-    build_lflows(ctx, data);
-    stopwatch_stop(BUILD_LFLOWS_STOPWATCH_NAME, time_msec());
     stopwatch_start(CLEAR_LFLOWS_CTX_STOPWATCH_NAME, time_msec());
     ovn_update_ipv6_prefix(&data->ports);
 
diff --git a/northd/northd.h b/northd/northd.h
index d4bc5cf16541..07ea6899984f 100644
--- a/northd/northd.h
+++ b/northd/northd.h
@@ -51,5 +51,6 @@  void northd_destroy(struct northd_data *data);
 void northd_init(struct northd_data *data);
 void northd_indices_create(struct northd_data *data,
                            struct ovsdb_idl *ovnsb_idl);
+void build_lflows(struct northd_idl_context *ctx, struct northd_data *data);
 
 #endif /* NORTHD_H */