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,
143 (
BVT (clib_bihash_kv) * kvp,
void *arg),
155 kv->key[0] = (
u64) vni;
164 BVT (clib_bihash_kv) kv, value;
188 BVT (clib_bihash_kv) kv, value;
210 BVT (clib_bihash_kv) kv, value;
214 for (i = 0; i < len; i++)
219 ASSERT (dst_address_length >= 0 && dst_address_length <= 32);
241 BVT (clib_bihash_kv) kv, value;
248 kv.key[2] = (
u64) vni;
262 BVT (clib_bihash_kv) kv, value;
266 for (i = 0; i < len; i++)
271 ASSERT (dst_address_length >= 0 && dst_address_length <= 128);
277 kv.key[2] = (
u64) vni;
308 memset (&sp, 0,
sizeof (sp));
325 memset (&sp, 0,
sizeof (sp));
347 kv->key[1] = (
u64) addr->ip.v4.as_u32;
348 kv->key[2] = (
u64) 0;
352 kv->key[1] = (
u64) addr->ip.v6.as_u64[0];
353 kv->key[2] = (
u64) addr->ip.v6.as_u64[1];
360 kv->key[0] = (
u64) vni;
361 kv->key[1] = (
u64) spi;
362 kv->key[2] = (
u64) si;
369 BVT (clib_bihash_kv) kv, value;
385 BVT (clib_bihash_kv) kv, value;
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);
503 BVT (clib_bihash_kv) kv, value;
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;
589 ip_prefix_t * src_pref,
u32 val,
u8 is_add)
591 u32 sfi, old_val = ~0;
609 memset (&sp, 0,
sizeof (sp));
625 memset (&sp, 0,
sizeof (sp));
641 memset (&sp, 0,
sizeof (sp));
645 if (sfib->
count == 0)
665 int dst_address_length = 128 - i;
666 vec_add1 (db->ip6_prefix_lengths_in_search_order, dst_address_length);
675 BVT (clib_bihash_kv) kv, value;
705 kv.key[0] = key.
as_u64[0];
706 kv.key[1] = key.
as_u64[1];
707 kv.key[2] = (
u64) vni;
710 if (BV (clib_bihash_search) (&db->ip6_lookup_table, &kv, &value) == 0)
711 old_val = value.value;
731 BVT (clib_bihash_kv) kv, value;
736 if (BV (clib_bihash_search) (&db->mac_lookup_table, &kv, &value) == 0)
737 old_val = value.value;
768 for (j = 0; j < i0; j++)
773 clib_host_to_net_u32 (
pow2_mask (i1) << (32 - i1));
792 ip_prefix_t * src_pref,
u32 val,
u8 is_add)
794 u32 sfi, old_val = ~0;
812 memset (&sp, 0,
sizeof (sp));
829 memset (&sp, 0,
sizeof (sp));
846 memset (&sp, 0,
sizeof (sp));
851 if (sfib->
count == 0)
863 ip_prefix_t * src_key,
u32 value,
u8 is_add)
905 u64 value,
u8 is_add)
907 BVT (clib_bihash_kv) kv, result;
911 if (BV (clib_bihash_search) (&db->arp_ndp_lookup_table, &kv, &result) == 0)
912 old_val = result.value;
934 BVT (clib_bihash_kv) kv, result;
938 if (BV (clib_bihash_search) (&db->nsh_lookup_table, &kv, &result) == 0)
939 old_val = result.value;
963 0, (
u32) value, is_add);
969 (
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
static void make_arp_ndp_key(BVT(clib_bihash_kv)*kv, u32 bd, ip_address_t *addr)
boost::asio::ip::address ip_address_t
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 void make_nsh_key(BVT(clib_bihash_kv)*kv, u32 vni, u32 spi, u8 si)
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 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)
#define ip_prefix_len(_a)
static void nsh_lookup_init(gid_nsh_table_t *db)
#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. ...
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 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)
#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)
u32 gid_dictionary_add_del(gid_dictionary_t *db, gid_address_t *key, u64 value, u8 is_add)
memset(h->entries, 0, sizeof(h->entries[0])*entries)
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)
#define ip_addr_version(_a)
#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)
#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
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
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 nsh_lookup_table_size
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)
#define clib_memcpy(a, b, c)
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
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)
#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 u64 arp_ndp_lookup(gid_l2_arp_ndp_table_t *db, u32 bd, ip_address_t *key)
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
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
void gid_dict_foreach_l2_arp_ndp_entry(gid_dictionary_t *db, void(*cb)(BVT(clib_bihash_kv)*kvp, void *arg), void *ht)
#define sd_dst_ippref(_a)