numam-dpdk/lib/librte_eal/common/eal_common_mcfg.c
Anatoly Burakov a08a5dd20e eal: uninline wait for complete init
Currently, the function to wait until config completion is
static inline for no reason. Move its implementation to
an EAL common file.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: David Marchand <david.marchand@redhat.com>
2019-07-06 10:32:40 +02:00

103 lines
2.2 KiB
C

/* SPDX-License-Identifier: BSD-3-Clause
* Copyright(c) 2019 Intel Corporation
*/
#include <rte_config.h>
#include <rte_eal_memconfig.h>
#include "eal_memcfg.h"
void
eal_mcfg_wait_complete(void)
{
struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
/* wait until shared mem_config finish initialising */
while (mcfg->magic != RTE_MAGIC)
rte_pause();
}
void
rte_mcfg_mem_read_lock(void)
{
struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
rte_rwlock_read_lock(&mcfg->memory_hotplug_lock);
}
void
rte_mcfg_mem_read_unlock(void)
{
struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
rte_rwlock_read_unlock(&mcfg->memory_hotplug_lock);
}
void
rte_mcfg_mem_write_lock(void)
{
struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
rte_rwlock_write_lock(&mcfg->memory_hotplug_lock);
}
void
rte_mcfg_mem_write_unlock(void)
{
struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
rte_rwlock_write_unlock(&mcfg->memory_hotplug_lock);
}
void
rte_mcfg_tailq_read_lock(void)
{
struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
rte_rwlock_read_lock(&mcfg->qlock);
}
void
rte_mcfg_tailq_read_unlock(void)
{
struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
rte_rwlock_read_unlock(&mcfg->qlock);
}
void
rte_mcfg_tailq_write_lock(void)
{
struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
rte_rwlock_write_lock(&mcfg->qlock);
}
void
rte_mcfg_tailq_write_unlock(void)
{
struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
rte_rwlock_write_unlock(&mcfg->qlock);
}
void
rte_mcfg_mempool_read_lock(void)
{
struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
rte_rwlock_read_lock(&mcfg->mplock);
}
void
rte_mcfg_mempool_read_unlock(void)
{
struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
rte_rwlock_read_unlock(&mcfg->mplock);
}
void
rte_mcfg_mempool_write_lock(void)
{
struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
rte_rwlock_write_lock(&mcfg->mplock);
}
void
rte_mcfg_mempool_write_unlock(void)
{
struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
rte_rwlock_write_unlock(&mcfg->mplock);
}