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 eal_mcfg_update_internal(void)
37 struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
39 internal_config.legacy_mem = mcfg->legacy_mem;
40 internal_config.single_file_segments = mcfg->single_file_segments;
44 eal_mcfg_update_from_internal(void)
46 struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
48 mcfg->legacy_mem = internal_config.legacy_mem;
49 mcfg->single_file_segments = internal_config.single_file_segments;
53 rte_mcfg_mem_read_lock(void)
55 struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
56 rte_rwlock_read_lock(&mcfg->memory_hotplug_lock);
60 rte_mcfg_mem_read_unlock(void)
62 struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
63 rte_rwlock_read_unlock(&mcfg->memory_hotplug_lock);
67 rte_mcfg_mem_write_lock(void)
69 struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
70 rte_rwlock_write_lock(&mcfg->memory_hotplug_lock);
74 rte_mcfg_mem_write_unlock(void)
76 struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
77 rte_rwlock_write_unlock(&mcfg->memory_hotplug_lock);
81 rte_mcfg_tailq_read_lock(void)
83 struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
84 rte_rwlock_read_lock(&mcfg->qlock);
88 rte_mcfg_tailq_read_unlock(void)
90 struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
91 rte_rwlock_read_unlock(&mcfg->qlock);
95 rte_mcfg_tailq_write_lock(void)
97 struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
98 rte_rwlock_write_lock(&mcfg->qlock);
102 rte_mcfg_tailq_write_unlock(void)
104 struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
105 rte_rwlock_write_unlock(&mcfg->qlock);
109 rte_mcfg_mempool_read_lock(void)
111 struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
112 rte_rwlock_read_lock(&mcfg->mplock);
116 rte_mcfg_mempool_read_unlock(void)
118 struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
119 rte_rwlock_read_unlock(&mcfg->mplock);
123 rte_mcfg_mempool_write_lock(void)
125 struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
126 rte_rwlock_write_lock(&mcfg->mplock);
130 rte_mcfg_mempool_write_unlock(void)
132 struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
133 rte_rwlock_write_unlock(&mcfg->mplock);