FD.io VPP  v21.06-3-gbb25fbf28
Vector Packet Processing
l2_fwd.c File Reference

Ethernet Forwarding. More...

+ Include dependency graph for l2_fwd.c:

Go to the source code of this file.

Data Structures

struct  l2fwd_main_t
 
struct  l2fwd_trace_t
 

Macros

#define foreach_l2fwd_error
 

Enumerations

enum  l2fwd_error_t { L2FWD_N_ERROR }
 
enum  l2fwd_next_t { L2FWD_NEXT_L2_OUTPUT, L2FWD_NEXT_DROP, L2FWD_N_NEXT }
 

Functions

static u8format_l2fwd_trace (u8 *s, va_list *args)
 
static_always_inline void l2fwd_process (vlib_main_t *vm, vlib_node_runtime_t *node, l2fwd_main_t *msm, vlib_error_main_t *em, vlib_buffer_t *b0, u32 sw_if_index0, l2fib_entry_result_t *result0, u16 *next0)
 Forward one packet based on the mac table lookup result. More...
 
static_always_inline uword l2fwd_node_inline (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, int do_trace)
 
VLIB_NODE_FN() l2fwd_node (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
 
clib_error_tl2fwd_init (vlib_main_t *vm)
 
void l2fwd_register_input_type (vlib_main_t *vm, ethernet_type_t type, u32 node_index)
 Add the L3 input node for this ethertype to the next nodes structure. More...
 
static clib_error_tint_fwd (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 Set subinterface forward enable/disable. More...
 

Variables

l2fwd_main_t l2fwd_main
 
vlib_node_registration_t l2fwd_node
 (constructor) VLIB_REGISTER_NODE (l2fwd_node) More...
 
static char * l2fwd_error_strings []
 
static vlib_cli_command_t int_fwd_cli
 (constructor) VLIB_CLI_COMMAND (int_fwd_cli) More...
 

Detailed Description

Ethernet Forwarding.

Code in this file handles forwarding Layer 2 packets. This file calls the FIB lookup, packet learning and the packet flooding as necessary. Packet is then sent to the next graph node.

Definition in file l2_fwd.c.

Macro Definition Documentation

◆ foreach_l2fwd_error

#define foreach_l2fwd_error
Value:
_(L2FWD, "L2 forward packets") \
_(FLOOD, "L2 forward misses") \
_(HIT, "L2 forward hits") \
_(BVI_BAD_MAC, "BVI L3 MAC mismatch") \
_(BVI_ETHERTYPE, "BVI packet with unhandled ethertype") \
_(FILTER_DROP, "Filter Mac Drop") \
_(REFLECT_DROP, "Reflection Drop") \
_(STALE_DROP, "Stale entry Drop")

Definition at line 97 of file l2_fwd.c.

Enumeration Type Documentation

◆ l2fwd_error_t

Enumerator
L2FWD_N_ERROR 

Definition at line 107 of file l2_fwd.c.

◆ l2fwd_next_t

Enumerator
L2FWD_NEXT_L2_OUTPUT 
L2FWD_NEXT_DROP 
L2FWD_N_NEXT 

Definition at line 121 of file l2_fwd.c.

Function Documentation

◆ format_l2fwd_trace()

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

Definition at line 72 of file l2_fwd.c.

+ Here is the call graph for this function:

◆ int_fwd()

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

Set subinterface forward enable/disable.

The CLI format is: set interface l2 forward <interface> [disable]

Definition at line 486 of file l2_fwd.c.

+ Here is the call graph for this function:

◆ l2fwd_init()

clib_error_t* l2fwd_init ( vlib_main_t vm)

Definition at line 440 of file l2_fwd.c.

+ Here is the call graph for this function:

◆ l2fwd_node()

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

Definition at line 410 of file l2_fwd.c.

+ Here is the call graph for this function:

◆ l2fwd_node_inline()

static_always_inline uword l2fwd_node_inline ( vlib_main_t vm,
vlib_node_runtime_t node,
vlib_frame_t frame,
int  do_trace 
)

Definition at line 235 of file l2_fwd.c.

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

◆ l2fwd_process()

static_always_inline void l2fwd_process ( vlib_main_t vm,
vlib_node_runtime_t node,
l2fwd_main_t msm,
vlib_error_main_t em,
vlib_buffer_t b0,
u32  sw_if_index0,
l2fib_entry_result_t result0,
u16 next0 
)

Forward one packet based on the mac table lookup result.

Definition at line 131 of file l2_fwd.c.

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

◆ l2fwd_register_input_type()

void l2fwd_register_input_type ( vlib_main_t vm,
ethernet_type_t  type,
u32  node_index 
)

Add the L3 input node for this ethertype to the next nodes structure.

Definition at line 468 of file l2_fwd.c.

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

Variable Documentation

◆ int_fwd_cli

vlib_cli_command_t int_fwd_cli
static
Initial value:
= {
.path = "set interface l2 forward",
.short_help = "set interface l2 forward <interface> [disable]",
.function = int_fwd,
}

(constructor) VLIB_CLI_COMMAND (int_fwd_cli)

Definition at line 532 of file l2_fwd.c.

◆ l2fwd_error_strings

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

Definition at line 115 of file l2_fwd.c.

◆ l2fwd_main

l2fwd_main_t l2fwd_main

Definition at line 90 of file l2_fwd.c.

◆ l2fwd_node

Initial value:
= {
.name = "l2-fwd",
.vector_size = sizeof (u32),
.format_trace = format_l2fwd_trace,
.error_strings = l2fwd_error_strings,
.n_next_nodes = L2FWD_N_NEXT,
.next_nodes = {
[L2FWD_NEXT_L2_OUTPUT] = "l2-output",
[L2FWD_NEXT_DROP] = "error-drop",
},
}

(constructor) VLIB_REGISTER_NODE (l2fwd_node)

Definition at line 419 of file l2_fwd.c.

VLIB_NODE_TYPE_INTERNAL
@ VLIB_NODE_TYPE_INTERNAL
Definition: node.h:72
L2FWD_NEXT_DROP
@ L2FWD_NEXT_DROP
Definition: l2_fwd.c:124
ARRAY_LEN
#define ARRAY_LEN(x)
Definition: clib.h:70
L2FWD_NEXT_L2_OUTPUT
@ L2FWD_NEXT_L2_OUTPUT
Definition: l2_fwd.c:123
int_fwd
static clib_error_t * int_fwd(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Set subinterface forward enable/disable.
Definition: l2_fwd.c:486
l2fwd_error_strings
static char * l2fwd_error_strings[]
Definition: l2_fwd.c:115
format_l2fwd_trace
static u8 * format_l2fwd_trace(u8 *s, va_list *args)
Definition: l2_fwd.c:72
foreach_l2fwd_error
#define foreach_l2fwd_error
Definition: l2_fwd.c:97
u32
unsigned int u32
Definition: types.h:88
L2FWD_N_NEXT
@ L2FWD_N_NEXT
Definition: l2_fwd.c:125
type
vl_api_fib_path_type_t type
Definition: fib_types.api:123