When using the same testcases as in the previous commits
Below lists the total time for the testrun with these various configs.
|          | Without this patch | With this patch |
| Config 1 | 31.0 s             | 30.8 s          |
| Config 2 | 31.6 s             | 31.5 s          |
| Config 3 | 7.8 s              | 7.7 s           |
| Config 4 | 15.9 s             | 17.7 s          |
| Config 5 | 45.7 s             | 44.1 s          |
| Config 6 | 46.1 s             | 43.9 s          |

Signed-off-by: Felix Huettner <[email protected]>
---
 lib/conntrack.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/lib/conntrack.c b/lib/conntrack.c
index da7ed0c77..cd275db54 100644
--- a/lib/conntrack.c
+++ b/lib/conntrack.c
@@ -23,6 +23,7 @@
 #include <string.h>
 
 #include "conntrack.h"
+#include "cmap.h"
 #include "conntrack-private.h"
 #include "conntrack-tp.h"
 #include "coverage.h"
@@ -1525,10 +1526,9 @@ ct_sweep_zone(struct conntrack *ct, uint16_t zone, long 
long now,
     struct conntrack_zone *cz;
     unsigned int conn_count = 0;
     struct conn *conn;
-    struct cmap_node *node;
     long long expiration;
 
-#define CONN_BUF_SIZE 100
+    #define CONN_BUF_SIZE 100
     struct conn *conn_buf[CONN_BUF_SIZE];
     unsigned int n_conn_buf = 0;
 
@@ -1541,9 +1541,12 @@ ct_sweep_zone(struct conntrack *ct, uint16_t zone, long 
long now,
         *current_position = xzalloc(sizeof(**current_position));
     }
 
-    while ((node = cmap_next_position(&cz->conns, *current_position))) {
-        keyn = OBJECT_CONTAINING(node, keyn, cm_node);
+    struct cmap_cursor cursor = cmap_position_to_cursor(&cz->conns,
+                                                        *current_position);
+
+    CMAP_CURSOR_FOR_EACH_CONTINUE (keyn, cm_node, &cursor) {
         if (conn_count > limit) {
+            cmap_cursor_to_position(&cursor, *current_position);
             return conn_count;
         }
 
-- 
2.43.0


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

Reply via email to