eal: add API to lock/unlock tailq list
[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 void
9 rte_mcfg_mem_read_lock(void)
10 {
11         struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
12         rte_rwlock_read_lock(&mcfg->memory_hotplug_lock);
13 }
14
15 void
16 rte_mcfg_mem_read_unlock(void)
17 {
18         struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
19         rte_rwlock_read_unlock(&mcfg->memory_hotplug_lock);
20 }
21
22 void
23 rte_mcfg_mem_write_lock(void)
24 {
25         struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
26         rte_rwlock_write_lock(&mcfg->memory_hotplug_lock);
27 }
28
29 void
30 rte_mcfg_mem_write_unlock(void)
31 {
32         struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
33         rte_rwlock_write_unlock(&mcfg->memory_hotplug_lock);
34 }
35
36 void
37 rte_mcfg_tailq_read_lock(void)
38 {
39         struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
40         rte_rwlock_read_lock(&mcfg->qlock);
41 }
42
43 void
44 rte_mcfg_tailq_read_unlock(void)
45 {
46         struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
47         rte_rwlock_read_unlock(&mcfg->qlock);
48 }
49
50 void
51 rte_mcfg_tailq_write_lock(void)
52 {
53         struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
54         rte_rwlock_write_lock(&mcfg->qlock);
55 }
56
57 void
58 rte_mcfg_tailq_write_unlock(void)
59 {
60         struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
61         rte_rwlock_write_unlock(&mcfg->qlock);
62 }