FD.io VPP  v21.06-3-gbb25fbf28
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 629 of file l2_rw.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
L2_RW_NEXT_DROP 
L2_RW_N_NEXT 

Definition at line 623 of file l2_rw.c.

◆ l2_rw_error_t

Enumerator
L2_RW_N_ERROR 

Definition at line 632 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 caller 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:
+ Here is the caller 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.

◆ l2_rw_enable_disable()

static int l2_rw_enable_disable ( u32  bridge_domain,
u8  disable 
)
static

Definition at line 557 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 357 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 607 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 434 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 415 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 565 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 523 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 488 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,
}

(constructor) VLIB_CLI_COMMAND (l2_rw_entry_cli)

Definition at line 405 of file l2_rw.c.

◆ l2_rw_error_strings

char* l2_rw_error_strings[]
static
Initial value:
= {
#define _(sym,string)
}

Definition at line 640 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>]",
}

(constructor) VLIB_CLI_COMMAND (l2_rw_interface_cli)

Definition at line 479 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"},
}

(constructor) VLIB_REGISTER_NODE (l2_rw_node)

Definition at line 647 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,
}

(constructor) VLIB_CLI_COMMAND (l2_rw_set_cli)

Definition at line 598 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",
}

(constructor) VLIB_CLI_COMMAND (l2_rw_show_entries_cli)

Definition at line 548 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",
}

(constructor) VLIB_CLI_COMMAND (l2_rw_show_interfaces_cli)

Definition at line 514 of file l2_rw.c.

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:565
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)
Definition: l2_rw.c:434
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:357
VLIB_NODE_TYPE_INTERNAL
@ VLIB_NODE_TYPE_INTERNAL
Definition: node.h:72
L2_RW_N_NEXT
@ L2_RW_N_NEXT
Definition: l2_rw.c:626
format_l2_rw_trace
static u8 * format_l2_rw_trace(u8 *s, va_list *args)
Definition: l2_rw.c:67
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)
Definition: l2_rw.c:488
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)
Definition: l2_rw.c:523
ARRAY_LEN
#define ARRAY_LEN(x)
Definition: clib.h:70
u32
unsigned int u32
Definition: types.h:88
L2_RW_NEXT_DROP
@ L2_RW_NEXT_DROP
Definition: l2_rw.c:625
type
vl_api_fib_path_type_t type
Definition: fib_types.api:123
l2_rw_error_strings
static char * l2_rw_error_strings[]
Definition: l2_rw.c:640
foreach_l2_rw_error
#define foreach_l2_rw_error
Definition: l2_rw.c:629