52 #ifndef CLIB_MARCH_VARIANT 60 #define foreach_l2_patch_error \ 61 _(PATCHED, "L2 patch packets") \ 62 _(DROPPED, "L2 patch misconfigured drops") 66 #define _(sym,str) L2_PATCH_ERROR_##sym, 73 #define _(sym,string) string, 90 if ((b->
flags & VLIB_BUFFER_IS_TRACED) == 0)
101 u32 n_left,
int do_trace)
204 em->
counters[node_counter_base_index + L2_PATCH_ERROR_PATCHED] +=
207 return frame->n_vectors;
213 .vector_size =
sizeof (
u32),
231 #ifndef CLIB_MARCH_VARIANT 248 return VNET_API_ERROR_INVALID_SW_IF_INDEX;
252 return VNET_API_ERROR_INVALID_SW_IF_INDEX_2;
318 else if (
unformat (line_input,
"del"))
343 case VNET_API_ERROR_INVALID_SW_IF_INDEX:
347 case VNET_API_ERROR_INVALID_SW_IF_INDEX_2:
353 (0,
"WARNING: vnet_l2_patch_add_del returned %d", rv);
375 .path =
"test l2patch",
376 .short_help =
"test l2patch rx <intfc> tx <intfc> [del]",
393 for (rx_sw_if_index = 0;
399 if (tx_sw_if_index != ~0)
427 .path =
"show l2patch",
428 .short_help =
"Show l2 interface cross-connect entries",
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 * l2_patch_init(vlib_main_t *vm)
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)
static_always_inline void l2_patch_inline(vlib_main_t *vm, vlib_node_runtime_t *node, l2_patch_main_t *l2pm, vlib_buffer_t **b, u16 *next, u32 n_left, int do_trace)
unformat_function_t unformat_vnet_sw_interface
#define VLIB_NODE_FN(node)
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 static_always_inline
#define VLIB_INIT_FUNCTION(x)
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
#define clib_error_return(e, args...)
vl_api_fib_path_type_t type
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_REGISTER_NODE(x,...)
static_always_inline void vlib_buffer_enqueue_to_next(vlib_main_t *vm, vlib_node_runtime_t *node, u32 *buffers, u16 *nexts, uword count)
l2_patch_main_t l2_patch_main
u32 * tx_next_by_rx_sw_if_index
#define ETHERNET_INTERFACE_FLAG_ACCEPT_ALL
vlib_node_registration_t l2_patch_node
(constructor) VLIB_REGISTER_NODE (l2_patch_node)
#define foreach_l2_patch_error
vlib_main_t vlib_node_runtime_t * node
#define VLIB_CLI_COMMAND(x,...)
vl_api_interface_index_t tx_sw_if_index
static_always_inline void l2_patch_trace(vlib_main_t *vm, vlib_node_runtime_t *node, l2_patch_main_t *l2pm, vlib_buffer_t *b, u32 sw_if_index)
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
u32 * tx_sw_if_index_by_rx_sw_if_index
static clib_error_t * test_patch_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
struct _vlib_node_registration vlib_node_registration_t
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
vlib_main_t vlib_node_runtime_t vlib_frame_t * frame
VLIB buffer representation.
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.
static vlib_node_t * vlib_get_node(vlib_main_t *vm, u32 i)
Get vlib node by index.
void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
static_always_inline void vlib_get_buffers(vlib_main_t *vm, u32 *bi, vlib_buffer_t **b, int count)
Translate array of buffer indices into buffer pointers.
#define VLIB_NODE_FLAG_TRACE
#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)
vl_api_interface_index_t sw_if_index
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)