30 #ifndef CLIB_MARCH_VARIANT 33 #define _(sym,name) name, 47 static char *display_names[] = {
48 #define _(sym,name) #sym, 52 u32 feature_bitmap = va_arg (*args,
u32);
54 if (feature_bitmap == 0)
56 s =
format (s,
" none configured");
62 if (feature_bitmap & (1 << i))
87 s =
format (s,
"l2-output: sw_if_index %d dst %U src %U data " 88 "%02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x",
101 #define _(sym,string) string, 127 u32 n_left,
int l2_efp,
int l2_vtr,
int l2_pbb,
128 int shg_set,
int update_feature_bitmap)
138 if (l2_vtr || l2_pbb || shg_set)
146 if (update_feature_bitmap)
157 for (i = 0; i < 4; i++)
159 u32 failed1 = l2_efp &&
176 for (i = 0; i < 4; i++)
200 if (update_feature_bitmap)
205 u32 failed1 = l2_efp &&
212 b[0]->
error = node->
errors[L2OUTPUT_ERROR_VTR_DROP];
214 b[0]->
error = node->
errors[L2OUTPUT_ERROR_EFP_DROP];
221 b[0]->
error = node->
errors[L2OUTPUT_ERROR_VTR_DROP];
258 i16 * cdo,
u16 * next,
u32 n_left,
int l2_efp,
259 int l2_vtr,
int l2_pbb)
262 if (config->
shg == 0 && feature_bitmap == 0)
264 if ((l2_efp | l2_vtr | l2_pbb) == 0)
267 l2_efp, l2_vtr, l2_pbb, 0, 0);
269 else if (config->
shg == 0)
271 l2_efp, l2_vtr, l2_pbb, 0, 1);
272 else if (feature_bitmap == 0)
274 l2_efp, l2_vtr, l2_pbb, 1, 0);
277 l2_efp, l2_vtr, l2_pbb, 1, 1);
294 n_left = frame->n_vectors;
298 sw_if_index = sw_if_indices;
299 cdo = cur_data_offsets;
337 n_left = frame->n_vectors;
341 u16 off = frame->n_vectors - n_left;
352 sw_if_index = sw_if_indices + off;
353 cdo = cur_data_offsets + off;
361 if (
PREDICT_FALSE ((feature_bitmap & ~L2OUTPUT_FEAT_OUTPUT) != 0))
372 (b, count, node->errors[L2OUTPUT_ERROR_MAPPING_DROP]);
379 if (feature_bitmap & L2OUTPUT_FEAT_EFP_FILTER)
406 n_left = frame->n_vectors;
430 L2OUTPUT_ERROR_L2OUTPUT, frame->n_vectors);
432 return frame->n_vectors;
438 .vector_size =
sizeof (
u32),
456 #define foreach_l2output_bad_intf_error \ 457 _(DROP, "L2 output to interface not in L2 mode or deleted") 460 #define _(sym,string) string, 467 #define _(sym,str) L2OUTPUT_BAD_INTF_ERROR_##sym, 490 u32 n_left_from, *from, *to_next;
494 n_left_from = frame->n_vectors;
496 while (n_left_from > 0)
503 while (n_left_from >= 4 && n_left_to_next >= 2)
508 to_next[0] = bi0 = from[0];
509 to_next[1] = bi1 = from[1];
516 b0->
error = node->errors[L2OUTPUT_BAD_INTF_ERROR_DROP];
517 b1->
error = node->errors[L2OUTPUT_BAD_INTF_ERROR_DROP];
520 while (n_left_from > 0 && n_left_to_next > 0)
532 b0->
error = node->errors[L2OUTPUT_BAD_INTF_ERROR_DROP];
538 return frame->n_vectors;
543 .name =
"l2-output-bad-intf",
544 .vector_size =
sizeof (
u32),
588 #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)
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)
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.
i16 current_data
signed offset in data[], pre_data[] that we are currently processing.
#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 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).
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,...)
#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)
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.
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 void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
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[]
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)
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.