DPDK  18.02.2
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_memory.h>
27 #include <rte_common.h>
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 #define RTE_MEMZONE_2MB 0x00000001
34 #define RTE_MEMZONE_1GB 0x00000002
35 #define RTE_MEMZONE_16MB 0x00000100
36 #define RTE_MEMZONE_16GB 0x00000200
37 #define RTE_MEMZONE_256KB 0x00010000
38 #define RTE_MEMZONE_256MB 0x00020000
39 #define RTE_MEMZONE_512MB 0x00040000
40 #define RTE_MEMZONE_4GB 0x00080000
41 #define RTE_MEMZONE_SIZE_HINT_ONLY 0x00000004
47 struct rte_memzone {
48 
49 #define RTE_MEMZONE_NAMESIZE 32
50  char name[RTE_MEMZONE_NAMESIZE];
52  RTE_STD_C11
53  union {
56  };
58  union {
59  void *addr;
60  uint64_t addr_64;
61  };
62  size_t len;
64  uint64_t hugepage_sz;
66  int32_t socket_id;
68  uint32_t flags;
69  uint32_t memseg_id;
70 } __attribute__((__packed__));
71 
116 const struct rte_memzone *rte_memzone_reserve(const char *name,
117  size_t len, int socket_id,
118  unsigned flags);
119 
168 const struct rte_memzone *rte_memzone_reserve_aligned(const char *name,
169  size_t len, int socket_id,
170  unsigned flags, unsigned align);
171 
226 const struct rte_memzone *rte_memzone_reserve_bounded(const char *name,
227  size_t len, int socket_id,
228  unsigned flags, unsigned align, unsigned bound);
229 
239 int rte_memzone_free(const struct rte_memzone *mz);
240 
252 const struct rte_memzone *rte_memzone_lookup(const char *name);
253 
260 void rte_memzone_dump(FILE *f);
261 
270 void rte_memzone_walk(void (*func)(const struct rte_memzone *, void *arg),
271  void *arg);
272 
273 #ifdef __cplusplus
274 }
275 #endif
276 
277 #endif /* _RTE_MEMZONE_H_ */