]> git.proxmox.com Git - ceph.git/blame - ceph/src/spdk/dpdk/lib/librte_eal/common/malloc_heap.h
import 15.2.0 Octopus source
[ceph.git] / ceph / src / spdk / dpdk / lib / librte_eal / common / malloc_heap.h
CommitLineData
11fdf7f2
TL
1/* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2010-2014 Intel Corporation
3 */
4
5#ifndef MALLOC_HEAP_H_
6#define MALLOC_HEAP_H_
7
8#include <stdbool.h>
9
10#include <rte_malloc.h>
11#include <rte_malloc_heap.h>
12
13#ifdef __cplusplus
14extern "C" {
15#endif
16
17static inline unsigned
18malloc_get_numa_socket(void)
19{
20 unsigned socket_id = rte_socket_id();
21
22 if (socket_id == (unsigned)SOCKET_ID_ANY)
23 return 0;
24
25 return socket_id;
26}
27
28void *
29malloc_heap_alloc(const char *type, size_t size, int socket, unsigned int flags,
30 size_t align, size_t bound, bool contig);
31
32void *
33malloc_heap_alloc_biggest(const char *type, int socket, unsigned int flags,
34 size_t align, bool contig);
35
9f95a23c
TL
36int
37malloc_heap_create(struct malloc_heap *heap, const char *heap_name);
38
39int
40malloc_heap_destroy(struct malloc_heap *heap);
41
42struct rte_memseg_list *
43malloc_heap_create_external_seg(void *va_addr, rte_iova_t iova_addrs[],
44 unsigned int n_pages, size_t page_sz, const char *seg_name,
45 unsigned int socket_id);
46
47struct rte_memseg_list *
48malloc_heap_find_external_seg(void *va_addr, size_t len);
49
50int
51malloc_heap_destroy_external_seg(struct rte_memseg_list *msl);
52
53int
54malloc_heap_add_external_memory(struct malloc_heap *heap,
55 struct rte_memseg_list *msl);
56
57int
58malloc_heap_remove_external_memory(struct malloc_heap *heap, void *va_addr,
59 size_t len);
60
11fdf7f2
TL
61int
62malloc_heap_free(struct malloc_elem *elem);
63
64int
65malloc_heap_resize(struct malloc_elem *elem, size_t size);
66
67int
68malloc_heap_get_stats(struct malloc_heap *heap,
69 struct rte_malloc_socket_stats *socket_stats);
70
71void
72malloc_heap_dump(struct malloc_heap *heap, FILE *f);
73
9f95a23c
TL
74int
75malloc_socket_to_heap_id(unsigned int socket_id);
76
11fdf7f2
TL
77int
78rte_eal_malloc_heap_init(void);
79
80#ifdef __cplusplus
81}
82#endif
83
84#endif /* MALLOC_HEAP_H_ */