From 82a68e91d04f2b97b72317309ab06af228fa4f3c Mon Sep 17 00:00:00 2001 From: Damjan Marion Date: Thu, 21 Dec 2023 15:52:46 +0100 Subject: buffers: add vlib_buffer_unalloc_to_pool() Change-Id: Icd616989a525ef0be6c73a2ad91ae4871cf3921d Type: improvement Signed-off-by: Damjan Marion --- src/vlib/buffer_funcs.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src') 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) -- cgit 1.2.3-korg