New upstream version 18.02
[deb_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_get_stats(struct malloc_heap *heap,
32                 struct rte_malloc_socket_stats *socket_stats);
33
34 int
35 rte_eal_malloc_heap_init(void);
36
37 #ifdef __cplusplus
38 }
39 #endif
40
41 #endif /* MALLOC_HEAP_H_ */