diff options
author | Damjan Marion <damarion@cisco.com> | 2018-07-17 23:01:49 +0200 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2018-07-18 00:03:55 +0000 |
commit | 882fcfe6f019f341e654daafe5afae9e69b64c50 (patch) | |
tree | fe0c3158421b28406cb3c0165f48999c82730b2c /src | |
parent | 96f40a0563d0a32fe1008c7cc8443367c528b902 (diff) |
vppinfra: increase max bihash arena size to 512GB
Change-Id: Ic636297df4c03303fdcb176669f0268d80e22123
Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/vppinfra/bihash_template.c | 8 | ||||
-rw-r--r-- | src/vppinfra/bihash_template.h | 24 |
2 files changed, 21 insertions, 11 deletions
diff --git a/src/vppinfra/bihash_template.c b/src/vppinfra/bihash_template.c index 89ae847c036..53ffbf156e6 100644 --- a/src/vppinfra/bihash_template.c +++ b/src/vppinfra/bihash_template.c @@ -287,7 +287,7 @@ int BV (clib_bihash_add_del) ; /* First elt in the bucket? */ - if (b->offset == 0) + if (BV (clib_bihash_bucket_is_empty) (b)) { if (is_add == 0) { @@ -473,7 +473,7 @@ int BV (clib_bihash_search) bucket_index = hash & (h->nbuckets - 1); b = &h->buckets[bucket_index]; - if (b->offset == 0) + if (BV (clib_bihash_bucket_is_empty) (b)) return -1; #if BIHASH_KVP_CACHE_SIZE > 0 @@ -571,7 +571,7 @@ u8 *BV (format_bihash) (u8 * s, va_list * args) for (i = 0; i < h->nbuckets; i++) { b = &h->buckets[i]; - if (b->offset == 0) + if (BV (clib_bihash_bucket_is_empty) (b)) { if (verbose > 1) s = format (s, "[%d]: empty\n", i); @@ -665,7 +665,7 @@ void BV (clib_bihash_foreach_key_value_pair) for (i = 0; i < h->nbuckets; i++) { b = &h->buckets[i]; - if (b->offset == 0) + if (BV (clib_bihash_bucket_is_empty) (b)) continue; v = BV (clib_bihash_get_value) (h, b->offset); diff --git a/src/vppinfra/bihash_template.h b/src/vppinfra/bihash_template.h index 8398c38f577..eb50d32d521 100644 --- a/src/vppinfra/bihash_template.h +++ b/src/vppinfra/bihash_template.h @@ -59,10 +59,10 @@ typedef struct { struct { - u32 offset; - u8 linear_search; - u8 log2_pages; - i16 refcnt; + u64 offset:37; + u64 linear_search:1; + u64 log2_pages:8; + i64 refcnt:16; }; u64 as_u64; }; @@ -72,6 +72,10 @@ typedef struct #endif } BVT (clib_bihash_bucket); +#if BIHASH_KVP_CACHE_SIZE == 0 +STATIC_ASSERT_SIZEOF (BVT (clib_bihash_bucket), sizeof (u64)); +#endif + typedef struct { BVT (clib_bihash_value) * values; @@ -238,6 +242,12 @@ static inline void *BV (clib_bihash_get_value) (BVT (clib_bihash) * h, return (void *) vp; } +static inline int BV (clib_bihash_bucket_is_empty) + (BVT (clib_bihash_bucket) * b) +{ + return b->as_u64 == 0; +} + static inline uword BV (clib_bihash_get_offset) (BVT (clib_bihash) * h, void *v) { @@ -284,7 +294,7 @@ static inline int BV (clib_bihash_search_inline_with_hash) bucket_index = hash & (h->nbuckets - 1); b = &h->buckets[bucket_index]; - if (b->offset == 0) + if (PREDICT_FALSE (BV (clib_bihash_bucket_is_empty) (b))) return -1; #if BIHASH_KVP_CACHE_SIZE > 0 @@ -373,7 +383,7 @@ static inline void BV (clib_bihash_prefetch_data) bucket_index = hash & (h->nbuckets - 1); b = &h->buckets[bucket_index]; - if (PREDICT_FALSE (b->offset == 0)) + if (PREDICT_FALSE (BV (clib_bihash_bucket_is_empty) (b))) return; hash >>= h->log2_nbuckets; @@ -401,7 +411,7 @@ static inline int BV (clib_bihash_search_inline_2_with_hash) bucket_index = hash & (h->nbuckets - 1); b = &h->buckets[bucket_index]; - if (b->offset == 0) + if (PREDICT_FALSE (BV (clib_bihash_bucket_is_empty) (b))) return -1; /* Check the cache, if currently unlocked */ |