38 u32 ip = (
u32) kvp->key[0];
46 src_ip &= mask->as_u32;
52 (a->
cb) (kvp->value, a->
arg);
58 ip_prefix_t * src, ip_prefix_t * dst,
89 ip.
as_u64[0] = kvp->key[0];
90 ip.
as_u64[1] = kvp->key[1];
95 (a->
cb) (kvp->value, a->
arg);
101 ip_prefix_t * src, ip_prefix_t * dst,
145 kv->key[0] = (
u64) vni;
154 BVT (clib_bihash_kv) kv, value;
157 rv = BV (clib_bihash_search_inline_2) (&db->mac_lookup_table, &kv, &value);
163 rv = BV (clib_bihash_search_inline_2) (&db->mac_lookup_table, &kv,
178 BVT (clib_bihash_kv) kv, value;
188 rv = BV (clib_bihash_search_inline_2) (&db->ip4_lookup_table, &kv, &value);
200 BVT (clib_bihash_kv) kv, value;
204 for (i = 0; i < len; i++)
209 ASSERT (dst_address_length >= 0 && dst_address_length <= 32);
219 BV (clib_bihash_search_inline_2) (&db->ip4_lookup_table, &kv, &value);
231 BVT (clib_bihash_kv) kv, value;
238 kv.key[2] = (
u64) vni;
240 rv = BV (clib_bihash_search_inline_2) (&db->ip6_lookup_table, &kv, &value);
252 BVT (clib_bihash_kv) kv, value;
256 for (i = 0; i < len; i++)
261 ASSERT (dst_address_length >= 0 && dst_address_length <= 128);
267 kv.key[2] = (
u64) vni;
270 BV (clib_bihash_search_inline_2) (&db->ip6_lookup_table, &kv, &value);
298 memset (&sp, 0,
sizeof (sp));
315 memset (&sp, 0,
sizeof (sp));
356 clib_warning (
"Source/Dest address type %d not supported!",
395 clib_warning (
"Source/Dest address type %d not supported!",
417 int dst_address_length = 32 - i;
418 vec_add1 (db->ip4_prefix_lengths_in_search_order, dst_address_length);
428 BVT (clib_bihash_kv) kv, value;
459 kv.key[0] = ((
u64) vni << 32) | key.
as_u32;
464 old_val = value.value;
514 ip_prefix_t * src_pref,
u32 val,
u8 is_add)
516 u32 sfi, old_val = ~0;
534 memset (&sp, 0,
sizeof (sp));
550 memset (&sp, 0,
sizeof (sp));
566 memset (&sp, 0,
sizeof (sp));
570 if (sfib->
count == 0)
590 int dst_address_length = 128 - i;
591 vec_add1 (db->ip6_prefix_lengths_in_search_order, dst_address_length);
600 BVT (clib_bihash_kv) kv, value;
630 kv.key[0] = key.
as_u64[0];
631 kv.key[1] = key.
as_u64[1];
632 kv.key[2] = (
u64) vni;
636 old_val = value.value;
656 BVT (clib_bihash_kv) kv, value;
662 old_val = value.value;
693 for (j = 0; j < i0; j++)
698 clib_host_to_net_u32 (
pow2_mask (i1) << (32 - i1));
717 ip_prefix_t * src_pref,
u32 val,
u8 is_add)
719 u32 sfi, old_val = ~0;
737 memset (&sp, 0,
sizeof (sp));
754 memset (&sp, 0,
sizeof (sp));
771 memset (&sp, 0,
sizeof (sp));
776 if (sfib->
count == 0)
788 ip_prefix_t * src_key,
u32 value,
u8 is_add)
static u32 add_del_ip(gid_dictionary_t *db, u32 vni, ip_prefix_t *dst_key, ip_prefix_t *src_key, u32 value, u8 is_add)
static void ip6_address_mask(ip6_address_t *a, ip6_address_t *mask)
#define IP6_LOOKUP_DEFAULT_HASH_NUM_BUCKETS
sll srl srl sll sra u16x4 i
gid_ip4_table_t * src_ip4_table_pool
pool of source IP LPM ip4 lookup tables
#define gid_address_type(_a)
ip4_address_t ip4_fib_masks[33]
static u32 mac_sd_lookup(gid_mac_table_t *db, u32 vni, u8 *dst, u8 *src)
static void gid_dict_foreach_ip4_subprefix(gid_dictionary_t *db, u32 vni, ip_prefix_t *src, ip_prefix_t *dst, foreach_subprefix_match_cb_t cb, void *arg)
static void mac_lookup_init(gid_mac_table_t *db)
u32 mac_lookup_table_nbuckets
static void gid_dict_foreach_ip6_subprefix(gid_dictionary_t *db, u32 vni, ip_prefix_t *src, ip_prefix_t *dst, foreach_subprefix_match_cb_t cb, void *arg)
#define MAC_LOOKUP_DEFAULT_HASH_NUM_BUCKETS
static void ip6_compute_prefix_lengths_in_search_order(gid_ip6_table_t *db)
#define gid_address_sd_src_mac(_a)
#define ip_prefix_len(_a)
#define gid_address_sd(_a)
u32 ip4_prefix_len_refcount[33]
#define IP4_LOOKUP_DEFAULT_HASH_NUM_BUCKETS
#define gid_address_sd_src_ippref(_a)
static uword * clib_bitmap_set(uword *ai, uword i, uword value)
Sets the ith bit of a bitmap to new_value Removes trailing zeros from the bitmap. ...
static uword ip6_address_is_equal_masked(ip6_address_t *a, ip6_address_t *b, ip6_address_t *mask)
#define gid_address_sd_dst_mac(_a)
#define IP4_LOOKUP_DEFAULT_HASH_MEMORY_SIZE
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
#define ip_prefix_version(_a)
gid_ip4_table_t dst_ip4_table
destination IP LPM ip4 lookup table
static u32 ip4_lookup(gid_ip4_table_t *db, u32 vni, ip_prefix_t *key)
void gid_dictionary_init(gid_dictionary_t *db)
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
static u32 add_del_sd_ip6_key(gid_dictionary_t *db, u32 vni, ip_prefix_t *dst_pref, ip_prefix_t *src_pref, u32 val, u8 is_add)
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.
static uword pow2_mask(uword x)
static u32 add_del_sd(gid_dictionary_t *db, u32 vni, source_dest_t *key, u32 value, u8 is_add)
static void foreach_sfib6_subprefix(BVT(clib_bihash_kv)*kvp, void *arg)
u32 gid_dictionary_lookup(gid_dictionary_t *db, gid_address_t *key)
#define clib_bitmap_foreach(i, ai, body)
Macro to iterate across set bits in a bitmap.
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
void gid_dict_foreach_subprefix(gid_dictionary_t *db, gid_address_t *eid, foreach_subprefix_match_cb_t cb, void *arg)
u32 gid_dictionary_add_del(gid_dictionary_t *db, gid_address_t *key, u32 value, u8 is_add)
#define gid_address_mac(_a)
static u32 ip6_lookup_exact_match(gid_ip6_table_t *db, u32 vni, ip_prefix_t *key)
#define gid_address_sd_dst_type(_a)
gid_ip6_table_t * src_ip6_table_pool
pool of source IP LPM ip6 lookup tables
gid_ip6_table_t dst_ip6_table
destination IP LPM ip6 lookup table
static void make_mac_sd_key(BVT(clib_bihash_kv)*kv, u32 vni, u8 src_mac[6], u8 dst_mac[6])
void clib_bihash_init(clib_bihash *h, char *name, u32 nbuckets, uword memory_size)
initialize a bounded index extensible hash table
u32 ip4_lookup_table_nbuckets
static void foreach_sfib4_subprefix(BVT(clib_bihash_kv)*kvp, void *arg)
#define gid_address_ippref(_a)
void clib_bihash_foreach_key_value_pair(clib_bihash *h, void *callback, void *arg)
Visit active (key,value) pairs in a bi-hash table.
#define sd_src_ippref(_a)
u32 ip6_lookup_table_nbuckets
u8 * ip6_prefix_lengths_in_search_order
static u32 add_del_ip4_key(gid_ip4_table_t *db, u32 vni, ip_prefix_t *pref, u32 val, u8 is_add)
uword ip6_lookup_table_size
#define clib_warning(format, args...)
static u32 ip4_lookup_exact_match(gid_ip4_table_t *db, u32 vni, ip_prefix_t *key)
#define clib_memcpy(a, b, c)
u8 * ip4_prefix_lengths_in_search_order
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
void(* foreach_subprefix_match_cb_t)(u32, void *)
struct _gid_address_t gid_address_t
#define IP6_LOOKUP_DEFAULT_HASH_MEMORY_SIZE
int clib_bihash_search(clib_bihash *h, clib_bihash_kv *search_v, clib_bihash_kv *return_v)
Search a bi-hash table.
u32 gid_dictionary_sd_lookup(gid_dictionary_t *db, gid_address_t *dst, gid_address_t *src)
u64 ip6_prefix_len_refcount[129]
static u32 add_del_sd_ip4_key(gid_dictionary_t *db, u32 vni, ip_prefix_t *dst_pref, ip_prefix_t *src_pref, u32 val, u8 is_add)
static u64 mac_to_u64(u8 *m)
#define gid_address_sd_dst_ippref(_a)
static void ip4_compute_prefix_lengths_in_search_order(gid_ip4_table_t *db)
static void ip6_lookup_init(gid_ip6_table_t *db)
u8 * format_ip_prefix(u8 *s, va_list *args)
uword mac_lookup_table_size
uword ip4_lookup_table_size
foreach_subprefix_match_cb_t cb
#define gid_address_vni(_a)
gid_mac_table_t sd_mac_table
flat source/dest mac lookup table
uword * ip4_non_empty_dst_address_length_bitmap
static void ip4_lookup_init(gid_ip4_table_t *db)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
static u32 ip_sd_lookup(gid_dictionary_t *db, u32 vni, ip_prefix_t *dst, ip_prefix_t *src)
static uword max_log2(uword x)
static u32 add_del_mac(gid_mac_table_t *db, u32 vni, u8 *dst_mac, u8 *src_mac, u32 val, u8 is_add)
gid_ip6_table_t * ip6_table
static u32 add_del_ip6_key(gid_ip6_table_t *db, u32 vni, ip_prefix_t *pref, u32 val, u8 is_add)
gid_ip4_table_t * ip4_table
ip6_address_t ip6_fib_masks[129]
static u32 ip6_lookup(gid_ip6_table_t *db, u32 vni, ip_prefix_t *key)
#define MAC_LOOKUP_DEFAULT_HASH_MEMORY_SIZE
uword * ip6_non_empty_dst_address_length_bitmap
#define sd_dst_ippref(_a)