aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/classify
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2020-09-28 19:03:37 +0200
committerDamjan Marion <damarion@cisco.com>2020-09-28 20:34:07 +0200
commit4537c30925050ffa34c33e6a481f07f1ec0a01ff (patch)
tree0516dba983516dd12027cd59d18e514dcebe24de /src/vnet/classify
parenta8af7cf253c4e8ab9ba1a2cfed50f6236fea3a62 (diff)
vppinfra: don't call dlmalloc API directly from the code
- it is confusing from end consumer perspective that some thing is somewhere called heap and somewhere mspace - this is base for additional work where heap pointer is not the same thing like mspace Type: improvement Change-Id: I644d5a0de17690d65d164d8cec3c5654571629ef Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vnet/classify')
-rw-r--r--src/vnet/classify/vnet_classify.c10
-rw-r--r--src/vnet/classify/vnet_classify.h4
2 files changed, 7 insertions, 7 deletions
diff --git a/src/vnet/classify/vnet_classify.c b/src/vnet/classify/vnet_classify.c
index f4a63171170..8e77d25d736 100644
--- a/src/vnet/classify/vnet_classify.c
+++ b/src/vnet/classify/vnet_classify.c
@@ -147,9 +147,8 @@ vnet_classify_new_table (vnet_classify_main_t * cm,
t->skip_n_vectors = skip_n_vectors;
t->entries_per_page = 2;
- t->mheap = create_mspace (memory_size, 1 /* locked */ );
- /* classifier requires the memory to be contiguous, so can not expand. */
- mspace_disable_expand (t->mheap);
+ t->mheap = clib_mem_create_heap (0, memory_size, 1 /* locked */ ,
+ "classify");
vec_validate_aligned (t->buckets, nbuckets - 1, CLIB_CACHE_LINE_BYTES);
oldheap = clib_mem_set_heap (t->mheap);
@@ -176,7 +175,7 @@ vnet_classify_delete_table_index (vnet_classify_main_t * cm,
vec_free (t->mask);
vec_free (t->buckets);
- destroy_mspace (t->mheap);
+ clib_mem_destroy_heap (t->mheap);
pool_put (cm->tables, t);
}
@@ -2134,7 +2133,8 @@ format_vnet_classify_table (u8 * s, va_list * args)
s = format (s, "%10u%10d%10d%10d", index, t->active_elements,
t->next_table_index, t->miss_next_index);
- s = format (s, "\n Heap: %U", format_mheap, t->mheap, 0 /*verbose */ );
+ s = format (s, "\n Heap: %U", format_clib_mem_heap, t->mheap,
+ 0 /*verbose */ );
s = format (s, "\n nbuckets %d, skip %d match %d flag %d offset %d",
t->nbuckets, t->skip_n_vectors, t->match_n_vectors,
diff --git a/src/vnet/classify/vnet_classify.h b/src/vnet/classify/vnet_classify.h
index db3821b7c77..f0c81241584 100644
--- a/src/vnet/classify/vnet_classify.h
+++ b/src/vnet/classify/vnet_classify.h
@@ -303,7 +303,7 @@ vnet_classify_prefetch_bucket (vnet_classify_table_t * t, u64 hash)
static inline vnet_classify_entry_t *
vnet_classify_get_entry (vnet_classify_table_t * t, uword offset)
{
- u8 *hp = t->mheap;
+ u8 *hp = clib_mem_get_heap_base (t->mheap);
u8 *vp = hp + offset;
return (void *) vp;
@@ -315,7 +315,7 @@ vnet_classify_get_offset (vnet_classify_table_t * t,
{
u8 *hp, *vp;
- hp = (u8 *) t->mheap;
+ hp = (u8 *) clib_mem_get_heap_base (t->mheap);
vp = (u8 *) v;
ASSERT ((vp - hp) < 0x100000000ULL);