55 #define foreach_l2_patch_error \ 56 _(PATCHED, "L2 patch packets") \ 57 _(DROPPED, "L2 patch misconfigured drops") 60 #define _(sym,str) L2_PATCH_ERROR_##sym, 67 #define _(sym,string) string, 82 u32 n_left_from, * from, * to_next;
93 while (n_left_from > 0)
98 to_next, n_left_to_next);
100 while (n_left_from >= 4 && n_left_to_next >= 2)
105 u32 sw_if_index0, sw_if_index1;
121 to_next[0] = bi0 = from[0];
122 to_next[1] = bi1 = from[1];
175 to_next, n_left_to_next,
176 bi0, bi1, next0, next1);
179 while (n_left_from > 0 && n_left_to_next > 0)
224 to_next, n_left_to_next,
231 em->
counters[node_counter_base_index + L2_PATCH_ERROR_PATCHED] +=
240 .vector_size =
sizeof (
u32),
270 return VNET_API_ERROR_INVALID_SW_IF_INDEX;
274 return VNET_API_ERROR_INVALID_SW_IF_INDEX_2;
323 u32 rx_sw_if_index, tx_sw_if_index;
341 else if (
unformat (line_input,
"del"))
359 case VNET_API_ERROR_INVALID_SW_IF_INDEX:
362 case VNET_API_ERROR_INVALID_SW_IF_INDEX_2:
367 (0,
"WARNING: vnet_l2_patch_add_del returned %d", rv);
374 .path =
"test l2patch",
376 "rx <intfc> tx <intfc> [del]",
393 for (rx_sw_if_index = 0;
399 if (tx_sw_if_index != ~0)
417 .path =
"show l2patch",
418 .short_help =
"Show l2 interface cross-connect entries",
void vlib_put_next_frame(vlib_main_t *vm, vlib_node_runtime_t *r, u32 next_index, u32 n_vectors_left)
static clib_error_t * show_l2patch(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
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
int vnet_hw_interface_rx_redirect_to_node(vnet_main_t *vnm, u32 hw_if_index, u32 node_index)
struct _vlib_node_registration vlib_node_registration_t
unformat_function_t unformat_vnet_sw_interface
format_function_t format_vnet_sw_if_index_name
vnet_main_t * vnet_get_main(void)
#define VLIB_INIT_FUNCTION(x)
always_inline void * vlib_frame_vector_args(vlib_frame_t *f)
vlib_error_main_t error_main
static u8 * format_l2_patch_trace(u8 *s, va_list *args)
static char * l2_patch_error_strings[]
#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)
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
l2_patch_main_t l2_patch_main
u32 * tx_next_by_rx_sw_if_index
always_inline vnet_hw_interface_t * vnet_get_sup_hw_interface(vnet_main_t *vnm, u32 sw_if_index)
#define ETHERNET_INTERFACE_FLAG_ACCEPT_ALL
static vlib_node_registration_t l2_patch_node
(constructor) VLIB_REGISTER_NODE (l2_patch_node)
#define foreach_l2_patch_error
#define VLIB_CLI_COMMAND(x,...)
static uword l2_patch_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
u32 * tx_sw_if_index_by_rx_sw_if_index
#define VLIB_NODE_FLAG_TRACE
static clib_error_t * test_patch_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
always_inline uword vlib_node_add_next(vlib_main_t *vm, uword node, uword next_node)
#define VLIB_BUFFER_IS_TRACED
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
int vnet_l2_patch_add_del(u32 rx_sw_if_index, u32 tx_sw_if_index, int is_add)
always_inline void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
#define VLIB_REGISTER_NODE(x,...)
#define clib_error_return(e, args...)
#define vec_validate_init_empty(V, I, INIT)
Make sure vector is long enough for given index and initialize empty space (no header, unspecified alignment)
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.
u32 cached_rx_sw_if_index
clib_error_t * l2_patch_init(vlib_main_t *vm)
u32 ethernet_set_flags(vnet_main_t *vnm, u32 hw_if_index, u32 flags)