FD.io VPP  v18.07-rc0-415-g6c78436
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, u32 *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)
 
static uword l2fwd_node_fn (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
 
static 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

#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 88 of file l2_fwd.c.

Enumeration Type Documentation

Enumerator
L2FWD_N_ERROR 

Definition at line 98 of file l2_fwd.c.

Enumerator
L2FWD_NEXT_L2_OUTPUT 
L2FWD_NEXT_DROP 
L2FWD_N_NEXT 

Definition at line 112 of file l2_fwd.c.

Function Documentation

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

Definition at line 71 of file l2_fwd.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 526 of file l2_fwd.c.

+ Here is the call graph for this function:

clib_error_t* l2fwd_init ( vlib_main_t vm)

Definition at line 480 of file l2_fwd.c.

+ Here is the call graph for this function:

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

Definition at line 450 of file l2_fwd.c.

+ Here is the call graph for this function:

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 226 of file l2_fwd.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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,
u32 next0 
)

Forward one packet based on the mac table lookup result.

Definition at line 122 of file l2_fwd.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 508 of file l2_fwd.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

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,
}
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:526

(constructor) VLIB_CLI_COMMAND (int_fwd_cli)

Definition at line 572 of file l2_fwd.c.

char* l2fwd_error_strings[]
static
Initial value:
= {
#define _(sym,string)
}
#define foreach_l2fwd_error
Definition: l2_fwd.c:88

Definition at line 106 of file l2_fwd.c.

l2fwd_main_t l2fwd_main

Definition at line 84 of file l2_fwd.c.

static vlib_node_registration_t l2fwd_node
static
Initial value:
= {
.function = l2fwd_node_fn,
.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",
},
}
static uword l2fwd_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
Definition: l2_fwd.c:450
unsigned int u32
Definition: types.h:88
static char * l2fwd_error_strings[]
Definition: l2_fwd.c:106
static u8 * format_l2fwd_trace(u8 *s, va_list *args)
Definition: l2_fwd.c:71
#define ARRAY_LEN(x)
Definition: clib.h:59

(constructor) VLIB_REGISTER_NODE (l2fwd_node)

Definition at line 86 of file l2_fwd.c.