FD.io VPP  v19.01.3-6-g70449b9b9
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, modifies the packet header.

Definition in file l2_rw.c.

Macro Definition Documentation

◆ foreach_l2_rw_error

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

Definition at line 670 of file l2_rw.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
L2_RW_NEXT_DROP 
L2_RW_N_NEXT 

Definition at line 664 of file l2_rw.c.

◆ l2_rw_error_t

Enumerator
L2_RW_N_ERROR 

Definition at line 673 of file l2_rw.c.

Function Documentation

◆ format_l2_rw_config()

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:

◆ format_l2_rw_entry()

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:

◆ format_l2_rw_trace()

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:

◆ l2_rw_enable_disable()

int l2_rw_enable_disable ( u32  bridge_domain,
u8  disable 
)

Definition at line 598 of file l2_rw.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this 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 
)
static

Definition at line 400 of file l2_rw.c.

+ Here is the call graph for this function:

◆ l2_rw_get_config()

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:

◆ l2_rw_init()

static clib_error_t* l2_rw_init ( vlib_main_t vm)
static

Definition at line 648 of file l2_rw.c.

+ Here is the call graph for this function:

◆ l2_rw_interface_cli_fn()

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 475 of file l2_rw.c.

+ Here is the call graph for this function:

◆ l2_rw_interface_set_table()

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

Definition at line 457 of file l2_rw.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ l2_rw_mod_entry()

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:

◆ l2_rw_node_fn()

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:

◆ l2_rw_rewrite()

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:

◆ 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 
)
static

Definition at line 606 of file l2_rw.c.

+ Here is the call graph for this function:

◆ l2_rw_show_entries_cli_fn()

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 564 of file l2_rw.c.

+ Here is the call graph for this function:

◆ l2_rw_show_interfaces_cli_fn()

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 529 of file l2_rw.c.

+ Here is the call graph for this function:

Variable Documentation

◆ l2_rw_entry_cli

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:400

(constructor) VLIB_CLI_COMMAND (l2_rw_entry_cli)

Definition at line 448 of file l2_rw.c.

◆ l2_rw_error_strings

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

Definition at line 681 of file l2_rw.c.

◆ l2_rw_interface_cli

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:475

(constructor) VLIB_CLI_COMMAND (l2_rw_interface_cli)

Definition at line 520 of file l2_rw.c.

◆ l2_rw_main

l2_rw_main_t l2_rw_main

Definition at line 29 of file l2_rw.c.

◆ l2_rw_node

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:681
unsigned int u32
Definition: types.h:88
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:62

(constructor) VLIB_REGISTER_NODE (l2_rw_node)

Definition at line 31 of file l2_rw.c.

◆ l2_rw_set_cli

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:606

(constructor) VLIB_CLI_COMMAND (l2_rw_set_cli)

Definition at line 639 of file l2_rw.c.

◆ l2_rw_show_entries_cli

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:564

(constructor) VLIB_CLI_COMMAND (l2_rw_show_entries_cli)

Definition at line 589 of file l2_rw.c.

◆ l2_rw_show_interfaces_cli

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:529

(constructor) VLIB_CLI_COMMAND (l2_rw_show_interfaces_cli)

Definition at line 555 of file l2_rw.c.