18 #ifndef included_l2fib_h 19 #define included_l2fib_h 27 #define L2FIB_NUM_BUCKETS (64 * 1024) 28 #define L2FIB_MEMORY_SIZE (256<<20) 89 temp_a = key->
words.w0;
90 temp_b = key->
words.w1;
105 #if CLIB_ARCH_IS_LITTLE_ENDIAN 110 temp = *((
u64 *) (mac_address)) << 16;
111 temp = (temp & ~0xffff) | (
u64) (bd_index);
117 temp = *((
u64 *) (mac_address)) >> 16;
118 temp = temp | (((
u64) bd_index) << 48);
152 if (key0->
raw == cached_key->
raw)
155 result0->
raw = cached_result->
raw;
160 BVT (clib_bihash_kv) kv;
164 BV (clib_bihash_search_inline) (mac_table, &kv);
165 result0->
raw = kv.value;
168 cached_key->
raw = key0->
raw;
169 cached_result->
raw = result0->
raw;
204 if ((key0->
raw == cached_key->
raw) && (key1->
raw == cached_key->
raw))
207 result0->
raw = cached_result->
raw;
208 result1->
raw = cached_result->
raw;
215 BVT (clib_bihash_kv) kv0, kv1;
226 BV (clib_bihash_search_inline) (mac_table, &kv0);
227 BV (clib_bihash_search_inline) (mac_table, &kv1);
229 result0->
raw = kv0.value;
230 result1->
raw = kv1.value;
233 cached_key->
raw = key1->
raw;
234 cached_result->
raw = result1->
raw;
269 if ((key0->
raw == cached_key->
raw) && (key1->
raw == cached_key->
raw) &&
270 (key2->
raw == cached_key->
raw) && (key3->
raw == cached_key->
raw))
273 result0->
raw = cached_result->
raw;
274 result1->
raw = cached_result->
raw;
275 result2->
raw = cached_result->
raw;
276 result3->
raw = cached_result->
raw;
285 BVT (clib_bihash_kv) kv0, kv1, kv2, kv3;
300 BV (clib_bihash_search_inline) (mac_table, &kv0);
301 BV (clib_bihash_search_inline) (mac_table, &kv1);
302 BV (clib_bihash_search_inline) (mac_table, &kv2);
303 BV (clib_bihash_search_inline) (mac_table, &kv3);
305 result0->
raw = kv0.value;
306 result1->
raw = kv1.value;
307 result2->
raw = kv2.value;
308 result3->
raw = kv3.value;
311 cached_key->
raw = key1->
raw;
312 cached_result->
raw = result1->
raw;
316 BVT (clib_bihash) * get_mac_table (
void);
323 u32 static_mac,
u32 drop_mac,
u32 bvi_mac);
#define static_always_inline
struct l2fib_entry_key_t::@189::@192 words
void l2fib_add_entry(u64 mac, u32 bd_index, u32 sw_if_index, u32 static_mac, u32 drop_mac, u32 bvi_mac)
Add an entry to the l2fib.
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.
#define hash_mix32(a0, b0, c0)
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(uint keep_static)
void l2fib_table_dump(u32 bd_index, l2fib_entry_key_t **l2fe_key, l2fib_entry_result_t **l2fe_res)
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.