X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvnet%2Flisp-gpe%2Flisp_gpe_adjacency.c;h=7361e8eb0d6c0cfe93e859e119b24c0a57658fbe;hb=7c03ed47d5acfa39820f9553999caa01cf47dba4;hp=7db1c9bbb728d5260e595da89ad32f1c2b5796e1;hpb=f55f9b851f59264d737d92c6277a87588c565d24;p=vpp.git diff --git a/src/vnet/lisp-gpe/lisp_gpe_adjacency.c b/src/vnet/lisp-gpe/lisp_gpe_adjacency.c index 7db1c9bbb72..7361e8eb0d6 100644 --- a/src/vnet/lisp-gpe/lisp_gpe_adjacency.c +++ b/src/vnet/lisp-gpe/lisp_gpe_adjacency.c @@ -115,7 +115,7 @@ ip46_address_to_ip_address (const ip46_address_t * a, ip_address_t * b) { if (ip46_address_is_ip4 (a)) { - memset (b, 0, sizeof (*b)); + clib_memset (b, 0, sizeof (*b)); ip_address_set (b, &a->ip4, IP4); } else @@ -131,48 +131,13 @@ static void lisp_gpe_adj_stack_one (lisp_gpe_adjacency_t * ladj, adj_index_t ai) { const lisp_gpe_tunnel_t *lgt; - dpo_id_t tmp = DPO_INVALID; lgt = lisp_gpe_tunnel_get (ladj->tunnel_index); - fib_entry_contribute_forwarding (lgt->fib_entry_index, - lisp_gpe_adj_get_fib_chain_type (ladj), - &tmp); - if (DPO_LOAD_BALANCE == tmp.dpoi_type) - { - /* - * post LISP rewrite we will load-balance. However, the LISP encap - * is always the same for this adjacency/tunnel and hence the IP/UDP src,dst - * hash is always the same result too. So we do that hash now and - * stack on the choice. - * If the choice is an incomplete adj then we will need a poke when - * it becomes complete. This happens since the adj update walk propagates - * as far a recursive paths. - */ - const dpo_id_t *choice; - load_balance_t *lb; - int hash; - - lb = load_balance_get (tmp.dpoi_index); - - if (IP4 == ip_addr_version (&ladj->remote_rloc)) - { - hash = ip4_compute_flow_hash ((ip4_header_t *) adj_get_rewrite (ai), - lb->lb_hash_config); - } - else - { - hash = ip6_compute_flow_hash ((ip6_header_t *) adj_get_rewrite (ai), - lb->lb_hash_config); - } - - choice = - load_balance_get_bucket_i (lb, hash & lb->lb_n_buckets_minus_1); - dpo_copy (&tmp, choice); - } - - adj_nbr_midchain_stack (ai, &tmp); - dpo_reset (&tmp); + adj_nbr_midchain_stack_on_fib_entry (ai, + lgt->fib_entry_index, + lisp_gpe_adj_get_fib_chain_type + (ladj)); } /** @@ -293,7 +258,7 @@ lisp_gpe_increment_stats_counters (lisp_cp_main_t * lcm, ip_adjacency_t * adj, return; lisp_stats_key_t key; - memset (&key, 0, sizeof (key)); + clib_memset (&key, 0, sizeof (key)); key.fwd_entry_index = feip[0]; key.tunnel_index = ladj->tunnel_index; @@ -307,7 +272,8 @@ lisp_gpe_increment_stats_counters (lisp_cp_main_t * lcm, ip_adjacency_t * adj, } static void -lisp_gpe_fixup (vlib_main_t * vm, ip_adjacency_t * adj, vlib_buffer_t * b) +lisp_gpe_fixup (vlib_main_t * vm, + ip_adjacency_t * adj, vlib_buffer_t * b, const void *data) { lisp_cp_main_t *lcm = vnet_lisp_cp_get_main (); @@ -331,6 +297,7 @@ lisp_gpe_update_adjacency (vnet_main_t * vnm, u32 sw_if_index, adj_index_t ai) ip_adjacency_t *adj; ip_address_t rloc; vnet_link_t linkt; + adj_flags_t af; index_t lai; adj = adj_get (ai); @@ -346,11 +313,12 @@ lisp_gpe_update_adjacency (vnet_main_t * vnm, u32 sw_if_index, adj_index_t ai) ladj = pool_elt_at_index (lisp_adj_pool, lai); lgt = lisp_gpe_tunnel_get (ladj->tunnel_index); linkt = adj_get_link_type (ai); + af = ADJ_FLAG_MIDCHAIN_IP_STACK; + if (VNET_LINK_ETHERNET == linkt) + af |= ADJ_FLAG_MIDCHAIN_NO_COUNT; + adj_nbr_midchain_update_rewrite - (ai, lisp_gpe_fixup, - (VNET_LINK_ETHERNET == linkt ? - ADJ_FLAG_MIDCHAIN_NO_COUNT : - ADJ_FLAG_NONE), + (ai, lisp_gpe_fixup, NULL, af, lisp_gpe_tunnel_build_rewrite (lgt, ladj, lisp_gpe_adj_proto_from_vnet_link_type (linkt))); @@ -393,7 +361,7 @@ lisp_gpe_adjacency_find_or_create_and_lock (const locator_pair_t * pair, { pool_get (lisp_adj_pool, ladj); - memset (ladj, 0, sizeof (*ladj)); + clib_memset (ladj, 0, sizeof (*ladj)); lai = (ladj - lisp_adj_pool); ip_address_copy (&ladj->remote_rloc, &pair->rmt_loc);