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: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Daniel Verkamp 2016-06-28 13:25:41 -07:00
parent 20b632d00e
commit 42111e78de
8 changed files with 26 additions and 47 deletions

View File

@ -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

View File

@ -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 {

View File

@ -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

View File

@ -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;

View File

@ -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");
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 */
if (strncasecmp(name, "nqn.", 4) != 0) {
SPDK_ERRLOG("Invalid NQN \"%s\": NQN must begin with \"nqn.\".\n", name);
return -1;
}
/* 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);

View File

@ -49,7 +49,7 @@ if [ -e "/dev/nvme-fabrics" ]; then
chmod a+rw /dev/nvme-fabrics
fi
echo 'traddr='$NVMF_FIRST_TARGET_IP',transport=rdma,nr_io_queues=1,trsvcid='$NVMF_PORT',nqn=iqn.2013-06.com.intel.ch.spdk:cnode1' > /dev/nvme-fabrics
echo 'traddr='$NVMF_FIRST_TARGET_IP',transport=rdma,nr_io_queues=1,trsvcid='$NVMF_PORT',nqn=nqn.2016-06.io.spdk:cnode1' > /dev/nvme-fabrics
# file system test
filesystem_test

View File

@ -23,7 +23,7 @@ if [ -e "/dev/nvme-fabrics" ]; then
chmod a+rw /dev/nvme-fabrics
fi
echo 'traddr='$NVMF_FIRST_TARGET_IP',transport=rdma,nr_io_queues=1,trsvcid='$NVMF_PORT',nqn=iqn.2013-06.com.intel.ch.spdk:cnode1' > /dev/nvme-fabrics
echo 'traddr='$NVMF_FIRST_TARGET_IP',transport=rdma,nr_io_queues=1,trsvcid='$NVMF_PORT',nqn=nqn.2016-06.io.spdk:cnode1' > /dev/nvme-fabrics
$testdir/nvmf_fio.py 4096 1 rw 1 verify
$testdir/nvmf_fio.py 4096 1 randrw 1 verify

View File

@ -6,7 +6,7 @@
#RpcConfiguration Yes
[Nvmf]
NodeBase "iqn.2013-06.com.intel.ch.spdk"
NodeBase "nqn.2016-06.io.spdk"
MaxConnectionsPerSession 4
[Port1]