1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2018 Intel Corporation
11 #include <rte_common.h>
12 #include <rte_random.h>
14 /* forward declarations */
18 /* multiprocess synchronization structures for malloc */
19 enum malloc_req_type {
20 REQ_TYPE_ALLOC, /**< ask primary to allocate */
21 REQ_TYPE_FREE, /**< ask primary to free */
22 REQ_TYPE_SYNC /**< ask secondary to synchronize its memory map */
25 enum malloc_req_result {
30 struct malloc_req_alloc {
31 uint32_t malloc_heap_idx;
41 struct malloc_req_free {
50 struct malloc_mp_req {
51 enum malloc_req_type t;
54 struct malloc_req_alloc alloc_req;
55 struct malloc_req_free free_req;
57 uint64_t id; /**< not to be populated by caller */
58 enum malloc_req_result result;
62 register_mp_requests(void);
65 unregister_mp_requests(void);
68 request_to_primary(struct malloc_mp_req *req);
70 /* synchronous memory map sync request */
74 /* functions from malloc_heap exposed here */
76 malloc_heap_free_pages(void *aligned_start, size_t aligned_len);
79 alloc_pages_on_heap(struct malloc_heap *heap, uint64_t pg_sz, size_t elt_size,
80 int socket, unsigned int flags, size_t align, size_t bound,
81 bool contig, struct rte_memseg **ms, int n_segs);
84 rollback_expand_heap(struct rte_memseg **ms, int n_segs,
85 struct malloc_elem *elem, void *map_addr, size_t map_len);
87 #endif /* MALLOC_MP_H */