FD.io VPP  v21.06-3-gbb25fbf28
Vector Packet Processing
l2_xcrw.c File Reference
+ Include dependency graph for l2_xcrw.c:

Go to the source code of this file.

Data Structures

struct  l2_xcrw_trace_t
 

Functions

static u8format_l2_xcrw_trace (u8 *s, va_list *args)
 
VLIB_NODE_FN() l2_xcrw_node (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
 
clib_error_tl2_xcrw_init (vlib_main_t *vm)
 
static u8format_xcrw_name (u8 *s, va_list *args)
 
 VNET_DEVICE_CLASS (xcrw_device_class, static)
 
static u32 create_xcrw_interface (vlib_main_t *vm)
 
int vnet_configure_l2_xcrw (vlib_main_t *vm, vnet_main_t *vnm, u32 l2_sw_if_index, u32 tx_fib_index, u8 *rewrite, u32 next_node_index, int is_add)
 
static clib_error_tset_l2_xcrw_command_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 
static u8format_l2xcrw (u8 *s, va_list *args)
 
static clib_error_tshow_l2xcrw_command_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 

Variables

l2_xcrw_main_t l2_xcrw_main
 
static char * l2_xcrw_error_strings []
 
vlib_node_registration_t l2_xcrw_node
 (constructor) VLIB_REGISTER_NODE (l2_xcrw_node) More...
 
static vlib_cli_command_t set_l2_xcrw_command
 (constructor) VLIB_CLI_COMMAND (set_l2_xcrw_command) More...
 
static vlib_cli_command_t show_l2xcrw_command
 (constructor) VLIB_CLI_COMMAND (show_l2xcrw_command) More...
 

Detailed Description

General L2 / L3 cross-connect, used to set up "L2 interface <--> your-favorite-tunnel-encap" tunnels.

We set up a typical L2 cross-connect or (future) bridge to hook L2 interface(s) up to the L3 stack in arbitrary ways.

Each l2_xcrw adjacency specifies 3 things:

  1. The next graph node (presumably in the L3 stack) to process the (L2 -> L3) packet
  2. A new value for vnet_buffer(b)->sw_if_indexVLIB_TX,
  3. A rewrite string to apply.

Example: to cross-connect an L2 interface or (future) bridge to an mpls-o-gre tunnel, set up the L2 rewrite string as shown in mpls_gre_rewrite, and use "mpls-post-rewrite" to fix the GRE IP header checksum and length fields.

Definition in file l2_xcrw.c.

Function Documentation

◆ create_xcrw_interface()

static u32 create_xcrw_interface ( vlib_main_t vm)
static

Definition at line 291 of file l2_xcrw.c.

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

◆ format_l2_xcrw_trace()

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

Definition at line 49 of file l2_xcrw.c.

◆ format_l2xcrw()

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

Definition at line 512 of file l2_xcrw.c.

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

◆ format_xcrw_name()

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

Definition at line 276 of file l2_xcrw.c.

◆ l2_xcrw_init()

clib_error_t* l2_xcrw_init ( vlib_main_t vm)

Definition at line 262 of file l2_xcrw.c.

◆ l2_xcrw_node()

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

Definition at line 72 of file l2_xcrw.c.

+ Here is the call graph for this function:

◆ set_l2_xcrw_command_fn()

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

Definition at line 392 of file l2_xcrw.c.

+ Here is the call graph for this function:

◆ show_l2xcrw_command_fn()

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

Definition at line 556 of file l2_xcrw.c.

+ Here is the call graph for this function:

◆ vnet_configure_l2_xcrw()

int vnet_configure_l2_xcrw ( vlib_main_t vm,
vnet_main_t vnm,
u32  l2_sw_if_index,
u32  tx_fib_index,
u8 rewrite,
u32  next_node_index,
int  is_add 
)

Definition at line 321 of file l2_xcrw.c.

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

◆ VNET_DEVICE_CLASS()

VNET_DEVICE_CLASS ( xcrw_device_class  ,
static   
)

Variable Documentation

◆ l2_xcrw_error_strings

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

Definition at line 66 of file l2_xcrw.c.

◆ l2_xcrw_main

l2_xcrw_main_t l2_xcrw_main

Definition at line 63 of file l2_xcrw.c.

◆ l2_xcrw_node

Initial value:
= {
.name = "l2-xcrw",
.vector_size = sizeof (u32),
.format_trace = format_l2_xcrw_trace,
.error_strings = l2_xcrw_error_strings,
.n_next_nodes = L2_XCRW_N_NEXT,
.next_nodes = {
[L2_XCRW_NEXT_DROP] = "error-drop",
},
}

(constructor) VLIB_REGISTER_NODE (l2_xcrw_node)

Definition at line 242 of file l2_xcrw.c.

◆ set_l2_xcrw_command

vlib_cli_command_t set_l2_xcrw_command
static
Initial value:
= {
.path = "set interface l2 xcrw",
.short_help =
"set interface l2 xcrw <interface> next <node-name>\n"
" [del] [tx-fib-id <id>] [ipv6] rw <hex-bytes>",
}

(constructor) VLIB_CLI_COMMAND (set_l2_xcrw_command)

Definition at line 500 of file l2_xcrw.c.

◆ show_l2xcrw_command

vlib_cli_command_t show_l2xcrw_command
static
Initial value:
= {
.path = "show l2xcrw",
.short_help = "show l2xcrw",
}

(constructor) VLIB_CLI_COMMAND (show_l2xcrw_command)

Definition at line 589 of file l2_xcrw.c.

show_l2xcrw_command_fn
static clib_error_t * show_l2xcrw_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: l2_xcrw.c:556
VLIB_NODE_TYPE_INTERNAL
@ VLIB_NODE_TYPE_INTERNAL
Definition: node.h:72
format_l2_xcrw_trace
static u8 * format_l2_xcrw_trace(u8 *s, va_list *args)
Definition: l2_xcrw.c:49
ARRAY_LEN
#define ARRAY_LEN(x)
Definition: clib.h:70
L2_XCRW_NEXT_DROP
@ L2_XCRW_NEXT_DROP
Definition: l2_xcrw.h:66
set_l2_xcrw_command_fn
static clib_error_t * set_l2_xcrw_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: l2_xcrw.c:392
L2_XCRW_N_NEXT
@ L2_XCRW_N_NEXT
Definition: l2_xcrw.h:67
l2_xcrw_error_strings
static char * l2_xcrw_error_strings[]
Definition: l2_xcrw.c:66
u32
unsigned int u32
Definition: types.h:88
foreach_l2_xcrw_error
#define foreach_l2_xcrw_error
Definition: l2_xcrw.h:70
type
vl_api_fib_path_type_t type
Definition: fib_types.api:123