1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2018 Intel Corporation
11 #include <rte_common.h>
12 #include <rte_random.h>
13 #include <rte_spinlock.h>
14 #include <rte_tailq.h>
16 /* forward declarations */
20 /* multiprocess synchronization structures for malloc */
21 enum malloc_req_type {
22 REQ_TYPE_ALLOC, /**< ask primary to allocate */
23 REQ_TYPE_FREE, /**< ask primary to free */
24 REQ_TYPE_SYNC /**< ask secondary to synchronize its memory map */
27 enum malloc_req_result {
32 struct malloc_req_alloc {
33 uint32_t malloc_heap_idx;
43 struct malloc_req_free {
52 struct malloc_mp_req {
53 enum malloc_req_type t;
56 struct malloc_req_alloc alloc_req;
57 struct malloc_req_free free_req;
59 uint64_t id; /**< not to be populated by caller */
60 enum malloc_req_result result;
64 register_mp_requests(void);
67 request_to_primary(struct malloc_mp_req *req);
69 /* synchronous memory map sync request */
73 /* functions from malloc_heap exposed here */
75 malloc_heap_free_pages(void *aligned_start, size_t aligned_len);
78 alloc_pages_on_heap(struct malloc_heap *heap, uint64_t pg_sz, size_t elt_size,
79 int socket, unsigned int flags, size_t align, size_t bound,
80 bool contig, struct rte_memseg **ms, int n_segs);
83 rollback_expand_heap(struct rte_memseg **ms, int n_segs,
84 struct malloc_elem *elem, void *map_addr, size_t map_len);
86 #endif /* MALLOC_MP_H */