vom: Add support for redirect contracts in gbp
[vpp.git] / src / vppinfra / bihash_template.h
index ef7e830..98dcf14 100644 (file)
@@ -95,11 +95,10 @@ STATIC_ASSERT_SIZEOF (BVT (clib_bihash_bucket), sizeof (u64));
 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;
@@ -108,7 +107,7 @@ typedef CLIB_PACKED (struct {
   u32 nbuckets;        /* Number of buckets */
   /* Set when header valid */
   volatile u32 ready;
-  u64 pad;
+  u64 pad[2];
 }) BVT (clib_bihash_shared_header);
 /* *INDENT-ON* */
 
@@ -136,6 +135,8 @@ typedef struct
     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
     */
@@ -150,7 +151,7 @@ typedef struct
 #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
@@ -159,7 +160,7 @@ typedef struct
 #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
 
@@ -230,8 +231,7 @@ void BV (clib_bihash_init)
 
 #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