32 #define _(sym,name) name, 46 static char *display_names[] = {
47 #define _(sym,name) #sym, 51 u32 feature_bitmap = va_arg (*args,
u32);
53 if (feature_bitmap == 0)
55 s =
format (s,
" none configured");
61 if (feature_bitmap & (1 << i))
85 s =
format (s,
"l2-output: sw_if_index %d dst %U src %U data " 86 "%02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x",
99 #define _(sym,string) string, 127 u32 * cached_sw_if_index,
u32 * cached_next_index,
128 u32 sw_if_index,
u32 feature_bitmap,
u32 * next0)
137 if (
PREDICT_FALSE ((feature_bitmap & ~L2OUTPUT_FEAT_OUTPUT) != 0))
140 vnet_buffer (b0)->l2.feature_bitmap = feature_bitmap;
155 if (sw_if_index == *cached_sw_if_index)
158 *next0 = *cached_next_index;
166 b0->
error = node->
errors[L2OUTPUT_ERROR_MAPPING_DROP];
169 *cached_sw_if_index = sw_if_index;
170 *cached_next_index = *next0;
190 u32 failed1 = (feature_bitmap & L2OUTPUT_FEAT_EFP_FILTER)
225 u32 n_left_from, *from, *to_next;
228 u32 cached_sw_if_index;
229 u32 cached_next_index;
232 cached_sw_if_index = ~0;
233 cached_next_index = ~0;
239 while (n_left_from > 0)
246 while (n_left_from >= 8 && n_left_to_next >= 4)
248 u32 bi0, bi1, bi2, bi3;
250 u32 next0, next1, next2, next3;
251 u32 sw_if_index0, sw_if_index1, sw_if_index2, sw_if_index3;
254 u32 feature_bitmap0, feature_bitmap1;
255 u32 feature_bitmap2, feature_bitmap3;
275 to_next[0] = bi0 = from[0];
276 to_next[1] = bi1 = from[1];
277 to_next[2] = bi2 = from[2];
278 to_next[3] = bi3 = from[3];
296 L2OUTPUT_ERROR_L2OUTPUT, 4);
315 &cached_next_index, sw_if_index0,
316 feature_bitmap0, &next0);
318 &cached_next_index, sw_if_index1,
319 feature_bitmap1, &next1);
321 &cached_next_index, sw_if_index2,
322 feature_bitmap2, &next2);
324 &cached_next_index, sw_if_index3,
325 feature_bitmap3, &next3);
327 l2output_vtr (node, config0, feature_bitmap0, b0, &next0);
328 l2output_vtr (node, config1, feature_bitmap1, b1, &next1);
329 l2output_vtr (node, config2, feature_bitmap2, b2, &next2);
330 l2output_vtr (node, config3, feature_bitmap3, b3, &next3);
338 if (b0->
flags & VLIB_BUFFER_IS_TRACED)
347 if (b1->
flags & VLIB_BUFFER_IS_TRACED)
356 if (b2->
flags & VLIB_BUFFER_IS_TRACED)
365 if (b3->
flags & VLIB_BUFFER_IS_TRACED)
381 config2->
shg + config3->
shg))
413 to_next, n_left_to_next,
415 next0, next1, next2, next3);
418 while (n_left_from > 0 && n_left_to_next > 0)
441 L2OUTPUT_ERROR_L2OUTPUT, 1);
454 &cached_next_index, sw_if_index0,
455 feature_bitmap0, &next0);
457 l2output_vtr (node, config0, feature_bitmap0, b0, &next0);
481 to_next, n_left_to_next,
504 .vector_size =
sizeof (
u32),
524 #define foreach_l2output_bad_intf_error \ 525 _(DROP, "L2 output to interface not in L2 mode or deleted") 528 #define _(sym,string) string, 535 #define _(sym,str) L2OUTPUT_BAD_INTF_ERROR_##sym, 559 u32 n_left_from, *from, *to_next;
565 while (n_left_from > 0)
572 while (n_left_from >= 4 && n_left_to_next >= 2)
577 to_next[0] = bi0 = from[0];
578 to_next[1] = bi1 = from[1];
585 b0->
error = node->
errors[L2OUTPUT_BAD_INTF_ERROR_DROP];
586 b1->
error = node->
errors[L2OUTPUT_BAD_INTF_ERROR_DROP];
589 while (n_left_from > 0 && n_left_to_next > 0)
601 b0->
error = node->
errors[L2OUTPUT_BAD_INTF_ERROR_DROP];
613 .name =
"l2-output-bad-intf",
614 .vector_size =
sizeof (
u32),
l2output_bad_intf_error_t
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
#define foreach_l2output_error
char ** l2output_get_feat_names(void)
vnet_main_t * vnet_get_main(void)
static vnet_hw_interface_t * vnet_get_sup_hw_interface(vnet_main_t *vnm, u32 sw_if_index)
u8 * format_l2_output_features(u8 *s, va_list *args)
vlib_node_registration_t l2output_node
(constructor) VLIB_REGISTER_NODE (l2output_node)
static uword l2output_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
#define vlib_validate_buffer_enqueue_x4(vm, node, next_index, to_next, n_left_to_next, bi0, bi1, bi2, bi3, next0, next1, next2, next3)
Finish enqueueing four buffers forward in the graph.
static u32 l2_pbb_process(vlib_buffer_t *b0, ptr_config_t *config)
u32 * output_node_index_vec
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 clib_error_t * l2output_init(vlib_main_t *vm)
void l2output_create_output_node_mapping(vlib_main_t *vlib_main, vnet_main_t *vnet_main, u32 sw_if_index)
Create a mapping in the next node mapping table for the given sw_if_index.
static_always_inline u32 split_horizon_violation(u8 shg1, u8 shg2)
Check for split horizon violations.
#define static_always_inline
u8 * format_ethernet_address(u8 *s, va_list *args)
#define VLIB_INIT_FUNCTION(x)
ptr_config_t output_pbb_vtr
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
void l2output_intf_bitmap_enable(u32 sw_if_index, u32 feature_bitmap, u32 enable)
Enable (or disable) the feature in the bitmap for the given interface.
static_always_inline uword l2output_node_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, int do_trace)
static_always_inline void l2_output_dispatch(vlib_buffer_t *b0, vlib_node_runtime_t *node, u32 *cached_sw_if_index, u32 *cached_next_index, u32 sw_if_index, u32 feature_bitmap, u32 *next0)
Determine the next L2 node based on the output feature bitmap.
static u32 l2_vtr_process(vlib_buffer_t *b0, vtr_config_t *config)
Perform the configured tag rewrite on the packet.
l2_output_config_t * l2output_intf_config(u32 sw_if_index)
Get a pointer to the config for the given interface.
static uword l2output_bad_intf_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
#define foreach_l2output_bad_intf_error
l2output_main_t l2output_main
static u32 feat_bitmap_get_next_node_index(u32 *next_nodes, u32 bitmap)
Return the graph node index for the feature corresponding to the first set bit in the bitmap...
#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).
vlib_error_t error
Error code for buffers to be enqueued to error handler.
static void vlib_node_increment_counter(vlib_main_t *vm, u32 node_index, u32 counter_index, u64 increment)
#define VLIB_REGISTER_NODE(x,...)
static void feat_bitmap_init_next_nodes(vlib_main_t *vm, u32 node_index, u32 num_features, char **feat_names, u32 *next_nodes)
Initialize the feature next-node indexes of a graph node.
static u8 l2_efp_filter_process(vlib_buffer_t *b0, vtr_config_t *in_config)
#define clib_memcpy(a, b, c)
static char * l2output_feat_names[]
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.
u16 cached_next_index
Next frame index that vector arguments were last enqueued to last time this node ran.
static_always_inline void l2output_vtr(vlib_node_runtime_t *node, l2_output_config_t *config, u32 feature_bitmap, vlib_buffer_t *b, u32 *next)
static char * l2output_error_strings[]
static vlib_node_registration_t l2output_bad_intf_node
Output node for interfaces/tunnels which was in L2 mode but were changed to L3 mode or possibly delet...
static void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
#define vec_elt(v, i)
Get vector value at index i.
int vlib_main(vlib_main_t *volatile vm, unformat_input_t *input)
struct _vlib_node_registration vlib_node_registration_t
static char * l2output_bad_intf_error_strings[]
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
l2_output_config_t * configs
u16 flags
Copy of main node flags.
static u8 * format_l2output_trace(u8 *s, va_list *args)
#define VLIB_NODE_FLAG_TRACE
#define vec_validate_init_empty(V, I, INIT)
Make sure vector is long enough for given index and initialize empty space (no header, unspecified alignment)
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
VLIB_NODE_FUNCTION_MULTIARCH(l2output_node, l2output_node_fn)