FD.io VPP  v18.07-rc0-415-g6c78436
Vector Packet Processing
buffer_node.h File Reference

vlib buffer/node functions More...

+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define vlib_validate_buffer_enqueue_x2(vm, node, next_index, to_next, n_left_to_next, bi0, bi1, next0, next1)
 Finish enqueueing two buffers forward in the graph. More...
 
#define vlib_validate_buffer_enqueue_x4(vm, node, next_index, to_next, n_left_to_next, bi0, bi1, bi2, bi3, next0, next1, next2, next3)
 Finish enqueueing four buffers forward in the graph. More...
 
#define vlib_validate_buffer_enqueue_x1(vm, node, next_index, to_next, n_left_to_next, bi0, next0)
 Finish enqueueing one buffer forward in the graph. More...
 

Functions

static uword generic_buffer_node_inline (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, uword sizeof_trace, void *opaque1, uword opaque2, void(*two_buffers)(vlib_main_t *vm, void *opaque1, uword opaque2, vlib_buffer_t *b0, vlib_buffer_t *b1, u32 *next0, u32 *next1), void(*one_buffer)(vlib_main_t *vm, void *opaque1, uword opaque2, vlib_buffer_t *b0, u32 *next0))
 
static_always_inline void vlib_buffer_enqueue_to_next (vlib_main_t *vm, vlib_node_runtime_t *node, u32 *buffers, u16 *nexts, uword count)
 

Detailed Description

vlib buffer/node functions

Definition in file buffer_node.h.

Macro Definition Documentation

#define vlib_validate_buffer_enqueue_x1 (   vm,
  node,
  next_index,
  to_next,
  n_left_to_next,
  bi0,
  next0 
)
Value:
do { \
if (PREDICT_FALSE (next0 != next_index)) \
{ \
vlib_put_next_frame (vm, node, next_index, n_left_to_next + 1); \
next_index = next0; \
vlib_get_next_frame (vm, node, next_index, to_next, n_left_to_next); \
\
to_next[0] = bi0; \
to_next += 1; \
n_left_to_next -= 1; \
} \
} while (0)
#define PREDICT_FALSE(x)
Definition: clib.h:105
#define vlib_get_next_frame(vm, node, next_index, vectors, n_vectors_left)
Get pointer to next frame vector data by (vlib_node_runtime_t, next_index).
Definition: node_funcs.h:364
vlib_main_t * vm
Definition: buffer.c:294
void vlib_put_next_frame(vlib_main_t *vm, vlib_node_runtime_t *r, u32 next_index, u32 n_vectors_left)
Release pointer to next frame vector data.
Definition: main.c:454

Finish enqueueing one buffer forward in the graph.

Standard single loop boilerplate element. This is a MACRO, with MULTIPLE SIDE EFFECTS. In the ideal case, next_index == next0, which means that the speculative enqueue at the top of the single loop has correctly dealt with the packet in hand. In that case, the macro does nothing at all.

Parameters
vmvlib_main_t pointer, varies by thread
nodecurrent node vlib_node_runtime_t pointer
next_indexspeculated next index used for both packets
to_nextspeculated vector pointer used for both packets
n_left_to_nextnumber of slots left in speculated vector
bi0first buffer index
next0actual next index to be used for the first packet
Returns
next_index – speculative next index to be used for future packets
to_next – speculative frame to be used for future packets
n_left_to_next – number of slots left in speculative frame

Definition at line 218 of file buffer_node.h.

