DPDK 25.03.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_memory.h>
17
18#ifdef __cplusplus
19extern "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
51void
52rte_free(void *ptr);
53
75void *
76rte_malloc(const char *type, size_t size, unsigned align)
79
103void *
104rte_zmalloc(const char *type, size_t size, unsigned align)
107
131void *
132rte_calloc(const char *type, size_t num, size_t size, unsigned align)
135
156void *
157rte_realloc(void *ptr, size_t size, unsigned int align)
160
183void *
184rte_realloc_socket(void *ptr, size_t size, unsigned int align, int socket)
187
211void *
212rte_malloc_socket(const char *type, size_t size, unsigned align, int socket)
215
241void *
242rte_zmalloc_socket(const char *type, size_t size, unsigned align, int socket)
245
271void *
272rte_calloc_socket(const char *type, size_t num, size_t size, unsigned align, int socket)
275
293int
294rte_malloc_validate(const void *ptr, size_t *size);
295
310int
312 struct rte_malloc_socket_stats *socket_stats);
313
353int
354rte_malloc_heap_memory_add(const char *heap_name, void *va_addr, size_t len,
355 rte_iova_t iova_addrs[], unsigned int n_pages, size_t page_sz);
356
384int
385rte_malloc_heap_memory_remove(const char *heap_name, void *va_addr, size_t len);
386
408int
409rte_malloc_heap_memory_attach(const char *heap_name, void *va_addr, size_t len);
410
432int
433rte_malloc_heap_memory_detach(const char *heap_name, void *va_addr, size_t len);
434
451int
452rte_malloc_heap_create(const char *heap_name);
453
474int
475rte_malloc_heap_destroy(const char *heap_name);
476
488int
490
503int
505
520void
521rte_malloc_dump_stats(FILE *f, const char *type);
522
532void
534
546rte_malloc_virt2iova(const void *addr);
547
548#ifdef __cplusplus
549}
550#endif
551
552#endif /* _RTE_MALLOC_H_ */
#define __rte_alloc_align(argno)
Definition: rte_common.h:241
uint64_t rte_iova_t
Definition: rte_common.h:658
#define __rte_alloc_size(...)
Definition: rte_common.h:228
#define __rte_malloc
Definition: rte_common.h:251
void * rte_calloc_socket(const char *type, size_t num, size_t size, unsigned align, int socket) __rte_alloc_size(2
void rte_free(void *ptr)
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_destroy(const char *heap_name)
int rte_malloc_heap_memory_attach(const char *heap_name, void *va_addr, size_t len)
int rte_malloc_validate(const void *ptr, size_t *size)
void * rte_calloc(const char *type, size_t num, size_t size, unsigned align) __rte_alloc_size(2
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
void rte_malloc_dump_stats(FILE *f, const char *type)
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
int rte_malloc_heap_socket_is_external(int socket_id)
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
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)
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)
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(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_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)