Commit 42111e78 authored by Daniel Verkamp's avatar Daniel Verkamp
Browse files

nvmf: replace IQN references with NQN



NVMe over Fabrics defines its own NVMe Qualified Name (NQN) format; it
does not use iSCSI Qualified Names.

Also change the default node base for nvmf_tgt to "nqn.2016-06.io.spdk".

Change-Id: I2b73c1426ef1d8c83cc2df499d79228ea61257cd
Signed-off-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
parent 20b632d0
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -34,7 +34,7 @@
[Nvmf]
  # node name (not include optional part)
  # Users can optionally change this to fit their environment.
  NodeBase "iqn.2013-06.com.intel.ch.spdk"
  NodeBase "nqn.2016-06.io.spdk"

  # Set the optional in-capsule data byte length for I/O queue capsule size.
  # Accepted values must be divisible by 16 and less than or equal to
+1 −0
Original line number Diff line number Diff line
@@ -456,6 +456,7 @@ struct spdk_nvmf_extended_identify_ctrlr_data {
};
SPDK_STATIC_ASSERT(sizeof(struct spdk_nvmf_extended_identify_ctrlr_data) == 256, "Incorrect size");

#define SPDK_NVMF_NQN_MAX_LEN 223
#define SPDK_NVMF_DISCOVERY_NQN "nqn.2014-08.org.nvmexpress.discovery"

struct spdk_nvmf_discovery_identify_data {
+1 −1
Original line number Diff line number Diff line
@@ -56,7 +56,7 @@
#define SPDK_NVMF_MAX_RECV_DATA_TRANSFER_SIZE  LARGE_BB_MAX_SIZE

#define SPDK_NVMF_DEFAULT_NUM_SESSIONS_PER_LCORE 1
#define SPDK_NVMF_DEFAULT_NODEBASE "iqn.2013-10.com.intel.spdk"
#define SPDK_NVMF_DEFAULT_NODEBASE "nqn.2016-06.io.spdk"
#define SPDK_NVMF_DEFAULT_IN_CAPSULE_DATA_SIZE 1024
#define SPDK_NVMF_DEFAULT_MAX_SESSIONS_PER_SUBSYSTEM 1
#define SPDK_NVMF_DEFAULT_MAX_QUEUE_DEPTH 128
+2 −2
Original line number Diff line number Diff line
@@ -410,8 +410,8 @@ nvmf_process_connect(struct spdk_nvmf_request *req)
		      connect_data->hostid[9],
		      ntohs(*(uint16_t *)&connect_data->hostid[10]),
		      ntohl(*(uint32_t *)&connect_data->hostid[12]));
	SPDK_TRACELOG(SPDK_TRACE_NVMF, "  subsiqn: \"%s\"\n", (char *)&connect_data->subnqn[0]);
	SPDK_TRACELOG(SPDK_TRACE_NVMF, "  hostiqn: \"%s\"\n", (char *)&connect_data->hostnqn[0]);
	SPDK_TRACELOG(SPDK_TRACE_NVMF, "  subnqn: \"%s\"\n", (char *)&connect_data->subnqn[0]);
	SPDK_TRACELOG(SPDK_TRACE_NVMF, "  hostnqn: \"%s\"\n", (char *)&connect_data->hostnqn[0]);

	response = &req->rsp->connect_rsp;

+18 −40
Original line number Diff line number Diff line
@@ -155,54 +155,34 @@ nvmf_subsystem_add_ns(struct spdk_nvmf_subsystem *subsystem,
	return 0;
}

/* nvmf uses iSCSI IQN format to name target subsystems.  We expect that
   the nvmf subsiqn name provided diring connect requests will be
/* nvmf uses NQN format to name target subsystems.  We expect that
   the nvmf subnqn name provided diring connect requests will be
   equivalent to a individual controller name
*/
static int
spdk_check_nvmf_name(const char *name)
{
	const unsigned char *up = (const unsigned char *) name;
	size_t n;
	size_t len;

	/* valid iSCSI name? */
	for (n = 0; up[n] != 0; n++) {
		if (up[n] > 0x00U && up[n] <= 0x2cU)
			goto err0;
		if (up[n] == 0x2fU)
			goto err0;
		if (up[n] >= 0x3bU && up[n] <= 0x40U)
			goto err0;
		if (up[n] >= 0x5bU && up[n] <= 0x60U)
			goto err0;
		if (up[n] >= 0x7bU && up[n] <= 0x7fU)
			goto err0;
		if (isspace(up[n]))
			goto err0;
	len = strlen(name);
	if (len > SPDK_NVMF_NQN_MAX_LEN) {
		SPDK_ERRLOG("Invalid NQN \"%s\": length %zu > max %d\n", name, len, SPDK_NVMF_NQN_MAX_LEN);
		return -1;
	}

	/* valid format? */
	if (strncasecmp(name, "iqn.", 4) == 0) {
		/* iqn.YYYY-MM.reversed.domain.name */
		if (!isdigit(up[4]) || !isdigit(up[5]) || !isdigit(up[6])
		    || !isdigit(up[7]) || up[8] != '-' || !isdigit(up[9])
		    || !isdigit(up[10]) || up[11] != '.') {
			SPDK_ERRLOG("invalid iqn format. "
				    "expect \"iqn.YYYY-MM.reversed.domain.name\"\n");
	if (strncasecmp(name, "nqn.", 4) != 0) {
		SPDK_ERRLOG("Invalid NQN \"%s\": NQN must begin with \"nqn.\".\n", name);
		return -1;
	}
	} else if (strncasecmp(name, "eui.", 4) == 0) {
		/* EUI-64 -> 16bytes */
		/* XXX */
	} else if (strncasecmp(name, "naa.", 4) == 0) {
		/* 64bit -> 16bytes, 128bit -> 32bytes */
		/* XXX */

	/* yyyy-mm. */
	if (!(isdigit(name[4]) && isdigit(name[5]) && isdigit(name[6]) && isdigit(name[7]) &&
	      name[8] == '-' && isdigit(name[9]) && isdigit(name[10]) && name[11] == '.')) {
		SPDK_ERRLOG("Invalid date code in NQN \"%s\"\n", name);
		return -1;
	}

	return 0;
err0:
	SPDK_ERRLOG("Invalid iSCSI character [val %x, index %d]\n", up[n], (int)n);
	return -1;
}

static void
@@ -289,9 +269,7 @@ spdk_cf_add_nvmf_subsystem(struct spdk_conf_section *sp)
		goto err0;
	}

	if (strncasecmp(name, "iqn.", 4) != 0
	    && strncasecmp(name, "eui.", 4) != 0
	    && strncasecmp(name, "naa.", 4) != 0) {
	if (strncasecmp(name, "nqn.", 4) != 0) {
		ss_group->name = spdk_sprintf_alloc("%s:%s", g_nvmf_tgt.nodebase, name);
	} else {
		ss_group->name = strdup(name);
Loading