FD.io VPP  v16.06
Vector Packet Processing
dpdk_buffer.c File Reference
+ Include dependency graph for dpdk_buffer.c:

Go to the source code of this file.

Macros

#define BUFFERS_PER_COPY   (sizeof (vlib_copy_unit_t) / sizeof (u32))
 

Functions

uword vlib_buffer_length_in_chain_slow_path (vlib_main_t *vm, vlib_buffer_t *b_first)
 
u8format_vlib_buffer (u8 *s, va_list *args)
 
u8format_vlib_buffer_and_data (u8 *s, va_list *args)
 
u8format_vlib_buffer_contents (u8 *s, va_list *va)
 
void vlib_aligned_memcpy (void *_dst, void *_src, int n_bytes)
 
static void fill_unaligned (vlib_main_t *vm, vlib_buffer_free_list_t *free_list, uword n_unaligned_buffers)
 
static void trim_aligned (vlib_buffer_free_list_t *f)
 
static void merge_free_lists (vlib_buffer_free_list_t *dst, vlib_buffer_free_list_t *src)
 
always_inline u32 vlib_buffer_get_free_list_with_size (vlib_main_t *vm, u32 size)
 
static u32 vlib_buffer_create_free_list_helper (vlib_main_t *vm, u32 n_data_bytes, u32 is_public, u32 is_default, u8 *name)
 
u32 vlib_buffer_create_free_list (vlib_main_t *vm, u32 n_data_bytes, char *fmt,...)
 
u32 vlib_buffer_get_or_create_free_list (vlib_main_t *vm, u32 n_data_bytes, char *fmt,...)
 
static void del_free_list (vlib_main_t *vm, vlib_buffer_free_list_t *f)
 
void vlib_buffer_delete_free_list (vlib_main_t *vm, u32 free_list_index)
 
static uword fill_free_list (vlib_main_t *vm, vlib_buffer_free_list_t *fl, uword min_free_buffers)
 
always_inline uword copy_alignment (u32 *x)
 
static u32 alloc_from_free_list (vlib_main_t *vm, vlib_buffer_free_list_t *free_list, u32 *alloc_buffers, u32 n_alloc_buffers)
 
u32 vlib_buffer_alloc (vlib_main_t *vm, u32 *buffers, u32 n_buffers)
 Allocate buffers into supplied array. More...
 
u32 vlib_buffer_alloc_from_free_list (vlib_main_t *vm, u32 *buffers, u32 n_buffers, u32 free_list_index)
 Allocate buffers from specific freelist into supplied array. More...
 
always_inline void add_buffer_to_free_list (vlib_main_t *vm, vlib_buffer_free_list_t *f, u32 buffer_index, u8 do_init)
 
always_inline vlib_buffer_free_list_tbuffer_get_free_list (vlib_main_t *vm, vlib_buffer_t *b, u32 *index)
 
voidvlib_set_buffer_free_callback (vlib_main_t *vm, void *fp)
 
static_always_inline void vlib_buffer_free_inline (vlib_main_t *vm, u32 *buffers, u32 n_buffers, u32 follow_buffer_next)
 
void vlib_buffer_free (vlib_main_t *vm, u32 *buffers, u32 n_buffers)
 Free buffers Frees the entire buffer chain for each buffer. More...
 
void vlib_buffer_free_no_next (vlib_main_t *vm, u32 *buffers, u32 n_buffers)
 Free buffers, does not free the buffer chain for each buffer. More...
 
static void vlib_packet_template_buffer_init (vlib_main_t *vm, vlib_buffer_free_list_t *fl, u32 *buffers, u32 n_buffers)
 
void vlib_packet_template_init (vlib_main_t *vm, vlib_packet_template_t *t, void *packet_data, uword n_packet_data_bytes, uword min_n_buffers_each_physmem_alloc, char *fmt,...)
 
voidvlib_packet_template_get_packet (vlib_main_t *vm, vlib_packet_template_t *t, u32 *bi_result)
 
