typedef CLIB_PACKED (struct {
/*
* Backing store allocation. Since bihash manages its own
- * freelists, we simple dole out memory at alloc_arena_next.
+ * freelists, we simple dole out memory starting from alloc_arena[alloc_arena_next].
*/
- u64 alloc_arena_next; /* Next VA to allocate, definitely NOT a constant */
+ u64 alloc_arena_next; /* Next offset from alloc_arena to allocate, definitely NOT a constant */
u64 alloc_arena_size; /* Size of the arena */
- u64 alloc_arena; /* Base VA of the arena */
/* Two SVM pointers stored as 8-byte integers */
u64 alloc_lock_as_u64;
u64 buckets_as_u64;
u32 nbuckets; /* Number of buckets */
/* Set when header valid */
volatile u32 ready;
- u64 pad;
+ u64 pad[2];
}) BVT (clib_bihash_shared_header);
/* *INDENT-ON* */
BVT (clib_bihash_shared_header) sh;
#endif
+ u64 alloc_arena; /* Base of the allocation arena */
+
/**
* A custom format function to print the Key and Value of bihash_key instead of default hexdump
*/
#undef CLIB_BIHASH_READY_MAGIC
#define alloc_arena_next(h) (((h)->sh)->alloc_arena_next)
#define alloc_arena_size(h) (((h)->sh)->alloc_arena_size)
-#define alloc_arena(h) (((h)->sh)->alloc_arena)
+#define alloc_arena(h) ((h)->alloc_arena)
#define CLIB_BIHASH_READY_MAGIC 0xFEEDFACE
#else
#undef alloc_arena_next
#undef CLIB_BIHASH_READY_MAGIC
#define alloc_arena_next(h) ((h)->sh.alloc_arena_next)
#define alloc_arena_size(h) ((h)->sh.alloc_arena_size)
-#define alloc_arena(h) ((h)->sh.alloc_arena)
+#define alloc_arena(h) ((h)->alloc_arena)
#define CLIB_BIHASH_READY_MAGIC 0
#endif
#if BIHASH_32_64_SVM
void BV (clib_bihash_master_init_svm)
- (BVT (clib_bihash) * h, char *name, u32 nbuckets,
- u64 base_address, u64 memory_size);
+ (BVT (clib_bihash) * h, char *name, u32 nbuckets, u64 memory_size);
void BV (clib_bihash_slave_init_svm)
(BVT (clib_bihash) * h, char *name, int fd);
#endif