eal: uninline wait for complete init
[dpdk.git] / lib / librte_eal / common / eal_common_mcfg.c
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2019 Intel Corporation
3  */
4
5 #include <rte_config.h>
6 #include <rte_eal_memconfig.h>
7
8 #include "eal_memcfg.h"
9
10 void
11 eal_mcfg_wait_complete(void)
12 {
13         struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
14
15         /* wait until shared mem_config finish initialising */
16         while (mcfg->magic != RTE_MAGIC)
17                 rte_pause();
18 }
19
20 void
21 rte_mcfg_mem_read_lock(void)
22 {
23         struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
24         rte_rwlock_read_lock(&mcfg->memory_hotplug_lock);
25 }
26
27 void
28 rte_mcfg_mem_read_unlock(void)
29 {
30         struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
31         rte_rwlock_read_unlock(&mcfg->memory_hotplug_lock);
32 }
33
34 void
35 rte_mcfg_mem_write_lock(void)
36 {
37         struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
38         rte_rwlock_write_lock(&mcfg->memory_hotplug_lock);
39 }
40
41 void
42 rte_mcfg_mem_write_unlock(void)
43 {
44         struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
45         rte_rwlock_write_unlock(&mcfg->memory_hotplug_lock);
46 }
47
48 void
49 rte_mcfg_tailq_read_lock(void)
50 {
51         struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
52         rte_rwlock_read_lock(&mcfg->qlock);
53 }
54
55 void
56 rte_mcfg_tailq_read_unlock(void)
57 {
58         struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
59         rte_rwlock_read_unlock(&mcfg->qlock);
60 }
61
62 void
63 rte_mcfg_tailq_write_lock(void)
64 {
65         struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
66         rte_rwlock_write_lock(&mcfg->qlock);
67 }
68
69 void
70 rte_mcfg_tailq_write_unlock(void)
71 {
72         struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
73         rte_rwlock_write_unlock(&mcfg->qlock);
74 }
75
76 void
77 rte_mcfg_mempool_read_lock(void)
78 {
79         struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
80         rte_rwlock_read_lock(&mcfg->mplock);
81 }
82
83 void
84 rte_mcfg_mempool_read_unlock(void)
85 {
86         struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
87         rte_rwlock_read_unlock(&mcfg->mplock);
88 }
89
90 void
91 rte_mcfg_mempool_write_lock(void)
92 {
93         struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
94         rte_rwlock_write_lock(&mcfg->mplock);
95 }
96
97 void
98 rte_mcfg_mempool_write_unlock(void)
99 {
100         struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
101         rte_rwlock_write_unlock(&mcfg->mplock);
102 }