From b9c8c57e983246ec034bc9059b1740558c951d51 Mon Sep 17 00:00:00 2001 From: Dave Barach Date: Thu, 16 Mar 2023 13:03:47 -0400 Subject: vppinfra: fix corner-cases in bihash lookup In a case where one pounds on a single kvp in a KVP_AT_BUCKET_LEVEL table, the code would sporadically return a transitional value (junk) from a half-deleted kvp. At most, 64-bits worth of the kvp will be written atomically, so using memset(...) to smear 0xFF's across a kvp to free it left a lot to be desired. Performance impact: very mild positive, thanks to FC for doing a multi-thread host stack perf/scale test. Added an ASSERT to catch attempts to add a (key,value) pair which contains the magic "free kvp" value. Type: fix Signed-off-by: Dave Barach Change-Id: I6a1aa8a2c30bc70bec4b696ce7b17c2839927065 --- src/vnet/l2/l2_fib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/vnet/l2/l2_fib.c') diff --git a/src/vnet/l2/l2_fib.c b/src/vnet/l2/l2_fib.c index d9d6710fd15..ad301af78f4 100644 --- a/src/vnet/l2/l2_fib.c +++ b/src/vnet/l2/l2_fib.c @@ -1149,7 +1149,7 @@ l2fib_scan (vlib_main_t * vm, f64 start_time, u8 event_only) { for (k = 0; k < BIHASH_KVP_PER_PAGE; k++) { - if (v->kvp[k].key == ~0ULL && v->kvp[k].value == ~0ULL) + if (BV (clib_bihash_is_free) (&v->kvp[k])) continue; l2fib_entry_key_t key = {.raw = v->kvp[k].key }; -- cgit 1.2.3-korg