DPDK  25.11.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_memory.h>
17 
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21 
29  unsigned free_count;
30  unsigned alloc_count;
32 };
33 
37 #define __rte_dealloc_free __rte_dealloc(rte_free, 1)
38 
51 void
52 rte_free(void *ptr);
53 
54 
73 __rte_experimental
74 void
75 rte_free_sensitive(void *ptr);
76 
98 void *
99 rte_malloc(const char *type, size_t size, unsigned align)
102 
126 void *
127 rte_zmalloc(const char *type, size_t size, unsigned align)
130 
154 void *
155 rte_calloc(const char *type, size_t num, size_t size, unsigned align)
158 
179 void *
180 rte_realloc(void *ptr, size_t size, unsigned int align)
183 
206 void *
207 rte_realloc_socket(void *ptr, size_t size, unsigned int align, int socket)
210 
234 void *
235 rte_malloc_socket(const char *type, size_t size, unsigned align, int socket)
238 
264 void *
265 rte_zmalloc_socket(const char *type, size_t size, unsigned align, int socket)
268 
294 void *
295 rte_calloc_socket(const char *type, size_t num, size_t size, unsigned align, int socket)
298 
316 int
317 rte_malloc_validate(const void *ptr, size_t *size);
318 
333 int
335  struct rte_malloc_socket_stats *socket_stats);
336 
376 int
377 rte_malloc_heap_memory_add(const char *heap_name, void *va_addr, size_t len,
378  rte_iova_t iova_addrs[], unsigned int n_pages, size_t page_sz);
379 
407 int
408 rte_malloc_heap_memory_remove(const char *heap_name, void *va_addr, size_t len);
409 
431 int
432 rte_malloc_heap_memory_attach(const char *heap_name, void *va_addr, size_t len);
433 
455 int
456 rte_malloc_heap_memory_detach(const char *heap_name, void *va_addr, size_t len);
457 
474 int
475 rte_malloc_heap_create(const char *heap_name);
476 
497 int
498 rte_malloc_heap_destroy(const char *heap_name);
499 
511 int
512 rte_malloc_heap_get_socket(const char *name);
513 
526 int
528 
543 void
544 rte_malloc_dump_stats(FILE *f, const char *type);
545 
555 void
557 
569 rte_malloc_virt2iova(const void *addr);
570 
571 #ifdef __cplusplus
572 }
573 #endif
574 
575 #endif /* _RTE_MALLOC_H_ */
#define __rte_alloc_align(argno)
Definition: rte_common.h:318
uint64_t rte_iova_t
Definition: rte_common.h:770
#define __rte_alloc_size(...)
Definition: rte_common.h:305
#define __rte_malloc
Definition: rte_common.h:328
void * rte_realloc(void *ptr, size_t size, unsigned int align) __rte_alloc_size(2) __rte_alloc_align(3) __rte_malloc __rte_dealloc_free
void * rte_zmalloc_socket(const char *type, size_t size, unsigned align, int socket) __rte_alloc_size(2) __rte_alloc_align(3) __rte_malloc __rte_dealloc_free
void rte_free(void *ptr)
__rte_experimental void rte_free_sensitive(void *ptr)
int rte_malloc_heap_destroy(const char *heap_name)
int rte_malloc_heap_memory_attach(const char *heap_name, void *va_addr, size_t len)
void * rte_zmalloc(const char *type, size_t size, unsigned align) __rte_alloc_size(2) __rte_alloc_align(3) __rte_malloc __rte_dealloc_free
void * rte_calloc(const char *type, size_t num, size_t size, unsigned align) __rte_alloc_size(2
int rte_malloc_validate(const void *ptr, size_t *size)
void rte_malloc_dump_stats(FILE *f, const char *type)
void * rte_malloc(const char *type, size_t size, unsigned align) __rte_alloc_size(2) __rte_alloc_align(3) __rte_malloc __rte_dealloc_free
int rte_malloc_heap_socket_is_external(int socket_id)
void * rte_malloc_socket(const char *type, size_t size, unsigned align, int socket) __rte_alloc_size(2) __rte_alloc_align(3) __rte_malloc __rte_dealloc_free
void * rte_calloc_socket(const char *type, size_t num, size_t size, unsigned align, int socket) __rte_alloc_size(2
int rte_malloc_heap_memory_detach(const char *heap_name, void *va_addr, size_t len)
rte_iova_t rte_malloc_virt2iova(const void *addr)
void * rte_realloc_socket(void *ptr, size_t size, unsigned int align, int socket) __rte_alloc_size(2) __rte_alloc_align(3) __rte_malloc __rte_dealloc_free
int rte_malloc_heap_memory_remove(const char *heap_name, void *va_addr, size_t len)
#define __rte_dealloc_free
Definition: rte_malloc.h:37
int rte_malloc_heap_create(const char *heap_name)
int rte_malloc_get_socket_stats(int socket, struct rte_malloc_socket_stats *socket_stats)
void rte_malloc_dump_heaps(FILE *f)
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)
int rte_malloc_heap_get_socket(const char *name)