diff --git a/app/nvmf_tgt/nvmf_tgt.c b/app/nvmf_tgt/nvmf_tgt.c index 1ee0b37290..d03e2b7c44 100644 --- a/app/nvmf_tgt/nvmf_tgt.c +++ b/app/nvmf_tgt/nvmf_tgt.c @@ -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); diff --git a/include/spdk/event.h b/include/spdk/event.h index a535ef2bad..4b1f64c6d4 100644 --- a/include/spdk/event.h +++ b/include/spdk/event.h @@ -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 diff --git a/lib/event/app.c b/lib/event/app.c index 8043d28831..6c3e053569 100644 --- a/lib/event/app.c +++ b/lib/event/app.c @@ -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 diff --git a/lib/event/dpdk_init.c b/lib/event/dpdk_init.c index 8c78b04953..04117a7d4a 100644 --- a/lib/event/dpdk_init.c +++ b/lib/event/dpdk_init.c @@ -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); +} diff --git a/test/lib/event/event/event.c b/test/lib/event/event/event.c index 305717d50b..cbaa827899 100644 --- a/test/lib/event/event/event.c +++ b/test/lib/event/event/event.c @@ -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();