DPDK  18.02.2
rte_malloc.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2010-2014 Intel Corporation
3  */
4 
5 #ifndef _RTE_MALLOC_H_
6 #define _RTE_MALLOC_H_
7 
14 #include <stdio.h>
15 #include <stddef.h>
16 #include <rte_memory.h>
17 
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21 
29  unsigned free_count;
30  unsigned alloc_count;
32 };
33 
55 void *
56 rte_malloc(const char *type, size_t size, unsigned align);
57 
81 void *
82 rte_zmalloc(const char *type, size_t size, unsigned align);
83 
107 void *
108 rte_calloc(const char *type, size_t num, size_t size, unsigned align);
109 
130 void *
131 rte_realloc(void *ptr, size_t size, unsigned align);
132 
156 void *
157 rte_malloc_socket(const char *type, size_t size, unsigned align, int socket);
158 
184 void *
185 rte_zmalloc_socket(const char *type, size_t size, unsigned align, int socket);
186 
212 void *
213 rte_calloc_socket(const char *type, size_t num, size_t size, unsigned align, int socket);
214 
227 void
228 rte_free(void *ptr);
229 
247 int
248 rte_malloc_validate(const void *ptr, size_t *size);
249 
261 int
262 rte_malloc_get_socket_stats(int socket,
263  struct rte_malloc_socket_stats *socket_stats);
264 
277 void
278 rte_malloc_dump_stats(FILE *f, const char *type);
279 
293 int
294 rte_malloc_set_limit(const char *type, size_t max);
295 
307 rte_malloc_virt2iova(const void *addr);
308 
309 __rte_deprecated
310 static inline phys_addr_t
311 rte_malloc_virt2phy(const void *addr)
312 {
313  return rte_malloc_virt2iova(addr);
314 }
315 
316 #ifdef __cplusplus
317 }
318 #endif
319 
320 #endif /* _RTE_MALLOC_H_ */