56 #define foreach_l2_patch_error \ 57 _(PATCHED, "L2 patch packets") \ 58 _(DROPPED, "L2 patch misconfigured drops") 62 #define _(sym,str) L2_PATCH_ERROR_##sym, 69 #define _(sym,string) string, 84 u32 n_left_from, *from, *to_next;
95 while (n_left_from > 0)
101 while (n_left_from >= 4 && n_left_to_next >= 2)
106 u32 sw_if_index0, sw_if_index1;
122 to_next[0] = bi0 = from[0];
123 to_next[1] = bi1 = from[1];
169 to_next, n_left_to_next,
170 bi0, bi1, next0, next1);
173 while (n_left_from > 0 && n_left_to_next > 0)
213 to_next, n_left_to_next,
220 em->
counters[node_counter_base_index + L2_PATCH_ERROR_PATCHED] +=
230 .vector_size =
sizeof (
u32),
263 return VNET_API_ERROR_INVALID_SW_IF_INDEX;
267 return VNET_API_ERROR_INVALID_SW_IF_INDEX_2;
313 u32 rx_sw_if_index, tx_sw_if_index;
332 else if (
unformat (line_input,
"del"))
357 case VNET_API_ERROR_INVALID_SW_IF_INDEX:
361 case VNET_API_ERROR_INVALID_SW_IF_INDEX_2:
367 (0,
"WARNING: vnet_l2_patch_add_del returned %d", rv);
389 .path =
"test l2patch",
390 .short_help =
"test l2patch rx <intfc> tx <intfc> [del]",
407 for (rx_sw_if_index = 0;
413 if (tx_sw_if_index != ~0)
441 .path =
"show l2patch",
442 .short_help =
"Show l2 interface cross-connect entries",
static clib_error_t * show_l2patch(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Display the contents of the l2patch table.
vnet_main_t * vnet_get_main(void)
static vnet_hw_interface_t * vnet_get_sup_hw_interface(vnet_main_t *vnm, u32 sw_if_index)
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.
struct _vlib_node_registration vlib_node_registration_t
unformat_function_t unformat_vnet_sw_interface
format_function_t format_vnet_sw_if_index_name
static uword vlib_node_add_next(vlib_main_t *vm, uword node, uword next_node)
#define VLIB_INIT_FUNCTION(x)
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
#define clib_error_return(e, args...)
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)
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).
l2_patch_main_t l2_patch_main
u32 * tx_next_by_rx_sw_if_index
#define VLIB_BUFFER_IS_TRACED
#define ETHERNET_INTERFACE_FLAG_ACCEPT_ALL
#define foreach_l2_patch_error
#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 vlib_node_registration_t l2_patch_node
(constructor) VLIB_REGISTER_NODE (l2_patch_node)
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)
static void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
#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)
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
#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.
#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.
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
clib_error_t * l2_patch_init(vlib_main_t *vm)
int vnet_feature_enable_disable(const char *arc_name, const char *node_name, u32 sw_if_index, int enable_disable, void *feature_config, u32 n_feature_config_bytes)
u32 ethernet_set_flags(vnet_main_t *vnm, u32 hw_if_index, u32 flags)