aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/map/map.h
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2017-02-20 20:29:41 -0800
committerOle Trøan <otroan@employees.org>2017-03-29 15:21:20 +0000
commit9705c3833a7b18609df8ae315a0aa062e1d2e180 (patch)
tree5e84c96ead76bdd40e405fdec46d9a424effd502 /src/vnet/map/map.h
parent04a75e3230ab71248fc29a56b9f64bdaee0c17ac (diff)
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 <nranns@cisco.com>
Diffstat (limited to 'src/vnet/map/map.h')
-rw-r--r--src/vnet/map/map.h29
1 files changed, 10 insertions, 19 deletions
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;