52 u32 feat_next_node_index[32];
83 s =
format (s,
"l2-flood: sw_if_index %d dst %U src %U bd_index %d",
94 #define foreach_l2flood_error \ 95 _(L2FLOOD, "L2 flood packets") \ 96 _(REPL_FAIL, "L2 replication failures") \ 97 _(NO_MEMBERS, "L2 replication complete") \ 98 _(BVI_BAD_MAC, "BVI L3 mac mismatch") \ 99 _(BVI_ETHERTYPE, "BVI packet with unhandled ethertype") 103 #define _(sym,str) L2FLOOD_ERROR_##sym, 110 #define _(sym,string) string, 141 u32 n_left_from, *from, *to_next;
150 while (n_left_from > 0)
156 while (n_left_from > 0 && n_left_to_next > 0)
158 u16 n_clones, n_cloned, clone0;
160 u32 sw_if_index0, bi0, ci0;
187 for (mi = bd_config->
flood_count - 1; mi >= 0; mi--)
189 member = &bd_config->
members[mi];
191 (!in_shg || (member->
shg != in_shg)))
206 b0->
error = node->
errors[L2FLOOD_ERROR_NO_MEMBERS];
208 to_next, n_left_to_next,
212 else if (n_clones > 1)
224 msm->
clones[thread_index],
236 for (clone0 = 0; clone0 < n_cloned - 1; clone0++)
238 member = msm->
members[thread_index][clone0];
239 ci0 = msm->
clones[thread_index][clone0];
247 (b0->
flags & VLIB_BUFFER_IS_TRACED)))
268 to_next, n_left_to_next,
278 member = msm->
members[thread_index][clone0];
279 ci0 = msm->
clones[thread_index][clone0];
285 member = msm->
members[thread_index][0];
298 (b0->
flags & VLIB_BUFFER_IS_TRACED)))
328 c0->
error = node->
errors[L2FLOOD_ERROR_BVI_BAD_MAC];
332 c0->
error = node->
errors[L2FLOOD_ERROR_BVI_ETHERTYPE];
344 to_next, n_left_to_next,
350 to_next, n_left_to_next);
358 L2FLOOD_ERROR_L2FLOOD, frame->
n_vectors);
368 .vector_size =
sizeof (
u32),
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]
#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).
static uword l2flood_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
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 L2_FLOOD_MEMBER_BVI
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)
#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...)
#define VLIB_NODE_FUNCTION_MULTIARCH(node, fn)
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
static vlib_node_registration_t l2flood_node
(constructor) VLIB_REGISTER_NODE (l2flood_node)
u32 node_index
Node index.
#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).
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,...)
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.
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,...)
u16 cached_next_index
Next frame index that vector arguments were last enqueued to last time this node ran.
static void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
struct _vlib_node_registration vlib_node_registration_t
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
#define foreach_l2flood_error
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()
u16 flags
Copy of main node flags.
next_by_ethertype_t l3_next
#define VLIB_NODE_FLAG_TRACE
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
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)