73 u32 n_left_from, next_index, * from, * to_next;
87 while (n_left_from > 0)
92 to_next, n_left_to_next);
94 while (n_left_from >= 4 && n_left_to_next >= 2)
100 u8 next0, next1, is_ethernet0, is_ethernet1, len0, len1, enqueue_code;
135 is_ethernet0 = oui0 == IEEE_OUI_ethernet;
136 is_ethernet1 = oui1 == IEEE_OUI_ethernet;
138 len0 =
sizeof (h0[0]) - (is_ethernet0 ?
sizeof (h0->protocol) : 0);
139 len1 =
sizeof (h1[0]) - (is_ethernet1 ?
sizeof (h1->protocol) : 0);
157 b0->
error = node->
errors[SNAP_ERROR_UNKNOWN_PROTOCOL];
158 b1->
error = node->
errors[SNAP_ERROR_UNKNOWN_PROTOCOL];
160 enqueue_code = (next0 != next_index) + 2*(next1 != next_index);
164 switch (enqueue_code)
198 while (n_left_from > 0 && n_left_to_next > 0)
204 u8 next0, is_ethernet0, len0;
220 is_ethernet0 = oui0 == IEEE_OUI_ethernet;
222 len0 =
sizeof (h0[0]) - (is_ethernet0 ?
sizeof (h0->protocol) : 0);
235 b0->
error = node->
errors[SNAP_ERROR_UNKNOWN_PROTOCOL];
246 to_next, n_left_to_next);
268 .name =
"snap-input",
270 .vector_size =
sizeof (
u32),
322 h.protocol = clib_host_to_net_u16 (protocol);
323 h.oui[0] = (ieee_oui >> 16) & 0xff;
324 h.oui[1] = (ieee_oui >> 8) & 0xff;
325 h.oui[2] = (ieee_oui >> 0) & 0xff;
339 key.
protocol = clib_host_to_net_u16 (protocol);
void vlib_put_next_frame(vlib_main_t *vm, vlib_node_runtime_t *r, u32 next_index, u32 n_vectors_left)
always_inline snap_protocol_info_t * snap_get_protocol_info(snap_main_t *sm, snap_header_t *h)
vlib_node_registration_t snap_input_node
(constructor) VLIB_REGISTER_NODE (snap_input_node)
static uword snap_input(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
static char * snap_error_strings[]
always_inline uword mhash_set(mhash_t *h, void *key, uword new_value, uword *old_value)
#define vec_add2(V, P, N)
Add N elements to end of vector V, return pointer to new elements in P.
#define foreach_snap_error
#define hash_set_mem(h, key, value)
#define clib_error_report(e)
format_function_t format_snap_header
static u8 * format_snap_input_trace(u8 *s, va_list *va)
i16 current_data
signed offset in data[], pre_data[] that we are currently processing.
#define VLIB_INIT_FUNCTION(x)
void llc_register_input_protocol(vlib_main_t *vm, llc_protocol_t protocol, u32 node_index)
#define vlib_call_init_function(vm, x)
always_inline void * vlib_frame_vector_args(vlib_frame_t *f)
u16 current_length
Nbytes between current data and the end of this buffer.
format_function_t format_snap_header_with_length
#define vlib_get_next_frame(vm, node, next_index, vectors, n_vectors_left)
vlib_error_t error
Error code for buffers to be enqueued to error handler.
#define CLIB_PREFETCH(addr, size, type)
uword * protocol_info_by_name
always_inline u32 snap_header_get_oui(snap_header_t *h)
unformat_function_t unformat_snap_header
#define VLIB_NODE_FLAG_TRACE
always_inline uword vlib_node_add_next(vlib_main_t *vm, uword node, uword next_node)
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)
always_inline void vlib_set_next_frame_buffer(vlib_main_t *vm, vlib_node_runtime_t *node, u32 next_index, u32 buffer_index)
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
#define VLIB_REGISTER_NODE(x,...)
always_inline void snap_setup_node(vlib_main_t *vm, u32 node_index)
snap_protocol_info_t * protocols
static clib_error_t * snap_input_init(vlib_main_t *vm)
always_inline vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
static clib_error_t * snap_init(vlib_main_t *vm)
void snap_register_input_protocol(vlib_main_t *vm, char *name, u32 ieee_oui, u16 protocol, u32 node_index)