diff options
author | Neale Ranns <nranns@cisco.com> | 2019-12-06 05:53:17 +0000 |
---|---|---|
committer | Dave Barach <openvpp@barachs.net> | 2019-12-16 23:29:21 +0000 |
commit | f50bac1bb25b02d7f086627c4c0a0709ee0f61d5 (patch) | |
tree | 26408a8b3d80f0e2eae7900aa8e49f37ac6de3b8 /src/vnet/lisp-cp | |
parent | 77cfc0171da0fa2b305378731a5fefd659d8947d (diff) |
vppinfra: bihash walk cb typedef and continue/stop controls
Type: feature
Change-Id: I28f7a658be3f3beec9ea32635b60d1d3a10d9b06
Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'src/vnet/lisp-cp')
-rw-r--r-- | src/vnet/lisp-cp/control.c | 20 | ||||
-rw-r--r-- | src/vnet/lisp-cp/gid_dictionary.c | 12 | ||||
-rw-r--r-- | src/vnet/lisp-cp/gid_dictionary.h | 6 |
3 files changed, 22 insertions, 16 deletions
diff --git a/src/vnet/lisp-cp/control.c b/src/vnet/lisp-cp/control.c index 420a6db4e5a..78750b962df 100644 --- a/src/vnet/lisp-cp/control.c +++ b/src/vnet/lisp-cp/control.c @@ -899,16 +899,17 @@ vnet_lisp_add_del_local_mapping (vnet_lisp_add_del_mapping_args_t * a, return vnet_lisp_map_cache_add_del (a, map_index_result); } -static void +static int add_l2_arp_bd (BVT (clib_bihash_kv) * kvp, void *arg) { u32 **ht = arg; u32 version = (u32) kvp->key[0]; if (AF_IP6 == version) - return; + return (BIHASH_WALK_CONTINUE); u32 bd = (u32) (kvp->key[0] >> 32); hash_set (ht[0], bd, 0); + return (BIHASH_WALK_CONTINUE); } u32 * @@ -922,16 +923,17 @@ vnet_lisp_l2_arp_bds_get (void) return bds; } -static void +static int add_ndp_bd (BVT (clib_bihash_kv) * kvp, void *arg) { u32 **ht = arg; u32 version = (u32) kvp->key[0]; if (AF_IP4 == version) - return; + return (BIHASH_WALK_CONTINUE); u32 bd = (u32) (kvp->key[0] >> 32); hash_set (ht[0], bd, 0); + return (BIHASH_WALK_CONTINUE); } u32 * @@ -951,7 +953,7 @@ typedef struct u32 bd; } lisp_add_l2_arp_ndp_args_t; -static void +static int add_l2_arp_entry (BVT (clib_bihash_kv) * kvp, void *arg) { lisp_add_l2_arp_ndp_args_t *a = arg; @@ -959,7 +961,7 @@ add_l2_arp_entry (BVT (clib_bihash_kv) * kvp, void *arg) u32 version = (u32) kvp->key[0]; if (AF_IP6 == version) - return; + return (BIHASH_WALK_CONTINUE); u32 bd = (u32) (kvp->key[0] >> 32); @@ -969,6 +971,7 @@ add_l2_arp_entry (BVT (clib_bihash_kv) * kvp, void *arg) e.ip4 = (u32) kvp->key[1]; vec_add1 (vector[0], e); } + return (BIHASH_WALK_CONTINUE); } lisp_api_l2_arp_entry_t * @@ -986,7 +989,7 @@ vnet_lisp_l2_arp_entries_get_by_bd (u32 bd) return entries; } -static void +static int add_ndp_entry (BVT (clib_bihash_kv) * kvp, void *arg) { lisp_add_l2_arp_ndp_args_t *a = arg; @@ -994,7 +997,7 @@ add_ndp_entry (BVT (clib_bihash_kv) * kvp, void *arg) u32 version = (u32) kvp->key[0]; if (AF_IP4 == version) - return; + return (BIHASH_WALK_CONTINUE); u32 bd = (u32) (kvp->key[0] >> 32); @@ -1004,6 +1007,7 @@ add_ndp_entry (BVT (clib_bihash_kv) * kvp, void *arg) clib_memcpy (e.ip6, &kvp->key[1], 16); vec_add1 (vector[0], e); } + return (BIHASH_WALK_CONTINUE); } lisp_api_ndp_entry_t * diff --git a/src/vnet/lisp-cp/gid_dictionary.c b/src/vnet/lisp-cp/gid_dictionary.c index 3fd98c737c8..c1b4adacf22 100644 --- a/src/vnet/lisp-cp/gid_dictionary.c +++ b/src/vnet/lisp-cp/gid_dictionary.c @@ -31,7 +31,7 @@ static u32 ip4_lookup (gid_ip4_table_t * db, u32 vni, ip_prefix_t * key); static u32 ip6_lookup (gid_ip6_table_t * db, u32 vni, ip_prefix_t * key); -static void +static int foreach_sfib4_subprefix (BVT (clib_bihash_kv) * kvp, void *arg) { sfib_entry_arg_t *a = arg; @@ -51,6 +51,7 @@ foreach_sfib4_subprefix (BVT (clib_bihash_kv) * kvp, void *arg) /* found sub-prefix of src prefix */ (a->cb) (kvp->value, a->arg); } + return (BIHASH_WALK_CONTINUE); } static void @@ -77,7 +78,7 @@ gid_dict_foreach_ip4_subprefix (gid_dictionary_t * db, u32 vni, foreach_sfib4_subprefix, &a); } -static void +static int foreach_sfib6_subprefix (BVT (clib_bihash_kv) * kvp, void *arg) { sfib_entry_arg_t *a = arg; @@ -94,6 +95,7 @@ foreach_sfib6_subprefix (BVT (clib_bihash_kv) * kvp, void *arg) /* found sub-prefix of src prefix */ (a->cb) (kvp->value, a->arg); } + return (BIHASH_WALK_CONTINUE); } static void @@ -139,9 +141,9 @@ gid_dict_foreach_subprefix (gid_dictionary_t * db, gid_address_t * eid, } void -gid_dict_foreach_l2_arp_ndp_entry (gid_dictionary_t * db, void (*cb) - (BVT (clib_bihash_kv) * kvp, void *arg), - void *ht) +gid_dict_foreach_l2_arp_ndp_entry (gid_dictionary_t * db, + BV (clib_bihash_foreach_key_value_pair_cb) + cb, void *ht) { gid_l2_arp_ndp_table_t *tab = &db->arp_ndp_table; BV (clib_bihash_foreach_key_value_pair) (&tab->arp_ndp_lookup_table, cb, diff --git a/src/vnet/lisp-cp/gid_dictionary.h b/src/vnet/lisp-cp/gid_dictionary.h index 3f8500e56a7..5154b3a5874 100644 --- a/src/vnet/lisp-cp/gid_dictionary.h +++ b/src/vnet/lisp-cp/gid_dictionary.h @@ -146,9 +146,9 @@ gid_dict_foreach_subprefix (gid_dictionary_t * db, gid_address_t * eid, foreach_subprefix_match_cb_t cb, void *arg); void -gid_dict_foreach_l2_arp_ndp_entry (gid_dictionary_t * db, void (*cb) - (BVT (clib_bihash_kv) * kvp, void *arg), - void *ht); +gid_dict_foreach_l2_arp_ndp_entry (gid_dictionary_t * db, + BV (clib_bihash_foreach_key_value_pair_cb) + cb, void *ht); #endif /* VNET_LISP_GPE_GID_DICTIONARY_H_ */ |