aboutsummaryrefslogtreecommitdiffstats
path: root/src/vppinfra/bihash_template.h
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2019-07-08 12:25:38 -0400
committerFlorin Coras <florin.coras@gmail.com>2019-07-09 02:23:00 +0000
commit32dcd3b2f227dec638c39ade0c58d6741d83ec30 (patch)
tree8d9a2a1761b5d5c6ec88445b9385ef8c991df535 /src/vppinfra/bihash_template.h
parent369db83f91a411977015748a74c5a4579170a16c (diff)
vppinfra: allocate bihash virtual space on demand
Reduces the vpp image virtual size by multiple gigabytes Add a "show bihash" command which displays configured and current virtual space in use by bihash tables. Modify the .py test framework to call "show bihash" on test tear-down Type: refactor Change-Id: Ifc1b7e2c43d29bbef645f6802fa29ff8ef09940c Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'src/vppinfra/bihash_template.h')
-rw-r--r--src/vppinfra/bihash_template.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/vppinfra/bihash_template.h b/src/vppinfra/bihash_template.h
index d145b61952a..2e2ba911b7c 100644
--- a/src/vppinfra/bihash_template.h
+++ b/src/vppinfra/bihash_template.h
@@ -129,6 +129,7 @@ BVS (clib_bihash)
u32 nbuckets;
u32 log2_nbuckets;
+ u64 memory_size;
u8 *name;
u64 *freelists;
@@ -157,6 +158,8 @@ BVS (clib_bihash)
} BVT (clib_bihash);
+extern void **clib_all_bihashes;
+
#if BIHASH_32_64_SVM
#undef alloc_arena_next
#undef alloc_arena_size
@@ -313,6 +316,8 @@ int BV (clib_bihash_search) (BVT (clib_bihash) * h,
void BV (clib_bihash_foreach_key_value_pair) (BVT (clib_bihash) * h,
void *callback, void *arg);
+void *clib_all_bihash_set_heap (void);
+void clib_bihash_copied (void *dst, void *src);
format_function_t BV (format_bihash);
format_function_t BV (format_bihash_kvp);
@@ -326,6 +331,9 @@ static inline int BV (clib_bihash_search_inline_with_hash)
BVT (clib_bihash_bucket) * b;
int i, limit;
+ if (PREDICT_FALSE (alloc_arena (h) == 0))
+ return -1;
+
bucket_index = hash & (h->nbuckets - 1);
b = &h->buckets[bucket_index];
@@ -389,6 +397,9 @@ static inline void BV (clib_bihash_prefetch_data)
BVT (clib_bihash_value) * v;
BVT (clib_bihash_bucket) * b;
+ if (PREDICT_FALSE (alloc_arena (h) == 0))
+ return;
+
bucket_index = hash & (h->nbuckets - 1);
b = &h->buckets[bucket_index];
@@ -414,6 +425,9 @@ static inline int BV (clib_bihash_search_inline_2_with_hash)
ASSERT (valuep);
+ if (PREDICT_FALSE (alloc_arena (h) == 0))
+ return -1;
+
bucket_index = hash & (h->nbuckets - 1);
b = &h->buckets[bucket_index];