55 s =
format (s,
"l2-output-vtr: sw_if_index %d dst %U src %U data " 56 "%02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x",
69 #define foreach_l2_efp_filter_error \ 70 _(L2_EFP_FILTER, "L2 EFP filter packets") \ 71 _(DROP, "L2 EFP filter post-rewrite drops") 74 #define _(sym,str) L2_EFP_FILTER_ERROR_##sym, 81 #define _(sym,string) string, 97 u32 * port_sw_if_index0,
98 u16 * first_ethertype0,
113 *first_ethertype0 = clib_net_to_host_u16(e0->
type);
114 *outer_id0 = clib_net_to_host_u16 (h0[0].priority_cfi_and_id);
115 *inner_id0 = clib_net_to_host_u16 (h0[1].priority_cfi_and_id);
155 u32 n_left_from, * from, * to_next;
161 u32 cached_sw_if_index = ~0;
162 u32 cached_next_index = ~0;
165 cached_sw_if_index = ~0;
171 while (n_left_from > 0)
177 to_next, n_left_to_next);
179 while (n_left_from >= 6 && n_left_to_next >= 2)
184 u32 sw_if_index0, sw_if_index1;
185 u32 feature_bitmap0, feature_bitmap1;
186 u16 first_ethertype0, first_ethertype1;
187 u16 outer_id0, inner_id0, outer_id1, inner_id1;
188 u32 match_flags0, match_flags1;
189 u32 port_sw_if_index0, subint_sw_if_index0, port_sw_if_index1, subint_sw_if_index1;
195 __attribute__((unused))
u32 matched0, matched1;
201 __attribute__((unused))
u32 sw_if_index2, sw_if_index3;
225 to_next[0] = bi0 = from[0];
226 to_next[1] = bi1 = from[1];
240 em->
counters[node_counter_base_index + L2_EFP_FILTER_ERROR_L2_EFP_FILTER] += 2;
243 feature_bitmap0 =
vnet_buffer(b0)->l2.feature_bitmap & ~L2OUTPUT_FEAT_EFP_FILTER;
244 feature_bitmap1 =
vnet_buffer(b1)->l2.feature_bitmap & ~L2OUTPUT_FEAT_EFP_FILTER;
318 &subint_sw_if_index0,
328 &subint_sw_if_index1,
335 b0->
error = node->
errors[L2_EFP_FILTER_ERROR_DROP];
341 b1->
error = node->
errors[L2_EFP_FILTER_ERROR_DROP];
368 to_next, n_left_to_next,
369 bi0, bi1, next0, next1);
372 while (n_left_from > 0 && n_left_to_next > 0)
379 u16 first_ethertype0;
380 u16 outer_id0, inner_id0;
382 u32 port_sw_if_index0, subint_sw_if_index0;
388 __attribute__((unused))
u32 matched0;
403 em->
counters[node_counter_base_index + L2_EFP_FILTER_ERROR_L2_EFP_FILTER] += 1;
406 feature_bitmap0 =
vnet_buffer(b0)->l2.feature_bitmap & ~L2OUTPUT_FEAT_EFP_FILTER;
449 &subint_sw_if_index0,
456 b0->
error = node->
errors[L2_EFP_FILTER_ERROR_DROP];
472 to_next, n_left_to_next,
485 .name =
"l2-efp-filter",
486 .vector_size =
sizeof (
u32),
568 .path =
"set interface l2 efp-filter",
569 .short_help =
"set interface l2 efp-filter <interface> [disable]",
void vlib_put_next_frame(vlib_main_t *vm, vlib_node_runtime_t *r, u32 next_index, u32 n_vectors_left)
always_inline void l2_output_dispatch(vlib_main_t *vlib_main, vnet_main_t *vnet_main, vlib_node_runtime_t *node, u32 node_index, u32 *cached_sw_if_index, u32 *cached_next_index, l2_output_next_nodes_st *next_nodes, vlib_buffer_t *b0, u32 sw_if_index, u32 feature_bitmap, u32 *next0)
char ** l2output_get_feat_names(void)
always_inline vlib_node_t * vlib_get_node(vlib_main_t *vm, u32 i)
bad routing header type(not 4)") sr_error (NO_MORE_SEGMENTS
struct _vlib_node_registration vlib_node_registration_t
unformat_function_t unformat_vnet_sw_interface
always_inline void l2output_init_output_node_vec(u32 **output_node_index_vec)
always_inline void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
static u8 * format_l2_efp_filter_trace(u8 *s, va_list *args)
ethernet_main_t ethernet_main
vnet_main_t * vnet_get_main(void)
#define static_always_inline
u8 * format_ethernet_address(u8 *s, va_list *args)
#define foreach_l2_efp_filter_error
#define VLIB_INIT_FUNCTION(x)
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)
always_inline void * vlib_frame_vector_args(vlib_frame_t *f)
void l2output_intf_bitmap_enable(u32 sw_if_index, u32 feature_bitmap, u32 enable)
clib_error_t * l2_efp_filter_init(vlib_main_t *vm)
u32 feat_next_node_index[32]
vlib_error_main_t error_main
static vlib_node_registration_t l2_efp_filter_node
(constructor) VLIB_REGISTER_NODE (l2_efp_filter_node)
void l2_efp_filter_configure(vnet_main_t *vnet_main, u32 sw_if_index, u32 enable)
#define vlib_validate_buffer_enqueue_x2(vm, node, next_index, to_next, n_left_to_next, bi0, bi1, next0, next1)
#define vlib_validate_buffer_enqueue_x1(vm, node, next_index, to_next, n_left_to_next, bi0, next0)
#define vlib_get_next_frame(vm, node, next_index, vectors, n_vectors_left)
vlib_error_t error
Error code for buffers to be enqueued to error handler.
static char * l2_efp_filter_error_strings[]
#define CLIB_PREFETCH(addr, size, type)
#define clib_memcpy(a, b, c)
always_inline 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)
always_inline vnet_sw_interface_t * vnet_get_sup_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
#define VLIB_CLI_COMMAND(x,...)
#define VLIB_NODE_FLAG_TRACE
#define VLIB_BUFFER_IS_TRACED
l2_output_next_nodes_st next_nodes
u32 * output_node_index_vec
static uword l2_efp_filter_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
always_inline void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
static clib_error_t * int_l2_efp_filter(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
always_inline u32 eth_identify_subint(vnet_hw_interface_t *hi, vlib_buffer_t *b0, 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)
#define VLIB_REGISTER_NODE(x,...)
l2_efp_filter_main_t l2_efp_filter_main
#define clib_error_return(e, args...)
always_inline u32 eth_create_valid_subint_match_flags(u32 num_tags)
#define CLIB_CACHE_LINE_BYTES
u32 flags
buffer flags: VLIB_BUFFER_IS_TRACED: trace this buffer.
always_inline vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
always_inline void feat_bitmap_init_next_nodes(vlib_main_t *vm, u32 node_index, u32 num_features, char **feat_names, u32 *next_nodes)