FD.io VPP  v19.01.3-6-g70449b9b9
Vector Packet Processing
l2e.c File Reference
+ Include dependency graph for l2e.c:

Go to the source code of this file.

Data Structures

struct  l2_emulation_main_t_
 Grouping of global data for the L2 emulation feature. More...
 
struct  l2_emulation_t_
 Per-interface L2 configuration. More...
 
struct  l2_emulation_trace_t_
 per-packet trace data More...
 

Macros

#define foreach_l2_emulation
 

Typedefs

typedef struct l2_emulation_main_t_ l2_emulation_main_t
 Grouping of global data for the L2 emulation feature. More...
 
typedef struct l2_emulation_t_ l2_emulation_t
 Per-interface L2 configuration. More...
 
typedef struct l2_emulation_trace_t_ l2_emulation_trace_t
 per-packet trace data More...
 

Enumerations

enum  l2_emulation_error_t { L2_EMULATION_N_ERROR }
 
enum  l2_emulation_next_t { L2_EMULATION_N_NEXT }
 

Functions

void l2_emulation_enable (u32 sw_if_index)
 L2 Emulation is a feautre that is applied to L2 ports to 'extract' IP packets from the L2 path and inject them into the L3 path (i.e. More...
 
void l2_emulation_disable (u32 sw_if_index)
 
static clib_error_tl2_emulation_interface_add_del (vnet_main_t *vnm, u32 sw_if_index, u32 is_add)
 
 VNET_SW_INTERFACE_ADD_DEL_FUNCTION (l2_emulation_interface_add_del)
 
static clib_error_tl2_emulation_cli (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 
static clib_error_tl2_emulation_show (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 
static uword l2_emulation_node_fn (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
 
static u8format_l2_emulation_trace (u8 *s, va_list *args)
 
 VLIB_NODE_FUNCTION_MULTIARCH (l2_emulation_node, l2_emulation_node_fn)
 
static clib_error_tl2_emulation_init (vlib_main_t *vm)
 

Variables

static l2_emulation_main_t l2_emulation_main
 
static const l2_emulation_t ezero = { }
 A zero'd out struct we can use in the vec_validate. More...
 
l2_emulation_tl2_emulations
 Per-interface vector of emulation configs. More...
 
static vlib_cli_command_t l2_emulation_cli_node
 (constructor) VLIB_CLI_COMMAND (l2_emulation_cli_node) More...
 
static vlib_cli_command_t l2_emulation_show_node
 (constructor) VLIB_CLI_COMMAND (l2_emulation_show_node) More...
 
static char * l2_emulation_error_strings []
 
vlib_node_registration_t l2_emulation_node
 (constructor) VLIB_REGISTER_NODE (l2_emulation_node) More...
 

Macro Definition Documentation

◆ foreach_l2_emulation

#define foreach_l2_emulation
Value:
_(IP4, "Extract IPv4") \
_(IP6, "Extract IPv6")
Definition: lisp_types.h:37
Definition: lisp_types.h:38

Definition at line 194 of file l2e.c.

Typedef Documentation

◆ l2_emulation_main_t

Grouping of global data for the L2 emulation feature.

◆ l2_emulation_t

Per-interface L2 configuration.

◆ l2_emulation_trace_t

per-packet trace data

Enumeration Type Documentation

◆ l2_emulation_error_t

Enumerator
L2_EMULATION_N_ERROR 

Definition at line 198 of file l2e.c.

◆ l2_emulation_next_t

Enumerator
L2_EMULATION_N_NEXT 

Definition at line 212 of file l2e.c.

Function Documentation

◆ format_l2_emulation_trace()

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

Definition at line 428 of file l2e.c.

+ Here is the call graph for this function:

◆ l2_emulation_cli()

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

Definition at line 108 of file l2e.c.

+ Here is the call graph for this function:

◆ l2_emulation_disable()

void l2_emulation_disable ( u32  sw_if_index)

Definition at line 80 of file l2e.c.

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

◆ l2_emulation_enable()

void l2_emulation_enable ( u32  sw_if_index)

L2 Emulation is a feautre that is applied to L2 ports to 'extract' IP packets from the L2 path and inject them into the L3 path (i.e.

into the appropriate ip[4|6]_input node). L3 routes in the table_id for that interface should then be configured as DVR routes, therefore the forwarded packet has the L2 header preserved and togehter the L3 routed system behaves like an L2 bridge.

Definition at line 59 of file l2e.c.

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

◆ l2_emulation_init()

static clib_error_t* l2_emulation_init ( vlib_main_t vm)
static

Definition at line 464 of file l2e.c.

+ Here is the call graph for this function:

◆ l2_emulation_interface_add_del()

static clib_error_t* l2_emulation_interface_add_del ( vnet_main_t vnm,
u32  sw_if_index,
u32  is_add 
)
static

Definition at line 94 of file l2e.c.

+ Here is the call graph for this function:

◆ l2_emulation_node_fn()

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

Definition at line 230 of file l2e.c.

+ Here is the call graph for this function:

◆ l2_emulation_show()

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

Definition at line 158 of file l2e.c.

+ Here is the call graph for this function:

◆ VLIB_NODE_FUNCTION_MULTIARCH()

VLIB_NODE_FUNCTION_MULTIARCH ( l2_emulation_node  ,
l2_emulation_node_fn   
)

◆ VNET_SW_INTERFACE_ADD_DEL_FUNCTION()

VNET_SW_INTERFACE_ADD_DEL_FUNCTION ( l2_emulation_interface_add_del  )
+ Here is the caller graph for this function:

Variable Documentation

◆ ezero

const l2_emulation_t ezero = { }
static

A zero'd out struct we can use in the vec_validate.

Definition at line 51 of file l2e.c.

◆ l2_emulation_cli_node

vlib_cli_command_t l2_emulation_cli_node
static
Initial value:
= {
.path = "set interface l2 l2-emulation",
.short_help =
"set interface l2 l2-emulation <interface-name> [disable|enable]\n",
.function = l2_emulation_cli,
}
static clib_error_t * l2_emulation_cli(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: l2e.c:108

(constructor) VLIB_CLI_COMMAND (l2_emulation_cli_node)

Definition at line 149 of file l2e.c.

◆ l2_emulation_error_strings

char* l2_emulation_error_strings[]
static
Initial value:
= {
#define _(sym,string)
}
#define foreach_l2_emulation
Definition: l2e.c:194

Definition at line 206 of file l2e.c.

◆ l2_emulation_main

l2_emulation_main_t l2_emulation_main
static

Definition at line 34 of file l2e.c.

◆ l2_emulation_node

vlib_node_registration_t l2_emulation_node
Initial value:
= {
.function = l2_emulation_node_fn,
.name = "l2-emulation",
.vector_size = sizeof (u32),
.format_trace = format_l2_emulation_trace,
.error_strings = l2_emulation_error_strings,
.n_next_nodes = L2_EMULATION_N_NEXT,
.next_nodes = {
[L2_EMULATION_NEXT_IP4] = "ip4-input",
[L2_EMULATION_NEXT_IP6] = "ip6-input",
},
}
static char * l2_emulation_error_strings[]
Definition: l2e.c:206
unsigned int u32
Definition: types.h:88
static u8 * format_l2_emulation_trace(u8 *s, va_list *args)
Definition: l2e.c:428
#define ARRAY_LEN(x)
Definition: clib.h:62
static uword l2_emulation_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
Definition: l2e.c:230

(constructor) VLIB_REGISTER_NODE (l2_emulation_node)

Definition at line 440 of file l2e.c.

◆ l2_emulation_show_node

vlib_cli_command_t l2_emulation_show_node
static
Initial value:
= {
.path = "show interface l2 l2-emulation",
.short_help = "show interface l2 l2-emulation\n",
.function = l2_emulation_show,
}
static clib_error_t * l2_emulation_show(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: l2e.c:158

(constructor) VLIB_CLI_COMMAND (l2_emulation_show_node)

Definition at line 187 of file l2e.c.

◆ l2_emulations

l2_emulation_t* l2_emulations

Per-interface vector of emulation configs.

Definition at line 56 of file l2e.c.