event: Remove use of rte_lcore

Change-Id: Ia20284118077e49f2988f30469c3e3f4100ebdf0
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/363607
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Ben Walker 2017-06-02 11:00:35 -07:00 committed by Daniel Verkamp
parent 54e16f96b3
commit d7134439f6
2 changed files with 15 additions and 12 deletions

View File

@ -36,7 +36,7 @@
#include "spdk_internal/event.h"
#include <rte_config.h>
#include <rte_lcore.h>
#include <rte_launch.h>
#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 */

View File

@ -45,7 +45,6 @@
#include <rte_config.h>
#include <rte_launch.h>
#include <rte_lcore.h>
#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();