eal: factorize lcore role code

This code belongs to the lcore API, move the prototype to the right
header, then factorize the code into the common code.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
This commit is contained in:
David Marchand 2019-10-25 15:56:09 +02:00
parent 56564391d7
commit 6614072791
5 changed files with 20 additions and 25 deletions

View File

@ -53,6 +53,16 @@ rte_cpuset_t rte_lcore_cpuset(unsigned int lcore_id)
return lcore_config[lcore_id].cpuset;
}
enum rte_lcore_role_t
rte_eal_lcore_role(unsigned int lcore_id)
{
struct rte_config *cfg = rte_eal_get_configuration();
if (lcore_id >= RTE_MAX_LCORE)
return ROLE_OFF;
return cfg->lcore_role[lcore_id];
}
int rte_lcore_is_enabled(unsigned int lcore_id)
{
struct rte_config *cfg = rte_eal_get_configuration();

View File

@ -83,17 +83,6 @@ struct rte_config {
*/
struct rte_config *rte_eal_get_configuration(void);
/**
* Get a lcore's role.
*
* @param lcore_id
* The identifier of the lcore.
* @return
* The role of the lcore.
*/
enum rte_lcore_role_t rte_eal_lcore_role(unsigned lcore_id);
/**
* Get the process type in a multi-process setup
*

View File

@ -25,6 +25,16 @@ extern "C" {
RTE_DECLARE_PER_LCORE(unsigned, _lcore_id); /**< Per thread "lcore id". */
RTE_DECLARE_PER_LCORE(rte_cpuset_t, _cpuset); /**< Per thread "cpuset". */
/**
* Get a lcore's role.
*
* @param lcore_id
* The identifier of the lcore, which MUST be between 0 and RTE_MAX_LCORE-1.
* @return
* The role of the lcore.
*/
enum rte_lcore_role_t rte_eal_lcore_role(unsigned int lcore_id);
/**
* Return the Application thread ID of the execution unit.
*

View File

@ -970,13 +970,6 @@ rte_eal_cleanup(void)
return 0;
}
/* get core role */
enum rte_lcore_role_t
rte_eal_lcore_role(unsigned lcore_id)
{
return rte_config.lcore_role[lcore_id];
}
enum rte_proc_type_t
rte_eal_process_type(void)
{

View File

@ -1323,13 +1323,6 @@ rte_eal_cleanup(void)
return 0;
}
/* get core role */
enum rte_lcore_role_t
rte_eal_lcore_role(unsigned lcore_id)
{
return rte_config.lcore_role[lcore_id];
}
enum rte_proc_type_t
rte_eal_process_type(void)
{