FD.io VPP  v18.01.2-1-g9b554f3
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)
 
static uword l2_rw_node_fn (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)
 
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
 
vlib_node_registration_t l2_rw_node
 (constructor) VLIB_REGISTER_NODE (l2_rw_node) More...
 
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 []
 

Detailed Description

Layer 2 Rewrite.

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

Definition in file l2_rw.c.

Macro Definition Documentation

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

Definition at line 671 of file l2_rw.c.

Enumeration Type Documentation

anonymous enum
Enumerator
L2_RW_NEXT_DROP 
L2_RW_N_NEXT 

Definition at line 665 of file l2_rw.c.

Enumerator
L2_RW_N_ERROR 

Definition at line 674 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:

int l2_rw_enable_disable ( u32  bridge_domain,
u8  disable 
)

Definition at line 599 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 649 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 476 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 458 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 352 of file l2_rw.c.

+ Here is the caller graph for this function:

static uword l2_rw_node_fn ( vlib_main_t vm,
vlib_node_runtime_t node,
vlib_frame_t frame 
)
static

Definition at line 160 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 607 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 565 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 530 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:671

Definition at line 682 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:476

(constructor) VLIB_CLI_COMMAND (l2_rw_interface_cli)

Definition at line 521 of file l2_rw.c.

l2_rw_main_t l2_rw_main

Definition at line 29 of file l2_rw.c.

Initial value:
= {
.function = l2_rw_node_fn,
.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:682
static u8 * format_l2_rw_trace(u8 *s, va_list *args)
Definition: l2_rw.c:66
static uword l2_rw_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
Definition: l2_rw.c:160
#define ARRAY_LEN(x)
Definition: clib.h:59
unsigned int u32
Definition: types.h:88

(constructor) VLIB_REGISTER_NODE (l2_rw_node)

Definition at line 31 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:607

(constructor) VLIB_CLI_COMMAND (l2_rw_set_cli)

Definition at line 640 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:565

(constructor) VLIB_CLI_COMMAND (l2_rw_show_entries_cli)

Definition at line 590 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:530

(constructor) VLIB_CLI_COMMAND (l2_rw_show_interfaces_cli)

Definition at line 556 of file l2_rw.c.