vlib: make vlib_buffer_alloc inline function
Currently, every alloc involves callback function call. With this change
callback function is called only if there is no empty buffers on the
free list.
Change-Id: I2238c19ece7ce182c49ba0f2485add52f335f3b6
Signed-off-by: Damjan Marion <damarion@cisco.com>
diff --git a/src/vlib/buffer.h b/src/vlib/buffer.h
index 21bed48..c3c4def 100644
--- a/src/vlib/buffer.h
+++ b/src/vlib/buffer.h
@@ -380,12 +380,9 @@
uword buffer_init_function_opaque;
} __attribute__ ((aligned (16))) vlib_buffer_free_list_t;
-typedef u32 (vlib_buffer_alloc_cb_t) (struct vlib_main_t * vm, u32 * buffers,
- u32 n_buffers);
-typedef u32 (vlib_buffer_alloc_from_free_list_cb_t) (struct vlib_main_t * vm,
- u32 * buffers,
- u32 n_buffers,
- u32 free_list_index);
+typedef uword (vlib_buffer_fill_free_list_cb_t) (struct vlib_main_t * vm,
+ vlib_buffer_free_list_t * fl,
+ uword min_free_buffers);
typedef void (vlib_buffer_free_cb_t) (struct vlib_main_t * vm, u32 * buffers,
u32 n_buffers);
typedef void (vlib_buffer_free_no_next_cb_t) (struct vlib_main_t * vm,
@@ -393,8 +390,7 @@
typedef struct
{
- vlib_buffer_alloc_cb_t *vlib_buffer_alloc_cb;
- vlib_buffer_alloc_from_free_list_cb_t *vlib_buffer_alloc_from_free_list_cb;
+ vlib_buffer_fill_free_list_cb_t *vlib_buffer_fill_free_list_cb;
vlib_buffer_free_cb_t *vlib_buffer_free_cb;
vlib_buffer_free_no_next_cb_t *vlib_buffer_free_no_next_cb;
void (*vlib_packet_template_init_cb) (struct vlib_main_t * vm, void *t,