FD.io VPP  v19.08-27-gf4dcae4
Vector Packet Processing
l2_rw.c File Reference

Layer 2 Rewrite. More...

+ Include dependency graph for l2_rw.c:

Go to the source code of this file.

Data Structures

struct  l2_rw_trace_t
 

Macros

#define foreach_l2_rw_error   _(UNKNOWN, "Unknown error")
 

Enumerations

enum  { L2_RW_NEXT_DROP, L2_RW_N_NEXT }
 
enum  l2_rw_error_t { L2_RW_N_ERROR }
 

Functions

static u8format_l2_rw_entry (u8 *s, va_list *args)
 
static u8format_l2_rw_config (u8 *s, va_list *args)
 
static u8format_l2_rw_trace (u8 *s, va_list *args)
 
static l2_rw_config_t * l2_rw_get_config (u32 sw_if_index)
 
static_always_inline void l2_rw_rewrite (l2_rw_entry_t *rwe, u8 *h)
 
VLIB_NODE_FN() l2_rw_node (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
 
int l2_rw_mod_entry (u32 *index, u8 *mask, u8 *value, u32 len, u32 skip, u8 is_del)
 
static clib_error_tl2_rw_entry_cli_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 
int l2_rw_interface_set_table (u32 sw_if_index, u32 table_index, u32 miss_index)
 
static clib_error_tl2_rw_interface_cli_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 
static clib_error_tl2_rw_show_interfaces_cli_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 
static clib_error_tl2_rw_show_entries_cli_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 
static int l2_rw_enable_disable (u32 bridge_domain, u8 disable)
 
static clib_error_tl2_rw_set_cli_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 
static clib_error_tl2_rw_init (vlib_main_t *vm)
 

Variables

l2_rw_main_t l2_rw_main
 
static vlib_cli_command_t l2_rw_entry_cli
 (constructor) VLIB_CLI_COMMAND (l2_rw_entry_cli) More...
 
static vlib_cli_command_t l2_rw_interface_cli
 (constructor) VLIB_CLI_COMMAND (l2_rw_interface_cli) More...
 
static vlib_cli_command_t l2_rw_show_interfaces_cli
 (constructor) VLIB_CLI_COMMAND (l2_rw_show_interfaces_cli) More...
 
static vlib_cli_command_t l2_rw_show_entries_cli
 (constructor) VLIB_CLI_COMMAND (l2_rw_show_entries_cli) More...
 
static vlib_cli_command_t l2_rw_set_cli
 (constructor) VLIB_CLI_COMMAND (l2_rw_set_cli) More...
 
static char * l2_rw_error_strings []
 
vlib_node_registration_t l2_rw_node
 (constructor) VLIB_REGISTER_NODE (l2_rw_node) More...
 

Detailed Description

Layer 2 Rewrite.

Layer 2-Rewrite node uses classify tables to match packets. Then, using the provisioned mask and value, modifies the packet header.

Definition in file l2_rw.c.

Macro Definition Documentation

#define foreach_l2_rw_error   _(UNKNOWN, "Unknown error")

Definition at line 673 of file l2_rw.c.

Enumeration Type Documentation

anonymous enum
Enumerator
L2_RW_NEXT_DROP 
L2_RW_N_NEXT 

Definition at line 667 of file l2_rw.c.

Enumerator
L2_RW_N_ERROR 

Definition at line 676 of file l2_rw.c.

Function Documentation

static u8* format_l2_rw_config ( u8 s,
va_list *  args 
)
static

Definition at line 57 of file l2_rw.c.

+ Here is the call graph for this function:

static u8* format_l2_rw_entry ( u8 s,
va_list *  args 
)
static

Definition at line 41 of file l2_rw.c.

+ Here is the call graph for this function:

static u8* format_l2_rw_trace ( u8 s,
va_list *  args 
)
static

Definition at line 66 of file l2_rw.c.

+ Here is the call graph for this function:

static int l2_rw_enable_disable ( u32  bridge_domain,
u8  disable 
)
static

Definition at line 601 of file l2_rw.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static clib_error_t* l2_rw_entry_cli_fn ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

Definition at line 401 of file l2_rw.c.

+ Here is the call graph for this function:

static l2_rw_config_t* l2_rw_get_config ( u32  sw_if_index)
inlinestatic

Definition at line 77 of file l2_rw.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static clib_error_t* l2_rw_init ( vlib_main_t vm)
static

Definition at line 651 of file l2_rw.c.

+ Here is the call graph for this function:

static clib_error_t* l2_rw_interface_cli_fn ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

Definition at line 478 of file l2_rw.c.

+ Here is the call graph for this function:

int l2_rw_interface_set_table ( u32  sw_if_index,
u32  table_index,
u32  miss_index 
)

Definition at line 459 of file l2_rw.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int l2_rw_mod_entry ( u32 index,
u8 mask,
u8 value,
u32  len,
u32  skip,
u8  is_del 
)

Definition at line 351 of file l2_rw.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

VLIB_NODE_FN() l2_rw_node ( vlib_main_t vm,
vlib_node_runtime_t node,
vlib_frame_t frame 
)

Definition at line 159 of file l2_rw.c.

+ Here is the call graph for this function:

static_always_inline void l2_rw_rewrite ( l2_rw_entry_t *  rwe,
u8 h 
)

Definition at line 92 of file l2_rw.c.

+ Here is the caller graph for this function:

static clib_error_t* l2_rw_set_cli_fn ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

Definition at line 609 of file l2_rw.c.

+ Here is the call graph for this function:

static clib_error_t* l2_rw_show_entries_cli_fn ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

Definition at line 567 of file l2_rw.c.

+ Here is the call graph for this function:

static clib_error_t* l2_rw_show_interfaces_cli_fn ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

Definition at line 532 of file l2_rw.c.

+ Here is the call graph for this function:

Variable Documentation

vlib_cli_command_t l2_rw_entry_cli
static
Initial value:
= {
.path = "l2 rewrite entry",
.short_help =
"l2 rewrite entry [index <index>] [mask <hex-mask>] [value <hex-value>] [skip <n_bytes>] [del]",
.function = l2_rw_entry_cli_fn,
}
static clib_error_t * l2_rw_entry_cli_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: l2_rw.c:401

(constructor) VLIB_CLI_COMMAND (l2_rw_entry_cli)

Definition at line 449 of file l2_rw.c.

char* l2_rw_error_strings[]
static
Initial value:
= {
#define _(sym,string)
}
#define foreach_l2_rw_error
Definition: l2_rw.c:673

Definition at line 684 of file l2_rw.c.

vlib_cli_command_t l2_rw_interface_cli
static
Initial value:
= {
.path = "set interface l2 rewrite",
.short_help =
"set interface l2 rewrite <interface> [table <table index>] [miss-index <entry-index>]",
}
static clib_error_t * l2_rw_interface_cli_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: l2_rw.c:478

(constructor) VLIB_CLI_COMMAND (l2_rw_interface_cli)

Definition at line 523 of file l2_rw.c.

l2_rw_main_t l2_rw_main

Definition at line 30 of file l2_rw.c.

Initial value:
= {
.name = "l2-rw",
.vector_size = sizeof (u32),
.format_trace = format_l2_rw_trace,
.error_strings = l2_rw_error_strings,
.runtime_data_bytes = 0,
.n_next_nodes = L2_RW_N_NEXT,
.next_nodes = { [L2_RW_NEXT_DROP] = "error-drop"},
}
static char * l2_rw_error_strings[]
Definition: l2_rw.c:684
unsigned int u32
Definition: types.h:88
vl_api_fib_path_type_t type
Definition: fib_types.api:123
static u8 * format_l2_rw_trace(u8 *s, va_list *args)
Definition: l2_rw.c:66
#define ARRAY_LEN(x)
Definition: clib.h:62

(constructor) VLIB_REGISTER_NODE (l2_rw_node)

Definition at line 691 of file l2_rw.c.

vlib_cli_command_t l2_rw_set_cli
static
Initial value:
= {
.path = "set bridge-domain rewrite",
.short_help =
"set bridge-domain rewrite <bridge-domain> [disable]",
.function = l2_rw_set_cli_fn,
}
static clib_error_t * l2_rw_set_cli_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: l2_rw.c:609

(constructor) VLIB_CLI_COMMAND (l2_rw_set_cli)

Definition at line 642 of file l2_rw.c.

vlib_cli_command_t l2_rw_show_entries_cli
static
Initial value:
= {
.path = "show l2 rewrite entries",
.short_help =
"show l2 rewrite entries",
}
static clib_error_t * l2_rw_show_entries_cli_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: l2_rw.c:567

(constructor) VLIB_CLI_COMMAND (l2_rw_show_entries_cli)

Definition at line 592 of file l2_rw.c.

vlib_cli_command_t l2_rw_show_interfaces_cli
static
Initial value:
= {
.path = "show l2 rewrite interfaces",
.short_help =
"show l2 rewrite interfaces",
}
static clib_error_t * l2_rw_show_interfaces_cli_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: l2_rw.c:532

(constructor) VLIB_CLI_COMMAND (l2_rw_show_interfaces_cli)

Definition at line 558 of file l2_rw.c.