DPDK  19.11.14
rte_malloc.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2010-2019 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_compat.h>
17 #include <rte_memory.h>
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 
30  unsigned free_count;
31  unsigned alloc_count;
33 };
34 
56 void *
57 rte_malloc(const char *type, size_t size, unsigned align);
58 
82 void *
83 rte_zmalloc(const char *type, size_t size, unsigned align);
84 
108 void *
109 rte_calloc(const char *type, size_t num, size_t size, unsigned align);
110 
131 void *
132 rte_realloc(void *ptr, size_t size, unsigned int align);
133 
156 __rte_experimental
157 void *
158 rte_realloc_socket(void *ptr, size_t size, unsigned int align, int socket);
159 
183 void *
184 rte_malloc_socket(const char *type, size_t size, unsigned align, int socket);
185 
211 void *
212 rte_zmalloc_socket(const char *type, size_t size, unsigned align, int socket);
213 
239 void *
240 rte_calloc_socket(const char *type, size_t num, size_t size, unsigned align, int socket);
241 
254 void
255 rte_free(void *ptr);
256 
274 int
275 rte_malloc_validate(const void *ptr, size_t *size);
276 
291 int
292 rte_malloc_get_socket_stats(int socket,
293  struct rte_malloc_socket_stats *socket_stats);
294 
334 __rte_experimental
335 int
336 rte_malloc_heap_memory_add(const char *heap_name, void *va_addr, size_t len,
337  rte_iova_t iova_addrs[], unsigned int n_pages, size_t page_sz);
338 
366 __rte_experimental
367 int
368 rte_malloc_heap_memory_remove(const char *heap_name, void *va_addr, size_t len);
369 
391 __rte_experimental
392 int
393 rte_malloc_heap_memory_attach(const char *heap_name, void *va_addr, size_t len);
394 
416 __rte_experimental
417 int
418 rte_malloc_heap_memory_detach(const char *heap_name, void *va_addr, size_t len);
419 
436 __rte_experimental
437 int
438 rte_malloc_heap_create(const char *heap_name);
439 
460 __rte_experimental
461 int
462 rte_malloc_heap_destroy(const char *heap_name);
463 
475 __rte_experimental
476 int
477 rte_malloc_heap_get_socket(const char *name);
478 
491 __rte_experimental
492 int
494 
510 void
511 rte_malloc_dump_stats(FILE *f, const char *type);
512 
522 __rte_experimental
523 void
524 rte_malloc_dump_heaps(FILE *f);
525 
539 __rte_deprecated
540 int
541 rte_malloc_set_limit(const char *type, size_t max);
542 
554 rte_malloc_virt2iova(const void *addr);
555 
556 #ifdef __cplusplus
557 }
558 #endif
559 
560 #endif /* _RTE_MALLOC_H_ */
__rte_experimental int rte_malloc_heap_memory_add(const char *heap_name, void *va_addr, size_t len, rte_iova_t iova_addrs[], unsigned int n_pages, size_t page_sz)
uint64_t rte_iova_t
Definition: rte_common.h:340
void * rte_malloc(const char *type, size_t size, unsigned align)
__rte_experimental void * rte_realloc_socket(void *ptr, size_t size, unsigned int align, int socket)
__rte_experimental int rte_malloc_heap_create(const char *heap_name)
__rte_experimental void rte_malloc_dump_heaps(FILE *f)
__rte_deprecated int rte_malloc_set_limit(const char *type, size_t max)
void * rte_realloc(void *ptr, size_t size, unsigned int align)
__rte_experimental int rte_malloc_heap_memory_attach(const char *heap_name, void *va_addr, size_t len)
void * rte_zmalloc_socket(const char *type, size_t size, unsigned align, int socket)
__rte_experimental int rte_malloc_heap_memory_detach(const char *heap_name, void *va_addr, size_t len)
void * rte_malloc_socket(const char *type, size_t size, unsigned align, int socket)
void rte_free(void *ptr)
void * rte_zmalloc(const char *type, size_t size, unsigned align)
int rte_malloc_validate(const void *ptr, size_t *size)
void * rte_calloc(const char *type, size_t num, size_t size, unsigned align)
rte_iova_t rte_malloc_virt2iova(const void *addr)
__rte_experimental int rte_malloc_heap_memory_remove(const char *heap_name, void *va_addr, size_t len)
__rte_experimental int rte_malloc_heap_destroy(const char *heap_name)
__rte_experimental int rte_malloc_heap_get_socket(const char *name)
int rte_malloc_get_socket_stats(int socket, struct rte_malloc_socket_stats *socket_stats)
__rte_experimental int rte_malloc_heap_socket_is_external(int socket_id)
void * rte_calloc_socket(const char *type, size_t num, size_t size, unsigned align, int socket)
void rte_malloc_dump_stats(FILE *f, const char *type)