1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2010-2014 Intel Corporation
5 #ifndef _RTE_EAL_MEMCONFIG_H_
6 #define _RTE_EAL_MEMCONFIG_H_
9 #include <rte_memory.h>
10 #include <rte_memzone.h>
11 #include <rte_malloc_heap.h>
12 #include <rte_rwlock.h>
13 #include <rte_pause.h>
20 * the structure for the memory configuration for the RTE.
21 * Used by the rte_config structure. It is separated out, as for multi-process
22 * support, the memory details should be shared across instances
24 struct rte_mem_config {
25 volatile uint32_t magic; /**< Magic number - Sanity check. */
28 uint32_t nchannel; /**< Number of channels (0 if unknown). */
29 uint32_t nrank; /**< Number of ranks (0 if unknown). */
32 * current lock nest order
33 * - qlock->mlock (ring/hash/lpm)
34 * - mplock->qlock->mlock (mempool)
36 * *ALWAYS* obtain qlock first if having to obtain both qlock and mlock
38 rte_rwlock_t mlock; /**< only used by memzone LIB for thread-safe. */
39 rte_rwlock_t qlock; /**< used for tailq operation for thread safe. */
40 rte_rwlock_t mplock; /**< only used by mempool LIB for thread-safe. */
42 uint32_t memzone_cnt; /**< Number of allocated memzones */
44 /* memory segments and zones */
45 struct rte_memseg memseg[RTE_MAX_MEMSEG]; /**< Physmem descriptors. */
46 struct rte_memzone memzone[RTE_MAX_MEMZONE]; /**< Memzone descriptors. */
48 struct rte_tailq_head tailq_head[RTE_MAX_TAILQ]; /**< Tailqs for objects */
50 /* Heaps of Malloc per socket */
51 struct malloc_heap malloc_heaps[RTE_MAX_NUMA_NODES];
53 /* address of mem_config in primary process. used to map shared config into
54 * exact same address the primary process maps it.
56 uint64_t mem_cfg_addr;
57 } __attribute__((__packed__));
61 rte_eal_mcfg_wait_complete(struct rte_mem_config* mcfg)
63 /* wait until shared mem_config finish initialising */
64 while(mcfg->magic != RTE_MAGIC)
72 #endif /*__RTE_EAL_MEMCONFIG_H_*/