#define vlib_validate_buffer_enqueue_x2 (   vm,
  node,
  next_index,
  to_next,
  n_left_to_next,
  bi0,
  bi1,
  next0,
  next1 
)
Value:
do { \
int enqueue_code = (next0 != next_index) + 2*(next1 != next_index); \
\
if (PREDICT_FALSE (enqueue_code != 0)) \
{ \
switch (enqueue_code) \
{ \
case 1: \
/* A B A */ \
to_next[-2] = bi1; \
to_next -= 1; \
n_left_to_next += 1; \
vlib_set_next_frame_buffer (vm, node, next0, bi0); \
break; \
\
case 2: \
/* A A B */ \
to_next -= 1; \
n_left_to_next += 1; \
vlib_set_next_frame_buffer (vm, node, next1, bi1); \
break; \
\
case 3: \
/* A B B or A B C */ \
to_next -= 2; \
n_left_to_next += 2; \
vlib_set_next_frame_buffer (vm, node, next0, bi0); \
vlib_set_next_frame_buffer (vm, node, next1, bi1); \
if (next0 == next1) \
{ \
vlib_put_next_frame (vm, node, next_index, \
n_left_to_next); \
next_index = next1; \
vlib_get_next_frame (vm, node, next_index, to_next, n_left_to_next); \
} \
} \
} \
} while (0)
static void vlib_set_next_frame_buffer(vlib_main_t *vm, vlib_node_runtime_t *node, u32 next_index, u32 buffer_index)
Definition: node_funcs.h:397
#define PREDICT_FALSE(x)
Definition: clib.h:105
#define vlib_get_next_frame(vm, node, next_index, vectors, n_vectors_left)
Get pointer to next frame vector data by (vlib_node_runtime_t, next_index).
Definition: node_funcs.h:364
vlib_main_t * vm
Definition: buffer.c:294
void vlib_put_next_frame(vlib_main_t *vm, vlib_node_runtime_t *r, u32 next_index, u32 n_vectors_left)
Release pointer to next frame vector data.
Definition: main.c:454

Finish enqueueing two buffers forward in the graph.

Standard dual loop boilerplate element. This is a MACRO, with MULTIPLE SIDE EFFECTS. In the ideal case, next_index == next0 == next1, which means that the speculative enqueue at the top of the dual loop has correctly dealt with both packets. In that case, the macro does nothing at all.

Parameters
vmvlib_main_t pointer, varies by thread
nodecurrent node vlib_node_runtime_t pointer
next_indexspeculated next index used for both packets
to_nextspeculated vector pointer used for both packets
n_left_to_nextnumber of slots left in speculated vector
bi0first buffer index
bi1second buffer index
next0actual next index to be used for the first packet
next1actual next index to be used for the second packet
Returns
next_index – speculative next index to be used for future packets
to_next – speculative frame to be used for future packets
n_left_to_next – number of slots left in speculative frame

Definition at line 70 of file buffer_node.h.

#define vlib_validate_buffer_enqueue_x4 (   vm,
  node,
  next_index,
  to_next,
  n_left_to_next,
  bi0,
  bi1,
  bi2,
  bi3,
  next0,
  next1,
  next2,
  next3 
)

Finish enqueueing four buffers forward in the graph.

Standard quad loop boilerplate element. This is a MACRO, with MULTIPLE SIDE EFFECTS. In the ideal case, next_index == next0 == next1 == next2 == next3, which means that the speculative enqueue at the top of the quad loop has correctly dealt with all four packets. In that case, the macro does nothing at all.

Parameters
vmvlib_main_t pointer, varies by thread
nodecurrent node vlib_node_runtime_t pointer
next_indexspeculated next index used for both packets
to_nextspeculated vector pointer used for both packets
n_left_to_nextnumber of slots left in speculated vector
bi0first buffer index
bi1second buffer index
bi2third buffer index
bi3fourth buffer index
next0actual next index to be used for the first packet
next1actual next index to be used for the second packet
next2actual next index to be used for the third packet
next3actual next index to be used for the fourth packet
Returns
next_index – speculative next index to be used for future packets
to_next – speculative frame to be used for future packets
n_left_to_next – number of slots left in speculative frame

Definition at line 138 of file buffer_node.h.

Function Documentation

static uword generic_buffer_node_inline ( vlib_main_t vm,
vlib_node_runtime_t node,
vlib_frame_t frame,
uword  sizeof_trace,
void *  opaque1,
uword  opaque2,
void(*)(vlib_main_t *vm, void *opaque1, uword opaque2, vlib_buffer_t *b0, vlib_buffer_t *b1, u32 *next0, u32 *next1)  two_buffers,
void(*)(vlib_main_t *vm, void *opaque1, uword opaque2, vlib_buffer_t *b0, u32 *next0)  one_buffer 
)
inlinestatic

Definition at line 233 of file buffer_node.h.

+ Here is the call graph for this function:

static_always_inline void vlib_buffer_enqueue_to_next ( vlib_main_t vm,
vlib_node_runtime_t node,
u32 buffers,
u16 nexts,
uword  count 
)

Definition at line 332 of file buffer_node.h.

+ Here is the call graph for this function:

+ Here is the caller graph for this function: