summaryrefslogtreecommitdiffstats
path: root/src/vppinfra/pool.h
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2022-03-31 15:12:20 +0200
committerFlorin Coras <florin.coras@gmail.com>2022-03-31 20:50:21 +0000
commit2473858233ef1c62f8c3a10395449c3ea975fe33 (patch)
tree6a167b471c00e9c07694af691a3f31fc711b11a1 /src/vppinfra/pool.h
parent4b20830b496ade3f1e77cd5fcbdf6d6c7bb5336d (diff)
vppinfra: vectors with non-default heap
Type: improvement Change-Id: Ic675ad4edbf27b7230fc2a77f00c90c46d6350c3 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vppinfra/pool.h')
-rw-r--r--src/vppinfra/pool.h13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/vppinfra/pool.h b/src/vppinfra/pool.h
index 32360daeffc..4db1f7b6bdf 100644
--- a/src/vppinfra/pool.h
+++ b/src/vppinfra/pool.h
@@ -308,7 +308,7 @@ _pool_put_index (void *p, uword index, uword elt_sz)
/** Allocate N more free elements to pool (general version). */
static_always_inline void
-_pool_alloc (void **pp, uword n_elts, uword align, uword elt_sz)
+_pool_alloc (void **pp, uword n_elts, uword align, void *heap, uword elt_sz)
{
pool_header_t *ph = pool_header (pp[0]);
uword len = vec_len (pp[0]);
@@ -320,7 +320,7 @@ _pool_alloc (void **pp, uword n_elts, uword align, uword elt_sz)
}
pp[0] = _vec_realloc_inline (pp[0], len + n_elts, elt_sz,
- sizeof (pool_header_t), align, 0);
+ sizeof (pool_header_t), align, heap);
_vec_len (pp[0]) = len;
CLIB_MEM_POISON (pp[0] + len * elt_sz, n_elts * elt_sz);
@@ -330,11 +330,12 @@ _pool_alloc (void **pp, uword n_elts, uword align, uword elt_sz)
clib_bitmap_vec_validate (ph->free_bitmap, len + n_elts - 1);
}
-#define pool_alloc_aligned(P, N, A) \
- _pool_alloc ((void **) &(P), N, _vec_align (P, A), _vec_elt_sz (P))
+#define pool_alloc_aligned_heap(P, N, A, H) \
+ _pool_alloc ((void **) &(P), N, _vec_align (P, A), H, _vec_elt_sz (P))
-/** Allocate N more free elements to pool (unspecified alignment). */
-#define pool_alloc(P,N) pool_alloc_aligned(P,N,0)
+#define pool_alloc_heap(P, N, H) pool_alloc_aligned_heap (P, N, 0, H)
+#define pool_alloc_aligned(P, N, A) pool_alloc_aligned_heap (P, N, A, 0)
+#define pool_alloc(P, N) pool_alloc_aligned_heap (P, N, 0, 0)
static_always_inline void *
_pool_dup (void *p, uword align, uword elt_sz)