event: Add dpdk framework start function into event.

Make sure the reactor mask in profile take effect.

Change-Id: Ia471b2b88a711f05738cf93068c4f3a8c9a3039d
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
This commit is contained in:
Cunyin Chang 2016-06-12 19:34:00 +08:00 committed by Daniel Verkamp
parent 2a806421c3
commit adcbbe19ff
5 changed files with 18 additions and 13 deletions

View File

@ -220,12 +220,10 @@ main(int argc, char **argv)
sleep(10);
}
spdk_init_dpdk(&opts);
printf("Total cores available: %d\n", rte_lcore_count());
opts.shutdown_cb = spdk_nvmf_shutdown_cb;
spdk_app_init(&opts);
printf("Total cores available: %d\n", rte_lcore_count());
/* Blocks until the application is exiting */
rc = spdk_app_start(spdk_nvmf_startup, NULL, NULL);

View File

@ -153,7 +153,7 @@ void spdk_app_opts_init(struct spdk_app_opts *opts);
/**
* \brief Initialize DPDK via opts.
*/
void spdk_init_dpdk(struct spdk_app_opts *opts);
void spdk_dpdk_framework_init(struct spdk_app_opts *opts);
/**
* \brief Initialize an application to use the event framework. This must be called prior to using

View File

@ -220,7 +220,7 @@ spdk_app_opts_init(struct spdk_app_opts *opts)
opts->dpdk_mem_size = -1;
opts->dpdk_master_core = SPDK_APP_DPDK_DEFAULT_MASTER_CORE;
opts->dpdk_mem_channel = SPDK_APP_DPDK_DEFAULT_MEM_CHANNEL;
opts->reactor_mask = SPDK_APP_DPDK_DEFAULT_CORE_MASK;
opts->reactor_mask = NULL;
}
void
@ -303,16 +303,18 @@ spdk_app_init(struct spdk_app_opts *opts)
if (opts->reactor_mask == NULL) {
sp = spdk_conf_find_section(g_spdk_app.config, "Global");
if (sp != NULL) {
if (spdk_conf_section_get_val(sp, "WorkerMask")) {
fprintf(stderr, "WorkerMask not valid key name."
" Use ReactorMask instead.\n");
spdk_conf_free(g_spdk_app.config);
exit(EXIT_FAILURE);
if (spdk_conf_section_get_val(sp, "ReactorMask")) {
opts->reactor_mask = spdk_conf_section_get_val(sp, "ReactorMask");
} else {
opts->reactor_mask = SPDK_APP_DPDK_DEFAULT_CORE_MASK;
}
opts->reactor_mask = spdk_conf_section_get_val(sp, "ReactorMask");
} else {
opts->reactor_mask = SPDK_APP_DPDK_DEFAULT_CORE_MASK;
}
}
spdk_dpdk_framework_init(opts);
/*
* If mask not specified on command line or in configuration file,
* reactor_mask will be NULL which will enable all cores to run

View File

@ -162,7 +162,7 @@ spdk_build_eal_cmdline(struct spdk_app_opts *opts)
memcpy(g_ealargs, g_arg_strings, sizeof(g_arg_strings));
}
void
static void
spdk_init_dpdk(struct spdk_app_opts *opts)
{
int i, rc;
@ -192,3 +192,9 @@ spdk_init_dpdk(struct spdk_app_opts *opts)
printf("done.\n");
}
__attribute__((weak))
void spdk_dpdk_framework_init(struct spdk_app_opts *opts)
{
spdk_init_dpdk(opts);
}

View File

@ -152,7 +152,6 @@ main(int argc, char **argv)
optind = 1; /*reset the optind */
spdk_init_dpdk(&opts);
spdk_app_init(&opts);
g_tsc_rate = rte_get_timer_hz();