FD.io VPP  v18.01.2-1-g9b554f3
Vector Packet Processing
l2_output.c File Reference
+ Include dependency graph for l2_output.c:

Go to the source code of this file.

Data Structures

struct  l2output_trace_t
 

Macros

#define foreach_l2output_bad_intf_error   _(DROP, "L2 output to interface not in L2 mode or deleted")
 

Enumerations

enum  l2output_bad_intf_error_t { L2OUTPUT_BAD_INTF_N_ERROR }
 

Functions

char ** l2output_get_feat_names (void)
 
u8format_l2_output_features (u8 *s, va_list *args)
 
static u8format_l2output_trace (u8 *s, va_list *args)
 
static_always_inline u32 split_horizon_violation (u8 shg1, u8 shg2)
 Check for split horizon violations. More...
 
static_always_inline void l2_output_dispatch (vlib_buffer_t *b0, vlib_node_runtime_t *node, u32 *cached_sw_if_index, u32 *cached_next_index, u32 sw_if_index, u32 feature_bitmap, u32 *next0)
 Determine the next L2 node based on the output feature bitmap. More...
 
static_always_inline void l2output_vtr (vlib_node_runtime_t *node, l2_output_config_t *config, u32 feature_bitmap, vlib_buffer_t *b, u32 *next)
 
static_always_inline uword l2output_node_inline (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, int do_trace)
 
