From 974be46e9e9bc4c9a58474492444d3c5a6911681 Mon Sep 17 00:00:00 2001 From: David Marchand Date: Fri, 25 Oct 2019 15:56:03 +0200 Subject: [PATCH] mem: hide internal heap header Let's avoid exporting structures without an identified usecase. Signed-off-by: David Marchand Acked-by: Thomas Monjalon Acked-by: Anatoly Burakov --- app/test-pmd/testpmd.c | 1 - doc/guides/rel_notes/release_19_11.rst | 3 ++ lib/librte_eal/common/Makefile | 2 +- lib/librte_eal/common/eal_memcfg.h | 3 +- .../common/include/rte_malloc_heap.h | 35 ------------------- lib/librte_eal/common/malloc_heap.h | 25 ++++++++++++- lib/librte_eal/common/meson.build | 1 - 7 files changed, 30 insertions(+), 40 deletions(-) delete mode 100644 lib/librte_eal/common/include/rte_malloc_heap.h diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 1bae02254f..38acbc58a2 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -27,7 +27,6 @@ #include #include #include -#include #include #include #include diff --git a/doc/guides/rel_notes/release_19_11.rst b/doc/guides/rel_notes/release_19_11.rst index d6424914ed..e3b24a57c7 100644 --- a/doc/guides/rel_notes/release_19_11.rst +++ b/doc/guides/rel_notes/release_19_11.rst @@ -291,6 +291,9 @@ API Changes * eal: removed the ``rte_malloc_virt2phy`` function, replaced by ``rte_malloc_virt2iova`` since v17.11. +* mem: hid the internal ``malloc_heap`` structure and the + ``rte_malloc_heap.h`` header. + * The network structure ``esp_tail`` has been prefixed by ``rte_``. * The network definitions of PPPoE ethertypes have been prefixed by ``RTE_``. diff --git a/lib/librte_eal/common/Makefile b/lib/librte_eal/common/Makefile index a00d4fcad3..fb291f5c1f 100644 --- a/lib/librte_eal/common/Makefile +++ b/lib/librte_eal/common/Makefile @@ -10,7 +10,7 @@ INC += rte_log.h rte_memory.h rte_memzone.h INC += rte_per_lcore.h rte_random.h INC += rte_tailq.h rte_interrupts.h rte_alarm.h INC += rte_string_fns.h rte_version.h -INC += rte_eal_memconfig.h rte_malloc_heap.h +INC += rte_eal_memconfig.h INC += rte_hexdump.h rte_devargs.h rte_bus.h rte_dev.h rte_class.h INC += rte_option.h INC += rte_pci_dev_feature_defs.h rte_pci_dev_features.h diff --git a/lib/librte_eal/common/eal_memcfg.h b/lib/librte_eal/common/eal_memcfg.h index 0e468bb3a7..4d650025c2 100644 --- a/lib/librte_eal/common/eal_memcfg.h +++ b/lib/librte_eal/common/eal_memcfg.h @@ -6,7 +6,6 @@ #define EAL_MEMCFG_H #include -#include #include #include #include @@ -14,6 +13,8 @@ #include #include +#include "malloc_heap.h" + /** * Memory configuration shared across multiple processes. */ diff --git a/lib/librte_eal/common/include/rte_malloc_heap.h b/lib/librte_eal/common/include/rte_malloc_heap.h deleted file mode 100644 index 4a7e0eb1db..0000000000 --- a/lib/librte_eal/common/include/rte_malloc_heap.h +++ /dev/null @@ -1,35 +0,0 @@ -/* SPDX-License-Identifier: BSD-3-Clause - * Copyright(c) 2010-2014 Intel Corporation - */ - -#ifndef _RTE_MALLOC_HEAP_H_ -#define _RTE_MALLOC_HEAP_H_ - -#include -#include -#include -#include - -/* Number of free lists per heap, grouped by size. */ -#define RTE_HEAP_NUM_FREELISTS 13 -#define RTE_HEAP_NAME_MAX_LEN 32 - -/* dummy definition, for pointers */ -struct malloc_elem; - -/** - * Structure to hold malloc heap - */ -struct malloc_heap { - rte_spinlock_t lock; - LIST_HEAD(, malloc_elem) free_head[RTE_HEAP_NUM_FREELISTS]; - struct malloc_elem *volatile first; - struct malloc_elem *volatile last; - - unsigned alloc_count; - unsigned int socket_id; - size_t total_size; - char name[RTE_HEAP_NAME_MAX_LEN]; -} __rte_cache_aligned; - -#endif /* _RTE_MALLOC_HEAP_H_ */ diff --git a/lib/librte_eal/common/malloc_heap.h b/lib/librte_eal/common/malloc_heap.h index ca9ff666ff..772736b53f 100644 --- a/lib/librte_eal/common/malloc_heap.h +++ b/lib/librte_eal/common/malloc_heap.h @@ -6,9 +6,32 @@ #define MALLOC_HEAP_H_ #include +#include #include -#include +#include + +/* Number of free lists per heap, grouped by size. */ +#define RTE_HEAP_NUM_FREELISTS 13 +#define RTE_HEAP_NAME_MAX_LEN 32 + +/* dummy definition, for pointers */ +struct malloc_elem; + +/** + * Structure to hold malloc heap + */ +struct malloc_heap { + rte_spinlock_t lock; + LIST_HEAD(, malloc_elem) free_head[RTE_HEAP_NUM_FREELISTS]; + struct malloc_elem *volatile first; + struct malloc_elem *volatile last; + + unsigned int alloc_count; + unsigned int socket_id; + size_t total_size; + char name[RTE_HEAP_NAME_MAX_LEN]; +} __rte_cache_aligned; #ifdef __cplusplus extern "C" { diff --git a/lib/librte_eal/common/meson.build b/lib/librte_eal/common/meson.build index 386577c973..d6a149bec7 100644 --- a/lib/librte_eal/common/meson.build +++ b/lib/librte_eal/common/meson.build @@ -72,7 +72,6 @@ common_headers = files( 'include/rte_lcore.h', 'include/rte_log.h', 'include/rte_malloc.h', - 'include/rte_malloc_heap.h', 'include/rte_memory.h', 'include/rte_memzone.h', 'include/rte_option.h', -- 2.20.1