diff options
author | Damjan Marion <damarion@cisco.com> | 2022-03-16 17:57:29 +0100 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2022-03-17 20:31:14 +0000 |
commit | 1da361f9ea525663a1141c3665a67df5e81c4133 (patch) | |
tree | 301fd513bc709e68b31d9671e63e9894b8aee36b /src/vppinfra/vec_bootstrap.h | |
parent | 2b702da86c42267682b30a888299b89718bc46e8 (diff) |
vppinfra: store vector header size and alignment into header
On the forst vector alloc values are stored into header.
Later, when vector grows values from header are used istead of provided
ones.
In the debug image code will assert if same values are not provided.
Type: improvement
Change-Id: I8fdcfa495e9c1df0f6392c90f634e8c74b73b328
Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vppinfra/vec_bootstrap.h')
-rw-r--r-- | src/vppinfra/vec_bootstrap.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/vppinfra/vec_bootstrap.h b/src/vppinfra/vec_bootstrap.h index f2940288110..d628d3827f9 100644 --- a/src/vppinfra/vec_bootstrap.h +++ b/src/vppinfra/vec_bootstrap.h @@ -56,12 +56,16 @@ typedef struct { u32 len; /**< Number of elements in vector (NOT its allocated length). */ u8 numa_id; /**< NUMA id */ - u8 vpad[3]; /**< pad to 8 bytes */ + u8 hdr_size; /**< header size divided by VEC_HEADER_ROUND */ + u8 log2_align; /**< data alignment */ + u8 vpad[1]; /**< pad to 8 bytes */ u8 vector_data[0]; /**< Vector data . */ } vec_header_t; #define VEC_NUMA_UNSPECIFIED (0xFF) +#define VEC_HEADER_ROUND 8 + /** \brief Find the vector header Given the user's pointer to a vector, find the corresponding @@ -78,8 +82,7 @@ typedef struct always_inline uword vec_header_bytes (uword header_bytes) { - return round_pow2 (header_bytes + sizeof (vec_header_t), - sizeof (vec_header_t)); + return round_pow2 (header_bytes + sizeof (vec_header_t), VEC_HEADER_ROUND); } /** \brief Find a user vector header |