u32 vlib_buffer_add_data (vlib_main_t *vm, u32 free_list_index, u32 buffer_index, void *data, u32 n_data_bytes)
 
u16 vlib_buffer_chain_append_data_with_alloc (vlib_main_t *vm, u32 free_list_index, vlib_buffer_t *first, vlib_buffer_t **last, void *data, u16 data_len)
 
void vlib_buffer_chain_validate (vlib_main_t *vm, vlib_buffer_t *b_first)
 
clib_error_tvlib_buffer_pool_create (vlib_main_t *vm, unsigned num_mbufs, unsigned socket_id)
 
static void vlib_serialize_tx (serialize_main_header_t *m, serialize_stream_t *s)
 
static void vlib_serialize_rx (serialize_main_header_t *m, serialize_stream_t *s)
 
static void serialize_open_vlib_helper (serialize_main_t *m, vlib_main_t *vm, vlib_serialize_buffer_main_t *sm, uword is_read)
 
void serialize_open_vlib_buffer (serialize_main_t *m, vlib_main_t *vm, vlib_serialize_buffer_main_t *sm)
 
void unserialize_open_vlib_buffer (serialize_main_t *m, vlib_main_t *vm, vlib_serialize_buffer_main_t *sm)
 
u32 serialize_close_vlib_buffer (serialize_main_t *m)
 
void unserialize_close_vlib_buffer (serialize_main_t *m)
 
static u8format_vlib_buffer_free_list (u8 *s, va_list *va)
 
