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))
79 #ifndef CLIB_MARCH_VARIANT 88 s =
format (s,
"l2-output: sw_if_index %d dst %U src %U data " 89 "%02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x",
102 #define _(sym,string) string, 129 u32 n_left,
int l2_efp,
int l2_vtr,
int l2_pbb,
130 int shg_set,
int update_feature_bitmap)
140 if (l2_vtr || l2_pbb || shg_set)
148 if (update_feature_bitmap)
159 for (i = 0; i < 4; i++)
161 u32 failed1 = l2_efp &&
178 for (i = 0; i < 4; i++)
202 if (update_feature_bitmap)
207 u32 failed1 = l2_efp &&
214 b[0]->
error = node->
errors[L2OUTPUT_ERROR_VTR_DROP];
216 b[0]->
error = node->
errors[L2OUTPUT_ERROR_EFP_DROP];
223 b[0]->
error = node->
errors[L2OUTPUT_ERROR_VTR_DROP];
260 i16 * cdo,
u16 * next,
u32 n_left,
int l2_efp,
261 int l2_vtr,
int l2_pbb)
264 if (config->
shg == 0 && feature_bitmap == 0)
266 l2_efp, l2_vtr, l2_pbb, 0, 0);
267 else if (config->
shg == 0)
269 l2_efp, l2_vtr, l2_pbb, 0, 1);
270 else if (feature_bitmap == 0)
272 l2_efp, l2_vtr, l2_pbb, 1, 0);
275 l2_efp, l2_vtr, l2_pbb, 1, 1);
292 n_left = frame->n_vectors;
296 sw_if_index = sw_if_indices;
297 cdo = cur_data_offsets;
335 n_left = frame->n_vectors;
339 u16 off = frame->n_vectors - n_left;
350 sw_if_index = sw_if_indices + off;
351 cdo = cur_data_offsets + off;
359 if (
PREDICT_FALSE ((feature_bitmap & ~L2OUTPUT_FEAT_OUTPUT) != 0))
370 (b, count, node->errors[L2OUTPUT_ERROR_MAPPING_DROP]);
377 if (feature_bitmap & L2OUTPUT_FEAT_EFP_FILTER)
404 n_left = frame->n_vectors;
428 L2OUTPUT_ERROR_L2OUTPUT, frame->n_vectors);
430 return frame->n_vectors;
433 #ifndef CLIB_MARCH_VARIANT 437 .vector_size =
sizeof (
u32),
455 #define foreach_l2output_bad_intf_error \ 456 _(DROP, "L2 output to interface not in L2 mode or deleted") 459 #define _(sym,string) string, 466 #define _(sym,str) L2OUTPUT_BAD_INTF_ERROR_##sym, 490 u32 n_left_from, *from, *to_next;
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];
544 .name =
"l2-output-bad-intf",
545 .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)
VLIB_NODE_FUNCTION_MULTIARCH(l2output_bad_intf_node, l2output_bad_intf_node_fn)
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 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_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 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_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)
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
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.