DPDK  18.11.11
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 
265 int
266 rte_malloc_get_socket_stats(int socket,
267  struct rte_malloc_socket_stats *socket_stats);
268 
308 int __rte_experimental
309 rte_malloc_heap_memory_add(const char *heap_name, void *va_addr, size_t len,
310  rte_iova_t iova_addrs[], unsigned int n_pages, size_t page_sz);
311 
339 int __rte_experimental
340 rte_malloc_heap_memory_remove(const char *heap_name, void *va_addr, size_t len);
341 
363 int __rte_experimental
364 rte_malloc_heap_memory_attach(const char *heap_name, void *va_addr, size_t len);
365 
387 int __rte_experimental
388 rte_malloc_heap_memory_detach(const char *heap_name, void *va_addr, size_t len);
389 
406 int __rte_experimental
407 rte_malloc_heap_create(const char *heap_name);
408 
429 int __rte_experimental
430 rte_malloc_heap_destroy(const char *heap_name);
431 
443 int __rte_experimental
444 rte_malloc_heap_get_socket(const char *name);
445 
458 int __rte_experimental
460 
476 void
477 rte_malloc_dump_stats(FILE *f, const char *type);
478 
488 void __rte_experimental
489 rte_malloc_dump_heaps(FILE *f);
490 
504 int
505 rte_malloc_set_limit(const char *type, size_t max);
506 
518 rte_malloc_virt2iova(const void *addr);
519 
520 __rte_deprecated
521 static inline phys_addr_t
522 rte_malloc_virt2phy(const void *addr)
523 {
524  return rte_malloc_virt2iova(addr);
525 }
526 
527 #ifdef __cplusplus
528 }
529 #endif
530 
531 #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)