40 #ifndef included_vlib_buffer_node_h 41 #define included_vlib_buffer_node_h 70 #define vlib_validate_buffer_enqueue_x2(vm,node,next_index,to_next,n_left_to_next,bi0,bi1,next0,next1) \ 72 int enqueue_code = (next0 != next_index) + 2*(next1 != next_index); \ 74 if (PREDICT_FALSE (enqueue_code != 0)) \ 76 switch (enqueue_code) \ 82 n_left_to_next += 1; \ 83 vlib_set_next_frame_buffer (vm, node, next0, bi0); \ 89 n_left_to_next += 1; \ 90 vlib_set_next_frame_buffer (vm, node, next1, bi1); \ 96 n_left_to_next += 2; \ 97 vlib_set_next_frame_buffer (vm, node, next0, bi0); \ 98 vlib_set_next_frame_buffer (vm, node, next1, bi1); \ 101 vlib_put_next_frame (vm, node, next_index, \ 103 next_index = next1; \ 104 vlib_get_next_frame (vm, node, next_index, to_next, n_left_to_next); \ 138 #define vlib_validate_buffer_enqueue_x4(vm,node,next_index,to_next,n_left_to_next,bi0,bi1,bi2,bi3,next0,next1,next2,next3) \ 141 u32 fix_speculation = next_index != next0 || next_index != next1 \ 142 || next_index != next2 || next_index != next3; \ 143 if (PREDICT_FALSE(fix_speculation)) \ 147 n_left_to_next += 4; \ 150 if (next_index == next0) \ 157 vlib_set_next_frame_buffer (vm, node, next0, bi0); \ 159 if (next_index == next1) \ 166 vlib_set_next_frame_buffer (vm, node, next1, bi1); \ 168 if (next_index == next2) \ 175 vlib_set_next_frame_buffer (vm, node, next2, bi2); \ 177 if (next_index == next3) \ 184 vlib_set_next_frame_buffer (vm, node, next3, bi3); \ 187 if (next2 == next3) \ 189 vlib_put_next_frame (vm, node, next_index, n_left_to_next); \ 190 next_index = next3; \ 191 vlib_get_next_frame (vm, node, next_index, to_next, n_left_to_next); \ 216 #define vlib_validate_buffer_enqueue_x1(vm,node,next_index,to_next,n_left_to_next,bi0,next0) \ 218 if (PREDICT_FALSE (next0 != next_index)) \ 220 vlib_put_next_frame (vm, node, next_index, n_left_to_next + 1); \ 221 next_index = next0; \ 222 vlib_get_next_frame (vm, node, next_index, to_next, n_left_to_next); \ 226 n_left_to_next -= 1; \ 242 u32 * next0,
u32 * next1),
244 void *opaque1,
uword opaque2,
248 u32 n_left_from, *from, *to_next;
259 while (n_left_from > 0)
265 while (n_left_from >= 4 && n_left_to_next >= 2)
285 pi0 = to_next[0] = from[0];
286 pi1 = to_next[1] = from[1];
295 two_buffers (vm, opaque1, opaque2, p0, p1, &next0, &next1);
298 to_next, n_left_to_next,
299 pi0, pi1, next0, next1);
302 while (n_left_from > 0 && n_left_to_next > 0)
316 one_buffer (vm, opaque1, opaque2, p0, &next0);
319 to_next, n_left_to_next,
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.
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
#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.
#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.
#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).
#define CLIB_PREFETCH(addr, size, type)
u16 cached_next_index
Next frame index that vector arguments were last enqueued to last time this node ran.
#define VLIB_NODE_FLAG_TRACE
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))
void vlib_trace_frame_buffers_only(vlib_main_t *vm, vlib_node_runtime_t *node, u32 *buffers, uword n_buffers, uword next_buffer_stride, uword n_buffer_data_bytes_in_trace)
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
u16 flags
Copy of main node flags.
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.