From: Felix Huettner <[email protected]>

Signed-off-by: Felix Huettner <[email protected]>
Signed-off-by: Martin Morgenstern <[email protected]>
---
 northd/ovn-northd.c | 43 ++++++-------------------------------------
 1 file changed, 6 insertions(+), 37 deletions(-)

diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c
index c11839e2b..3595fc73f 100644
--- a/northd/ovn-northd.c
+++ b/northd/ovn-northd.c
@@ -737,39 +737,6 @@ update_ssl_config(void)
     }
 }
 
-static struct ovsdb_idl_txn *
-run_idl_loop(struct ovsdb_idl_loop *idl_loop, const char *name,
-             uint64_t *idl_duration)
-{
-    unsigned long long duration, start = time_msec();
-    unsigned int seqno = UINT_MAX;
-    struct ovsdb_idl_txn *txn;
-    int n = 0;
-
-    /* Accumulate database changes as long as there are some,
-     * but no longer than "IDL_LOOP_MAX_DURATION_MS". */
-    while (seqno != ovsdb_idl_get_seqno(idl_loop->idl)
-           && time_msec() - start < IDL_LOOP_MAX_DURATION_MS) {
-        seqno = ovsdb_idl_get_seqno(idl_loop->idl);
-        ovsdb_idl_run(idl_loop->idl);
-        n++;
-    }
-
-    txn = ovsdb_idl_loop_run(idl_loop);
-
-    duration = time_msec() - start;
-    *idl_duration = duration;
-    /* ovsdb_idl_run() is called at least 2 times.  Once directly and
-     * once in the ovsdb_idl_loop_run().  n > 2 means that we received
-     * data on at least 2 subsequent calls. */
-    if (n > 2 || duration > 100) {
-        VLOG(duration > IDL_LOOP_MAX_DURATION_MS ? VLL_INFO : VLL_DBG,
-             "%s IDL run: %d iterations in %lld ms", name, n + 1, duration);
-    }
-
-    return txn;
-}
-
 #define DEFAULT_NORTHD_TRIM_TO_MS 30000
 
 static void
@@ -1021,8 +988,9 @@ main(int argc, char *argv[])
             }
 
             struct ovsdb_idl_txn *ovnnb_txn =
-                    run_idl_loop(&ovnnb_idl_loop, "OVN_Northbound",
-                                 &eng_ctx.nb_idl_duration_ms);
+                    ovsdb_idl_loop_run_completion(&ovnnb_idl_loop,
+                                                  IDL_LOOP_MAX_DURATION_MS,
+                                                  &eng_ctx.nb_idl_duration_ms);
             unsigned int new_ovnnb_cond_seqno =
                         ovsdb_idl_get_condition_seqno(ovnnb_idl_loop.idl);
             if (new_ovnnb_cond_seqno != ovnnb_cond_seqno) {
@@ -1034,8 +1002,9 @@ main(int argc, char *argv[])
             }
 
             struct ovsdb_idl_txn *ovnsb_txn =
-                    run_idl_loop(&ovnsb_idl_loop, "OVN_Southbound",
-                                 &eng_ctx.sb_idl_duration_ms);
+                    ovsdb_idl_loop_run_completion(&ovnsb_idl_loop,
+                                                  IDL_LOOP_MAX_DURATION_MS,
+                                                  &eng_ctx.sb_idl_duration_ms);
             unsigned int new_ovnsb_cond_seqno =
                         ovsdb_idl_get_condition_seqno(ovnsb_idl_loop.idl);
             if (new_ovnsb_cond_seqno != ovnsb_cond_seqno) {
-- 
2.45.2

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to