[ovs-dev] [PATCH] test-conntrack: Fix conntrack benchmark by clearing conntrack metadata.

Ilya Maximets i.maximets at ovn.org
Tue Aug 18 14:13:29 UTC 2020


Packets in the benchmark must be treated as new packets, i.e. they
should not have conntrack metadata set.  Current code will set up
'pkt->md.conn' after the first run and all subsequent calls will hit
the 'fast' processing that is intended for recirculated packets making
a false impression that current conntrack implementation is lightning
fast.

Before the change:
  $ ./ovstest test-conntrack benchmark 4 33554432 32 1
  conntrack:   1059 ms

After (correct):
  $ ./ovstest test-conntrack benchmark 4 33554432 32 1
  conntrack:  92785 ms

Fixes: 594570ea1cde ("conntrack: Optimize recirculations.")
Signed-off-by: Ilya Maximets <i.maximets at ovn.org>
---
 tests/test-conntrack.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tests/test-conntrack.c b/tests/test-conntrack.c
index e7c73220a..24c93e4a4 100644
--- a/tests/test-conntrack.c
+++ b/tests/test-conntrack.c
@@ -82,6 +82,7 @@ ct_thread_main(void *aux_)
 {
     struct thread_aux *aux = aux_;
     struct dp_packet_batch *pkt_batch;
+    struct dp_packet *pkt;
     ovs_be16 dl_type;
     size_t i;
     long long now = time_msec();
@@ -91,6 +92,9 @@ ct_thread_main(void *aux_)
     for (i = 0; i < n_pkts; i += batch_size) {
         conntrack_execute(ct, pkt_batch, dl_type, false, true, 0, NULL, NULL,
                           0, 0, NULL, NULL, now, 0);
+        DP_PACKET_BATCH_FOR_EACH (j, pkt, pkt_batch) {
+            pkt_metadata_init_conn(&pkt->md);
+        }
     }
     ovs_barrier_block(&barrier);
     destroy_packets(pkt_batch);
-- 
2.25.4



More information about the dev mailing list