29 #ifndef CLIB_MARCH_VARIANT 32 #define _(sym,name) name, 46 static char *display_names[] = {
47 #define _(sym,name) #sym, 51 u32 feature_bitmap = va_arg (*args,
u32);
52 u32 verbose = va_arg (*args,
u32);
54 if (feature_bitmap == 0)
56 s =
format (s,
" none configured");
63 if (feature_bitmap & (1 << i))
67 format (s,
"%17s (%s)\n", display_names[i],
97 s =
format (s,
"l2-output: sw_if_index %d dst %U src %U data " 98 "%02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x",
111 #define _(sym,string) string, 137 u32 n_left,
int l2_efp,
int l2_vtr,
int l2_pbb,
138 int shg_set,
int update_feature_bitmap)
148 if (l2_vtr || l2_pbb || shg_set)
156 if (update_feature_bitmap)
167 for (i = 0; i < 4; i++)
169 u32 failed1 = l2_efp &&
186 for (i = 0; i < 4; i++)
210 if (update_feature_bitmap)
215 u32 failed1 = l2_efp &&
222 b[0]->
error = node->
errors[L2OUTPUT_ERROR_VTR_DROP];
224 b[0]->
error = node->
errors[L2OUTPUT_ERROR_EFP_DROP];
231 b[0]->
error = node->
errors[L2OUTPUT_ERROR_VTR_DROP];
268 i16 * cdo,
u16 * next,
u32 n_left,
int l2_efp,
269 int l2_vtr,
int l2_pbb)
272 if (config->
shg == 0 && feature_bitmap == 0)
274 if ((l2_efp | l2_vtr | l2_pbb) == 0)
277 l2_efp, l2_vtr, l2_pbb, 0, 0);
279 else if (config->
shg == 0)
281 l2_efp, l2_vtr, l2_pbb, 0, 1);
282 else if (feature_bitmap == 0)
284 l2_efp, l2_vtr, l2_pbb, 1, 0);
287 l2_efp, l2_vtr, l2_pbb, 1, 1);
304 n_left =
frame->n_vectors;
308 sw_if_index = sw_if_indices;
309 cdo = cur_data_offsets;
347 n_left =
frame->n_vectors;
351 u16 off =
frame->n_vectors - n_left;
362 sw_if_index = sw_if_indices + off;
363 cdo = cur_data_offsets + off;
371 if (
PREDICT_FALSE ((feature_bitmap & ~L2OUTPUT_FEAT_OUTPUT) != 0))
382 (b, count,
node->errors[L2OUTPUT_ERROR_MAPPING_DROP]);
389 if (feature_bitmap & L2OUTPUT_FEAT_EFP_FILTER)
416 n_left =
frame->n_vectors;
440 L2OUTPUT_ERROR_L2OUTPUT,
frame->n_vectors);
442 return frame->n_vectors;
448 .vector_size =
sizeof (
u32),
466 #define foreach_l2output_bad_intf_error \ 467 _(DROP, "L2 output to interface not in L2 mode or deleted") 470 #define _(sym,string) string, 477 #define _(sym,str) L2OUTPUT_BAD_INTF_ERROR_##sym, 500 u32 n_left_from, *from, *to_next;
504 n_left_from =
frame->n_vectors;
506 while (n_left_from > 0)
513 while (n_left_from >= 4 && n_left_to_next >= 2)
518 to_next[0] = bi0 = from[0];
519 to_next[1] = bi1 = from[1];
526 b0->
error =
node->errors[L2OUTPUT_BAD_INTF_ERROR_DROP];
527 b1->
error =
node->errors[L2OUTPUT_BAD_INTF_ERROR_DROP];
530 while (n_left_from > 0 && n_left_to_next > 0)
542 b0->
error =
node->errors[L2OUTPUT_BAD_INTF_ERROR_DROP];
548 return frame->n_vectors;
553 .name =
"l2-output-bad-intf",
554 .vector_size =
sizeof (
u32),
598 #ifndef CLIB_MARCH_VARIANT 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)
vl_api_wireguard_peer_flags_t flags
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)
i16 current_data
signed offset in data[], pre_data[] that we are currently processing.
#define clib_memcpy_fast(a, b, c)
vlib_node_registration_t l2output_bad_intf_node
(constructor) VLIB_REGISTER_NODE (l2output_bad_intf_node)
static_always_inline void split_horizon_violation(vlib_node_runtime_t *node, u8 shg, vlib_buffer_t *b, u16 *next)
Check for split horizon violations.
static_always_inline void l2output_set_buffer_error(vlib_buffer_t **b, u32 n_left, vlib_error_t error)
#define VLIB_NODE_FN(node)
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.
#define static_always_inline
u8 * format_ethernet_address(u8 *s, va_list *args)
#define VLIB_INIT_FUNCTION(x)
ptr_config_t output_pbb_vtr
description fragment has unexpected format
#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.
vl_api_fib_path_type_t type
vlib_error_t error
Error code for buffers to be enqueued to error handler.
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_always_inline void l2output_process_batch(vlib_main_t *vm, vlib_node_runtime_t *node, l2_output_config_t *config, vlib_buffer_t **b, i16 *cdo, u16 *next, u32 n_left, int l2_efp, int l2_vtr, int l2_pbb)
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_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).
void l2output_intf_bitmap_enable(u32 sw_if_index, l2output_feat_masks_t feature_bitmap, u32 enable)
Enable (or disable) the feature in the bitmap for the given interface.
static void vlib_node_increment_counter(vlib_main_t *vm, u32 node_index, u32 counter_index, u64 increment)
#define VLIB_REGISTER_NODE(x,...)
#define CLIB_PREFETCH(addr, size, type)
static_always_inline void vlib_buffer_enqueue_to_next(vlib_main_t *vm, vlib_node_runtime_t *node, u32 *buffers, u16 *nexts, uword count)
sll srl srl sll sra u16x4 i
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)
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.
vlib_main_t vlib_node_runtime_t * node
static_always_inline void l2output_process_batch_inline(vlib_main_t *vm, vlib_node_runtime_t *node, l2_output_config_t *config, vlib_buffer_t **b, i16 *cdo, u16 *next, u32 n_left, int l2_efp, int l2_vtr, int l2_pbb, int shg_set, int update_feature_bitmap)
static char * l2output_error_strings[]
static_always_inline void clib_memset_u16(void *p, u16 val, uword count)
#define vec_elt(v, i)
Get vector value at index i.
int vlib_main(vlib_main_t *volatile vm, unformat_input_t *input)
static char * l2output_bad_intf_error_strings[]
vlib_main_t vlib_node_runtime_t vlib_frame_t * frame
VLIB buffer representation.
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
l2_output_config_t * configs
static_always_inline uword clib_count_equal_u32(u32 *data, uword max_count)
void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
static u8 * format_l2output_trace(u8 *s, va_list *args)
static_always_inline void vlib_get_buffers(vlib_main_t *vm, u32 *bi, vlib_buffer_t **b, int count)
Translate array of buffer indices into buffer pointers.
#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)
#define CLIB_CACHE_LINE_BYTES
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
vl_api_interface_index_t sw_if_index
const char *const const char *const raw