Commit 89031c3e authored by Daniel Verkamp's avatar Daniel Verkamp
Browse files

nvmf: move discovery subsystem creation to conf.c



It is not currently configurable, but this will allow us to make the
discovery subsystem have config options (e.g. which lcore to run on).

Change-Id: I788a64ba4462b023453191e509ce8de59fd90ae4
Signed-off-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
parent 35bc1e93
Loading
Loading
Loading
Loading
+36 −1
Original line number Diff line number Diff line
@@ -68,6 +68,30 @@ struct spdk_nvmf_probe_ctx {
#define SPDK_NVMF_CONFIG_QUEUE_DEPTH_MIN 16
#define SPDK_NVMF_CONFIG_QUEUE_DEPTH_MAX 1024

static int
spdk_add_nvmf_discovery_subsystem(void)
{
	struct spdk_nvmf_subsystem *subsystem;
	char *name;

	name = strdup(SPDK_NVMF_DISCOVERY_NQN);
	if (name == NULL) {
		SPDK_ERRLOG("strdup ss_group->name error\n");
		return -1;
	}

	subsystem = nvmf_create_subsystem(0, name, SPDK_NVMF_SUBTYPE_DISCOVERY, rte_get_master_lcore());
	if (subsystem == NULL) {
		SPDK_ERRLOG("Failed creating discovery nvmf library subsystem\n");
		free(name);
		return -1;
	}

	free(name);

	return 0;
}

static int
spdk_nvmf_parse_nvmf_tgt(void)
{
@@ -97,9 +121,20 @@ spdk_nvmf_parse_nvmf_tgt(void)
	max_queues_per_sess = nvmf_min(max_queues_per_sess, SPDK_NVMF_CONFIG_QUEUES_PER_SESSION_MAX);

	rc = nvmf_tgt_init(max_queue_depth, max_queues_per_sess);
	if (rc != 0) {
		SPDK_ERRLOG("nvmf_tgt_init() failed\n");
		return rc;
	}

	rc = spdk_add_nvmf_discovery_subsystem();
	if (rc != 0) {
		SPDK_ERRLOG("spdk_add_nvmf_discovery_subsystem failed\n");
		return rc;
	}

	return 0;
}

static int
spdk_nvmf_parse_addr(char *listen_addr, char **host, char **port)
{
+1 −7
Original line number Diff line number Diff line
@@ -162,13 +162,7 @@ nvmf_tgt_subsystem_initialize(void)
		return -1;
	}

	rc = spdk_add_nvmf_discovery_subsystem();
	if (rc < 0) {
		SPDK_ERRLOG("spdk_add_nvmf_discovery_subsystem failed\n");
		return rc;
	}

	return rc;
	return 0;
}

static int
+0 −24
Original line number Diff line number Diff line
@@ -211,30 +211,6 @@ nvmf_subsystem_add_ctrlr(struct spdk_nvmf_subsystem *subsystem,
	return 0;
}

int
spdk_add_nvmf_discovery_subsystem(void)
{
	struct spdk_nvmf_subsystem *subsystem;
	char *name;

	name = strdup(SPDK_NVMF_DISCOVERY_NQN);
	if (name == NULL) {
		SPDK_ERRLOG("strdup ss_group->name error\n");
		return -1;
	}

	subsystem = nvmf_create_subsystem(0, name, SPDK_NVMF_SUBTYPE_DISCOVERY, rte_get_master_lcore());
	if (subsystem == NULL) {
		SPDK_ERRLOG("Failed creating discovery nvmf library subsystem\n");
		free(name);
		return -1;
	}

	free(name);

	return 0;
}

void
spdk_format_discovery_log(struct spdk_nvmf_discovery_log_page *disc_log, uint32_t length)
{
+0 −3
Original line number Diff line number Diff line
@@ -113,9 +113,6 @@ nvmf_subsystem_add_ctrlr(struct spdk_nvmf_subsystem *subsystem,
int
spdk_shutdown_nvmf_subsystems(void);

int
spdk_add_nvmf_discovery_subsystem(void);

void
spdk_format_discovery_log(struct spdk_nvmf_discovery_log_page *disc_log, uint32_t length);