FD.io VPP  v16.06
Vector Packet Processing
buffer.c File Reference
+ Include dependency graph for 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)
 
static u8format_vlib_buffer_known_state (u8 *s, va_list *args)
 
u8format_vlib_buffer_contents (u8 *s, va_list *va)
 
static u8vlib_validate_buffer_helper (vlib_main_t *vm, u32 bi, uword follow_buffer_next, uword **unique_hash)
 
u8vlib_validate_buffer (vlib_main_t *vm, u32 bi, uword follow_buffer_next)
 
u8vlib_validate_buffers (vlib_main_t *vm, u32 *buffers, uword next_buffer_stride, uword n_buffers, vlib_buffer_known_state_t known_state, uword follow_buffer_next)
 
static void vlib_buffer_validate_alloc_free (vlib_main_t *vm, u32 *buffers, uword n_buffers, vlib_buffer_known_state_t expected_state)
 
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)
 
void vnet_buffer_free_dpdk_mb (vlib_buffer_t *b)
 
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)
 
void vlib_packet_template_get_packet_helper (vlib_main_t *vm, vlib_packet_template_t *t)
 
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)
 
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)
 

Variables

vlib_main_t ** vlib_mains
 
vlib_cli_command_t show_buffers_command
 (constructor) VLIB_CLI_COMMAND (show_buffers_command) More...
 

Macro Definition Documentation

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

Definition at line 353 of file 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 794 of file 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 650 of file 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 806 of file buffer.c.

+ Here is the caller graph for this function:

always_inline uword copy_alignment ( u32 x)

Definition at line 646 of file 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 535 of file buffer.c.

+ 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 574 of file 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 357 of file buffer.c.

+ Here is the caller graph for this function:

u8* format_vlib_buffer ( u8 s,
va_list *  args 
)

Definition at line 57 of file 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 74 of file buffer.c.

+ Here is the call graph for this function:

u8* format_vlib_buffer_contents ( u8 s,
va_list *  va 
)

Definition at line 112 of file 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 1427 of file buffer.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static u8* format_vlib_buffer_known_state ( u8 s,
va_list *  args 
)
static

Definition at line 85 of file 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 411 of file 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 1393 of file buffer.c.

+ Here is the caller 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 1387 of file buffer.c.

+ Here is the caller 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 1363 of file 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 1451 of file buffer.c.

+ Here is the call graph for this function:

static void trim_aligned ( vlib_buffer_free_list_t f)
static

Definition at line 383 of file buffer.c.

+ Here is the caller graph for this function:

void unserialize_close_vlib_buffer ( serialize_main_t m)

Definition at line 1416 of file buffer.c.

+ Here is the caller 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 1390 of file buffer.c.

+ Here is the caller graph for this function:

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

Definition at line 293 of file buffer.c.

+ 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 1169 of file buffer.c.

+ 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 770 of file buffer.c.

+ 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 782 of file buffer.c.

+ 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 1224 of file buffer.c.

+ 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 1254 of file buffer.c.

+ 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 495 of file buffer.c.

+ 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 449 of file 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 548 of file buffer.c.

+ 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 1060 of file buffer.c.

+ 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 828 of file 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 1067 of file buffer.c.

+ 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 438 of file 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 511 of file buffer.c.

+ 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 42 of file buffer.c.

static void vlib_buffer_validate_alloc_free ( vlib_main_t vm,
u32 buffers,
uword  n_buffers,
vlib_buffer_known_state_t  expected_state 
)
static

Definition at line 249 of file 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 1076 of file buffer.c.

+ Here is the call graph for this function:

+ Here is the caller 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 1133 of file buffer.c.

+ Here is the caller graph for this function:

void vlib_packet_template_get_packet_helper ( vlib_main_t vm,
vlib_packet_template_t t 
)

Definition at line 1153 of file 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 1093 of file buffer.c.

+ Here is the caller graph for this function:

static void vlib_serialize_rx ( serialize_main_header_t m,
serialize_stream_t s 
)
static

Definition at line 1317 of file 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 1259 of file 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 815 of file buffer.c.

u8* vlib_validate_buffer ( vlib_main_t vm,
u32  bi,
uword  follow_buffer_next 
)

Definition at line 189 of file buffer.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static u8* vlib_validate_buffer_helper ( vlib_main_t vm,
u32  bi,
uword  follow_buffer_next,
uword **  unique_hash 
)
static

Definition at line 130 of file buffer.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

u8* vlib_validate_buffers ( vlib_main_t vm,
u32 buffers,
uword  next_buffer_stride,
uword  n_buffers,
vlib_buffer_known_state_t  known_state,
uword  follow_buffer_next 
)

Definition at line 193 of file buffer.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void vnet_buffer_free_dpdk_mb ( vlib_buffer_t b)

Definition at line 825 of file buffer.c.

+ Here is the caller 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: buffer.c:1451

(constructor) VLIB_CLI_COMMAND (show_buffers_command)

Definition at line 1466 of file buffer.c.

vlib_main_t** vlib_mains

Definition at line 244 of file buffer.c.