[ovs-dev] [PATCH ovn 3/3] inc-proc-eng: Add inc-engine/recompute command.

Dumitru Ceara dceara at redhat.com
Fri Nov 19 15:56:36 UTC 2021


This will be automatically available to all incremental processing
engine clients (ovn-northd and ovn-controller).

At the same time, deprecate the ovn-controller "recompute" command.

Signed-off-by: Dumitru Ceara <dceara at redhat.com>
---
 NEWS                        |    2 ++
 controller/ovn-controller.c |    7 +++----
 lib/inc-proc-eng.c          |   20 ++++++++++++++++++++
 lib/inc-proc-eng.h          |    3 +++
 4 files changed, 28 insertions(+), 4 deletions(-)

diff --git a/NEWS b/NEWS
index 97a833a1b..5bd191bf9 100644
--- a/NEWS
+++ b/NEWS
@@ -12,6 +12,8 @@ Post v21.09.0
     running on SmartNIC control plane CPUs.  Please refer to
     Documentation/topics/vif-plug-providers/vif-plug-providers.rst for more
     information.
+  - Added new "inc-engine/recompute" command to all incremental processing
+    engine clients (ovn-northd and ovn-controller).
 
 OVN v21.09.0 - 01 Oct 2021
 --------------------------
diff --git a/controller/ovn-controller.c b/controller/ovn-controller.c
index 61a94b3c3..d503b049a 100644
--- a/controller/ovn-controller.c
+++ b/controller/ovn-controller.c
@@ -3395,7 +3395,8 @@ main(int argc, char *argv[])
     unixctl_command_register("inject-pkt", "MICROFLOW", 1, 1, inject_pkt,
                              &pending_pkt);
 
-    unixctl_command_register("recompute", "", 0, 0, engine_recompute_cmd,
+    unixctl_command_register("recompute", "[deprecated]", 0, 0,
+                             engine_recompute_cmd,
                              NULL);
     unixctl_command_register("lflow-cache/flush", "", 0, 0,
                              lflow_cache_flush_cmd,
@@ -4145,9 +4146,7 @@ static void
 engine_recompute_cmd(struct unixctl_conn *conn OVS_UNUSED, int argc OVS_UNUSED,
                      const char *argv[] OVS_UNUSED, void *arg OVS_UNUSED)
 {
-    VLOG_INFO("User triggered force recompute.");
-    engine_set_force_recompute(true);
-    poll_immediate_wake();
+    engine_trigger_recompute();
     unixctl_command_reply(conn, NULL);
 }
 
diff --git a/lib/inc-proc-eng.c b/lib/inc-proc-eng.c
index 49a1fe2f2..2958a55e3 100644
--- a/lib/inc-proc-eng.c
+++ b/lib/inc-proc-eng.c
@@ -25,6 +25,7 @@
 #include "lib/util.h"
 #include "openvswitch/dynamic-string.h"
 #include "openvswitch/hmap.h"
+#include "openvswitch/poll-loop.h"
 #include "openvswitch/vlog.h"
 #include "inc-proc-eng.h"
 #include "timeval.h"
@@ -142,6 +143,15 @@ engine_dump_stats(struct unixctl_conn *conn, int argc OVS_UNUSED,
     ds_destroy(&dump);
 }
 
+static void
+engine_trigger_recompute_cmd(struct unixctl_conn *conn, int argc OVS_UNUSED,
+                             const char *argv[] OVS_UNUSED,
+                             void *arg OVS_UNUSED)
+{
+    engine_trigger_recompute();
+    unixctl_command_reply(conn, NULL);
+}
+
 void
 engine_init(struct engine_node *node, struct engine_arg *arg)
 {
@@ -160,6 +170,8 @@ engine_init(struct engine_node *node, struct engine_arg *arg)
                              engine_dump_stats, NULL);
     unixctl_command_register("inc-engine/clear-stats", "", 0, 0,
                              engine_clear_stats, NULL);
+    unixctl_command_register("inc-engine/recompute", "", 0, 0,
+                             engine_trigger_recompute_cmd, NULL);
 }
 
 void
@@ -475,3 +487,11 @@ engine_need_run(void)
     }
     return false;
 }
+
+void
+engine_trigger_recompute(void)
+{
+    VLOG_INFO("User triggered force recompute.");
+    engine_set_force_recompute(true);
+    poll_immediate_wake();
+}
diff --git a/lib/inc-proc-eng.h b/lib/inc-proc-eng.h
index 6f3918ae7..9bfab1f7c 100644
--- a/lib/inc-proc-eng.h
+++ b/lib/inc-proc-eng.h
@@ -264,6 +264,9 @@ void *engine_get_internal_data(struct engine_node *node);
 #define engine_set_node_state(node, state) \
     engine_set_node_state_at(node, state, OVS_SOURCE_LOCATOR)
 
+/* Trigger a full recompute. */
+void engine_trigger_recompute(void);
+
 struct ed_ovsdb_index {
     const char *name;
     struct ovsdb_idl_index *index;



More information about the dev mailing list