43 #define foreach_handoffdemo_error \ 44 _(HANDED_OFF, "packets handed off processed") \ 45 _(CONGESTION_DROP, "handoff queue congestion drops") \ 46 _(COMPLETE, "completed packets") 50 #define _(sym,str) HANDOFFDEMO_ERROR_##sym, 57 #define _(sym,string) string, 71 int which,
int is_trace)
74 u32 n_left_from, *from;
75 u32 error0 = node->
errors[HANDOFFDEMO_ERROR_COMPLETE];
95 thread_indices[
i] = 2;
97 if (is_trace && (b[0]->
flags & VLIB_BUFFER_IS_TRACED))
114 if (n_enq < frame->n_vectors)
116 HANDOFFDEMO_ERROR_CONGESTION_DROP,
119 HANDOFFDEMO_ERROR_HANDED_OFF, n_enq);
133 while (n_left_from > 0)
135 if (is_trace && (b[0]->
flags & VLIB_BUFFER_IS_TRACED))
143 b[0]->
error = error0;
171 .name =
"handoffdemo-1",
173 .vector_size =
sizeof (
u32),
204 .name =
"handoffdemo-2",
206 .vector_size =
sizeof (
u32),
vlib_node_registration_t handoffdemo_node
u32 vlib_frame_queue_main_init(u32 node_index, u32 frame_queue_nelts)
static clib_error_t * handoffdemo_node_init(vlib_main_t *vm)
vlib_error_t * errors
Vector of errors for this node.
#define VLIB_INIT_FUNCTION(x)
static uword handoffdemo_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, int which, int is_trace)
static u8 * format_handoffdemo_trace(u8 *s, va_list *args)
vlib_node_registration_t handoffdemo_node_2
(constructor) VLIB_REGISTER_NODE (handoffdemo_node_2)
vl_api_fib_path_type_t type
vlib_error_t error
Error code for buffers to be enqueued to error handler.
u32 node_index
Node index.
static void vlib_node_increment_counter(vlib_main_t *vm, u32 node_index, u32 counter_index, u64 increment)
#define VLIB_REGISTER_NODE(x,...)
static_always_inline void vlib_buffer_enqueue_to_next(vlib_main_t *vm, vlib_node_runtime_t *node, u32 *buffers, u16 *nexts, uword count)
static uword handoffdemo_node_1_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
handoffdemo_main_t handoffdemo_main
vlib_node_registration_t handoffdemo_node_1
(constructor) VLIB_REGISTER_NODE (handoffdemo_node_1)
static char * handoffdemo_error_strings[]
static void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
struct _vlib_node_registration vlib_node_registration_t
VLIB buffer representation.
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
static_always_inline u32 vlib_buffer_enqueue_to_thread(vlib_main_t *vm, u32 frame_queue_index, u32 *buffer_indices, u16 *thread_indices, u32 n_packets, int drop_on_congestion)
u16 flags
Copy of main node flags.
#define foreach_handoffdemo_error
static_always_inline void vlib_get_buffers(vlib_main_t *vm, u32 *bi, vlib_buffer_t **b, int count)
Translate array of buffer indices into buffer pointers.
#define VLIB_NODE_FLAG_TRACE
uword handoffdemo_node_2_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)