FD.io VPP  v19.08.3-2-gbabecb413
Vector Packet Processing
l2_learn.c File Reference

Ethernet Bridge Learning. More...

+ Include dependency graph for l2_learn.c:

Go to the source code of this file.

Data Structures

struct  l2learn_trace_t
 

Macros

#define foreach_l2learn_error
 

Enumerations

enum  l2learn_error_t { L2LEARN_N_ERROR }
 
enum  l2learn_next_t { L2LEARN_NEXT_L2FWD, L2LEARN_NEXT_DROP, L2LEARN_N_NEXT }
 

Functions

static u8format_l2learn_trace (u8 *s, va_list *args)
 
static_always_inline void l2learn_process (vlib_node_runtime_t *node, l2learn_main_t *msm, u64 *counter_base, vlib_buffer_t *b0, u32 sw_if_index0, l2fib_entry_key_t *key0, l2fib_entry_key_t *cached_key, u32 *count, l2fib_entry_result_t *result0, u16 *next0, u8 timestamp)
 Perform learning on one packet based on the mac table lookup result. More...
 
static_always_inline uword l2learn_node_inline (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, int do_trace)
 
VLIB_NODE_FN() l2learn_node (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
 
clib_error_tl2learn_init (vlib_main_t *vm)
 
static clib_error_tint_learn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 Set subinterface learn enable/disable. More...
 
static clib_error_tl2learn_config (vlib_main_t *vm, unformat_input_t *input)
 

Variables

l2learn_main_t l2learn_main
 
vlib_node_registration_t l2learn_node
 (constructor) VLIB_REGISTER_NODE (l2learn_node) More...
 
static char * l2learn_error_strings []
 
static vlib_cli_command_t int_learn_cli
 (constructor) VLIB_CLI_COMMAND (int_learn_cli) More...
 

Detailed Description

Ethernet Bridge Learning.

Populate the mac table with entries mapping the packet's source mac + bridge domain ID to the input sw_if_index.

Note that learning and forwarding are separate graph nodes. This means that for a set of packets, all learning is performed first, then all nodes are forwarded. The forwarding is done based on the end-state of the mac table, instead of the state after each packet. Thus the forwarding results could differ in certain cases (mac move tests), but this not expected to cause problems in real-world networks. It is much simpler to separate learning and forwarding into separate nodes.

Definition in file l2_learn.c.

Macro Definition Documentation

◆ foreach_l2learn_error

#define foreach_l2learn_error
Value:
_(L2LEARN, "L2 learn packets") \
_(MISS, "L2 learn misses") \
_(MAC_MOVE, "L2 mac moves") \
_(MAC_MOVE_VIOLATE, "L2 mac move violations") \
_(LIMIT, "L2 not learned due to limit") \
_(HIT_UPDATE, "L2 learn hit updates") \
_(FILTER_DROP, "L2 filter mac drops")

Definition at line 79 of file l2_learn.c.

Enumeration Type Documentation

◆ l2learn_error_t

Enumerator
L2LEARN_N_ERROR 

Definition at line 88 of file l2_learn.c.

◆ l2learn_next_t

Enumerator
L2LEARN_NEXT_L2FWD 
L2LEARN_NEXT_DROP 
L2LEARN_N_NEXT 

Definition at line 102 of file l2_learn.c.

Function Documentation

◆ format_l2learn_trace()

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

Definition at line 64 of file l2_learn.c.

+ Here is the call graph for this function:

◆ int_learn()

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

Set subinterface learn enable/disable.

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

Definition at line 486 of file l2_learn.c.

+ Here is the call graph for this function:

◆ l2learn_config()

static clib_error_t* l2learn_config ( vlib_main_t vm,
unformat_input_t input 
)
static

Definition at line 535 of file l2_learn.c.

+ Here is the call graph for this function:

◆ l2learn_init()

clib_error_t* l2learn_init ( vlib_main_t vm)

Definition at line 451 of file l2_learn.c.

+ Here is the call graph for this function:

◆ l2learn_node()

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

Definition at line 421 of file l2_learn.c.

+ Here is the call graph for this function:

◆ l2learn_node_inline()

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

Definition at line 241 of file l2_learn.c.

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

◆ l2learn_process()

static_always_inline void l2learn_process ( vlib_node_runtime_t node,
l2learn_main_t msm,
u64 counter_base,
vlib_buffer_t b0,
u32  sw_if_index0,
l2fib_entry_key_t key0,
l2fib_entry_key_t cached_key,
u32 count,
l2fib_entry_result_t result0,
u16 next0,
u8  timestamp 
)

Perform learning on one packet based on the mac table lookup result.

Definition at line 113 of file l2_learn.c.

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

Variable Documentation

◆ int_learn_cli

vlib_cli_command_t int_learn_cli
static
Initial value:
= {
.path = "set interface l2 learn",
.short_help = "set interface l2 learn <interface> [disable]",
.function = int_learn,
}
static clib_error_t * int_learn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Set subinterface learn enable/disable.
Definition: l2_learn.c:486

(constructor) VLIB_CLI_COMMAND (int_learn_cli)

Definition at line 526 of file l2_learn.c.

◆ l2learn_error_strings

char* l2learn_error_strings[]
static
Initial value:
= {
#define _(sym,string)
}
#define foreach_l2learn_error
Definition: l2_learn.c:79

Definition at line 96 of file l2_learn.c.

◆ l2learn_main

l2learn_main_t l2learn_main

Definition at line 33 of file l2_learn.c.

◆ l2learn_node

Initial value:
= {
.name = "l2-learn",
.vector_size = sizeof (u32),
.format_trace = format_l2learn_trace,
.error_strings = l2learn_error_strings,
.n_next_nodes = L2LEARN_N_NEXT,
.next_nodes = {
[L2LEARN_NEXT_DROP] = "error-drop",
[L2LEARN_NEXT_L2FWD] = "l2-fwd",
},
}
unsigned int u32
Definition: types.h:88
static char * l2learn_error_strings[]
Definition: l2_learn.c:96
vl_api_fib_path_type_t type
Definition: fib_types.api:123
static u8 * format_l2learn_trace(u8 *s, va_list *args)
Definition: l2_learn.c:64
#define ARRAY_LEN(x)
Definition: clib.h:63

(constructor) VLIB_REGISTER_NODE (l2learn_node)

Definition at line 430 of file l2_learn.c.