env: export spdk_env_get_last_core function.
Also use this function in iscsi/conn.c Change-Id: I25f6da175eddb12c4ac2624d695c2c43c871d8e8 Signed-off-by: Ziye Yang <optimistyzy@gmail.com> Reviewed-on: https://review.gerrithub.io/392713 Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
08a7e4f4f8
commit
1b7ce80530
@ -227,6 +227,12 @@ uint32_t spdk_env_get_current_core(void);
|
|||||||
*/
|
*/
|
||||||
uint32_t spdk_env_get_first_core(void);
|
uint32_t spdk_env_get_first_core(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Return the index of the last dedicated CPU core for
|
||||||
|
* this application.
|
||||||
|
*/
|
||||||
|
uint32_t spdk_env_get_last_core(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Return the index of the next dedicated CPU core for
|
* \brief Return the index of the next dedicated CPU core for
|
||||||
* this application.
|
* this application.
|
||||||
|
@ -54,6 +54,24 @@ spdk_env_get_first_core(void)
|
|||||||
return rte_get_next_lcore(-1, 0, 0);
|
return rte_get_next_lcore(-1, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t
|
||||||
|
spdk_env_get_last_core(void)
|
||||||
|
{
|
||||||
|
uint32_t i;
|
||||||
|
static uint32_t last_core = UINT32_MAX;
|
||||||
|
|
||||||
|
/* Already know the last_core, just return */
|
||||||
|
if (last_core != UINT32_MAX) {
|
||||||
|
return last_core;
|
||||||
|
}
|
||||||
|
|
||||||
|
SPDK_ENV_FOREACH_CORE(i) {
|
||||||
|
last_core = i;
|
||||||
|
}
|
||||||
|
|
||||||
|
return last_core;
|
||||||
|
}
|
||||||
|
|
||||||
uint32_t
|
uint32_t
|
||||||
spdk_env_get_next_core(uint32_t prev_core)
|
spdk_env_get_next_core(uint32_t prev_core)
|
||||||
{
|
{
|
||||||
|
@ -349,7 +349,7 @@ int spdk_initialize_iscsi_conns(void)
|
|||||||
{
|
{
|
||||||
size_t conns_size;
|
size_t conns_size;
|
||||||
int conns_array_fd, rc;
|
int conns_array_fd, rc;
|
||||||
uint32_t i, last_core = 0;
|
uint32_t i, last_core;
|
||||||
|
|
||||||
SPDK_DEBUGLOG(SPDK_LOG_ISCSI, "spdk_iscsi_init\n");
|
SPDK_DEBUGLOG(SPDK_LOG_ISCSI, "spdk_iscsi_init\n");
|
||||||
|
|
||||||
@ -383,10 +383,7 @@ int spdk_initialize_iscsi_conns(void)
|
|||||||
g_conns_array[i].id = i;
|
g_conns_array[i].id = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
SPDK_ENV_FOREACH_CORE(i) {
|
last_core = spdk_env_get_last_core();
|
||||||
last_core = i;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_num_connections = calloc(last_core + 1, sizeof(uint32_t));
|
g_num_connections = calloc(last_core + 1, sizeof(uint32_t));
|
||||||
if (!g_num_connections) {
|
if (!g_num_connections) {
|
||||||
SPDK_ERRLOG("Could not allocate array size=%u for g_num_connections\n",
|
SPDK_ERRLOG("Could not allocate array size=%u for g_num_connections\n",
|
||||||
|
Loading…
Reference in New Issue
Block a user