diff options
author | Damjan Marion <damarion@cisco.com> | 2020-09-26 19:32:34 +0200 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2020-09-30 11:41:16 +0000 |
commit | 2454de2d4539943d4140839facf6a2a2ea795556 (patch) | |
tree | 1fa54cb417ef29074825a6e66579cb17fc66e6c8 /src/vppinfra/bihash_template.h | |
parent | 2a7c0b6fc027e86727c08d98b66e19ad8768c82b (diff) |
vppinfra: use heap to store bihash data
Type: improvement
Change-Id: Ifb0fa114414aa2fdc244f964612ca3ac3e29b5e1
Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vppinfra/bihash_template.h')
-rw-r--r-- | src/vppinfra/bihash_template.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/vppinfra/bihash_template.h b/src/vppinfra/bihash_template.h index d6aa3c9f6ef..a6990ff5999 100644 --- a/src/vppinfra/bihash_template.h +++ b/src/vppinfra/bihash_template.h @@ -124,6 +124,25 @@ typedef CLIB_PACKED (struct { STATIC_ASSERT_SIZEOF (BVT (clib_bihash_shared_header), 8 * sizeof (u64)); typedef +BVS (clib_bihash_alloc_chunk) +{ + CLIB_CACHE_LINE_ALIGN_MARK (cacheline0); + + /* chunk size */ + uword size; + + /* pointer to the next allocation */ + u8 *next_alloc; + + /* number of bytes left in this chunk */ + uword bytes_left; + + /* doubly linked list of heap allocated chunks */ + BVS (clib_bihash_alloc_chunk) * prev, *next; + +} BVT (clib_bihash_alloc_chunk); + +typedef BVS (clib_bihash) { BVT (clib_bihash_bucket) * buckets; @@ -137,6 +156,8 @@ BVS (clib_bihash) u32 log2_nbuckets; u64 memory_size; u8 *name; + void *heap; + BVT (clib_bihash_alloc_chunk) * chunks; u64 *freelists; |