FD.io VPP  v21.06-3-gbb25fbf28
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 void split_horizon_violation (vlib_node_runtime_t *node, u8 shg, vlib_buffer_t *b, u16 *next)
 Check for split horizon violations. More...
 
static_always_inline void l2output_process_batch_inline (vlib_main_t *vm, vlib_node_runtime_t *node, l2_output_config_t *config, vlib_buffer_t **b, i16 *cdo, u16 *next, u32 n_left, int l2_efp, int l2_vtr, int l2_pbb, int shg_set, int update_feature_bitmap)
 
static_always_inline void l2output_set_buffer_error (vlib_buffer_t **b, u32 n_left, vlib_error_t error)
 
static_always_inline void l2output_process_batch (vlib_main_t *vm, vlib_node_runtime_t *node, l2_output_config_t *config, vlib_buffer_t **b, i16 *cdo, u16 *next, u32 n_left, int l2_efp, int l2_vtr, int l2_pbb)
 
VLIB_NODE_FN() l2output_node (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
 
VLIB_NODE_FN() l2output_bad_intf_node (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
 Output node for interfaces/tunnels which was in L2 mode but were changed to L3 mode or possibly deleted thereafter. More...
 
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, l2output_feat_masks_t 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 []
 
vlib_node_registration_t l2output_bad_intf_node
 (constructor) VLIB_REGISTER_NODE (l2output_bad_intf_node) More...
 

Macro Definition Documentation

◆ foreach_l2output_bad_intf_error

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

Definition at line 466 of file l2_output.c.

Enumeration Type Documentation

◆ l2output_bad_intf_error_t

Enumerator
L2OUTPUT_BAD_INTF_N_ERROR 

Definition at line 475 of file l2_output.c.

Function Documentation

◆ format_l2_output_features()

u8* format_l2_output_features ( u8 s,
va_list *  args 
)

Definition at line 44 of file l2_output.c.

+ Here is the caller graph for this function:

◆ format_l2output_trace()

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

Definition at line 91 of file l2_output.c.

+ Here is the call graph for this function:

◆ l2output_bad_intf_node()

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

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

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 deleted tunnels won't cause possible packet or memory corruption.

Definition at line 496 of file l2_output.c.

+ Here is the call graph for this function:

◆ l2output_create_output_node_mapping()

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 601 of file l2_output.c.

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

◆ l2output_get_feat_names()

char** l2output_get_feat_names ( void  )

Definition at line 38 of file l2_output.c.

+ Here is the caller graph for this function:

◆ l2output_init()

static clib_error_t* l2output_init ( vlib_main_t vm)
static

Definition at line 570 of file l2_output.c.

+ Here is the call graph for this function:

◆ l2output_intf_bitmap_enable()

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

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

Definition at line 625 of file l2_output.c.

+ Here is the caller graph for this function:

◆ l2output_intf_config()

l2_output_config_t* l2output_intf_config ( u32  sw_if_index)

Get a pointer to the config for the given interface.

Definition at line 615 of file l2_output.c.

+ Here is the caller graph for this function:

◆ l2output_node()

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

Definition at line 290 of file l2_output.c.

+ Here is the call graph for this function:

◆ l2output_process_batch()

static_always_inline void l2output_process_batch ( vlib_main_t vm,
vlib_node_runtime_t node,
l2_output_config_t config,
vlib_buffer_t **  b,
i16 cdo,
u16 next,
u32  n_left,
int  l2_efp,
int  l2_vtr,
int  l2_pbb 
)

Definition at line 266 of file l2_output.c.

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

◆ l2output_process_batch_inline()

static_always_inline void l2output_process_batch_inline ( vlib_main_t vm,
vlib_node_runtime_t node,
l2_output_config_t config,
vlib_buffer_t **  b,
i16 cdo,
u16 next,
u32  n_left,
int  l2_efp,
int  l2_vtr,
int  l2_pbb,
int  shg_set,
int  update_feature_bitmap 
)

Definition at line 134 of file l2_output.c.

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

◆ l2output_set_buffer_error()

static_always_inline void l2output_set_buffer_error ( vlib_buffer_t **  b,
u32  n_left,
vlib_error_t  error 
)

Definition at line 245 of file l2_output.c.

+ Here is the caller graph for this function:

◆ split_horizon_violation()

static_always_inline void split_horizon_violation ( vlib_node_runtime_t node,
u8  shg,
vlib_buffer_t b,
u16 next 
)

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 124 of file l2_output.c.

+ Here is the caller graph for this function:

Variable Documentation

◆ l2output_bad_intf_error_strings

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

Definition at line 469 of file l2_output.c.

◆ l2output_bad_intf_node

vlib_node_registration_t l2output_bad_intf_node
Initial value:
= {
.name = "l2-output-bad-intf",
.vector_size = sizeof (u32),
.n_next_nodes = 1,
.next_nodes = {
[0] = "error-drop",
},
}

(constructor) VLIB_REGISTER_NODE (l2output_bad_intf_node)

Definition at line 552 of file l2_output.c.

◆ l2output_error_strings

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

Definition at line 110 of file l2_output.c.

◆ l2output_feat_names

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

Definition at line 31 of file l2_output.c.

◆ l2output_main

l2output_main_t l2output_main

Definition at line 77 of file l2_output.c.

◆ l2output_node

vlib_node_registration_t l2output_node
Initial value:
= {
.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",
},
}

(constructor) VLIB_REGISTER_NODE (l2output_node)

Definition at line 446 of file l2_output.c.

L2OUTPUT_N_NEXT
@ L2OUTPUT_N_NEXT
Definition: l2_output.h:131
l2output_bad_intf_error_strings
static char * l2output_bad_intf_error_strings[]
Definition: l2_output.c:469
foreach_l2output_bad_intf_error
#define foreach_l2output_bad_intf_error
Definition: l2_output.c:466
VLIB_NODE_TYPE_INTERNAL
@ VLIB_NODE_TYPE_INTERNAL
Definition: node.h:72
format_l2output_trace
static u8 * format_l2output_trace(u8 *s, va_list *args)
Definition: l2_output.c:91
ARRAY_LEN
#define ARRAY_LEN(x)
Definition: clib.h:70
foreach_l2output_feat
@ foreach_l2output_feat
Definition: l2_output.h:115
u32
unsigned int u32
Definition: types.h:88
L2OUTPUT_NEXT_BAD_INTF
@ L2OUTPUT_NEXT_BAD_INTF
Definition: l2_output.h:130
foreach_l2output_error
#define foreach_l2output_error
Definition: l2_output.h:119
type
vl_api_fib_path_type_t type
Definition: fib_types.api:123
L2OUTPUT_NEXT_DROP
@ L2OUTPUT_NEXT_DROP
Definition: l2_output.h:129
l2output_error_strings
static char * l2output_error_strings[]
Definition: l2_output.c:110