From 9705c3833a7b18609df8ae315a0aa062e1d2e180 Mon Sep 17 00:00:00 2001 From: Neale Ranns Date: Mon, 20 Feb 2017 20:29:41 -0800 Subject: MAP - add the domain struct directly into the dat-path and avoid the indirectiob throught the map-DPO Change-Id: Ifb72a1c1258440fdc4845aca8aecf2abd63526b1 Signed-off-by: Neale Ranns --- src/vnet/map/map.h | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) (limited to 'src/vnet/map/map.h') diff --git a/src/vnet/map/map.h b/src/vnet/map/map.h index 616d42c0..644e80f5 100644 --- a/src/vnet/map/map.h +++ b/src/vnet/map/map.h @@ -416,17 +416,11 @@ map_get_ip4 (ip6_address_t *addr) * Get the MAP domain from an IPv4 lookup adjacency. */ static_always_inline map_domain_t * -ip4_map_get_domain (u32 mdi, - u32 *map_domain_index) +ip4_map_get_domain (u32 mdi) { map_main_t *mm = &map_main; - map_dpo_t *md; - md = map_dpo_get(mdi); - - ASSERT(md); - *map_domain_index = md->md_domain; - return pool_elt_at_index(mm->domains, *map_domain_index); + return pool_elt_at_index(mm->domains, mdi); } /* @@ -435,23 +429,21 @@ ip4_map_get_domain (u32 mdi, * The IPv4 address is used otherwise. */ static_always_inline map_domain_t * -ip6_map_get_domain (u32 mdi, ip4_address_t *addr, - u32 *map_domain_index, u8 *error) +ip6_map_get_domain (u32 mdi, + ip4_address_t *addr, + u32 *map_domain_index, + u8 *error) { map_main_t *mm = &map_main; - map_dpo_t *md; /* * Disable direct MAP domain lookup on decap, until the security check is updated to verify IPv4 SA. * (That's done implicitly when MAP domain is looked up in the IPv4 FIB) */ #ifdef MAP_NONSHARED_DOMAIN_ENABLED - md = map_dpo_get(mdi); - - ASSERT(md); - *map_domain_index = md->md_domain; - if (*map_domain_index != ~0) - return pool_elt_at_index(mm->domains, *map_domain_index); +#error "How can you be sure this domain is not shared?" + *map_domain_index = mdi; + return pool_elt_at_index(mm->domains, mdi); #endif u32 lbi = ip4_fib_forwarding_lookup(0, addr); @@ -459,8 +451,7 @@ ip6_map_get_domain (u32 mdi, ip4_address_t *addr, if (PREDICT_TRUE(dpo->dpoi_type == map_dpo_type || dpo->dpoi_type == map_t_dpo_type)) { - md = map_dpo_get(dpo->dpoi_index); - *map_domain_index = md->md_domain; + *map_domain_index = dpo->dpoi_index; return pool_elt_at_index(mm->domains, *map_domain_index); } *error = MAP_ERROR_NO_DOMAIN; -- cgit 1.2.3-korg