DPDK  18.11.8
rte_memzone.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_MEMZONE_H_
6 #define _RTE_MEMZONE_H_
7 
25 #include <stdio.h>
26 #include <rte_compat.h>
27 #include <rte_memory.h>
28 #include <rte_common.h>
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 #define RTE_MEMZONE_2MB 0x00000001
35 #define RTE_MEMZONE_1GB 0x00000002
36 #define RTE_MEMZONE_16MB 0x00000100
37 #define RTE_MEMZONE_16GB 0x00000200
38 #define RTE_MEMZONE_32MB 0x00000400
39 #define RTE_MEMZONE_256KB 0x00010000
40 #define RTE_MEMZONE_256MB 0x00020000
41 #define RTE_MEMZONE_512MB 0x00040000
42 #define RTE_MEMZONE_4GB 0x00080000
43 #define RTE_MEMZONE_SIZE_HINT_ONLY 0x00000004
44 #define RTE_MEMZONE_IOVA_CONTIG 0x00100000
50 struct rte_memzone {
51 
52 #define RTE_MEMZONE_NAMESIZE 32
53  char name[RTE_MEMZONE_NAMESIZE];
55  RTE_STD_C11
56  union {
59  };
61  union {
62  void *addr;
63  uint64_t addr_64;
64  };
65  size_t len;
67  uint64_t hugepage_sz;
69  int32_t socket_id;
71  uint32_t flags;
72 } __attribute__((__packed__));
73 
132 const struct rte_memzone *rte_memzone_reserve(const char *name,
133  size_t len, int socket_id,
134  unsigned flags);
135 
198 const struct rte_memzone *rte_memzone_reserve_aligned(const char *name,
199  size_t len, int socket_id,
200  unsigned flags, unsigned align);
201 
270 const struct rte_memzone *rte_memzone_reserve_bounded(const char *name,
271  size_t len, int socket_id,
272  unsigned flags, unsigned align, unsigned bound);
273 
283 int rte_memzone_free(const struct rte_memzone *mz);
284 
296 const struct rte_memzone *rte_memzone_lookup(const char *name);
297 
304 void rte_memzone_dump(FILE *f);
305 
314 void rte_memzone_walk(void (*func)(const struct rte_memzone *, void *arg),
315  void *arg);
316 
317 #ifdef __cplusplus
318 }
319 #endif
320 
321 #endif /* _RTE_MEMZONE_H_ */
struct rte_memzone * rte_memzone_reserve_bounded(const char *name, size_t len, int socket_id, unsigned flags, unsigned align, unsigned bound)
void * addr
Definition: rte_memzone.h:62
phys_addr_t phys_addr
Definition: rte_memzone.h:57
uint32_t flags
Definition: rte_memzone.h:71
rte_iova_t iova
Definition: rte_memzone.h:58
uint64_t addr_64
Definition: rte_memzone.h:63
size_t len
Definition: rte_memzone.h:65
void rte_memzone_walk(void(*func)(const struct rte_memzone *, void *arg), void *arg)
struct rte_memzone * rte_memzone_lookup(const char *name)
void rte_memzone_dump(FILE *f)
#define RTE_STD_C11
Definition: rte_common.h:37
int32_t socket_id
Definition: rte_memzone.h:69
struct rte_memzone * rte_memzone_reserve_aligned(const char *name, size_t len, int socket_id, unsigned flags, unsigned align)
uint64_t rte_iova_t
Definition: rte_memory.h:83
struct rte_memzone * rte_memzone_reserve(const char *name, size_t len, int socket_id, unsigned flags)
uint64_t phys_addr_t
Definition: rte_memory.h:74
char name[RTE_MEMZONE_NAMESIZE]
Definition: rte_memzone.h:53
int rte_memzone_free(const struct rte_memzone *mz)
uint64_t hugepage_sz
Definition: rte_memzone.h:67