aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/map/map_dpo.c
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_dpo.c
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_dpo.c')
-rw-r--r--src/vnet/map/map_dpo.c69
1 files changed, 4 insertions, 65 deletions
diff --git a/src/vnet/map/map_dpo.c b/src/vnet/map/map_dpo.c
index df2b5fa4197..430c1fbf266 100644
--- a/src/vnet/map/map_dpo.c
+++ b/src/vnet/map/map_dpo.c
@@ -17,48 +17,20 @@
#include <vnet/map/map_dpo.h>
/**
- * pool of all MPLS Label DPOs
- */
-map_dpo_t *map_dpo_pool;
-
-/**
* The register MAP DPO type
*/
dpo_type_t map_dpo_type;
dpo_type_t map_t_dpo_type;
-static map_dpo_t *
-map_dpo_alloc (void)
-{
- map_dpo_t *md;
-
- pool_get_aligned(map_dpo_pool, md, CLIB_CACHE_LINE_BYTES);
- memset(md, 0, sizeof(*md));
-
- return (md);
-}
-
-static index_t
-map_dpo_get_index (map_dpo_t *md)
-{
- return (md - map_dpo_pool);
-}
-
void
map_dpo_create (dpo_proto_t dproto,
u32 domain_index,
dpo_id_t *dpo)
{
- map_dpo_t *md;
-
- md = map_dpo_alloc();
- md->md_domain = domain_index;
- md->md_proto = dproto;
-
dpo_set(dpo,
map_dpo_type,
dproto,
- map_dpo_get_index(md));
+ domain_index);
}
void
@@ -66,16 +38,10 @@ map_t_dpo_create (dpo_proto_t dproto,
u32 domain_index,
dpo_id_t *dpo)
{
- map_dpo_t *md;
-
- md = map_dpo_alloc();
- md->md_domain = domain_index;
- md->md_proto = dproto;
-
dpo_set(dpo,
map_t_dpo_type,
dproto,
- map_dpo_get_index(md));
+ domain_index);
}
@@ -84,14 +50,8 @@ format_map_dpo (u8 *s, va_list *args)
{
index_t index = va_arg (*args, index_t);
CLIB_UNUSED(u32 indent) = va_arg (*args, u32);
- map_dpo_t *md;
-
- md = map_dpo_get(index);
- return (format(s, "map:[%d]:%U domain:%d",
- index,
- format_dpo_proto, md->md_proto,
- md->md_domain));
+ return (format(s, "map: domain:%d", index));
}
u8*
@@ -99,40 +59,19 @@ format_map_t_dpo (u8 *s, va_list *args)
{
index_t index = va_arg (*args, index_t);
CLIB_UNUSED(u32 indent) = va_arg (*args, u32);
- map_dpo_t *md;
-
- md = map_dpo_get(index);
- return (format(s, "map-t:[%d]:%U domain:%d",
- index,
- format_dpo_proto, md->md_proto,
- md->md_domain));
+ return (format(s, "map-t: domain:%d", index));
}
static void
map_dpo_lock (dpo_id_t *dpo)
{
- map_dpo_t *md;
-
- md = map_dpo_get(dpo->dpoi_index);
-
- md->md_locks++;
}
static void
map_dpo_unlock (dpo_id_t *dpo)
{
- map_dpo_t *md;
-
- md = map_dpo_get(dpo->dpoi_index);
-
- md->md_locks--;
-
- if (0 == md->md_locks)
- {
- pool_put(map_dpo_pool, md);
- }
}
const static dpo_vft_t md_vft = {