DPDK  24.03.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 
55 void *
56 rte_malloc(const char *type, size_t size, unsigned align)
58 
82 void *
83 rte_zmalloc(const char *type, size_t size, unsigned align)
85 
109 void *
110 rte_calloc(const char *type, size_t num, size_t size, unsigned align)
111  __rte_alloc_size(2, 3);
112 
133 void *
134 rte_realloc(void *ptr, size_t size, unsigned int align)
135  __rte_alloc_size(2);
136 
159 void *
160 rte_realloc_socket(void *ptr, size_t size, unsigned int align, int socket)
161  __rte_alloc_size(2);
162 
186 void *
187 rte_malloc_socket(const char *type, size_t size, unsigned align, int socket)
188  __rte_alloc_size(2);
189 
215 void *
216 rte_zmalloc_socket(const char *type, size_t size, unsigned align, int socket)
217  __rte_alloc_size(2);
218 
244 void *
245 rte_calloc_socket(const char *type, size_t num, size_t size, unsigned align, int socket)
246  __rte_alloc_size(2, 3);
247 
260 void
261 rte_free(void *ptr);
262 
280 int
281 rte_malloc_validate(const void *ptr, size_t *size);
282 
297 int
298 rte_malloc_get_socket_stats(int socket,
299  struct rte_malloc_socket_stats *socket_stats);
300 
340 int
341 rte_malloc_heap_memory_add(const char *heap_name, void *va_addr, size_t len,
342  rte_iova_t iova_addrs[], unsigned int n_pages, size_t page_sz);
343 
371 int
372 rte_malloc_heap_memory_remove(const char *heap_name, void *va_addr, size_t len);
373 
395 int
396 rte_malloc_heap_memory_attach(const char *heap_name, void *va_addr, size_t len);
397 
419 int
420 rte_malloc_heap_memory_detach(const char *heap_name, void *va_addr, size_t len);
421 
438 int
439 rte_malloc_heap_create(const char *heap_name);
440 
461 int
462 rte_malloc_heap_destroy(const char *heap_name);
463 
475 int
476 rte_malloc_heap_get_socket(const char *name);
477 
490 int
492 
508 void
509 rte_malloc_dump_stats(FILE *f, const char *type);
510 
520 void
521 rte_malloc_dump_heaps(FILE *f);
522 
534 rte_malloc_virt2iova(const void *addr);
535 
536 #ifdef __cplusplus
537 }
538 #endif
539 
540 #endif /* _RTE_MALLOC_H_ */
int rte_malloc_heap_socket_is_external(int socket_id)
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_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:584
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)
void void * rte_realloc(void *ptr, size_t size, unsigned int align) __rte_alloc_size(2)
#define __rte_alloc_size(...)
Definition: rte_common.h:213
int rte_malloc_heap_memory_remove(const char *heap_name, void *va_addr, size_t len)
void * rte_realloc_socket(void *ptr, size_t size, unsigned int align, int socket) __rte_alloc_size(2)
int rte_malloc_heap_create(const char *heap_name)
int rte_malloc_heap_get_socket(const char *name)
int rte_malloc_validate(const void *ptr, size_t *size)
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_zmalloc_socket(const char *type, size_t size, unsigned align, int socket) __rte_alloc_size(2)
void void rte_free(void *ptr)
int rte_malloc_heap_memory_detach(const char *heap_name, void *va_addr, size_t len)
void * rte_malloc(const char *type, size_t size, unsigned align) __rte_alloc_size(2)
void * rte_malloc_socket(const char *type, size_t size, unsigned align, int socket) __rte_alloc_size(2)
rte_iova_t rte_malloc_virt2iova(const void *addr)
int rte_malloc_get_socket_stats(int socket, struct rte_malloc_socket_stats *socket_stats)
void rte_malloc_dump_heaps(FILE *f)
void rte_malloc_dump_stats(FILE *f, const char *type)