FD.io VPP
v21.01.1
Vector Packet Processing
|
vlib buffer structure definition and a few select access methods. More...
Go to the source code of this file.
Data Structures | |
union | vlib_buffer_t |
VLIB buffer representation. More... | |
struct | vlib_buffer_pool_thread_t |
struct | vlib_buffer_pool_t |
struct | vlib_buffer_main_t |
Enumerations | |
enum | { foreach_vlib_buffer_flag } |
enum | { foreach_vlib_buffer_flag } |
Functions | |
STATIC_ASSERT_SIZEOF (vlib_buffer_t, 128+VLIB_BUFFER_PRE_DATA_SIZE) | |
STATIC_ASSERT (VLIB_BUFFER_PRE_DATA_SIZE % CLIB_CACHE_LINE_BYTES==0, "VLIB_BUFFER_PRE_DATA_SIZE must be divisible by cache line size") | |
static void | vlib_buffer_struct_is_sane (vlib_buffer_t *b) |
static uword | vlib_buffer_get_va (vlib_buffer_t *b) |
static void * | vlib_buffer_get_current (vlib_buffer_t *b) |
Get pointer to current data to process. More... | |
static uword | vlib_buffer_get_current_va (vlib_buffer_t *b) |
static void | vlib_buffer_advance (vlib_buffer_t *b, word l) |
Advance current data pointer by the supplied (signed!) amount. More... | |
static u8 | vlib_buffer_has_space (vlib_buffer_t *b, word l) |
Check if there is enough space in buffer to advance. More... | |
static void | vlib_buffer_reset (vlib_buffer_t *b) |
Reset current header & length to state they were in when packet was received. More... | |
static void * | vlib_get_buffer_opaque (vlib_buffer_t *b) |
Get pointer to buffer's opaque data array. More... | |
static void * | vlib_get_buffer_opaque2 (vlib_buffer_t *b) |
Get pointer to buffer's opaque2 data array. More... | |
static u8 * | vlib_buffer_get_tail (vlib_buffer_t *b) |
Get pointer to the end of buffer's data. More... | |
static void * | vlib_buffer_put_uninit (vlib_buffer_t *b, u16 size) |
Append uninitialized data to buffer. More... | |
static void * | vlib_buffer_push_uninit (vlib_buffer_t *b, u8 size) |
Prepend uninitialized data to buffer. More... | |
static void * | vlib_buffer_make_headroom (vlib_buffer_t *b, u8 size) |
Make head room, typically for packet headers. More... | |
static u32 | vlib_buffer_make_trace_handle (u32 thread, u32 pool_index) |
Construct a trace handle from thread and pool index. More... | |
static u32 | vlib_buffer_get_trace_thread (vlib_buffer_t *b) |
Extract the thread id from a trace handle. More... | |
static u32 | vlib_buffer_get_trace_index (vlib_buffer_t *b) |
Extract the trace (pool) index from a trace handle. More... | |
static void * | vlib_buffer_pull (vlib_buffer_t *b, u8 size) |
Retrieve bytes from buffer head. More... | |
clib_error_t * | vlib_buffer_main_init (struct vlib_main_t *vm) |
vlib buffer structure definition and a few select access methods.
This structure and the buffer allocation mechanism should perhaps live in vnet, but it would take a lot of typing to make it so.
Definition in file buffer.h.
foreach_vlib_buffer_flag |
#define VLIB_BUFFER_FLAG_USER | ( | n | ) | (1 << LOG2_VLIB_BUFFER_FLAG_USER(n)) |
#define VLIB_BUFFER_HDR_SIZE (sizeof(vlib_buffer_t) - VLIB_BUFFER_PRE_DATA_SIZE) |
#define VLIB_BUFFER_SET_EXT_HDR_SIZE | ( | x | ) |
#define VLIB_BUFFER_TRACE_TRAJECTORY 0 |
#define vlib_prefetch_buffer_data | ( | b, | |
type | |||
) | CLIB_PREFETCH (vlib_buffer_get_current(b), CLIB_CACHE_LINE_BYTES, type) |
#define vlib_prefetch_buffer_header | ( | b, | |
type | |||
) | CLIB_PREFETCH (b, 64, type) |
Prefetch buffer metadata.
The first 64 bytes of buffer contains most header information
b | - (vlib_buffer_t *) pointer to the buffer |
type | - LOAD, STORE. In most cases, STORE is the right answer |
STATIC_ASSERT | ( | VLIB_BUFFER_PRE_DATA_SIZE % | CLIB_CACHE_LINE_BYTES = =0 , |
"VLIB_BUFFER_PRE_DATA_SIZE must be divisible by cache line size" | |||
) |
STATIC_ASSERT_SIZEOF | ( | vlib_buffer_t | , |
128+ | VLIB_BUFFER_PRE_DATA_SIZE | ||
) |
|
inlinestatic |
Advance current data pointer by the supplied (signed!) amount.
b | - (vlib_buffer_t *) pointer to the buffer |
l | - (word) signed increment |
|
inlinestatic |
Get pointer to current data to process.
b | - (vlib_buffer_t *) pointer to the buffer |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
Check if there is enough space in buffer to advance.
b | - (vlib_buffer_t *) pointer to the buffer |
l | - (word) size to check |
Definition at line 269 of file buffer.h.
clib_error_t* vlib_buffer_main_init | ( | struct vlib_main_t * | vm | ) |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
Reset current header & length to state they were in when packet was received.
b | - (vlib_buffer_t *) pointer to the buffer |
Definition at line 281 of file buffer.h.
|
inlinestatic |
|
inlinestatic |
Get pointer to buffer's opaque data array.
b | - (vlib_buffer_t *) pointer to the buffer |
|
inlinestatic |
Get pointer to buffer's opaque2 data array.
b | - (vlib_buffer_t *) pointer to the buffer |