From d7134439f6eadb64c0e7afe7803e1794626ee2a7 Mon Sep 17 00:00:00 2001 From: Ben Walker Date: Fri, 2 Jun 2017 11:00:35 -0700 Subject: [PATCH] event: Remove use of rte_lcore Change-Id: Ia20284118077e49f2988f30469c3e3f4100ebdf0 Signed-off-by: Ben Walker Reviewed-on: https://review.gerrithub.io/363607 Tested-by: SPDK Automated Test System Reviewed-by: Daniel Verkamp --- lib/event/app.c | 9 +++++---- lib/event/reactor.c | 18 ++++++++++-------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/lib/event/app.c b/lib/event/app.c index 10b329ee2..9f3982e58 100644 --- a/lib/event/app.c +++ b/lib/event/app.c @@ -36,7 +36,7 @@ #include "spdk_internal/event.h" #include -#include +#include #include "spdk/env.h" #include "spdk/log.h" @@ -341,7 +341,8 @@ spdk_app_init(struct spdk_app_opts *opts) } if (opts->shutdown_cb != NULL) { - g_shutdown_event = spdk_event_allocate(rte_lcore_id(), __shutdown_event_cb, + g_shutdown_event = spdk_event_allocate(spdk_env_get_current_core(), + __shutdown_event_cb, NULL, NULL); sigact.sa_handler = __shutdown_signal; @@ -433,10 +434,10 @@ spdk_app_start(spdk_event_fn start_fn, void *arg1, void *arg2) g_spdk_app.rc = 0; - app_start_event = spdk_event_allocate(rte_get_master_lcore(), start_fn, + app_start_event = spdk_event_allocate(spdk_env_get_current_core(), start_fn, arg1, arg2); - spdk_event_call(spdk_event_allocate(rte_get_master_lcore(), spdk_subsystem_init, + spdk_event_call(spdk_event_allocate(spdk_env_get_current_core(), spdk_subsystem_init, app_start_event, NULL)); /* This blocks until spdk_app_stop is called */ diff --git a/lib/event/reactor.c b/lib/event/reactor.c index 35f19bd0d..805ae336d 100644 --- a/lib/event/reactor.c +++ b/lib/event/reactor.c @@ -45,7 +45,6 @@ #include #include -#include #include "spdk/log.h" #include "spdk/io_channel.h" @@ -437,7 +436,7 @@ spdk_reactor_construct(struct spdk_reactor *reactor, uint32_t lcore, uint64_t ma static void spdk_reactor_start(struct spdk_reactor *reactor) { - if (reactor->lcore != rte_get_master_lcore()) { + if (reactor->lcore != spdk_env_get_current_core()) { switch (rte_eal_get_lcore_state(reactor->lcore)) { case FINISHED: rte_eal_wait_lcore(reactor->lcore); @@ -469,8 +468,9 @@ spdk_app_get_current_core(void) int spdk_app_parse_core_mask(const char *mask, uint64_t *cpumask) { - unsigned int i; + uint32_t i; char *end; + uint64_t validmask; if (mask == NULL || cpumask == NULL) { return -1; @@ -482,12 +482,16 @@ spdk_app_parse_core_mask(const char *mask, uint64_t *cpumask) return -1; } - for (i = 0; i < RTE_MAX_LCORE && i < 64; i++) { - if ((*cpumask & (1ULL << i)) && !rte_lcore_is_enabled(i)) { - *cpumask &= ~(1ULL << i); + validmask = 0; + SPDK_ENV_FOREACH_CORE(i) { + if (i >= 64) { + break; } + validmask |= 1ULL << i; } + *cpumask &= validmask; + return 0; } @@ -526,8 +530,6 @@ spdk_reactors_start(void) struct spdk_reactor *reactor; uint32_t i, current_core; - assert(rte_get_master_lcore() == rte_lcore_id()); - g_reactor_state = SPDK_REACTOR_STATE_RUNNING; current_core = spdk_env_get_current_core();