|
FD.io VPP
v21.10.1-2-g0a485f517
Vector Packet Processing
|
Go to the documentation of this file.
31 #ifndef CLIB_MARCH_VARIANT
69 s =
format (s,
"l2-learn: sw_if_index %d dst %U src %U bd_index %d",
78 #define foreach_l2learn_error \
79 _(L2LEARN, "L2 learn packets") \
80 _(MISS, "L2 learn misses") \
81 _(MAC_MOVE, "L2 mac moves") \
82 _(MAC_MOVE_VIOLATE, "L2 mac move violations") \
83 _(LIMIT, "L2 not learned due to limit") \
84 _(HIT_UPDATE, "L2 learn hit updates") \
85 _(FILTER_DROP, "L2 filter mac drops")
89 #define _(sym,str) L2LEARN_ERROR_##sym,
96 #define _(sym,string) string,
138 if (l2fib_entry_result_is_set_AGE_NOT (result0))
148 if ((*
count > 2) && (dtime == 1) && (dsn == 0))
151 counter_base[L2LEARN_ERROR_HIT_UPDATE] += 1;
154 else if (result0->
raw == ~0)
157 counter_base[L2LEARN_ERROR_MISS] += 1;
166 counter_base[L2LEARN_ERROR_LIMIT] += 1;
172 key.fields.bd_index = 0;
183 result0->
fields.sw_if_index = sw_if_index0;
185 l2fib_entry_result_set_LRN_EVT (result0);
187 l2fib_entry_result_clear_LRN_EVT (result0);
192 if (l2fib_entry_result_is_set_FILTER (result0))
196 b0->
error =
node->errors[L2LEARN_ERROR_FILTER_DROP];
201 if (l2fib_entry_result_is_set_STATIC (result0))
207 b0->
error =
node->errors[L2LEARN_ERROR_MAC_MOVE_VIOLATE];
216 result0->
fields.sw_if_index = sw_if_index0;
217 if (l2fib_entry_result_is_set_AGE_NOT (result0))
226 l2fib_entry_result_clear_AGE_NOT (result0);
230 (L2FIB_ENTRY_RESULT_FLAG_LRN_EVT |
231 L2FIB_ENTRY_RESULT_FLAG_LRN_MOV));
234 (L2FIB_ENTRY_RESULT_FLAG_LRN_EVT |
235 L2FIB_ENTRY_RESULT_FLAG_LRN_MOV));
236 counter_base[L2LEARN_ERROR_MAC_MOVE] += 1;
243 BVT (clib_bihash_kv) kv;
245 kv.value = result0->
raw;
249 cached_key->
raw = ~0;
277 cached_result.
raw = ~0;
281 u32 sw_if_index0, sw_if_index1, sw_if_index2, sw_if_index3;
316 if (
b[0]->
flags & VLIB_BUFFER_IS_TRACED)
325 if (
b[1]->
flags & VLIB_BUFFER_IS_TRACED)
334 if (
b[2]->
flags & VLIB_BUFFER_IS_TRACED)
343 if (
b[3]->
flags & VLIB_BUFFER_IS_TRACED)
356 L2LEARN_ERROR_L2LEARN, 4);
367 &key0, &key1, &key2, &key3,
368 &result0, &result1, &result2, &result3);
371 b[0], sw_if_index0, &key0, &cached_key,
375 b[1], sw_if_index1, &key1, &cached_key,
379 b[2], sw_if_index2, &key2, &cached_key,
383 b[3], sw_if_index3, &key3, &cached_key,
413 L2LEARN_ERROR_L2LEARN, 1);
421 b[0], sw_if_index0, &key0, &cached_key,
431 return frame->n_vectors;
445 .vector_size =
sizeof (
u32),
462 #ifndef CLIB_MARCH_VARIANT
479 mp->mac_table = get_mac_table ();
545 .path =
"set interface l2 learn",
546 .short_help =
"set interface l2 learn <interface> [disable]",
vlib_node_registration_t l2learn_node
(constructor) VLIB_REGISTER_NODE (l2learn_node)
vlib_buffer_t * bufs[VLIB_FRAME_SIZE]
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
vlib_main_t vlib_node_runtime_t vlib_frame_t * frame
#define foreach_l2learn_error
static vlib_cli_command_t int_learn_cli
(constructor) VLIB_CLI_COMMAND (int_learn_cli)
struct l2fib_entry_result_t_::@469::@471 fields
u8 * format_ethernet_address(u8 *s, va_list *args)
vlib_get_buffers(vm, from, b, n_left_from)
@ VLIB_NODE_TYPE_INTERNAL
vlib_main_t vlib_node_runtime_t * node
static_always_inline void l2fib_lookup_1(BVT(clib_bihash) *mac_table, l2fib_entry_key_t *cached_key, l2fib_entry_result_t *cached_result, u8 *mac0, u16 bd_index0, l2fib_entry_key_t *key0, l2fib_entry_result_t *result0)
Lookup the entry for mac and bd_index in the mac table for 1 packet.
#define clib_error_return(e, args...)
static u8 * format_l2learn_trace(u8 *s, va_list *args)
vlib_error_main_t error_main
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
vlib_buffer_enqueue_to_next(vm, node, from,(u16 *) nexts, frame->n_vectors)
static_always_inline void * clib_memcpy_fast(void *restrict dst, const void *restrict src, size_t n)
static void l2fib_entry_result_clear_bits(l2fib_entry_result_t *r, l2fib_entry_result_flags_t bits)
static clib_error_t * l2learn_config(vlib_main_t *vm, unformat_input_t *input)
static clib_error_t * int_learn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Set subinterface learn enable/disable.
u32 bd_default_learn_limit
#define VLIB_CONFIG_FUNCTION(x, n,...)
static_always_inline void l2fib_lookup_4(BVT(clib_bihash) *mac_table, l2fib_entry_key_t *cached_key, l2fib_entry_result_t *cached_result, const u8 *mac0, const u8 *mac1, const u8 *mac2, const u8 *mac3, u16 bd_index0, u16 bd_index1, u16 bd_index2, u16 bd_index3, l2fib_entry_key_t *key0, l2fib_entry_key_t *key1, l2fib_entry_key_t *key2, l2fib_entry_key_t *key3, l2fib_entry_result_t *result0, l2fib_entry_result_t *result1, l2fib_entry_result_t *result2, l2fib_entry_result_t *result3)
vlib_error_t error
Error code for buffers to be enqueued to error handler.
#define VLIB_NODE_FN(node)
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
vnet_main_t * vnet_get_main(void)
#define VLIB_NODE_FLAG_TRACE
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
#define static_always_inline
BVT(clib_bihash)
The table of adjacencies indexed by the rewrite string.
static void vlib_node_increment_counter(vlib_main_t *vm, u32 node_index, u32 counter_index, u64 increment)
static vlib_node_t * vlib_get_node(vlib_main_t *vm, u32 i)
Get vlib node by index.
#define VLIB_CLI_COMMAND(x,...)
struct _vlib_node_registration vlib_node_registration_t
static u32 vnet_l2_feature_next(vlib_buffer_t *b, u32 *next_nodes, u32 feat_bit)
Return the graph node index for the feature corresponding to the next set bit after clearing the curr...
l2learn_main_t l2learn_main
#define L2LEARN_DEFAULT_LIMIT
u32 feat_next_node_index[32]
unformat_function_t unformat_vnet_sw_interface
description fragment has unexpected format
#define VLIB_INIT_FUNCTION(x)
static_always_inline void clib_prefetch_load(void *p)
int clib_bihash_add_del(clib_bihash *h, clib_bihash_kv *add_v, int is_add)
Add or delete a (key,value) pair from a bi-hash table.
void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
static_always_inline uword l2learn_node_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, int do_trace)
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.
u16 nexts[VLIB_FRAME_SIZE]
clib_error_t * l2learn_init(vlib_main_t *vm)
static char * l2learn_error_strings[]
static f64 vlib_time_now(vlib_main_t *vm)
vl_api_interface_index_t sw_if_index
static foreach_l2fib_entry_result_attr void l2fib_entry_result_set_bits(l2fib_entry_result_t *r, l2fib_entry_result_flags_t bits)
static void feat_bitmap_init_next_nodes(vlib_main_t *vm, u32 node_index, u32 num_features, char **feat_names, u32 *next_nodes)
Initialize the feature next-node indexes of a graph node.
vl_api_fib_path_type_t type
l2_bridge_domain_t * bd_configs
VLIB buffer representation.
#define VLIB_REGISTER_NODE(x,...)
vl_api_wireguard_peer_flags_t flags