aboutsummaryrefslogtreecommitdiffstats
path: root/src/vppinfra/bihash_template.h
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2018-09-11 17:20:23 -0400
committerDave Barach <dave@barachs.net>2018-09-11 17:21:10 -0400
commitffb14b9554afa1e58c3657e0c91dda3135008274 (patch)
tree47ea77a16de4720c978f75b4fce1e3ffa99f999e /src/vppinfra/bihash_template.h
parent9b2f51abb5a48da1948866da8255ef18e4235e12 (diff)
bihash 32/64 bit shared memory interop
This patch makes 32/64 bit interoperable shared memory bihash tables work regardless of where they're mapped. Change-Id: If5b4a37ccdaa75410eba755c7d7195633de1b30b Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'src/vppinfra/bihash_template.h')
-rw-r--r--src/vppinfra/bihash_template.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/vppinfra/bihash_template.h b/src/vppinfra/bihash_template.h
index ef7e83013ae..6ce3da77e7f 100644
--- a/src/vppinfra/bihash_template.h
+++ b/src/vppinfra/bihash_template.h
@@ -99,7 +99,6 @@ typedef CLIB_PACKED (struct {
*/
u64 alloc_arena_next; /* Next VA 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