46 src_ip &= mask->as_u32;
52 (a->
cb) (kvp->value, a->
arg);
54 return (BIHASH_WALK_CONTINUE);
90 ip.
as_u64[0] = kvp->key[0];
91 ip.
as_u64[1] = kvp->key[1];
96 (a->
cb) (kvp->value, a->
arg);
98 return (BIHASH_WALK_CONTINUE);
157 kv->key[0] = (
u64) vni;
216 for (i = 0; i <
len; i++)
221 ASSERT (dst_address_length >= 0 && dst_address_length <= 32);
250 kv.key[2] = (
u64) vni;
268 for (i = 0; i <
len; i++)
273 ASSERT (dst_address_length >= 0 && dst_address_length <= 128);
279 kv.key[2] = (
u64) vni;
350 kv->key[2] = (
u64) 0;
362 kv->key[0] = (
u64) vni;
363 kv->key[1] = (
u64) spi;
364 kv->key[2] = (
u64) si;
423 clib_warning (
"Source/Dest address type %d not supported!",
469 clib_warning (
"Source/Dest address type %d not supported!",
494 int dst_address_length = 32 - i;
495 vec_add1 (db->ip4_prefix_lengths_in_search_order, dst_address_length);
536 kv.key[0] = ((
u64) vni << 32) | key.
as_u32;
540 if (BV (clib_bihash_search) (&db->ip4_lookup_table, &kv, &
value) == 0)
541 old_val = value.value;
560 BVT (clib_bihash_init2_args) _a, *
a = &_a;
589 memset (a, 0,
sizeof (*a));
590 a->h = &db->ip4_lookup_table;
591 a->name =
"LISP ip4 lookup table";
594 a->dont_add_to_all_bihash_list = 1;
596 BV (clib_bihash_init2) (
a);
603 u32 sfi, old_val = ~0;
657 if (sfib->
count == 0)
677 int dst_address_length = 128 - i;
678 vec_add1 (db->ip6_prefix_lengths_in_search_order, dst_address_length);
717 kv.key[0] = key.
as_u64[0];
718 kv.key[1] = key.
as_u64[1];
719 kv.key[2] = (
u64) vni;
722 if (BV (clib_bihash_search) (&db->ip6_lookup_table, &kv, &
value) == 0)
723 old_val = value.value;
748 if (BV (clib_bihash_search) (&db->mac_lookup_table, &kv, &value) == 0)
749 old_val = value.value;
769 BVT (clib_bihash_init2_args) _a, *
a = &_a;
781 for (j = 0; j < i0; j++)
786 clib_host_to_net_u32 (
pow2_mask (i1) << (32 - i1));
802 memset (a, 0,
sizeof (*a));
803 a->h = &db->ip6_lookup_table;
804 a->name =
"LISP ip6 lookup table";
807 a->dont_add_to_all_bihash_list = 1;
809 BV (clib_bihash_init2) (
a);
816 u32 sfi, old_val = ~0;
873 if (sfib->
count == 0)
929 BVT (clib_bihash_kv) kv, result;
933 if (BV (clib_bihash_search) (&db->arp_ndp_lookup_table, &kv, &result) == 0)
934 old_val = result.value;
956 BVT (clib_bihash_kv) kv, result;
960 if (BV (clib_bihash_search) (&db->nsh_lookup_table, &kv, &result) == 0)
961 old_val = result.value;
985 0, (
u32) value, is_add);
991 (
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)
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)
int(* clib_bihash_foreach_key_value_pair_cb)(clib_bihash_kv *kv, void *ctx)
#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 clib_bihash_foreach_key_value_pair(clib_bihash *h, clib_bihash_foreach_key_value_pair_cb *callback, void *arg)
Visit active (key,value) pairs in a bi-hash table.
#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 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)
#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)
static int foreach_sfib6_subprefix(BVT(clib_bihash_kv) *kvp, void *arg)
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
void gid_dict_foreach_l2_arp_ndp_entry(gid_dictionary_t *db, cb, void *ht)
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)
static int foreach_sfib4_subprefix(BVT(clib_bihash_kv) *kvp, void *arg)
#define ip_prefix_len(_a)
static u64 arp_ndp_lookup(gid_l2_arp_ndp_table_t *db, u32 bd, ip_address_t *key)
union ip_address::@304 ip
gid_ip6_table_t * ip6_table
#define ip_prefix_version(_a)
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)