46 src_ip &= mask->as_u32;
52 (a->
cb) (kvp->value, a->
arg);
89 ip.
as_u64[0] = kvp->key[0];
90 ip.
as_u64[1] = kvp->key[1];
95 (a->
cb) (kvp->value, a->
arg);
143 (
BVT (clib_bihash_kv) * kvp,
void *arg),
155 kv->key[0] = (
u64) vni;
214 for (i = 0; i <
len; i++)
219 ASSERT (dst_address_length >= 0 && dst_address_length <= 32);
248 kv.key[2] = (
u64) vni;
266 for (i = 0; i <
len; i++)
271 ASSERT (dst_address_length >= 0 && dst_address_length <= 128);
277 kv.key[2] = (
u64) vni;
348 kv->key[2] = (
u64) 0;
360 kv->key[0] = (
u64) vni;
361 kv->key[1] = (
u64) spi;
362 kv->key[2] = (
u64) si;
421 clib_warning (
"Source/Dest address type %d not supported!",
467 clib_warning (
"Source/Dest address type %d not supported!",
492 int dst_address_length = 32 - i;
493 vec_add1 (db->ip4_prefix_lengths_in_search_order, dst_address_length);
534 kv.key[0] = ((
u64) vni << 32) | key.
as_u32;
538 if (BV (clib_bihash_search) (&db->ip4_lookup_table, &kv, &
value) == 0)
539 old_val = value.value;
558 BVT (clib_bihash_init2_args) _a, *
a = &_a;
587 memset (a, 0,
sizeof (*a));
588 a->h = &db->ip4_lookup_table;
589 a->name =
"LISP ip4 lookup table";
592 a->dont_add_to_all_bihash_list = 1;
594 BV (clib_bihash_init2) (
a);
601 u32 sfi, old_val = ~0;
655 if (sfib->
count == 0)
675 int dst_address_length = 128 - i;
676 vec_add1 (db->ip6_prefix_lengths_in_search_order, dst_address_length);
715 kv.key[0] = key.
as_u64[0];
716 kv.key[1] = key.
as_u64[1];
717 kv.key[2] = (
u64) vni;
720 if (BV (clib_bihash_search) (&db->ip6_lookup_table, &kv, &
value) == 0)
721 old_val = value.value;
746 if (BV (clib_bihash_search) (&db->mac_lookup_table, &kv, &value) == 0)
747 old_val = value.value;
767 BVT (clib_bihash_init2_args) _a, *
a = &_a;
779 for (j = 0; j < i0; j++)
784 clib_host_to_net_u32 (
pow2_mask (i1) << (32 - i1));
800 memset (a, 0,
sizeof (*a));
801 a->h = &db->ip6_lookup_table;
802 a->name =
"LISP ip6 lookup table";
805 a->dont_add_to_all_bihash_list = 1;
807 BV (clib_bihash_init2) (
a);
814 u32 sfi, old_val = ~0;
871 if (sfib->
count == 0)
927 BVT (clib_bihash_kv) kv, result;
931 if (BV (clib_bihash_search) (&db->arp_ndp_lookup_table, &kv, &result) == 0)
932 old_val = result.value;
954 BVT (clib_bihash_kv) kv, result;
958 if (BV (clib_bihash_search) (&db->nsh_lookup_table, &kv, &result) == 0)
959 old_val = result.value;
983 0, (
u32) value, is_add);
989 (
u32) value, 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)
#define IP6_LOOKUP_DEFAULT_HASH_NUM_BUCKETS
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
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
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 u32 add_del_nsh(gid_nsh_table_t *db, u32 vni, u32 spi, u8 si, u32 value, u8 is_add)
static void ip6_compute_prefix_lengths_in_search_order(gid_ip6_table_t *db)
#define gid_address_sd_src_mac(_a)
static void make_nsh_key(BVT(clib_bihash_kv) *kv, u32 vni, u32 spi, u8 si)
static void nsh_lookup_init(gid_nsh_table_t *db)
#define gid_address_sd(_a)
u32 ip4_prefix_len_refcount[33]
static void make_arp_ndp_key(BVT(clib_bihash_kv) *kv, u32 bd, ip_address_t *addr)
#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. ...
u32 nsh_lookup_table_nbuckets
uword arp_ndp_lookup_table_size
#define gid_address_sd_dst_mac(_a)
#define IP4_LOOKUP_DEFAULT_HASH_MEMORY_SIZE
#define ip_addr_version(_a)
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
static void ip6_address_mask(ip6_address_t *a, const ip6_address_t *mask)
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.
#define clib_memcpy(d, s, n)
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)
u32 gid_dictionary_add_del(gid_dictionary_t *db, gid_address_t *key, u64 value, u8 is_add)
void gid_dict_foreach_l2_arp_ndp_entry(gid_dictionary_t *db, void(*cb)(BVT(clib_bihash_kv) *kvp, void *arg), void *ht)
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)
#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.
#define gid_address_arp_ndp_ip(_a)
void gid_dict_foreach_subprefix(gid_dictionary_t *db, gid_address_t *eid, foreach_subprefix_match_cb_t cb, void *arg)
static void make_mac_sd_key(BVT(clib_bihash_kv) *kv, u32 vni, u8 src_mac[6], u8 dst_mac[6])
#define gid_address_mac(_a)
static void foreach_sfib4_subprefix(BVT(clib_bihash_kv) *kvp, void *arg)
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
void clib_bihash_init(clib_bihash *h, char *name, u32 nbuckets, uword memory_size)
initialize a bounded index extensible hash table
static uword ip6_address_is_equal_masked(const ip6_address_t *a, const ip6_address_t *b, const ip6_address_t *mask)
u32 ip4_lookup_table_nbuckets
#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 nsh_lookup_table_size
u8 * format_ip_prefix(u8 *s, va_list *args)
uword ip6_lookup_table_size
gid_l2_arp_ndp_table_t arp_ndp_table
L2 ARP/NDP table.
#define clib_warning(format, args...)
static u32 ip4_lookup_exact_match(gid_ip4_table_t *db, u32 vni, ip_prefix_t *key)
static u64 add_del_arp_ndp(gid_l2_arp_ndp_table_t *db, u32 bd, ip_address_t *key, u64 value, u8 is_add)
u8 * ip4_prefix_lengths_in_search_order
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
#define gid_address_nsh_si(_a)
void(* foreach_subprefix_match_cb_t)(u32, void *)
static void arp_ndp_lookup_init(gid_l2_arp_ndp_table_t *db)
#define gid_address_arp_ndp_bd(_a)
struct _gid_address_t gid_address_t
#define ARP_NDP_LOOKUP_DEFAULT_HASH_MEMORY_SIZE
#define IP6_LOOKUP_DEFAULT_HASH_MEMORY_SIZE
int clib_bihash_search_inline_2(clib_bihash *h, clib_bihash_kv *search_key, clib_bihash_kv *valuep)
Search a bi-hash table.
u32 gid_dictionary_sd_lookup(gid_dictionary_t *db, gid_address_t *dst, gid_address_t *src)
gid_nsh_table_t nsh_table
NSH lookup table.
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)
u64 gid_dictionary_lookup(gid_dictionary_t *db, gid_address_t *key)
static void ip4_compute_prefix_lengths_in_search_order(gid_ip4_table_t *db)
static void ip6_lookup_init(gid_ip6_table_t *db)
#define ARP_NDP_LOOKUP_DEFAULT_HASH_NUM_BUCKETS
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)
#define GID_LOOKUP_MISS_L2
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)
#define gid_address_nsh_spi(_a)
#define ip_prefix_len(_a)
static u64 arp_ndp_lookup(gid_l2_arp_ndp_table_t *db, u32 bd, ip_address_t *key)
gid_ip6_table_t * ip6_table
#define ip_prefix_version(_a)
static void foreach_sfib6_subprefix(BVT(clib_bihash_kv) *kvp, void *arg)
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
u32 arp_ndp_lookup_table_nbuckets
static u32 nsh_lookup(gid_nsh_table_t *db, u32 vni, u32 spi, u8 si)
uword * ip6_non_empty_dst_address_length_bitmap
#define sd_dst_ippref(_a)
union ip_address::@230 ip