75 u32 n_left_from, next_index, *from, *to_next;
89 while (n_left_from > 0)
95 while (n_left_from >= 4 && n_left_to_next >= 2)
101 u8 next0, next1, is_ethernet0, is_ethernet1, len0, len1,
137 is_ethernet0 = oui0 == IEEE_OUI_ethernet;
138 is_ethernet1 = oui1 == IEEE_OUI_ethernet;
140 len0 =
sizeof (h0[0]) - (is_ethernet0 ?
sizeof (h0->protocol) : 0);
141 len1 =
sizeof (h1[0]) - (is_ethernet1 ?
sizeof (h1->protocol) : 0);
159 b0->
error = node->
errors[SNAP_ERROR_UNKNOWN_PROTOCOL];
160 b1->
error = node->
errors[SNAP_ERROR_UNKNOWN_PROTOCOL];
162 enqueue_code = (next0 != next_index) + 2 * (next1 != next_index);
166 switch (enqueue_code)
201 while (n_left_from > 0 && n_left_to_next > 0)
207 u8 next0, is_ethernet0, len0;
223 is_ethernet0 = oui0 == IEEE_OUI_ethernet;
225 len0 =
sizeof (h0[0]) - (is_ethernet0 ?
sizeof (h0->protocol) : 0);
238 b0->
error = node->
errors[SNAP_ERROR_UNKNOWN_PROTOCOL];
249 to_next, n_left_to_next);
272 .name =
"snap-input",
274 .vector_size =
sizeof (
u32),
326 h.protocol = clib_host_to_net_u16 (protocol);
327 h.oui[0] = (ieee_oui >> 16) & 0xff;
328 h.oui[1] = (ieee_oui >> 8) & 0xff;
329 h.oui[2] = (ieee_oui >> 0) & 0xff;
341 key.
protocol = clib_host_to_net_u16 (protocol);
static void snap_setup_node(vlib_main_t *vm, u32 node_index)
static void vlib_set_next_frame_buffer(vlib_main_t *vm, vlib_node_runtime_t *node, u32 next_index, u32 buffer_index)
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.
u16 current_length
Nbytes between current data and the end of this buffer.
#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)
void llc_register_input_protocol(vlib_main_t *vm, llc_protocol_t protocol, u32 node_index)
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)
format_function_t format_snap_header
#define VLIB_INIT_FUNCTION(x)
static clib_error_t * snap_input_init(vlib_main_t *vm)
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
static char * snap_error_strings[]
#define vlib_call_init_function(vm, x)
vlib_error_t error
Error code for buffers to be enqueued to error handler.
format_function_t format_snap_header_with_length
static uword mhash_set(mhash_t *h, void *key, uword new_value, uword *old_value)
#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 VLIB_REGISTER_NODE(x,...)
#define CLIB_PREFETCH(addr, size, type)
static snap_protocol_info_t * snap_get_protocol_info(snap_main_t *sm, snap_header_t *h)
uword * protocol_info_by_name
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.
static u32 snap_header_get_oui(snap_header_t *h)
u16 cached_next_index
Next frame index that vector arguments were last enqueued to last time this node ran.
vlib_node_registration_t snap_input_node
(constructor) VLIB_REGISTER_NODE (snap_input_node)
#define clib_error_report(e)
unformat_function_t unformat_snap_header
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)
VLIB buffer representation.
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
static uword snap_input(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
u16 flags
Copy of main node flags.
#define VLIB_NODE_FLAG_TRACE
snap_protocol_info_t * protocols
static clib_error_t * snap_init(vlib_main_t *vm)
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
void snap_register_input_protocol(vlib_main_t *vm, char *name, u32 ieee_oui, u16 protocol, u32 node_index)