53 u32 feat_next_node_index[32];
80 s =
format (s,
"l2-flood: sw_if_index %d dst %U src %U bd_index %d",
91 #define foreach_l2flood_error \ 92 _(L2FLOOD, "L2 flood packets") \ 93 _(REPL_FAIL, "L2 replication failures") \ 94 _(NO_MEMBERS, "L2 replication complete") \ 95 _(BVI_BAD_MAC, "BVI L3 mac mismatch") \ 96 _(BVI_ETHERTYPE, "BVI packet with unhandled ethertype") 100 #define _(sym,str) L2FLOOD_ERROR_##sym, 107 #define _(sym,string) string, 164 while ((current_member >= 0) &&
165 ((members[current_member].sw_if_index == *sw_if_index0) ||
166 (in_shg && members[current_member].shg == in_shg)))
171 if (current_member < 0)
175 b0->
error = node->
errors[L2FLOOD_ERROR_NO_MEMBERS];
179 if ((current_member > 0) &&
180 ((current_member > 1) ||
181 ((members[0].sw_if_index != *sw_if_index0) &&
182 (!in_shg || members[0].shg != in_shg))))
217 while ((current_member >= 0) &&
218 ((members[current_member].
sw_if_index == *sw_if_index0) ||
219 (in_shg && members[current_member].shg == in_shg)))
224 if (current_member < 0)
235 b0->
error = node->
errors[L2FLOOD_ERROR_NO_MEMBERS];
242 ((current_member == 1) &&
243 ((members[0].sw_if_index ==
244 *sw_if_index0) || (in_shg
264 b0->
error = node->
errors[L2FLOOD_ERROR_BVI_BAD_MAC];
269 b0->
error = node->
errors[L2FLOOD_ERROR_BVI_ETHERTYPE];
290 u32 n_left_from, *from, *to_next;
301 while (n_left_from > 0)
308 while (n_left_from >= 6 && n_left_to_next >= 2)
313 u32 sw_if_index0, sw_if_index1;
316 u32 bucket0, bucket1;
343 to_next[0] = bi0 = from[0];
344 to_next[1] = bi1 = from[1];
358 em->
counters[node_counter_base_index + L2FLOOD_ERROR_L2FLOOD] += 2;
361 &em->
counters[node_counter_base_index], b0,
362 &sw_if_index0, &key0, &bucket0, &result0, &next0);
365 &em->
counters[node_counter_base_index], b1,
366 &sw_if_index1, &key1, &bucket1, &result1, &next1);
395 to_next, n_left_to_next,
396 bi0, bi1, next0, next1);
399 while (n_left_from > 0 && n_left_to_next > 0)
422 em->
counters[node_counter_base_index + L2FLOOD_ERROR_L2FLOOD] += 1;
425 &em->
counters[node_counter_base_index], b0,
426 &sw_if_index0, &key0, &bucket0, &result0, &next0);
441 to_next, n_left_to_next,
456 .vector_size =
sizeof (
u32),
556 .path =
"set interface l2 flood",
557 .short_help =
"set interface l2 flood <interface> [disable]",
u32 feat_next_node_index[32]
#define TO_BVI_ERR_BAD_MAC
vnet_main_t * vnet_get_main(void)
#define TO_BVI_ERR_ETHERTYPE
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, u32 *next0)
Send a packet from L2 processing to L3 via the BVI interface.
l2flood_main_t l2flood_main
static void replication_clear_recycled(vlib_buffer_t *b0)
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.
struct _vlib_node_registration vlib_node_registration_t
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 static_always_inline
u8 * format_ethernet_address(u8 *s, va_list *args)
#define VLIB_INIT_FUNCTION(x)
#define VLIB_BUFFER_REPL_FAIL
static u8 * format_l2flood_trace(u8 *s, va_list *args)
#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.
#define clib_error_return(e, args...)
static void replication_prefetch_ctx(vlib_buffer_t *b0)
vlib_error_main_t error_main
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)
replication_context_t * replication_prep(vlib_main_t *vm, vlib_buffer_t *b0, u32 recycle_node_index, u32 l2_packet)
#define vlib_validate_buffer_enqueue_x2(vm, node, next_index, to_next, n_left_to_next, bi0, bi1, next0, next1)
Finish enqueueing two buffers forward in the graph.
#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.
clib_error_t * next_by_ethertype_register(next_by_ethertype_t *l3_next, u32 ethertype, u32 next_index)
#define CLIB_PREFETCH(addr, size, type)
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.
#define VLIB_BUFFER_IS_TRACED
u32 sw_if_index[VLIB_N_RX_TX]
#define clib_memcpy(a, b, c)
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 replication_context_t * replication_get_ctx(vlib_buffer_t *b0)
u16 cached_next_index
Next frame index that vector arguments were last enqueued to last time this node ran.
static u32 replication_is_recycled(vlib_buffer_t *b0)
#define VLIB_NODE_FLAG_TRACE
static void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
#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
replication_context_t * replication_recycle(vlib_main_t *vm, vlib_buffer_t *b0, u32 is_last)
static_always_inline void l2flood_process(vlib_main_t *vm, vlib_node_runtime_t *node, l2flood_main_t *msm, u64 *counter_base, vlib_buffer_t *b0, u32 *sw_if_index0, l2fib_entry_key_t *key0, u32 *bucket0, l2fib_entry_result_t *result0, u32 *next0)
#define VLIB_NODE_FUNCTION_MULTIARCH(node, fn)
#define VLIB_REGISTER_NODE(x,...)
static vlib_node_t * vlib_get_node(vlib_main_t *vm, u32 i)
Get vlib node by index.
u16 flags
Copy of main node flags.
next_by_ethertype_t l3_next
#define CLIB_CACHE_LINE_BYTES
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.
clib_error_t * l2flood_init(vlib_main_t *vm)