DPDK  21.02.0
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)
59 
83 void *
84 rte_zmalloc(const char *type, size_t size, unsigned align)
86 
110 void *
111 rte_calloc(const char *type, size_t num, size_t size, unsigned align)
112  __rte_alloc_size(2, 3);
113 
134 void *
135 rte_realloc(void *ptr, size_t size, unsigned int align)
136  __rte_alloc_size(2);
137 
160 __rte_experimental
161 void *
162 rte_realloc_socket(void *ptr, size_t size, unsigned int align, int socket)
163  __rte_alloc_size(2, 3);
164 
188 void *
189 rte_malloc_socket(const char *type, size_t size, unsigned align, int socket)
190  __rte_alloc_size(2);
191 
217 void *
218 rte_zmalloc_socket(const char *type, size_t size, unsigned align, int socket)
219  __rte_alloc_size(2);
220 
246 void *
247 rte_calloc_socket(const char *type, size_t num, size_t size, unsigned align, int socket)
248  __rte_alloc_size(2, 3);
249 
262 void
263 rte_free(void *ptr);
264 
282 int
283 rte_malloc_validate(const void *ptr, size_t *size);
284 
299 int
300 rte_malloc_get_socket_stats(int socket,
301  struct rte_malloc_socket_stats *socket_stats);
302 
342 __rte_experimental
343 int
344 rte_malloc_heap_memory_add(const char *heap_name, void *va_addr, size_t len,
345  rte_iova_t iova_addrs[], unsigned int n_pages, size_t page_sz);
346 
374 __rte_experimental
375 int
376 rte_malloc_heap_memory_remove(const char *heap_name, void *va_addr, size_t len);
377 
399 __rte_experimental
400 int
401 rte_malloc_heap_memory_attach(const char *heap_name, void *va_addr, size_t len);
402 
424 __rte_experimental
425 int
426 rte_malloc_heap_memory_detach(const char *heap_name, void *va_addr, size_t len);
427 
444 __rte_experimental
445 int
446 rte_malloc_heap_create(const char *heap_name);
447 
468 __rte_experimental
469 int
470 rte_malloc_heap_destroy(const char *heap_name);
471 
483 __rte_experimental
484 int
485 rte_malloc_heap_get_socket(const char *name);
486 
499 __rte_experimental
500 int
502 
518 void
519 rte_malloc_dump_stats(FILE *f, const char *type);
520 
530 __rte_experimental
531 void
532 rte_malloc_dump_heaps(FILE *f);
533 
547 __rte_deprecated
548 int
549 rte_malloc_set_limit(const char *type, size_t max);
550 
562 rte_malloc_virt2iova(const void *addr);
563 
564 #ifdef __cplusplus
565 }
566 #endif
567 
568 #endif /* _RTE_MALLOC_H_ */
__rte_experimental void * rte_realloc_socket(void *ptr, size_t size, unsigned int align, int socket) __rte_alloc_size(2
__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)
void * rte_calloc_socket(const char *type, size_t num, size_t size, unsigned align, int socket) __rte_alloc_size(2
uint64_t rte_iova_t
Definition: rte_common.h:418
void * rte_calloc(const char *type, size_t num, size_t size, unsigned align) __rte_alloc_size(2
void * rte_zmalloc(const char *type, size_t size, unsigned align) __rte_alloc_size(2)
__rte_experimental int rte_malloc_heap_create(const char *heap_name)
__rte_experimental void rte_malloc_dump_heaps(FILE *f)
void void * rte_realloc(void *ptr, size_t size, unsigned int align) __rte_alloc_size(2)
__rte_deprecated int rte_malloc_set_limit(const char *type, size_t max)
#define __rte_alloc_size(...)
Definition: rte_common.h:157
__rte_experimental int rte_malloc_heap_memory_attach(const char *heap_name, void *va_addr, size_t len)
__rte_experimental int rte_malloc_heap_memory_detach(const char *heap_name, void *va_addr, size_t len)
int rte_malloc_validate(const void *ptr, size_t *size)
void * rte_zmalloc_socket(const char *type, size_t size, unsigned align, int socket) __rte_alloc_size(2)
void void rte_free(void *ptr)
void * rte_malloc(const char *type, size_t size, unsigned align) __rte_alloc_size(2)
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 void void * rte_malloc_socket(const char *type, size_t size, unsigned align, int socket) __rte_alloc_size(2)
__rte_experimental int rte_malloc_heap_socket_is_external(int socket_id)
void rte_malloc_dump_stats(FILE *f, const char *type)