DPDK  24.07.0
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
42 #define RTE_MEMZONE_IOVA_CONTIG 0x00100000
48 struct rte_memzone {
49 
50 #define RTE_MEMZONE_NAMESIZE 32
51  char name[RTE_MEMZONE_NAMESIZE];
53  rte_iova_t iova;
54  union {
55  void *addr;
56  uint64_t addr_64;
57  };
58  size_t len;
60  uint64_t hugepage_sz;
62  int32_t socket_id;
64  uint32_t flags;
65 } __rte_packed;
66 
80 __rte_experimental
81 int rte_memzone_max_set(size_t max);
82 
94 __rte_experimental
95 size_t rte_memzone_max_get(void);
96 
154 const struct rte_memzone *rte_memzone_reserve(const char *name,
155  size_t len, int socket_id,
156  unsigned flags);
157 
219 const struct rte_memzone *rte_memzone_reserve_aligned(const char *name,
220  size_t len, int socket_id,
221  unsigned flags, unsigned align);
222 
290 const struct rte_memzone *rte_memzone_reserve_bounded(const char *name,
291  size_t len, int socket_id,
292  unsigned flags, unsigned align, unsigned bound);
293 
303 int rte_memzone_free(const struct rte_memzone *mz);
304 
316 const struct rte_memzone *rte_memzone_lookup(const char *name);
317 
324 void rte_memzone_dump(FILE *f);
325 
334 void rte_memzone_walk(void (*func)(const struct rte_memzone *, void *arg),
335  void *arg);
336 
337 #ifdef __cplusplus
338 }
339 #endif
340 
341 #endif /* _RTE_MEMZONE_H_ */
void * addr
Definition: rte_memzone.h:55
uint32_t flags
Definition: rte_memzone.h:64
const struct rte_memzone * rte_memzone_reserve(const char *name, size_t len, int socket_id, unsigned flags)
#define __rte_packed
Definition: rte_common.h:108
uint64_t addr_64
Definition: rte_memzone.h:56
size_t len
Definition: rte_memzone.h:58
__rte_experimental size_t rte_memzone_max_get(void)
__rte_experimental int rte_memzone_max_set(size_t max)
const struct rte_memzone * rte_memzone_lookup(const char *name)
const struct rte_memzone * rte_memzone_reserve_bounded(const char *name, size_t len, int socket_id, unsigned flags, unsigned align, unsigned bound)
void rte_memzone_walk(void(*func)(const struct rte_memzone *, void *arg), void *arg)
void rte_memzone_dump(FILE *f)
int32_t socket_id
Definition: rte_memzone.h:62
const struct rte_memzone * rte_memzone_reserve_aligned(const char *name, size_t len, int socket_id, unsigned flags, unsigned align)
char name[RTE_MEMZONE_NAMESIZE]
Definition: rte_memzone.h:51
int rte_memzone_free(const struct rte_memzone *mz)
uint64_t hugepage_sz
Definition: rte_memzone.h:60