static uword l2output_node_fn (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
 
 VLIB_NODE_FUNCTION_MULTIARCH (l2output_node, l2output_node_fn)
 
static uword l2output_bad_intf_node_fn (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
 
 VLIB_NODE_FUNCTION_MULTIARCH (l2output_bad_intf_node, l2output_bad_intf_node_fn)
 
static clib_error_tl2output_init (vlib_main_t *vm)
 
void l2output_create_output_node_mapping (vlib_main_t *vlib_main, vnet_main_t *vnet_main, u32 sw_if_index)
 Create a mapping in the next node mapping table for the given sw_if_index. More...
 
l2_output_config_tl2output_intf_config (u32 sw_if_index)
 Get a pointer to the config for the given interface. More...
 
void l2output_intf_bitmap_enable (u32 sw_if_index, u32 feature_bitmap, u32 enable)
 Enable (or disable) the feature in the bitmap for the given interface. More...
 

Variables

static char * l2output_feat_names []
 
l2output_main_t l2output_main
 
static char * l2output_error_strings []
 
vlib_node_registration_t l2output_node
 (constructor) VLIB_REGISTER_NODE (l2output_node) More...
 
static char * l2output_bad_intf_error_strings []
 
static vlib_node_registration_t l2output_bad_intf_node
 Output node for interfaces/tunnels which was in L2 mode but were changed to L3 mode or possibly deleted thereafter. More...
 

Macro Definition Documentation

#define foreach_l2output_bad_intf_error   _(DROP, "L2 output to interface not in L2 mode or deleted")

Definition at line 524 of file l2_output.c.

Enumeration Type Documentation

Enumerator
L2OUTPUT_BAD_INTF_N_ERROR 

Definition at line 533 of file l2_output.c.

Function Documentation

u8* format_l2_output_features ( u8 s,
va_list *  args 
)

Definition at line 44 of file l2_output.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 79 of file l2_output.c.

+ Here is the call graph for this function:

static_always_inline void l2_output_dispatch ( vlib_buffer_t b0,
vlib_node_runtime_t node,
u32 cached_sw_if_index,
u32 cached_next_index,
u32  sw_if_index,
u32  feature_bitmap,
u32 next0 
)

Determine the next L2 node based on the output feature bitmap.

Definition at line 126 of file l2_output.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 556 of file l2_output.c.

+ Here is the call graph for this function:

void l2output_create_output_node_mapping ( vlib_main_t vlib_main,
vnet_main_t vnet_main,
u32  sw_if_index 
)

Create a mapping in the next node mapping table for the given sw_if_index.

The next set of functions is for use by output feature graph nodes.

Definition at line 662 of file l2_output.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

char** l2output_get_feat_names ( void  )

Definition at line 38 of file l2_output.c.

+ Here is the caller graph for this function:

static clib_error_t* l2output_init ( vlib_main_t vm)
static

Definition at line 632 of file l2_output.c.

+ Here is the call graph for this function:

void l2output_intf_bitmap_enable ( u32  sw_if_index,
u32  feature_bitmap,
u32  enable 
)

Enable (or disable) the feature in the bitmap for the given interface.

Definition at line 686 of file l2_output.c.

+ Here is the caller graph for this function:

l2_output_config_t* l2output_intf_config ( u32  sw_if_index)

Get a pointer to the config for the given interface.

Definition at line 676 of file l2_output.c.

+ Here is the caller graph for this function:

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

Definition at line 492 of file l2_output.c.

+ Here is the call graph for this function:

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

Definition at line 222 of file l2_output.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static_always_inline void l2output_vtr ( vlib_node_runtime_t node,
l2_output_config_t config,
u32  feature_bitmap,
vlib_buffer_t b,
u32 next 
)

Definition at line 176 of file l2_output.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static_always_inline u32 split_horizon_violation ( u8  shg1,
u8  shg2 
)

Check for split horizon violations.

Return 0 if split horizon check passes, otherwise return non-zero. Packets should not be transmitted out an interface with the same split-horizon group as the input interface, except if the shg is 0 in which case the check always passes.

Definition at line 112 of file l2_output.c.

+ Here is the caller graph for this function:

VLIB_NODE_FUNCTION_MULTIARCH ( l2output_node  ,
l2output_node_fn   
)

+ Here is the caller graph for this function:

VLIB_NODE_FUNCTION_MULTIARCH ( l2output_bad_intf_node  ,
l2output_bad_intf_node_fn   
)

Variable Documentation

char* l2output_bad_intf_error_strings[]
static
Initial value:
= {
#define _(sym,string)
}
#define foreach_l2output_bad_intf_error
Definition: l2_output.c:524

Definition at line 527 of file l2_output.c.

static vlib_node_registration_t l2output_bad_intf_node
static
Initial value:
= {
.name = "l2-output-bad-intf",
.vector_size = sizeof (u32),
.n_next_nodes = 1,
.next_nodes = {
[0] = "error-drop",
},
}
static uword l2output_bad_intf_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
Definition: l2_output.c:556
#define ARRAY_LEN(x)
Definition: clib.h:59
unsigned int u32
Definition: types.h:88
static char * l2output_bad_intf_error_strings[]
Definition: l2_output.c:527

Output node for interfaces/tunnels which was in L2 mode but were changed to L3 mode or possibly deleted thereafter.

(constructor) VLIB_REGISTER_NODE (l2output_bad_intf_node)

On changing forwarding mode of any tunnel/interface from L2 to L3, its entry in l2_output_main table next_nodes.output_node_index_vec[sw_if_index] MUST be set to the value of L2OUTPUT_NEXT_BAD_INTF. Thus, if there are stale entries in the L2FIB for this sw_if_index, l2-output will send packets for this sw_if_index to the l2-output-bad-intf node which just setup the proper drop reason before sending packets to the error-drop node to drop the packet. Then, stale L2FIB entries for delted tunnels won't cause possible packet or memory corrpution.

Definition at line 553 of file l2_output.c.

char* l2output_error_strings[]
static
Initial value:
= {
#define _(sym,string)
}
#define foreach_l2output_error
Definition: l2_output.h:118

Definition at line 98 of file l2_output.c.

char* l2output_feat_names[]
static
Initial value:

Definition at line 31 of file l2_output.c.

l2output_main_t l2output_main

Definition at line 66 of file l2_output.c.

vlib_node_registration_t l2output_node
Initial value:
= {
.function = l2output_node_fn,
.name = "l2-output",
.vector_size = sizeof (u32),
.format_trace = format_l2output_trace,
.error_strings = l2output_error_strings,
.n_next_nodes = L2OUTPUT_N_NEXT,
.next_nodes = {
[L2OUTPUT_NEXT_DROP] = "error-drop",
[L2OUTPUT_NEXT_BAD_INTF] = "l2-output-bad-intf",
},
}
static uword l2output_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
Definition: l2_output.c:492
#define ARRAY_LEN(x)
Definition: clib.h:59
unsigned int u32
Definition: types.h:88
static char * l2output_error_strings[]
Definition: l2_output.c:98
static u8 * format_l2output_trace(u8 *s, va_list *args)
Definition: l2_output.c:79

(constructor) VLIB_REGISTER_NODE (l2output_node)

Definition at line 501 of file l2_output.c.