summaryrefslogtreecommitdiffstats
path: root/src/vnet
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2020-04-16 12:00:14 -0400
committerDamjan Marion <dmarion@me.com>2020-04-21 10:26:14 +0000
commit16e4a4a0ae39ebc1ded1b6dba2799b176aee1828 (patch)
tree14e21d5be2bb77b9301b5cb56118e3e9d8293811 /src/vnet
parentb9753540d2a69bbab807653fc3d0c1b43ec4d6d5 (diff)
vppinfra: bihash improvements
Template instances can allocate BIHASH_KVP_PER_PAGE data records tangent to the bucket, to remove a dependent read / prefetch. Template instances can ask for immediate memory allocation, to avoid several branches in the lookup path. Clean up l2 fib, gpb plugin codes: use clib_bihash_get_bucket(...) Use hugepages for bihash allocation arenas Type: improvement Signed-off-by: Dave Barach <dave@barachs.net> Signed-off-by: Damjan Marion <damarion@cisco.com> Change-Id: I92fc11bc58e48d84e2d61f44580916dd1c56361c
Diffstat (limited to 'src/vnet')
-rw-r--r--src/vnet/l2/l2_fib.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/vnet/l2/l2_fib.c b/src/vnet/l2/l2_fib.c
index 160e4e64048..983e0218bfc 100644
--- a/src/vnet/l2/l2_fib.c
+++ b/src/vnet/l2/l2_fib.c
@@ -1028,10 +1028,11 @@ l2fib_scan (vlib_main_t * vm, f64 start_time, u8 event_only)
if (i < (h->nbuckets - 3))
{
- BVT (clib_bihash_bucket) * b = &h->buckets[i + 3];
+ BVT (clib_bihash_bucket) * b =
+ BV (clib_bihash_get_bucket) (h, i + 3);
CLIB_PREFETCH (b, CLIB_CACHE_LINE_BYTES, LOAD);
- b = &h->buckets[i + 1];
- if (b->offset)
+ b = BV (clib_bihash_get_bucket) (h, i + 1);
+ if (!BV (clib_bihash_bucket_is_empty) (b))
{
BVT (clib_bihash_value) * v =
BV (clib_bihash_get_value) (h, b->offset);
@@ -1039,8 +1040,8 @@ l2fib_scan (vlib_main_t * vm, f64 start_time, u8 event_only)
}
}
- BVT (clib_bihash_bucket) * b = &h->buckets[i];
- if (b->offset == 0)
+ BVT (clib_bihash_bucket) * b = BV (clib_bihash_get_bucket) (h, i);
+ if (BV (clib_bihash_bucket_is_empty) (b))
continue;
BVT (clib_bihash_value) * v = BV (clib_bihash_get_value) (h, b->offset);
for (j = 0; j < (1 << b->log2_pages); j++)
@@ -1146,7 +1147,7 @@ l2fib_scan (vlib_main_t * vm, f64 start_time, u8 event_only)
* Note: we may have just freed the bucket's backing
* storage, so check right here...
*/
- if (b->offset == 0)
+ if (BV (clib_bihash_bucket_is_empty) (b))
goto doublebreak;
}
v++;