1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2019 Intel Corporation
5 #include <rte_config.h>
6 #include <rte_eal_memconfig.h>
8 #include "eal_internal_cfg.h"
9 #include "eal_memcfg.h"
12 eal_mcfg_complete(void)
14 struct rte_config *cfg = rte_eal_get_configuration();
15 struct rte_mem_config *mcfg = cfg->mem_config;
17 /* ALL shared mem_config related INIT DONE */
18 if (cfg->process_type == RTE_PROC_PRIMARY)
19 mcfg->magic = RTE_MAGIC;
21 internal_config.init_complete = 1;
25 eal_mcfg_wait_complete(void)
27 struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
29 /* wait until shared mem_config finish initialising */
30 while (mcfg->magic != RTE_MAGIC)
35 rte_mcfg_mem_read_lock(void)
37 struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
38 rte_rwlock_read_lock(&mcfg->memory_hotplug_lock);
42 rte_mcfg_mem_read_unlock(void)
44 struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
45 rte_rwlock_read_unlock(&mcfg->memory_hotplug_lock);
49 rte_mcfg_mem_write_lock(void)
51 struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
52 rte_rwlock_write_lock(&mcfg->memory_hotplug_lock);
56 rte_mcfg_mem_write_unlock(void)
58 struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
59 rte_rwlock_write_unlock(&mcfg->memory_hotplug_lock);
63 rte_mcfg_tailq_read_lock(void)
65 struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
66 rte_rwlock_read_lock(&mcfg->qlock);
70 rte_mcfg_tailq_read_unlock(void)
72 struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
73 rte_rwlock_read_unlock(&mcfg->qlock);
77 rte_mcfg_tailq_write_lock(void)
79 struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
80 rte_rwlock_write_lock(&mcfg->qlock);
84 rte_mcfg_tailq_write_unlock(void)
86 struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
87 rte_rwlock_write_unlock(&mcfg->qlock);
91 rte_mcfg_mempool_read_lock(void)
93 struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
94 rte_rwlock_read_lock(&mcfg->mplock);
98 rte_mcfg_mempool_read_unlock(void)
100 struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
101 rte_rwlock_read_unlock(&mcfg->mplock);
105 rte_mcfg_mempool_write_lock(void)
107 struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
108 rte_rwlock_write_lock(&mcfg->mplock);
112 rte_mcfg_mempool_write_unlock(void)
114 struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
115 rte_rwlock_write_unlock(&mcfg->mplock);