bb28422fe8f89fbbb29379038e603734f4d6d6aa
[dpdk.git] / lib / librte_eal / common / malloc_heap.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2010-2014 Intel Corporation
3  */
4
5 #ifndef MALLOC_HEAP_H_
6 #define MALLOC_HEAP_H_
7
8 #include <rte_malloc.h>
9 #include <rte_malloc_heap.h>
10
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14
15 static inline unsigned
16 malloc_get_numa_socket(void)
17 {
18         unsigned socket_id = rte_socket_id();
19
20         if (socket_id == (unsigned)SOCKET_ID_ANY)
21                 return 0;
22
23         return socket_id;
24 }
25
26 void *
27 malloc_heap_alloc(struct malloc_heap *heap,     const char *type, size_t size,
28                 unsigned flags, size_t align, size_t bound);
29
30 int
31 malloc_heap_free(struct malloc_elem *elem);
32
33 int
34 malloc_heap_resize(struct malloc_elem *elem, size_t size);
35
36 int
37 malloc_heap_get_stats(struct malloc_heap *heap,
38                 struct rte_malloc_socket_stats *socket_stats);
39
40 void
41 malloc_heap_dump(struct malloc_heap *heap, FILE *f);
42
43 int
44 rte_eal_malloc_heap_init(void);
45
46 #ifdef __cplusplus
47 }
48 #endif
49
50 #endif /* MALLOC_HEAP_H_ */