Commit adcbbe19 authored by Cunyin Chang's avatar Cunyin Chang Committed by Daniel Verkamp
Browse files

event: Add dpdk framework start function into event.



Make sure the reactor mask in profile take effect.

Change-Id: Ia471b2b88a711f05738cf93068c4f3a8c9a3039d
Signed-off-by: default avatarCunyin Chang <cunyin.chang@intel.com>
parent 2a806421
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -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);

+1 −1
Original line number Diff line number Diff line
@@ -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
+9 −7
Original line number Diff line number Diff line
@@ -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,15 +303,17 @@ 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;
			}
		} 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,
+7 −1
Original line number Diff line number Diff line
@@ -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);
}
+0 −1
Original line number Diff line number Diff line
@@ -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();