|
FD.io VPP
v21.06-3-gbb25fbf28
Vector Packet Processing
|
Go to the documentation of this file.
18 #ifndef included_l2fib_h
19 #define included_l2fib_h
27 #define L2FIB_NUM_BUCKETS (256 * 1024)
28 #define L2FIB_MEMORY_SIZE (128<<20)
31 #define L2FIB_AGE_SCAN_INTERVAL (60.0)
34 #define L2FIB_EVENT_SCAN_DELAY_DEFAULT (0.1)
37 #define L2FIB_EVENT_MAX_MACS_DEFAULT (100)
40 #define L2FIB_EVENT_LEARN_LIMIT_DEFAULT (1000)
46 BVT (clib_bihash) mac_table;
112 return (((
u16) bd_sn) << 8) | if_sn;
137 #define foreach_l2fib_entry_result_attr \
138 _(STATIC, 0, "static") \
139 _(AGE_NOT, 1, "age-not") \
141 _(FILTER, 3, "filter") \
142 _(LRN_EVT, 4, "learn-event") \
143 _(LRN_MOV, 5, "learn-move")
148 #define _(a,v,s) L2FIB_ENTRY_RESULT_FLAG_##a = (1 << v),
180 l2fib_entry_result_is_set_##a (const l2fib_entry_result_t *r) { \
181 return (r->fields.flags & L2FIB_ENTRY_RESULT_FLAG_##a); \
187 l2fib_entry_result_set_##a (l2fib_entry_result_t *r) { \
188 r->fields.flags |= L2FIB_ENTRY_RESULT_FLAG_##a; \
194 l2fib_entry_result_clear_##a (l2fib_entry_result_t *r) { \
195 r->fields.flags &= ~L2FIB_ENTRY_RESULT_FLAG_##a; \
203 r->fields.flags |= bits;
210 r->fields.flags &= ~bits;
233 temp_a =
key->words.w0;
234 temp_b =
key->words.w1;
249 #if CLIB_ARCH_IS_LITTLE_ENDIAN
255 temp = (temp & ~0xffff) | (
u64) (bd_index);
262 temp = temp | (((
u64) bd_index) << 48);
293 if (key0->
raw == cached_key->
raw)
296 result0->
raw = cached_result->
raw;
301 BVT (clib_bihash_kv) kv;
306 result0->
raw = kv.value;
309 cached_key->
raw = key0->
raw;
310 cached_result->
raw = result0->
raw;
343 if ((key0->
raw == cached_key->
raw) && (key1->
raw == cached_key->
raw))
346 result0->
raw = cached_result->
raw;
347 result1->
raw = cached_result->
raw;
351 BVT (clib_bihash_kv) kv0, kv1;
365 result0->
raw = kv0.value;
366 result1->
raw = kv1.value;
369 cached_key->
raw = key1->
raw;
370 cached_result->
raw = result1->
raw;
401 if ((key0->
raw == cached_key->
raw) && (key1->
raw == cached_key->
raw) &&
402 (key2->
raw == cached_key->
raw) && (key3->
raw == cached_key->
raw))
405 result0->
raw = cached_result->
raw;
406 result1->
raw = cached_result->
raw;
407 result2->
raw = cached_result->
raw;
408 result3->
raw = cached_result->
raw;
412 BVT (clib_bihash_kv) kv0, kv1, kv2, kv3;
432 result0->
raw = kv0.value;
433 result1->
raw = kv1.value;
434 result2->
raw = kv2.value;
435 result3->
raw = kv3.value;
438 cached_key->
raw = key1->
raw;
439 cached_result->
raw = result1->
raw;
456 (L2FIB_ENTRY_RESULT_FLAG_FILTER |
457 L2FIB_ENTRY_RESULT_FLAG_STATIC));
476 BVT (clib_bihash) * get_mac_table (
void);
static void l2fib_add_filter_entry(const u8 *mac, u32 bd_index)
struct l2fib_entry_result_t_ l2fib_entry_result_t
#define hash_mix32(a0, b0, c0)
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_MEM_OVERFLOW_LOAD(f, src)
static_always_inline l2fib_seq_num_t l2_fib_update_seq_num(l2fib_seq_num_t sn, u8 if_sn)
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
vnet_hw_if_output_node_runtime_t * r
static void l2fib_entry_result_clear_bits(l2fib_entry_result_t *r, l2fib_entry_result_flags_t bits)
int clib_bihash_search_inline(clib_bihash *h, clib_bihash_kv *in_out_kv)
Search a bi-hash table.
struct l2fib_entry_result_t_::@463::@465 fields
void l2fib_flush_all_mac(vlib_main_t *vm)
Flush all non static MACs - flushes all valid BDs.
u8 * format_l2fib_entry_result_flags(u8 *s, va_list *args)
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)
STATIC_ASSERT_SIZEOF(l2fib_entry_key_t, 8)
void l2fib_add_entry(const u8 *mac, u32 bd_index, u32 sw_if_index, l2fib_entry_result_flags_t flags)
Add an entry to the l2fib.
#define static_always_inline
#define L2FIB_NUM_BUCKETS
static_always_inline void l2fib_lookup_2(BVT(clib_bihash) *mac_table, l2fib_entry_key_t *cached_key, l2fib_entry_result_t *cached_result, u8 *mac0, u8 *mac1, u16 bd_index0, u16 bd_index1, l2fib_entry_key_t *key0, l2fib_entry_key_t *key1, l2fib_entry_result_t *result0, l2fib_entry_result_t *result1)
Lookup the entry for mac and bd_index in the mac table for 2 packets.
void l2fib_clear_table(void)
@ MAC_EVENT_ACTION_DELETE
BVT(clib_bihash) *get_mac_table(void)
The table of adjacencies indexed by the rewrite string.
uword mac_table_memory_size
l2fib_entry_result_flags_t flags
l2fib_entry_result_flags_t_
static u64 l2fib_make_key(const u8 *mac_address, u16 bd_index)
u8 * format_vnet_sw_if_index_name_with_NA(u8 *s, va_list *args)
Format sw_if_index.
static_always_inline l2fib_seq_num_t l2_fib_mk_seq_num(u8 bd_sn, u8 if_sn)
u8 * format_l2_fib_seq_num(u8 *s, va_list *a)
void l2_fib_extract_seq_num(l2fib_seq_num_t sn, u8 *bd_sn, u8 *if_sn)
void l2fib_flush_bd_mac(vlib_main_t *vm, u32 bd_index)
Flush all non static MACs in a bridge domain.
void l2fib_table_dump(u32 bd_index, l2fib_entry_key_t **l2fe_key, l2fib_entry_result_t **l2fe_res)
void l2fib_flush_int_mac(vlib_main_t *vm, u32 sw_if_index)
Flush all non static MACs from an interface.
uword mac_table_n_buckets
enum l2fib_entry_result_flags_t_ l2fib_entry_result_flags_t
#define foreach_l2fib_entry_result_attr
Flags associated with an L2 Fib Entry.
void l2fib_table_init(void)
void l2fib_start_ager_scan(vlib_main_t *vm)
Kick off ager to scan MACs to age/delete MAC entries.
u16 l2fib_seq_num_t
A combined representation of the sequence number associated with the interface and the BD.
@ L2FIB_ENTRY_RESULT_FLAG_NONE
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)
u32 l2fib_del_entry(const u8 *mac, u32 bd_index, u32 sw_if_index)
Delete an entry from the l2fib.
static u32 l2fib_compute_hash_bucket(l2fib_entry_key_t *key)
Compute the hash for the given key and return the corresponding bucket index.
manual_print typedef u8 mac_address[6]
vl_api_wireguard_peer_flags_t flags