DPDK  19.08.0-rc0
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 void * __rte_experimental
157 rte_realloc_socket(void *ptr, size_t size, unsigned int align, int socket);
158 
182 void *
183 rte_malloc_socket(const char *type, size_t size, unsigned align, int socket);
184 
210 void *
211 rte_zmalloc_socket(const char *type, size_t size, unsigned align, int socket);
212 
238 void *
239 rte_calloc_socket(const char *type, size_t num, size_t size, unsigned align, int socket);
240 
253 void
254 rte_free(void *ptr);
255 
273 int
274 rte_malloc_validate(const void *ptr, size_t *size);
275 
290 int
291 rte_malloc_get_socket_stats(int socket,
292  struct rte_malloc_socket_stats *socket_stats);
293 
333 int __rte_experimental
334 rte_malloc_heap_memory_add(const char *heap_name, void *va_addr, size_t len,
335  rte_iova_t iova_addrs[], unsigned int n_pages, size_t page_sz);
336 
364 int __rte_experimental
365 rte_malloc_heap_memory_remove(const char *heap_name, void *va_addr, size_t len);
366 
388 int __rte_experimental
389 rte_malloc_heap_memory_attach(const char *heap_name, void *va_addr, size_t len);
390 
412 int __rte_experimental
413 rte_malloc_heap_memory_detach(const char *heap_name, void *va_addr, size_t len);
414 
431 int __rte_experimental
432 rte_malloc_heap_create(const char *heap_name);
433 
454 int __rte_experimental
455 rte_malloc_heap_destroy(const char *heap_name);
456 
468 int __rte_experimental
469 rte_malloc_heap_get_socket(const char *name);
470 
483 int __rte_experimental
485 
501 void
502 rte_malloc_dump_stats(FILE *f, const char *type);
503 
513 void __rte_experimental
514 rte_malloc_dump_heaps(FILE *f);
515 
529 int
530 rte_malloc_set_limit(const char *type, size_t max);
531 
543 rte_malloc_virt2iova(const void *addr);
544 
545 __rte_deprecated
546 static inline phys_addr_t
547 rte_malloc_virt2phy(const void *addr)
548 {
549  return rte_malloc_virt2iova(addr);
550 }
551 
552 #ifdef __cplusplus
553 }
554 #endif
555 
556 #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)
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_realloc(void *ptr, size_t size, unsigned int align)
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
void *__rte_experimental rte_realloc_socket(void *ptr, size_t size, unsigned int align, int socket)
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)