32 #define _(sym,name) name, 62 s =
format (s,
"l2-output: sw_if_index %d dst %U src %U data " 63 "%02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x",
76 #define _(sym,string) string, 116 u32 failed1 = (feature_bitmap & L2OUTPUT_FEAT_EFP_FILTER)
153 u32 n_left_from, *from, *to_next;
156 u32 cached_sw_if_index;
157 u32 cached_next_index;
160 cached_sw_if_index = ~0;
161 cached_next_index = ~0;
167 while (n_left_from > 0)
174 while (n_left_from >= 8 && n_left_to_next >= 4)
176 u32 bi0, bi1, bi2, bi3;
178 u32 next0, next1, next2, next3;
179 u32 sw_if_index0, sw_if_index1, sw_if_index2, sw_if_index3;
182 u32 feature_bitmap0, feature_bitmap1;
183 u32 feature_bitmap2, feature_bitmap3;
203 to_next[0] = bi0 = from[0];
204 to_next[1] = bi1 = from[1];
205 to_next[2] = bi2 = from[2];
206 to_next[3] = bi3 = from[3];
224 L2OUTPUT_ERROR_L2OUTPUT, 4);
249 b0, sw_if_index0, feature_bitmap0, &next0);
258 b1, sw_if_index1, feature_bitmap1, &next1);
267 b2, sw_if_index2, feature_bitmap2, &next2);
276 b3, sw_if_index3, feature_bitmap3, &next3);
278 l2output_vtr (node, config0, feature_bitmap0, b0, &next0);
279 l2output_vtr (node, config1, feature_bitmap1, b1, &next1);
280 l2output_vtr (node, config2, feature_bitmap2, b2, &next2);
281 l2output_vtr (node, config3, feature_bitmap3, b3, &next3);
332 config2->
shg + config3->
shg))
364 to_next, n_left_to_next,
366 next0, next1, next2, next3);
369 while (n_left_from > 0 && n_left_to_next > 0)
392 L2OUTPUT_ERROR_L2OUTPUT, 1);
411 b0, sw_if_index0, feature_bitmap0, &next0);
413 l2output_vtr (node, config0, feature_bitmap0, b0, &next0);
437 to_next, n_left_to_next,
460 .vector_size =
sizeof (
u32),
478 #define foreach_l2output_bad_intf_error \ 479 _(DROP, "L2 output to interface not in L2 mode or deleted") 482 #define _(sym,string) string, 489 #define _(sym,str) L2OUTPUT_BAD_INTF_ERROR_##sym, 513 u32 n_left_from, *from, *to_next;
519 while (n_left_from > 0)
526 while (n_left_from >= 4 && n_left_to_next >= 2)
531 to_next[0] = bi0 = from[0];
532 to_next[1] = bi1 = from[1];
539 b0->
error = node->
errors[L2OUTPUT_BAD_INTF_ERROR_DROP];
540 b1->
error = node->
errors[L2OUTPUT_BAD_INTF_ERROR_DROP];
543 while (n_left_from > 0 && n_left_to_next > 0)
555 b0->
error = node->
errors[L2OUTPUT_BAD_INTF_ERROR_DROP];
567 .name =
"l2-output-bad-intf",
568 .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)
clib_error_t * l2output_init(vlib_main_t *vm)
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)
static uword l2output_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
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.
#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.
struct _vlib_node_registration vlib_node_registration_t
static u32 l2_pbb_process(vlib_buffer_t *b0, ptr_config_t *config)
vlib_error_t * errors
Vector of errors for this node.
l2_output_next_nodes_st next_nodes
static uword vlib_node_add_next(vlib_main_t *vm, uword node, uword next_node)
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 u32 l2_vtr_process(vlib_buffer_t *b0, vtr_config_t *config)
Perform the configured tag rewrite on the packet.
u32 feat_next_node_index[32]
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
#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)
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 VLIB_BUFFER_IS_TRACED
#define clib_memcpy(a, b, c)
static char * l2output_feat_names[]
u16 cached_next_index
Next frame index that vector arguments were last enqueued to last time this node ran.
int vlib_main(vlib_main_t *volatile vm, unformat_input_t *input)
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)
#define VLIB_NODE_FLAG_TRACE
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)
static char * l2output_bad_intf_error_strings[]
u32 * output_node_index_vec
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
l2_output_config_t * configs
static vlib_node_registration_t l2output_node
(constructor) VLIB_REGISTER_NODE (l2output_node)
#define VLIB_NODE_FUNCTION_MULTIARCH(node, fn)
#define VLIB_REGISTER_NODE(x,...)
u16 flags
Copy of main node flags.
static u8 * format_l2output_trace(u8 *s, va_list *args)
static void l2_output_dispatch(vlib_main_t *vlib_main, vnet_main_t *vnet_main, vlib_node_runtime_t *node, u32 node_index, u32 *cached_sw_if_index, u32 *cached_next_index, l2_output_next_nodes_st *next_nodes, vlib_buffer_t *b0, u32 sw_if_index, u32 feature_bitmap, u32 *next0)
Determine the next L2 node based on the output feature bitmap.
#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_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.