vhost: Remove DPDK dependency and simplify load balancing

The latest patch for the iSCSI connection is applied to the vhost
too.

RTE_MAX_LCORE in the for loop is removed and the for loop is
replaced by SPDK_ENV_FOREACH_CORE().

When the cpumask is unexpectedly 0, not 0 but the first core is
returned.

Change-Id: I39cfc2219a3532eccc8c0ce59712102b947a76d7
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/392588
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
This commit is contained in:
Shuhei Matsumoto 2017-12-25 08:26:52 +09:00 committed by Daniel Verkamp
parent 62dc3292f5
commit 0686f0381b
2 changed files with 4 additions and 8 deletions

View File

@ -677,16 +677,10 @@ spdk_vhost_allocate_reactor(uint64_t cpumask)
uint32_t i, selected_core;
uint32_t min_ctrlrs;
cpumask &= spdk_app_get_core_mask();
if (cpumask == 0) {
return 0;
}
min_ctrlrs = INT_MAX;
selected_core = 0;
selected_core = spdk_env_get_first_core();
for (i = 0; i < RTE_MAX_LCORE && i < 64; i++) {
SPDK_ENV_FOREACH_CORE(i) {
if (!((1ULL << i) & cpumask)) {
continue;
}

View File

@ -48,6 +48,8 @@ DEFINE_STUB(spdk_mem_register, int, (void *vaddr, size_t len), 0);
DEFINE_STUB(spdk_mem_unregister, int, (void *vaddr, size_t len), 0);
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_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,