env: expose function to get main core

Main core can be different than first core (default behavior) as it
can be specified by application argument. It can be useful to
determine if given thread is matching main core.

Signed-off-by: Jacek Kalwas <jacek.kalwas@intel.com>
Change-Id: I25292a91ad677806eaf19ad68acdda0f28da6cfb
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16596
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
This commit is contained in:
Jacek Kalwas 2023-01-30 04:20:17 -05:00 committed by Tomasz Zawadzki
parent 1974117a29
commit 37b5d87b19
4 changed files with 18 additions and 0 deletions

View File

@ -2,6 +2,10 @@
## v23.05: (Upcoming Release)
### env
New function `spdk_env_get_main_core` was added.
## v23.01
### accel

View File

@ -462,6 +462,13 @@ uint32_t spdk_env_get_core_count(void);
*/
uint32_t spdk_env_get_current_core(void);
/**
* Get the index of the main dedicated CPU core for this application.
*
* \return the index of the main dedicated CPU core.
*/
uint32_t spdk_env_get_main_core(void);
/**
* Get the index of the first dedicated CPU core for this application.
*

View File

@ -34,6 +34,7 @@
spdk_mempool_lookup;
spdk_env_get_core_count;
spdk_env_get_current_core;
spdk_env_get_main_core;
spdk_env_get_first_core;
spdk_env_get_last_core;
spdk_env_get_next_core;

View File

@ -20,6 +20,12 @@ spdk_env_get_current_core(void)
return rte_lcore_id();
}
uint32_t
spdk_env_get_main_core(void)
{
return rte_get_main_lcore();
}
uint32_t
spdk_env_get_first_core(void)
{