From: Ilya Maximets <i.maxim...@ovn.org> This could save some costly key comparison miss, especially in the case there are many expired connections waiting for the sweeper to evict them.
Signed-off-by: Ilya Maximets <i.maxim...@ovn.org> Signed-off-by: Paolo Valerio <pvale...@redhat.com> --- lib/conntrack.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/conntrack.c b/lib/conntrack.c index 057653781..a2b8f5562 100644 --- a/lib/conntrack.c +++ b/lib/conntrack.c @@ -589,14 +589,17 @@ conn_key_lookup(struct conntrack *ct, const struct conn_key *key, bool found = false; CMAP_FOR_EACH_WITH_HASH (conn, cm_node, hash, &ct->conns) { - if (!conn_key_cmp(&conn->key, key) && !conn_expired(conn, now)) { + if (conn_expired(conn, now)) { + continue; + } + if (!conn_key_cmp(&conn->key, key)) { found = true; if (reply) { *reply = false; } break; } - if (!conn_key_cmp(&conn->rev_key, key) && !conn_expired(conn, now)) { + if (!conn_key_cmp(&conn->rev_key, key)) { found = true; if (reply) { *reply = true; _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev