nvme/rdma: add hostnqn to spdk_nvme_ctrlr_opts

Allow the host NQN to be overriden when connecting to NVMe over Fabrics
controllers.

Change-Id: I8fcf2e89ae7d9722677e834f76a8fe805c52f91b
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Daniel Verkamp 2016-11-28 15:56:23 -07:00 committed by Jim Harris
parent 038236949f
commit 89136259ec
4 changed files with 11 additions and 2 deletions

View File

@ -100,6 +100,13 @@ struct spdk_nvme_ctrlr_opts {
* The queue depth of each NVMe I/O queue.
*/
uint32_t queue_size;
/**
* The host NQN to use when connecting to NVMe over Fabrics controllers.
*
* Unused for local PCIe-attached NVMe devices.
*/
char hostnqn[SPDK_NVMF_NQN_MAX_LEN + 1];
};
/**

View File

@ -81,6 +81,7 @@ spdk_nvme_ctrlr_opts_set_defaults(struct spdk_nvme_ctrlr_opts *opts)
opts->arb_mechanism = SPDK_NVME_CC_AMS_RR;
opts->keep_alive_timeout_ms = 10 * 1000;
opts->queue_size = DEFAULT_MAX_QUEUE_SIZE;
strncpy(opts->hostnqn, DEFAULT_HOSTNQN, sizeof(opts->hostnqn));
}
struct spdk_nvme_qpair *

View File

@ -94,6 +94,8 @@
#define DEFAULT_MAX_IO_QUEUES (1024)
#define DEFAULT_MAX_QUEUE_SIZE (256)
#define DEFAULT_HOSTNQN "nqn.2016-06.io.spdk:host"
enum nvme_payload_type {
NVME_PAYLOAD_TYPE_INVALID = 0,

View File

@ -61,7 +61,6 @@
#define NVME_RDMA_TIME_OUT_IN_MS 2000
#define NVME_RDMA_RW_BUFFER_SIZE 131072
#define NVME_HOST_ID_DEFAULT "12345679890"
#define NVME_HOST_NQN "nqn.2016-06.io.spdk:host"
#define NVME_HOST_MAX_ENTRIES_PER_QUEUE (127)
@ -765,7 +764,7 @@ nvme_rdma_qpair_fabric_connect(struct nvme_rdma_qpair *rqpair)
strncpy((char *)&nvmf_data->hostid, (char *)NVME_HOST_ID_DEFAULT,
strlen((char *)NVME_HOST_ID_DEFAULT));
strncpy((char *)nvmf_data->hostnqn, NVME_HOST_NQN, sizeof(nvmf_data->hostnqn));
strncpy((char *)nvmf_data->hostnqn, ctrlr->opts.hostnqn, sizeof(nvmf_data->hostnqn));
strncpy((char *)nvmf_data->subnqn, ctrlr->probe_info.nqn, sizeof(nvmf_data->subnqn));
if (nvme_qpair_is_admin_queue(&rqpair->qpair)) {