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);
53 u32 verbose = va_arg (*args,
u32);
55 if (feature_bitmap == 0)
57 s =
format (s,
" none configured");
64 if (feature_bitmap & (1 << i))
68 format (s,
"%17s (%s)\n", display_names[i],
98 s =
format (s,
"l2-output: sw_if_index %d dst %U src %U data " 99 "%02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x",
112 #define _(sym,string) string, 138 u32 n_left,
int l2_efp,
int l2_vtr,
int l2_pbb,
139 int shg_set,
int update_feature_bitmap)
149 if (l2_vtr || l2_pbb || shg_set)
157 if (update_feature_bitmap)
168 for (i = 0; i < 4; i++)
170 u32 failed1 = l2_efp &&
187 for (i = 0; i < 4; i++)
211 if (update_feature_bitmap)
216 u32 failed1 = l2_efp &&
223 b[0]->
error = node->
errors[L2OUTPUT_ERROR_VTR_DROP];
225 b[0]->
error = node->
errors[L2OUTPUT_ERROR_EFP_DROP];
232 b[0]->
error = node->
errors[L2OUTPUT_ERROR_VTR_DROP];
269 i16 * cdo,
u16 * next,
u32 n_left,
int l2_efp,
270 int l2_vtr,
int l2_pbb)
273 if (config->
shg == 0 && feature_bitmap == 0)
275 if ((l2_efp | l2_vtr | l2_pbb) == 0)
278 l2_efp, l2_vtr, l2_pbb, 0, 0);
280 else if (config->
shg == 0)
282 l2_efp, l2_vtr, l2_pbb, 0, 1);
283 else if (feature_bitmap == 0)
285 l2_efp, l2_vtr, l2_pbb, 1, 0);
288 l2_efp, l2_vtr, l2_pbb, 1, 1);
305 n_left =
frame->n_vectors;
309 sw_if_index = sw_if_indices;
310 cdo = cur_data_offsets;
348 n_left =
frame->n_vectors;
352 u16 off =
frame->n_vectors - n_left;
363 sw_if_index = sw_if_indices + off;
364 cdo = cur_data_offsets + off;
372 if (
PREDICT_FALSE ((feature_bitmap & ~L2OUTPUT_FEAT_OUTPUT) != 0))
383 (b, count,
node->errors[L2OUTPUT_ERROR_MAPPING_DROP]);
390 if (feature_bitmap & L2OUTPUT_FEAT_EFP_FILTER)
417 n_left =
frame->n_vectors;
441 L2OUTPUT_ERROR_L2OUTPUT,
frame->n_vectors);
443 return frame->n_vectors;
449 .vector_size =
sizeof (
u32),
467 #define foreach_l2output_bad_intf_error \ 468 _(DROP, "L2 output to interface not in L2 mode or deleted") 471 #define _(sym,string) string, 478 #define _(sym,str) L2OUTPUT_BAD_INTF_ERROR_##sym, 501 u32 n_left_from, *from, *to_next;
505 n_left_from =
frame->n_vectors;
507 while (n_left_from > 0)
514 while (n_left_from >= 4 && n_left_to_next >= 2)
519 to_next[0] = bi0 = from[0];
520 to_next[1] = bi1 = from[1];
527 b0->
error =
node->errors[L2OUTPUT_BAD_INTF_ERROR_DROP];
528 b1->
error =
node->errors[L2OUTPUT_BAD_INTF_ERROR_DROP];
531 while (n_left_from > 0 && n_left_to_next > 0)
543 b0->
error =
node->errors[L2OUTPUT_BAD_INTF_ERROR_DROP];
549 return frame->n_vectors;
554 .name =
"l2-output-bad-intf",
555 .vector_size =
sizeof (
u32),
599 #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)
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)
vl_api_interface_index_t sw_if_index
#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.
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)
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 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[]
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)
vlib_main_t vlib_node_runtime_t vlib_frame_t * frame
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.