diff options
author | Damjan Marion <damarion@cisco.com> | 2023-12-21 15:52:46 +0100 |
---|---|---|
committer | Dave Wallace <dwallacelf@gmail.com> | 2023-12-21 20:23:41 +0000 |
commit | 82a68e91d04f2b97b72317309ab06af228fa4f3c (patch) | |
tree | cfa10fc67649f2263ecc4d420588ca635e674a23 /src/vlib | |
parent | 28b6dfa723c00f38eac05c4546a1773a89063369 (diff) |
buffers: add vlib_buffer_unalloc_to_pool()
Change-Id: Icd616989a525ef0be6c73a2ad91ae4871cf3921d
Type: improvement
Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vlib')
-rw-r--r-- | src/vlib/buffer_funcs.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/vlib/buffer_funcs.h b/src/vlib/buffer_funcs.h index e65a80bfad8..b3861a2f695 100644 --- a/src/vlib/buffer_funcs.h +++ b/src/vlib/buffer_funcs.h @@ -753,6 +753,23 @@ vlib_buffer_pool_put (vlib_main_t * vm, u8 buffer_pool_index, clib_spinlock_unlock (&bp->lock); } +/** \brief return unused buffers back to pool + This function can be used to return buffers back to pool without going + through vlib_buffer_free. Buffer metadata must not be modified in any + way before buffers are returned. + + @param vm - (vlib_main_t *) vlib main data structure pointer + @param buffers - (u32 * ) buffer index array + @param n_buffers - (u32) number of buffers to free + @param buffer_pool_index - (u8) buffer pool index +*/ +always_inline void +vlib_buffer_unalloc_to_pool (vlib_main_t *vm, u32 *buffers, u32 n_buffers, + u8 buffer_pool_index) +{ + vlib_buffer_pool_put (vm, buffer_pool_index, buffers, n_buffers); +} + static_always_inline void vlib_buffer_free_inline (vlib_main_t * vm, u32 * buffers, u32 n_buffers, int maybe_next) |