FD.io VPP  v21.10.1-2-g0a485f517
Vector Packet Processing
buffer.c File Reference
+ Include dependency graph for buffer.c:

Go to the source code of this file.

Macros

#define VLIB_BUFFER_DEFAULT_BUFFERS_PER_NUMA   16384
 
#define VLIB_BUFFER_DEFAULT_BUFFERS_PER_NUMA_UNPRIV   8192
 

Functions

 STATIC_ASSERT_OFFSET_OF (vlib_buffer_t, template_end, 64)
 
static void buffer_gauges_update_cached_fn (stat_segment_directory_entry_t *e, u32 index)
 
static void buffer_gauges_update_available_fn (stat_segment_directory_entry_t *e, u32 index)
 
static void buffer_gauges_update_used_fn (stat_segment_directory_entry_t *e, u32 index)
 
uword vlib_buffer_length_in_chain_slow_path (vlib_main_t *vm, vlib_buffer_t *b_first)
 
u8format_vlib_buffer_no_chain (u8 *s, va_list *args)
 
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)
 
void vlib_buffer_validate_alloc_free (vlib_main_t *vm, u32 *buffers, uword n_buffers, vlib_buffer_known_state_t expected_state)
 
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_alloc, char *fmt,...)
 
void * vlib_packet_template_get_packet (vlib_main_t *vm, vlib_packet_template_t *t, u32 *bi_result)
 
int vlib_buffer_add_data (vlib_main_t *vm, u32 *buffer_index, void *data, u32 n_data_bytes)
 
u16 vlib_buffer_chain_append_data_with_alloc (vlib_main_t *vm, vlib_buffer_t *first, vlib_buffer_t **last, void *data, u16 data_len)
 
static uword vlib_buffer_alloc_size (uword ext_hdr_size, uword data_size)
 
u8 vlib_buffer_pool_create (vlib_main_t *vm, char *name, u32 data_size, u32 physmem_map_index)
 
static u8format_vlib_buffer_pool (u8 *s, va_list *va)
 
u8format_vlib_buffer_pool_all (u8 *s, va_list *va)
 
