48 u32 l2_out_feat_next[32];
73 s =
format (s,
"l2-output-vtr: sw_if_index %d dst %U src %U data " 74 "%02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x",
86 #ifndef CLIB_MARCH_VARIANT 90 #define foreach_l2_efp_filter_error \ 91 _(L2_EFP_FILTER, "L2 EFP filter packets") \ 92 _(DROP, "L2 EFP filter post-rewrite drops") 96 #define _(sym,str) L2_EFP_FILTER_ERROR_##sym, 103 #define _(sym,string) string, 123 u32 * port_sw_if_index0,
124 u16 * first_ethertype0,
125 u16 * outer_id0,
u16 * inner_id0,
u32 * match_flags0)
138 *first_ethertype0 = clib_net_to_host_u16 (e0->
type);
139 *outer_id0 = clib_net_to_host_u16 (h0[0].priority_cfi_and_id);
140 *inner_id0 = clib_net_to_host_u16 (h0[1].priority_cfi_and_id);
179 u32 n_left_from, *from, *to_next;
187 n_left_from =
frame->n_vectors;
188 next_index =
node->cached_next_index;
190 while (n_left_from > 0)
197 while (n_left_from >= 6 && n_left_to_next >= 2)
202 u32 sw_if_index0, sw_if_index1;
203 u16 first_ethertype0, first_ethertype1;
204 u16 outer_id0, inner_id0, outer_id1, inner_id1;
205 u32 match_flags0, match_flags1;
206 u32 port_sw_if_index0, subint_sw_if_index0, port_sw_if_index1,
213 __attribute__ ((unused))
u32 matched0, matched1;
219 __attribute__ ((unused))
u32 sw_if_index2, sw_if_index3;
248 to_next[0] = bi0 = from[0];
249 to_next[1] = bi1 = from[1];
263 em->
counters[node_counter_base_index +
264 L2_EFP_FILTER_ERROR_L2_EFP_FILTER] += 2;
268 L2OUTPUT_FEAT_EFP_FILTER);
270 L2OUTPUT_FEAT_EFP_FILTER);
279 &outer_id0, &inner_id0, &match_flags0);
286 &outer_id1, &inner_id1, &match_flags1);
295 &main_intf0, &vlan_intf0, &qinq_intf0);
304 &main_intf1, &vlan_intf1, &qinq_intf1);
311 &subint_sw_if_index0,
319 &subint_sw_if_index1,
326 b0->
error =
node->errors[L2_EFP_FILTER_ERROR_DROP];
333 b1->
error =
node->errors[L2_EFP_FILTER_ERROR_DROP];
338 if (b0->
flags & VLIB_BUFFER_IS_TRACED)
348 if (b1->
flags & VLIB_BUFFER_IS_TRACED)
363 to_next, n_left_to_next,
364 bi0, bi1, next0, next1);
367 while (n_left_from > 0 && n_left_to_next > 0)
373 u16 first_ethertype0;
374 u16 outer_id0, inner_id0;
376 u32 port_sw_if_index0, subint_sw_if_index0;
382 __attribute__ ((unused))
u32 matched0;
397 em->
counters[node_counter_base_index +
398 L2_EFP_FILTER_ERROR_L2_EFP_FILTER] += 1;
402 L2OUTPUT_FEAT_EFP_FILTER);
411 &outer_id0, &inner_id0, &match_flags0);
420 &main_intf0, &vlan_intf0, &qinq_intf0);
427 &subint_sw_if_index0,
434 b0->
error =
node->errors[L2_EFP_FILTER_ERROR_DROP];
438 && (b0->
flags & VLIB_BUFFER_IS_TRACED)))
451 to_next, n_left_to_next,
458 return frame->n_vectors;
464 .name =
"l2-efp-filter",
465 .vector_size =
sizeof (
u32),
481 #ifndef CLIB_MARCH_VARIANT 562 .path =
"set interface l2 efp-filter",
563 .short_help =
"set interface l2 efp-filter <interface> [disable]",
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
char ** l2output_get_feat_names(void)
vnet_main_t * vnet_get_main(void)
#define clib_memcpy_fast(a, b, c)
unformat_function_t unformat_vnet_sw_interface
#define VLIB_NODE_FN(node)
static u32 vnet_l2_feature_next(vlib_buffer_t *b, u32 *next_nodes, u32 feat_bit)
Return the graph node index for the feature corresponding to the next set bit after clearing the curr...
static u8 * format_l2_efp_filter_trace(u8 *s, va_list *args)
ethernet_main_t ethernet_main
#define static_always_inline
u8 * format_ethernet_address(u8 *s, va_list *args)
vl_api_interface_index_t sw_if_index
#define foreach_l2_efp_filter_error
#define VLIB_INIT_FUNCTION(x)
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
static vnet_sw_interface_t * vnet_get_sup_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
#define clib_error_return(e, args...)
static_always_inline void extract_keys(vnet_main_t *vnet_main, u32 sw_if_index0, vlib_buffer_t *b0, u32 *port_sw_if_index0, u16 *first_ethertype0, u16 *outer_id0, u16 *inner_id0, u32 *match_flags0)
Extract fields from the packet that will be used in interface classification.
vl_api_fib_path_type_t type
vlib_error_t error
Error code for buffers to be enqueued to error handler.
clib_error_t * l2_efp_filter_init(vlib_main_t *vm)
vlib_error_main_t error_main
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
vlib_node_registration_t l2_efp_filter_node
(constructor) VLIB_REGISTER_NODE (l2_efp_filter_node)
#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).
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.
#define VLIB_REGISTER_NODE(x,...)
static char * l2_efp_filter_error_strings[]
#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.
static u32 eth_create_valid_subint_match_flags(u32 num_tags)
static u32 eth_identify_subint(vnet_hw_interface_t *hi, u32 match_flags, main_intf_t *main_intf, vlan_intf_t *vlan_intf, qinq_intf_t *qinq_intf, u32 *new_sw_if_index, u8 *error0, u32 *is_l2)
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
#define VLIB_CLI_COMMAND(x,...)
static void eth_vlan_table_lookups(ethernet_main_t *em, vnet_main_t *vnm, u32 port_sw_if_index0, u16 first_ethertype, u16 outer_id, u16 inner_id, vnet_hw_interface_t **hi, main_intf_t **main_intf, vlan_intf_t **vlan_intf, qinq_intf_t **qinq_intf)
static void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
void l2_efp_filter_configure(vnet_main_t *vnet_main, u32 sw_if_index, u8 enable)
Enable/disable the EFP Filter check on the subinterface.
VLIB buffer representation.
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
static clib_error_t * int_l2_efp_filter(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Set subinterface egress efp filter enable/disable.
l2_efp_filter_main_t l2_efp_filter_main
static vlib_node_t * vlib_get_node(vlib_main_t *vm, u32 i)
Get vlib node by index.
vlib_main_t vlib_node_runtime_t vlib_frame_t * frame
#define VLIB_NODE_FLAG_TRACE
#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.