FD.io VPP  v20.01-48-g3e0dafb74
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

◆ foreach_l2_rw_error

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

Definition at line 632 of file l2_rw.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
L2_RW_NEXT_DROP 
L2_RW_N_NEXT 

Definition at line 626 of file l2_rw.c.

◆ l2_rw_error_t

Enumerator
L2_RW_N_ERROR 

Definition at line 635 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 58 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 42 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 67 of file l2_rw.c.

+ Here is the call graph for this function:

◆ l2_rw_enable_disable()

static int l2_rw_enable_disable ( u32  bridge_domain,
u8  disable 
)
static

Definition at line 560 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 360 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 78 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 610 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 437 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 418 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 310 of file l2_rw.c.

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

◆ l2_rw_node()

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

Definition at line 118 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 93 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 568 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 526 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 491 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:360

(constructor) VLIB_CLI_COMMAND (l2_rw_entry_cli)

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

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

(constructor) VLIB_CLI_COMMAND (l2_rw_interface_cli)

Definition at line 482 of file l2_rw.c.

◆ l2_rw_main

l2_rw_main_t l2_rw_main

Definition at line 31 of file l2_rw.c.

◆ l2_rw_node

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:643
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:67
#define ARRAY_LEN(x)
Definition: clib.h:62

(constructor) VLIB_REGISTER_NODE (l2_rw_node)

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

(constructor) VLIB_CLI_COMMAND (l2_rw_set_cli)

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

(constructor) VLIB_CLI_COMMAND (l2_rw_show_entries_cli)

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

(constructor) VLIB_CLI_COMMAND (l2_rw_show_interfaces_cli)

Definition at line 517 of file l2_rw.c.