static clib_error_tshow_buffers (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 
clib_error_tvlib_buffer_worker_init (vlib_main_t *vm)
 
 VLIB_WORKER_INIT_FUNCTION (vlib_buffer_worker_init)
 
static clib_error_tvlib_buffer_main_init_numa_alloc (struct vlib_main_t *vm, u32 numa_node, u32 *physmem_map_index, clib_mem_page_sz_t log2_page_size, u8 unpriv)
 
static clib_error_tvlib_buffer_main_init_numa_node (struct vlib_main_t *vm, u32 numa_node, u8 *index)
 
void vlib_buffer_main_alloc (vlib_main_t *vm)
 
static u32 buffer_get_cached (vlib_buffer_pool_t *bp)
 
static vlib_buffer_pool_tbuffer_get_by_index (vlib_buffer_main_t *bm, u32 index)
 
clib_error_tvlib_buffer_main_init (struct vlib_main_t *vm)
 
static clib_error_tvlib_buffers_configure (vlib_main_t *vm, unformat_input_t *input)
 
__clib_export int vlib_buffer_set_alloc_free_callback (vlib_main_t *vm, vlib_buffer_alloc_free_callback_t *alloc_callback_fn, vlib_buffer_alloc_free_callback_t *free_callback_fn)
 

Variables

static vlib_cli_command_t show_buffers_command
 (constructor) VLIB_CLI_COMMAND (show_buffers_command) More...
 

Detailed Description

Allocate/free network buffers.

Definition in file buffer.c.

Macro Definition Documentation

◆ VLIB_BUFFER_DEFAULT_BUFFERS_PER_NUMA

#define VLIB_BUFFER_DEFAULT_BUFFERS_PER_NUMA   16384

Definition at line 51 of file buffer.c.

◆ VLIB_BUFFER_DEFAULT_BUFFERS_PER_NUMA_UNPRIV

#define VLIB_BUFFER_DEFAULT_BUFFERS_PER_NUMA_UNPRIV   8192

Definition at line 52 of file buffer.c.

Function Documentation

◆ buffer_gauges_update_available_fn()

static void buffer_gauges_update_available_fn ( stat_segment_directory_entry_t e,
u32  index 
)
static

Definition at line 812 of file buffer.c.

+ Here is the call graph for this function:

◆ buffer_gauges_update_cached_fn()

static void buffer_gauges_update_cached_fn ( stat_segment_directory_entry_t e,
u32  index 
)
static

Definition at line 824 of file buffer.c.

+ Here is the call graph for this function:

◆ buffer_gauges_update_used_fn()

static void buffer_gauges_update_used_fn ( stat_segment_directory_entry_t e,
u32  index 
)
static

Definition at line 801 of file buffer.c.

+ Here is the call graph for this function:

◆ buffer_get_by_index()

static vlib_buffer_pool_t* buffer_get_by_index ( vlib_buffer_main_t bm,
u32  index 
)
static

Definition at line 790 of file buffer.c.

+ Here is the caller graph for this function:

◆ buffer_get_cached()

static u32 buffer_get_cached ( vlib_buffer_pool_t bp)
static

Definition at line 772 of file buffer.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ format_vlib_buffer()

u8* format_vlib_buffer ( u8 s,
va_list *  args 
)

Definition at line 125 of file buffer.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ format_vlib_buffer_and_data()

u8* format_vlib_buffer_and_data ( u8 s,
va_list *  args 
)

Definition at line 148 of file buffer.c.

+ Here is the call graph for this function:

◆ format_vlib_buffer_contents()

u8* format_vlib_buffer_contents ( u8 s,
va_list *  va 
)

Definition at line 188 of file buffer.c.

+ Here is the call graph for this function:

◆ format_vlib_buffer_known_state()

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

Definition at line 160 of file buffer.c.

+ Here is the caller graph for this function:

◆ format_vlib_buffer_no_chain()

u8* format_vlib_buffer_no_chain ( u8 s,
va_list *  args 
)

Definition at line 95 of file buffer.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ format_vlib_buffer_pool()

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

Definition at line 592 of file buffer.c.

+ Here is the caller graph for this function:

◆ format_vlib_buffer_pool_all()

u8* format_vlib_buffer_pool_all ( u8 s,
va_list *  va 
)

Definition at line 619 of file buffer.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ show_buffers()

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

Definition at line 634 of file buffer.c.

+ Here is the call graph for this function:

◆ STATIC_ASSERT_OFFSET_OF()

STATIC_ASSERT_OFFSET_OF ( vlib_buffer_t  ,
template_end  ,
64   
)
+ Here is the caller graph for this function:

◆ vlib_buffer_add_data()

int vlib_buffer_add_data ( vlib_main_t vm,
u32 buffer_index,
void *  data,
u32  n_data_bytes 
)

Definition at line 398 of file buffer.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vlib_buffer_alloc_size()

static uword vlib_buffer_alloc_size ( uword  ext_hdr_size,
uword  data_size 
)
static

Definition at line 485 of file buffer.c.

+ Here is the caller graph for this function:

◆ vlib_buffer_chain_append_data_with_alloc()

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

Definition at line 453 of file buffer.c.

+ Here is the call graph for this function:

◆ vlib_buffer_length_in_chain_slow_path()

uword vlib_buffer_length_in_chain_slow_path ( vlib_main_t vm,
vlib_buffer_t b_first 
)

Definition at line 78 of file buffer.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vlib_buffer_main_alloc()

void vlib_buffer_main_alloc ( vlib_main_t vm)

Definition at line 759 of file buffer.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vlib_buffer_main_init()

clib_error_t* vlib_buffer_main_init ( struct vlib_main_t vm)

Definition at line 835 of file buffer.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vlib_buffer_main_init_numa_alloc()

static clib_error_t* vlib_buffer_main_init_numa_alloc ( struct vlib_main_t vm,
u32  numa_node,
u32 physmem_map_index,
clib_mem_page_sz_t  log2_page_size,
u8  unpriv 
)
static

Definition at line 671 of file buffer.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vlib_buffer_main_init_numa_node()

static clib_error_t* vlib_buffer_main_init_numa_node ( struct vlib_main_t vm,
u32  numa_node,
u8 index 
)
static

Definition at line 708 of file buffer.c.

+ Here is the call graph for this function:

◆ vlib_buffer_pool_create()

u8 vlib_buffer_pool_create ( vlib_main_t vm,
char *  name,
u32  data_size,
u32  physmem_map_index 
)

Definition at line 498 of file buffer.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vlib_buffer_set_alloc_free_callback()

__clib_export int vlib_buffer_set_alloc_free_callback ( vlib_main_t vm,
vlib_buffer_alloc_free_callback_t alloc_callback_fn,
vlib_buffer_alloc_free_callback_t free_callback_fn 
)

Definition at line 981 of file buffer.c.

+ Here is the caller graph for this function:

◆ vlib_buffer_validate_alloc_free()

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

Definition at line 315 of file buffer.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vlib_buffer_worker_init()

clib_error_t* vlib_buffer_worker_init ( vlib_main_t vm)

Definition at line 650 of file buffer.c.

+ Here is the call graph for this function:

◆ vlib_buffers_configure()

static clib_error_t* vlib_buffers_configure ( vlib_main_t vm,
unformat_input_t input 
)
static

Definition at line 932 of file buffer.c.

+ Here is the call graph for this function:

◆ vlib_packet_template_get_packet()

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

Definition at line 377 of file buffer.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vlib_packet_template_init()

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_alloc,
char *  fmt,
  ... 
)

Definition at line 355 of file buffer.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vlib_validate_buffer()

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

Definition at line 254 of file buffer.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vlib_validate_buffer_helper()

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

Definition at line 205 of file buffer.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vlib_validate_buffers()

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ VLIB_WORKER_INIT_FUNCTION()

VLIB_WORKER_INIT_FUNCTION ( vlib_buffer_worker_init  )

Variable Documentation

◆ show_buffers_command

vlib_cli_command_t show_buffers_command
static
Initial value:
= {
.path = "show buffers",
.short_help = "Show packet buffer allocation",
.function = show_buffers,
}

(constructor) VLIB_CLI_COMMAND (show_buffers_command)

Definition at line 642 of file buffer.c.

show_buffers
static clib_error_t * show_buffers(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: buffer.c:634