vhost: Replace RTE_MAX_LCORE by spdk_env_get_last_core()

Adopt two improvements for iSCSI by Ziye to VHOST.
- iscsi/conn: remove rte_config.h header
- env: export spdk_env_get_last_core function

Change-Id: I8f067093d593c8d483c52587669f8b0b706f497f
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/392910
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Shuhei Matsumoto 2017-12-25 08:43:41 +09:00 committed by Daniel Verkamp
parent 0686f0381b
commit b29d208267
2 changed files with 12 additions and 1 deletions

View File

@ -42,7 +42,7 @@
#include "spdk/vhost.h"
#include "vhost_internal.h"
static uint32_t g_num_ctrlrs[RTE_MAX_LCORE];
static uint32_t *g_num_ctrlrs;
/* Path to folder where character device will be created. Can be set by user. */
static char dev_dirname[PATH_MAX] = "";
@ -1159,12 +1159,22 @@ spdk_vhost_unlock(void)
int
spdk_vhost_init(void)
{
uint32_t last_core;
last_core = spdk_env_get_last_core();
g_num_ctrlrs = calloc(last_core + 1, sizeof(uint32_t));
if (!g_num_ctrlrs) {
SPDK_ERRLOG("Could not allocate array size=%u for g_num_ctrlrs\n",
last_core + 1);
return -1;
}
return 0;
}
void
spdk_vhost_fini(void)
{
free(g_num_ctrlrs);
}
SPDK_LOG_REGISTER_COMPONENT("vhost_ring", SPDK_LOG_VHOST_RING)

View File

@ -50,6 +50,7 @@ DEFINE_STUB(spdk_app_get_core_mask, uint64_t, (void), 0);
DEFINE_STUB(spdk_app_parse_core_mask, int, (const char *mask, uint64_t *cpumask), 0);
DEFINE_STUB(spdk_env_get_first_core, uint32_t, (void), 0);
DEFINE_STUB(spdk_env_get_next_core, uint32_t, (uint32_t prev_core), 0);
DEFINE_STUB(spdk_env_get_last_core, uint32_t, (void), 0);
DEFINE_STUB_V(spdk_app_stop, (int rc));
DEFINE_STUB_V(spdk_event_call, (struct spdk_event *event));
DEFINE_STUB(spdk_poller_register, struct spdk_poller *, (spdk_poller_fn fn, void *arg,