45 #define foreach_hdlc_input_next \ 46 _ (PUNT, "error-punt") \ 47 _ (DROP, "error-drop") 51 #define _(s,n) HDLC_INPUT_NEXT_##s, 88 u32 n_left_from, next_index, i_next, *from, *to_next;
103 while (n_left_from > 0)
109 while (n_left_from >= 4 && n_left_to_next >= 2)
114 u32 i0, i1, len0, len1, protocol0, protocol1, enqueue_code;
149 len0 =
sizeof (h0[0]);
150 len1 =
sizeof (h1[0]);
152 len0 += protocol0 == clib_host_to_net_u16 (HDLC_PROTOCOL_osi);
153 len1 += protocol1 == clib_host_to_net_u16 (HDLC_PROTOCOL_osi);
165 HDLC_ERROR_UNKNOWN_PROTOCOL : HDLC_ERROR_NONE];
169 HDLC_ERROR_UNKNOWN_PROTOCOL : HDLC_ERROR_NONE];
171 enqueue_code = (i0 != i_next) + 2 * (i1 != i_next);
175 switch (enqueue_code)
219 while (n_left_from > 0 && n_left_to_next > 0)
224 u32 i0, len0, protocol0;
240 len0 =
sizeof (h0[0]);
241 len0 += protocol0 == clib_host_to_net_u16 (HDLC_PROTOCOL_osi);
250 HDLC_ERROR_UNKNOWN_PROTOCOL : HDLC_ERROR_NONE];
262 to_next, n_left_to_next);
277 #define hdlc_error(n,s) s, 285 .name =
"hdlc-input",
287 .vector_size =
sizeof (
u32),
296 #define _(s,n) [HDLC_INPUT_NEXT_##s] = n, 370 clib_host_to_net_u16 (protocol));
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
static hdlc_protocol_info_t * hdlc_get_protocol_info(hdlc_main_t *em, hdlc_protocol_t protocol)
u8 runtime_data[0]
Function dependent node-runtime data.
static void vlib_set_next_frame_buffer(vlib_main_t *vm, vlib_node_runtime_t *node, u32 next_index, u32 buffer_index)
vl_api_ip_proto_t protocol
static clib_error_t * hdlc_input_runtime_init(vlib_main_t *vm)
format_function_t format_hdlc_header_with_length
vlib_error_t * errors
Vector of errors for this node.
static uword vlib_node_add_next(vlib_main_t *vm, uword node, uword next_node)
static u8 * format_hdlc_input_trace(u8 *s, va_list *va)
static clib_error_t * hdlc_input_init(vlib_main_t *vm)
static void hdlc_setup_node(vlib_main_t *vm, u32 node_index)
static char * hdlc_error_strings[]
#define VLIB_INIT_FUNCTION(x)
#define foreach_hdlc_input_next
description fragment has unexpected format
#define sparse_vec_validate(v, i)
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
static clib_error_t * hdlc_init(vlib_main_t *vm)
static void sparse_vec_index2(void *v, u32 si0, u32 si1, u32 *i0_return, u32 *i1_return)
#define vlib_call_init_function(vm, x)
vlib_node_registration_t hdlc_input_node
(constructor) VLIB_REGISTER_NODE (hdlc_input_node)
vlib_error_t error
Error code for buffers to be enqueued to error handler.
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
static void * vlib_node_get_runtime_data(vlib_main_t *vm, u32 node_index)
Get node runtime private data by node index.
#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).
unformat_function_t unformat_hdlc_header
#define VLIB_REGISTER_NODE(x,...)
#define CLIB_PREFETCH(addr, size, type)
sll srl srl sll sra u16x4 i
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.
vlib_main_t vlib_node_runtime_t * node
static uword sparse_vec_index(void *v, uword sparse_index)
u16 cached_next_index
Next frame index that vector arguments were last enqueued to last time this node ran.
#define clib_error_report(e)
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
#define vec_elt(v, i)
Get vector value at index i.
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)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
VLIB buffer representation.
VLIB_WORKER_INIT_FUNCTION(hdlc_input_runtime_init)
static uword hdlc_input(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
void hdlc_register_input_protocol(vlib_main_t *vm, hdlc_protocol_t protocol, u32 node_index)
u16 flags
Copy of main node flags.
format_function_t format_hdlc_header
#define VLIB_NODE_FLAG_TRACE
static void * sparse_vec_new(uword elt_bytes, uword sparse_index_bits)
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
#define SPARSE_VEC_INVALID_INDEX