40 #ifndef included_vlib_buffer_h 41 #define included_vlib_buffer_h 50 #include <rte_config.h> 51 #define VLIB_BUFFER_DATA_SIZE (2048) 52 #define VLIB_BUFFER_PRE_DATA_SIZE RTE_PKTMBUF_HEADROOM 54 #include <vlib/config.h> 55 #define VLIB_BUFFER_DATA_SIZE (512) 56 #define VLIB_BUFFER_PRE_DATA_SIZE __PRE_DATA_SIZE 59 #if defined (CLIB_HAVE_VEC128) || defined (__aarch64__) 95 #define VLIB_BUFFER_IS_TRACED (1 << 0) 96 #define VLIB_BUFFER_LOG2_NEXT_PRESENT (1) 97 #define VLIB_BUFFER_NEXT_PRESENT (1 << VLIB_BUFFER_LOG2_NEXT_PRESENT) 98 #define VLIB_BUFFER_IS_RECYCLED (1 << 2) 99 #define VLIB_BUFFER_TOTAL_LENGTH_VALID (1 << 3) 100 #define VLIB_BUFFER_REPL_FAIL (1 << 4) 101 #define VLIB_BUFFER_RECYCLE (1 << 5) 102 #define VLIB_BUFFER_FLOW_REPORT (1 << 6) 105 #define LOG2_VLIB_BUFFER_FLAG_USER(n) (32 - (n)) 106 #define VLIB_BUFFER_FLAG_USER(n) (1 << LOG2_VLIB_BUFFER_FLAG_USER(n)) 161 #define VLIB_BUFFER_HDR_SIZE (sizeof(vlib_buffer_t) - VLIB_BUFFER_PRE_DATA_SIZE) 170 #define vlib_prefetch_buffer_header(b,type) CLIB_PREFETCH (b, 64, type) 175 return (
void *) (b + 1) + buffer_bytes;
181 ASSERT (
sizeof (b[0]) % 64 == 0);
235 return (
void *) b->
opaque;
289 u32 * buffers,
u32 n_buffers);
304 u32 n_buffers,
u32 follow_buffer_next);
310 #define VLIB_BUFFER_DEFAULT_FREE_LIST_INDEX (0) 311 #define VLIB_BUFFER_DEFAULT_FREE_LIST_BYTES VLIB_BUFFER_DATA_SIZE 389 #define rte_mbuf_from_vlib_buffer(x) (((struct rte_mbuf *)x) - 1) 390 #define vlib_buffer_from_rte_mbuf(x) ((vlib_buffer_t *)(x+1)) 401 #define VLIB_BUFFER_TRACE_TRAJECTORY 0 403 #if VLIB_BUFFER_TRACE_TRAJECTORY > 0 404 #define VLIB_BUFFER_TRACE_TRAJECTORY_INIT(b) (b)->pre_data[0]=0 406 #define VLIB_BUFFER_TRACE_TRAJECTORY_INIT(b)
#define CLIB_CACHE_LINE_ALIGN_MARK(mark)
u32 max_n_data_bytes_per_chain
u32 current_config_index
Used by feature subgraph arcs to visit enabled feature nodes.
u32 free_list_index
Buffer free list that this buffer was allocated from and will be freed to.
static void vlib_buffer_struct_is_sane(vlib_buffer_t *b)
vlib_buffer_t buffer_init_template
struct vlib_serialize_buffer_main_t::@22::@24 tx
struct vlib_main_t * vlib_main
u32 serialize_close_vlib_buffer(serialize_main_t *m)
void ** buffer_memory_allocated
u32 recycle_count
Used by L2 path recycle code.
u32 min_n_buffers_each_physmem_alloc
void * vlib_set_buffer_free_callback(struct vlib_main_t *vm, void *fp)
static u32 serialize_vlib_buffer_n_bytes(serialize_main_t *m)
i16 current_data
signed offset in data[], pre_data[] that we are currently processing.
void(* buffer_init_function)(struct vlib_main_t *vm, struct vlib_buffer_free_list_t *fl, u32 *buffers, u32 n_buffers)
void unserialize_close_vlib_buffer(serialize_main_t *m)
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
u8 feature_arc_index
Used to identify feature arcs by intermediate feature node.
u8 pre_data[VLIB_BUFFER_PRE_DATA_SIZE]
Space for inserting data before buffer start.
vlib_buffer_free_list_t ** announce_list
#define VLIB_BUFFER_PRE_DATA_SIZE
u16 current_length
Nbytes between current data and the end of this buffer.
static void * vlib_get_buffer_opaque(vlib_buffer_t *b)
Get pointer to buffer's opaque data array.
uword ready_one_time_event
void serialize_open_vlib_buffer(serialize_main_t *m, struct vlib_main_t *vm, vlib_serialize_buffer_main_t *sm)
static void * vlib_get_buffer_opaque2(vlib_buffer_t *b)
Get pointer to buffer's opaque2 data array.
static void vlib_buffer_reset(vlib_buffer_t *b)
Reset current header & length to state they were in when packet was received.
vlib_error_t error
Error code for buffers to be enqueued to error handler.
#define uword_to_pointer(u, type)
struct rte_mempool ** pktmbuf_pools
serialize_stream_t stream
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
void(* buffers_added_to_freelist_function)(struct vlib_main_t *vm, struct vlib_buffer_free_list_t *fl)
uword data_function_opaque
u32 next_buffer
Next buffer for this linked-list of buffers.
void unserialize_open_vlib_buffer(serialize_main_t *m, struct vlib_main_t *vm, vlib_serialize_buffer_main_t *sm)
u32 total_length_not_including_first_buffer
Only valid for first buffer in chain.
static vlib_buffer_t * vlib_buffer_next_contiguous(vlib_buffer_t *b, u32 buffer_bytes)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
vlib_buffer_free_list_t * buffer_free_list_pool
uword * buffer_known_hash
u32 opaque[8]
Opaque data used by sub-graphs for their own purposes.
uword buffer_init_function_opaque
u32 flags
buffer flags: VLIB_BUFFER_IS_TRACED: trace this buffer.
u32 trace_index
Specifies index into trace buffer if VLIB_PACKET_IS_TRACED flag is set.
uword * free_list_by_size
u32 opaque2[14]
More opaque data, currently unused.