52 u32 feat_next_node_index[32];
83 s =
format (s,
"l2-flood: sw_if_index %d dst %U src %U bd_index %d",
92 #ifndef CLIB_MARCH_VARIANT 96 #define foreach_l2flood_error \ 97 _(L2FLOOD, "L2 flood packets") \ 98 _(REPL_FAIL, "L2 replication failures") \ 99 _(NO_MEMBERS, "L2 replication complete") \ 100 _(BVI_BAD_MAC, "BVI L3 mac mismatch") \ 101 _(BVI_ETHERTYPE, "BVI packet with unhandled ethertype") 105 #define _(sym,str) L2FLOOD_ERROR_##sym, 112 #define _(sym,string) string, 142 u32 n_left_from, *from, *to_next;
148 n_left_from = frame->n_vectors;
149 next_index = node->cached_next_index;
151 while (n_left_from > 0)
157 while (n_left_from > 0 && n_left_to_next > 0)
159 u16 n_clones, n_cloned, clone0;
161 u32 sw_if_index0, bi0, ci0;
188 for (mi = bd_config->
flood_count - 1; mi >= 0; mi--)
190 member = &bd_config->
members[mi];
192 (!in_shg || (member->
shg != in_shg)))
207 b0->
error = node->errors[L2FLOOD_ERROR_NO_MEMBERS];
209 to_next, n_left_to_next,
213 else if (n_clones > 1)
225 msm->
clones[thread_index],
231 b0->
error = node->errors[L2FLOOD_ERROR_REPL_FAIL];
237 for (clone0 = 0; clone0 < n_cloned - 1; clone0++)
239 member = msm->
members[thread_index][clone0];
240 ci0 = msm->
clones[thread_index][clone0];
248 (b0->
flags & VLIB_BUFFER_IS_TRACED)))
269 to_next, n_left_to_next,
279 member = msm->
members[thread_index][clone0];
280 ci0 = msm->
clones[thread_index][clone0];
286 member = msm->
members[thread_index][0];
299 (b0->
flags & VLIB_BUFFER_IS_TRACED)))
329 c0->
error = node->errors[L2FLOOD_ERROR_BVI_BAD_MAC];
333 c0->
error = node->errors[L2FLOOD_ERROR_BVI_ETHERTYPE];
345 to_next, n_left_to_next,
351 to_next, n_left_to_next);
359 L2FLOOD_ERROR_L2FLOOD, frame->n_vectors);
361 return frame->n_vectors;
368 .vector_size =
sizeof (
u32),
385 #ifndef CLIB_MARCH_VARIANT 473 .path =
"set interface l2 flood",
474 .short_help =
"set interface l2 flood <interface> [disable]",
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
u32 feat_next_node_index[32]
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
#define VLIB_BUFFER_CLONE_HEAD_SIZE
#define TO_BVI_ERR_BAD_MAC
vnet_main_t * vnet_get_main(void)
#define clib_memcpy_fast(a, b, c)
#define TO_BVI_ERR_ETHERTYPE
l2flood_main_t l2flood_main
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
void l2flood_register_input_type(vlib_main_t *vm, ethernet_type_t type, u32 node_index)
Add the L3 input node for this ethertype to the next nodes structure.
l2_flood_member_t * members
static char * l2flood_error_strings[]
unformat_function_t unformat_vnet_sw_interface
#define VLIB_NODE_FN(node)
#define L2_FLOOD_MEMBER_BVI
static uword vlib_node_add_next(vlib_main_t *vm, uword node, uword next_node)
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
u8 * format_ethernet_address(u8 *s, va_list *args)
#define VLIB_INIT_FUNCTION(x)
static u8 * format_l2flood_trace(u8 *s, va_list *args)
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
#define clib_error_return(e, args...)
vlib_error_t error
Error code for buffers to be enqueued to error handler.
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
#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).
static void vlib_node_increment_counter(vlib_main_t *vm, u32 node_index, u32 counter_index, u64 increment)
#define VLIB_REGISTER_NODE(x,...)
static void vlib_buffer_copy_trace_flag(vlib_main_t *vm, vlib_buffer_t *b, u32 bi_target)
clib_error_t * next_by_ethertype_register(next_by_ethertype_t *l3_next, u32 ethertype, u32 next_index)
static u16 vlib_buffer_clone(vlib_main_t *vm, u32 src_buffer, u32 *buffers, u16 n_buffers, u16 head_end_offset)
Create multiple clones of buffer and store them in the supplied array.
vlib_node_registration_t l2flood_node
(constructor) VLIB_REGISTER_NODE (l2flood_node)
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.
l2_flood_member_t *** members
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_CLI_COMMAND(x,...)
static void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
#define foreach_l2flood_error
VLIB buffer representation.
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
l2_bridge_domain_t * bd_configs
static u32 vlib_num_workers()
next_by_ethertype_t l3_next
#define VLIB_NODE_FLAG_TRACE
static clib_error_t * int_flood(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Set subinterface flood enable/disable.
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
static_always_inline u32 l2_to_bvi(vlib_main_t *vlib_main, vnet_main_t *vnet_main, vlib_buffer_t *b0, u32 bvi_sw_if_index, next_by_ethertype_t *l3_next, u16 *next0)
Send a packet from L2 processing to L3 via the BVI interface.
clib_error_t * l2flood_init(vlib_main_t *vm)