DPDK  18.11.0
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_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 align);
133 
157 void *
158 rte_malloc_socket(const char *type, size_t size, unsigned align, int socket);
159 
185 void *
186 rte_zmalloc_socket(const char *type, size_t size, unsigned align, int socket);
187 
213 void *
214 rte_calloc_socket(const char *type, size_t num, size_t size, unsigned align, int socket);
215 
228 void
229 rte_free(void *ptr);
230 
248 int
249 rte_malloc_validate(const void *ptr, size_t *size);
250 
262 int
263 rte_malloc_get_socket_stats(int socket,
264  struct rte_malloc_socket_stats *socket_stats);
265 
305 int __rte_experimental
306 rte_malloc_heap_memory_add(const char *heap_name, void *va_addr, size_t len,
307  rte_iova_t iova_addrs[], unsigned int n_pages, size_t page_sz);
308 
336 int __rte_experimental
337 rte_malloc_heap_memory_remove(const char *heap_name, void *va_addr, size_t len);
338 
360 int __rte_experimental
361 rte_malloc_heap_memory_attach(const char *heap_name, void *va_addr, size_t len);
362 
384 int __rte_experimental
385 rte_malloc_heap_memory_detach(const char *heap_name, void *va_addr, size_t len);
386 
403 int __rte_experimental
404 rte_malloc_heap_create(const char *heap_name);
405 
426 int __rte_experimental
427 rte_malloc_heap_destroy(const char *heap_name);
428 
440 int __rte_experimental
441 rte_malloc_heap_get_socket(const char *name);
442 
455 int __rte_experimental
457 
470 void
471 rte_malloc_dump_stats(FILE *f, const char *type);
472 
479 void __rte_experimental
480 rte_malloc_dump_heaps(FILE *f);
481 
495 int
496 rte_malloc_set_limit(const char *type, size_t max);
497 
509 rte_malloc_virt2iova(const void *addr);
510 
511 __rte_deprecated
512 static inline phys_addr_t
513 rte_malloc_virt2phy(const void *addr)
514 {
515  return rte_malloc_virt2iova(addr);
516 }
517 
518 #ifdef __cplusplus
519 }
520 #endif
521 
522 #endif /* _RTE_MALLOC_H_ */
int __rte_experimental rte_malloc_heap_socket_is_external(int socket_id)
void * rte_malloc(const char *type, size_t size, unsigned align)
int __rte_experimental rte_malloc_heap_memory_attach(const char *heap_name, void *va_addr, size_t len)
int __rte_experimental rte_malloc_heap_destroy(const char *heap_name)
int __rte_experimental rte_malloc_heap_memory_remove(const char *heap_name, void *va_addr, size_t len)
void * rte_realloc(void *ptr, size_t size, unsigned align)
int __rte_experimental 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)
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)
int __rte_experimental rte_malloc_heap_create(const char *heap_name)
uint64_t rte_iova_t
Definition: rte_memory.h:82
uint64_t phys_addr_t
Definition: rte_memory.h:73
int rte_malloc_set_limit(const char *type, size_t max)
void * rte_calloc(const char *type, size_t num, size_t size, unsigned align)
rte_iova_t rte_malloc_virt2iova(const void *addr)
int __rte_experimental rte_malloc_heap_get_socket(const char *name)
void __rte_experimental rte_malloc_dump_heaps(FILE *f)
int __rte_experimental rte_malloc_heap_memory_detach(const char *heap_name, void *va_addr, size_t len)
int rte_malloc_get_socket_stats(int socket, struct rte_malloc_socket_stats *socket_stats)
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)