18 #ifndef included_l2fib_h 19 #define included_l2fib_h 27 #define L2FIB_NUM_BUCKETS (64 * 1024) 28 #define L2FIB_MEMORY_SIZE (512<<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;
144 temp_a = key->
words.w0;
145 temp_b = key->
words.w1;
160 #if CLIB_ARCH_IS_LITTLE_ENDIAN 165 temp = *((
u64 *) (mac_address)) << 16;
166 temp = (temp & ~0xffff) | (
u64) (bd_index);
172 temp = *((
u64 *) (mac_address)) >> 16;
173 temp = temp | (((
u64) bd_index) << 48);
207 if (key0->
raw == cached_key->
raw)
210 result0->
raw = cached_result->
raw;
215 BVT (clib_bihash_kv) kv;
219 BV (clib_bihash_search_inline) (mac_table, &kv);
220 result0->
raw = kv.value;
223 cached_key->
raw = key0->
raw;
224 cached_result->
raw = result0->
raw;
259 if ((key0->
raw == cached_key->
raw) && (key1->
raw == cached_key->
raw))
262 result0->
raw = cached_result->
raw;
263 result1->
raw = cached_result->
raw;
270 BVT (clib_bihash_kv) kv0, kv1;
281 BV (clib_bihash_search_inline) (mac_table, &kv0);
282 BV (clib_bihash_search_inline) (mac_table, &kv1);
284 result0->
raw = kv0.value;
285 result1->
raw = kv1.value;
288 cached_key->
raw = key1->
raw;
289 cached_result->
raw = result1->
raw;
324 if ((key0->
raw == cached_key->
raw) && (key1->
raw == cached_key->
raw) &&
325 (key2->
raw == cached_key->
raw) && (key3->
raw == cached_key->
raw))
328 result0->
raw = cached_result->
raw;
329 result1->
raw = cached_result->
raw;
330 result2->
raw = cached_result->
raw;
331 result3->
raw = cached_result->
raw;
340 BVT (clib_bihash_kv) kv0, kv1, kv2, kv3;
355 BV (clib_bihash_search_inline) (mac_table, &kv0);
356 BV (clib_bihash_search_inline) (mac_table, &kv1);
357 BV (clib_bihash_search_inline) (mac_table, &kv2);
358 BV (clib_bihash_search_inline) (mac_table, &kv3);
360 result0->
raw = kv0.value;
361 result1->
raw = kv1.value;
362 result2->
raw = kv2.value;
363 result3->
raw = kv3.value;
366 cached_key->
raw = key1->
raw;
367 cached_result->
raw = result1->
raw;
376 u32 sw_if_index,
u8 static_mac,
u8 drop_mac,
u8 bvi_mac);
422 BVT (clib_bihash) * get_mac_table (
void);
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
static void l2fib_add_fwd_entry(u64 mac, u32 bd_index, u32 sw_if_index, u8 static_mac, u8 bvi_mac)
void l2fib_add_entry(u64 mac, u32 bd_index, u32 sw_if_index, u8 static_mac, u8 drop_mac, u8 bvi_mac)
Add an entry to the l2fib.
static_always_inline u8 * l2fib_swif_seq_num(u32 sw_if_index)
#define static_always_inline
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
void l2fib_flush_all_mac(vlib_main_t *vm)
Flush all non static MACs - flushes all valid BDs.
static_always_inline u8 * l2fib_valid_swif_seq_num(u32 sw_if_index)
static void l2fib_add_filter_entry(u64 mac, u32 bd_index)
BVT(clib_bihash)*get_mac_table(void)
STATIC_ASSERT_SIZEOF(l2fib_entry_key_t, 8)
#define L2FIB_NUM_BUCKETS
u32 l2fib_del_entry(u64 mac, u32 bd_index)
Delete an entry from the l2fib.
void l2fib_flush_bd_mac(vlib_main_t *vm, u32 bd_index)
Flush all non static MACs in a bridge domain.
#define hash_mix32(a0, b0, c0)
struct l2fib_entry_key_t::@178::@181 words
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, u32 *bucket0, u32 *bucket1, 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)
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.
u8 * format_vnet_sw_if_index_name_with_NA(u8 *s, va_list *args)
Format sw_if_index.
static u32 l2fib_compute_hash_bucket(l2fib_entry_key_t *key)
Compute the hash for the given key and return the corresponding bucket index.
static u64 l2fib_make_key(u8 *mac_address, u16 bd_index)
static_always_inline void l2fib_lookup_4(BVT(clib_bihash)*mac_table, l2fib_entry_key_t *cached_key, l2fib_entry_result_t *cached_result, u8 *mac0, u8 *mac1, u8 *mac2, 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, u32 *bucket0, u32 *bucket1, u32 *bucket2, u32 *bucket3, l2fib_entry_result_t *result0, l2fib_entry_result_t *result1, l2fib_entry_result_t *result2, l2fib_entry_result_t *result3)
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, u32 *bucket0, l2fib_entry_result_t *result0)
Lookup the entry for mac and bd_index in the mac table for 1 packet.
void l2fib_start_ager_scan(vlib_main_t *vm)
Kick off ager to scan MACs to age/delete MAC entries.