static clib_error_tshow_buffers (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 
static clib_error_tbuffer_state_validation_init (vlib_main_t *vm)
 

Variables

vlib_main_t ** vlib_mains
 
vlib_cli_command_t show_buffers_command
 (constructor) VLIB_CLI_COMMAND (show_buffers_command) More...
 
u32vlib_buffer_state_validation_lock
 
uwordvlib_buffer_state_validation_hash
 
voidvlib_buffer_state_heap
 

Macro Definition Documentation

#define BUFFERS_PER_COPY   (sizeof (vlib_copy_unit_t) / sizeof (u32))

Definition at line 210 of file dpdk_buffer.c.

Function Documentation

always_inline void add_buffer_to_free_list ( vlib_main_t vm,
vlib_buffer_free_list_t f,
u32  buffer_index,
u8  do_init 
)

Definition at line 646 of file dpdk_buffer.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static u32 alloc_from_free_list ( vlib_main_t vm,
vlib_buffer_free_list_t free_list,
u32 alloc_buffers,
u32  n_alloc_buffers 
)
static

Definition at line 510 of file dpdk_buffer.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

always_inline vlib_buffer_free_list_t* buffer_get_free_list ( vlib_main_t vm,
vlib_buffer_t b,
u32 index 
)

Definition at line 658 of file dpdk_buffer.c.

+ Here is the caller graph for this function:

static clib_error_t* buffer_state_validation_init ( vlib_main_t vm)
static

Definition at line 1247 of file dpdk_buffer.c.

+ Here is the call graph for this function:

always_inline uword copy_alignment ( u32 x)

Definition at line 506 of file dpdk_buffer.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void del_free_list ( vlib_main_t vm,
vlib_buffer_free_list_t f 
)
static

Definition at line 392 of file dpdk_buffer.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static uword fill_free_list ( vlib_main_t vm,
vlib_buffer_free_list_t fl,
uword  min_free_buffers 
)
static

Definition at line 441 of file dpdk_buffer.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void fill_unaligned ( vlib_main_t vm,
vlib_buffer_free_list_t free_list,
uword  n_unaligned_buffers 
)
static

Definition at line 214 of file dpdk_buffer.c.

+ Here is the caller graph for this function:

u8* format_vlib_buffer ( u8 s,
va_list *  args 
)

Definition at line 88 of file dpdk_buffer.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

u8* format_vlib_buffer_and_data ( u8 s,
va_list *  args 
)

Definition at line 118 of file dpdk_buffer.c.

+ Here is the call graph for this function:

u8* format_vlib_buffer_contents ( u8 s,
va_list *  va 
)

Definition at line 129 of file dpdk_buffer.c.

+ Here is the call graph for this function:

static u8* format_vlib_buffer_free_list ( u8 s,
va_list *  va 
)
static

Definition at line 1183 of file dpdk_buffer.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void merge_free_lists ( vlib_buffer_free_list_t dst,
vlib_buffer_free_list_t src 
)
static

Definition at line 268 of file dpdk_buffer.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

u32 serialize_close_vlib_buffer ( serialize_main_t m)

Definition at line 1149 of file dpdk_buffer.c.

+ Here is the call graph for this function:

void serialize_open_vlib_buffer ( serialize_main_t m,
vlib_main_t vm,
vlib_serialize_buffer_main_t sm 
)

Definition at line 1143 of file dpdk_buffer.c.

+ Here is the call graph for this function:

static void serialize_open_vlib_helper ( serialize_main_t m,
vlib_main_t vm,
vlib_serialize_buffer_main_t sm,
uword  is_read 
)
static

Definition at line 1119 of file dpdk_buffer.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static clib_error_t* show_buffers ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

Definition at line 1209 of file dpdk_buffer.c.

+ Here is the call graph for this function:

static void trim_aligned ( vlib_buffer_free_list_t f)
static

Definition at line 240 of file dpdk_buffer.c.

+ Here is the caller graph for this function:

void unserialize_close_vlib_buffer ( serialize_main_t m)

Definition at line 1172 of file dpdk_buffer.c.

+ Here is the call graph for this function:

void unserialize_open_vlib_buffer ( serialize_main_t m,
vlib_main_t vm,
vlib_serialize_buffer_main_t sm 
)

Definition at line 1146 of file dpdk_buffer.c.

+ Here is the call graph for this function:

void vlib_aligned_memcpy ( void _dst,
void _src,
int  n_bytes 
)

Definition at line 150 of file dpdk_buffer.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

u32 vlib_buffer_add_data ( vlib_main_t vm,
u32  free_list_index,
u32  buffer_index,
void data,
u32  n_data_bytes 
)

Definition at line 828 of file dpdk_buffer.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

u32 vlib_buffer_alloc ( vlib_main_t vm,
u32 buffers,
u32  n_buffers 
)

Allocate buffers into supplied array.

Parameters
vm- (vlib_main_t *) vlib main data structure pointer
buffers- (u32 * ) buffer index array
n_buffers- (u32) number of buffers requested
Returns
- (u32) number of buffers actually allocated, may be less than the number requested or zero

Definition at line 623 of file dpdk_buffer.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

u32 vlib_buffer_alloc_from_free_list ( vlib_main_t vm,
u32 buffers,
u32  n_buffers,
u32  free_list_index 
)

Allocate buffers from specific freelist into supplied array.

Parameters
vm- (vlib_main_t *) vlib main data structure pointer
buffers- (u32 * ) buffer index array
n_buffers- (u32) number of buffers requested
Returns
- (u32) number of buffers actually allocated, may be less than the number requested or zero

Definition at line 634 of file dpdk_buffer.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

u16 vlib_buffer_chain_append_data_with_alloc ( vlib_main_t vm,
u32  free_list_index,
vlib_buffer_t first,
vlib_buffer_t **  last,
void data,
u16  data_len 
)

Definition at line 883 of file dpdk_buffer.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void vlib_buffer_chain_validate ( vlib_main_t vm,
vlib_buffer_t b_first 
)

Definition at line 913 of file dpdk_buffer.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

u32 vlib_buffer_create_free_list ( vlib_main_t vm,
u32  n_data_bytes,
char *  fmt,
  ... 
)

Definition at line 352 of file dpdk_buffer.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static u32 vlib_buffer_create_free_list_helper ( vlib_main_t vm,
u32  n_data_bytes,
u32  is_public,
u32  is_default,
u8 name 
)
static

Definition at line 306 of file dpdk_buffer.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void vlib_buffer_delete_free_list ( vlib_main_t vm,
u32  free_list_index 
)

Definition at line 416 of file dpdk_buffer.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void vlib_buffer_free ( vlib_main_t vm,
u32 buffers,
u32  n_buffers 
)

Free buffers Frees the entire buffer chain for each buffer.

Parameters
vm- (vlib_main_t *) vlib main data structure pointer
buffers- (u32 * ) buffer index array
n_buffers- (u32) number of buffers to free

Definition at line 744 of file dpdk_buffer.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static_always_inline void vlib_buffer_free_inline ( vlib_main_t vm,
u32 buffers,
u32  n_buffers,
u32  follow_buffer_next 
)

Definition at line 677 of file dpdk_buffer.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void vlib_buffer_free_no_next ( vlib_main_t vm,
u32 buffers,
u32  n_buffers 
)

Free buffers, does not free the buffer chain for each buffer.

Parameters
vm- (vlib_main_t *) vlib main data structure pointer
buffers- (u32 * ) buffer index array
n_buffers- (u32) number of buffers to free

Definition at line 751 of file dpdk_buffer.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

always_inline u32 vlib_buffer_get_free_list_with_size ( vlib_main_t vm,
u32  size 
)

Definition at line 295 of file dpdk_buffer.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

u32 vlib_buffer_get_or_create_free_list ( vlib_main_t vm,
u32  n_data_bytes,
char *  fmt,
  ... 
)

Definition at line 368 of file dpdk_buffer.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uword vlib_buffer_length_in_chain_slow_path ( vlib_main_t vm,
vlib_buffer_t b_first 
)

Definition at line 73 of file dpdk_buffer.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

clib_error_t* vlib_buffer_pool_create ( vlib_main_t vm,
unsigned  num_mbufs,
unsigned  socket_id 
)

Definition at line 934 of file dpdk_buffer.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void vlib_packet_template_buffer_init ( vlib_main_t vm,
vlib_buffer_free_list_t fl,
u32 buffers,
u32  n_buffers 
)
static

Definition at line 760 of file dpdk_buffer.c.

+ Here is the call graph for this function:

void* vlib_packet_template_get_packet ( vlib_main_t vm,
vlib_packet_template_t t,
u32 bi_result 
)

Definition at line 801 of file dpdk_buffer.c.

+ Here is the call graph for this function:

void vlib_packet_template_init ( vlib_main_t vm,
vlib_packet_template_t t,
void packet_data,
uword  n_packet_data_bytes,
uword  min_n_buffers_each_physmem_alloc,
char *  fmt,
  ... 
)

Definition at line 777 of file dpdk_buffer.c.

+ Here is the call graph for this function:

static void vlib_serialize_rx ( serialize_main_header_t m,
serialize_stream_t s 
)
static

Definition at line 1073 of file dpdk_buffer.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void vlib_serialize_tx ( serialize_main_header_t m,
serialize_stream_t s 
)
static

Definition at line 1015 of file dpdk_buffer.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void* vlib_set_buffer_free_callback ( vlib_main_t vm,
void fp 
)

Definition at line 667 of file dpdk_buffer.c.

+ Here is the call graph for this function:

Variable Documentation

vlib_cli_command_t show_buffers_command
Initial value:
= {
.path = "show buffers",
.short_help = "Show packet buffer allocation",
.function = show_buffers,
}
static clib_error_t * show_buffers(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: dpdk_buffer.c:1209

(constructor) VLIB_CLI_COMMAND (show_buffers_command)

Definition at line 1234 of file dpdk_buffer.c.

void* vlib_buffer_state_heap

Definition at line 1244 of file dpdk_buffer.c.

uword* vlib_buffer_state_validation_hash

Definition at line 1243 of file dpdk_buffer.c.

u32* vlib_buffer_state_validation_lock

Definition at line 1242 of file dpdk_buffer.c.

vlib_main_t** vlib_mains

Definition at line 146 of file dpdk_buffer.c.