FD.io VPP  v17.04-9-g99c0734
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 u8 * format_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 *bucket0, l2fib_entry_result_t *result0, u32 *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)
 
static uword l2learn_node_fn (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
 
clib_error_t * l2learn_init (vlib_main_t *vm)
 
static clib_error_t * int_learn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 Set subinterface learn enable/disable. More...
 
static clib_error_t * l2learn_config (vlib_main_t *vm, unformat_input_t *input)
 

Variables

static 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

#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, "L2 learn hits") \
_(FILTER_DROP, "L2 filter mac drops")

Definition at line 75 of file l2_learn.c.

Enumeration Type Documentation

Enumerator
L2LEARN_N_ERROR 

Definition at line 84 of file l2_learn.c.

Enumerator
L2LEARN_NEXT_L2FWD 
L2LEARN_NEXT_DROP 
L2LEARN_N_NEXT 

Definition at line 98 of file l2_learn.c.

Function Documentation

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

Definition at line 60 of file l2_learn.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 537 of file l2_learn.c.

+ Here is the call graph for this function:

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

Definition at line 586 of file l2_learn.c.

+ Here is the call graph for this function:

clib_error_t* l2learn_init ( vlib_main_t *  vm)

Definition at line 502 of file l2_learn.c.

+ Here is the call graph for this function:

static uword l2learn_node_fn ( vlib_main_t *  vm,
vlib_node_runtime_t *  node,
vlib_frame_t *  frame 
)
static

Definition at line 472 of file l2_learn.c.

+ Here is the call graph for this function:

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 243 of file l2_learn.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 *  bucket0,
l2fib_entry_result_t *  result0,
u32 *  next0,
u8  timestamp 
)

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

Definition at line 109 of file l2_learn.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

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:537

(constructor) VLIB_CLI_COMMAND (int_learn_cli)

Definition at line 577 of file l2_learn.c.

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

Definition at line 92 of file l2_learn.c.

static vlib_node_registration_t l2learn_node
static
Initial value:
= {
.function = l2learn_node_fn,
.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",
},
}
static char * l2learn_error_strings[]
Definition: l2_learn.c:92
static u8 * format_l2learn_trace(u8 *s, va_list *args)
Definition: l2_learn.c:60
#define ARRAY_LEN(x)
Definition: clib.h:59
unsigned int u32
Definition: types.h:88
static uword l2learn_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
Definition: l2_learn.c:472

(constructor) VLIB_REGISTER_NODE (l2learn_node)

Definition at line 73 of file l2_learn.c.