nvme-fabrics: change NQN UUID to big-endian format
NVM Express 1.2.1 section 7.9, NVMe Qualified Names, specifies that the UUID format of NQN uses a UUID based on RFC 4122. RFC 4122 specifies that the UUID is encoded in big-endian byte order. Switch the NVMe over Fabrics host ID field from little-endian UUID to big-endian UUID to match the specification. Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com> Reviewed-by: Jay Freyensee <james_p_freyensee@linux.intel.com> Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
This commit is contained in:
parent
eadb7cf441
commit
7a665d2f60
|
@ -56,7 +56,7 @@ static struct nvmf_host *nvmf_host_add(const char *hostnqn)
|
||||||
|
|
||||||
kref_init(&host->ref);
|
kref_init(&host->ref);
|
||||||
memcpy(host->nqn, hostnqn, NVMF_NQN_SIZE);
|
memcpy(host->nqn, hostnqn, NVMF_NQN_SIZE);
|
||||||
uuid_le_gen(&host->id);
|
uuid_be_gen(&host->id);
|
||||||
|
|
||||||
list_add_tail(&host->list, &nvmf_hosts);
|
list_add_tail(&host->list, &nvmf_hosts);
|
||||||
out_unlock:
|
out_unlock:
|
||||||
|
@ -73,9 +73,9 @@ static struct nvmf_host *nvmf_host_default(void)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
kref_init(&host->ref);
|
kref_init(&host->ref);
|
||||||
uuid_le_gen(&host->id);
|
uuid_be_gen(&host->id);
|
||||||
snprintf(host->nqn, NVMF_NQN_SIZE,
|
snprintf(host->nqn, NVMF_NQN_SIZE,
|
||||||
"nqn.2014-08.org.nvmexpress:NVMf:uuid:%pUl", &host->id);
|
"nqn.2014-08.org.nvmexpress:NVMf:uuid:%pUb", &host->id);
|
||||||
|
|
||||||
mutex_lock(&nvmf_hosts_mutex);
|
mutex_lock(&nvmf_hosts_mutex);
|
||||||
list_add_tail(&host->list, &nvmf_hosts);
|
list_add_tail(&host->list, &nvmf_hosts);
|
||||||
|
@ -382,7 +382,7 @@ int nvmf_connect_admin_queue(struct nvme_ctrl *ctrl)
|
||||||
if (!data)
|
if (!data)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
memcpy(&data->hostid, &ctrl->opts->host->id, sizeof(uuid_le));
|
memcpy(&data->hostid, &ctrl->opts->host->id, sizeof(uuid_be));
|
||||||
data->cntlid = cpu_to_le16(0xffff);
|
data->cntlid = cpu_to_le16(0xffff);
|
||||||
strncpy(data->subsysnqn, ctrl->opts->subsysnqn, NVMF_NQN_SIZE);
|
strncpy(data->subsysnqn, ctrl->opts->subsysnqn, NVMF_NQN_SIZE);
|
||||||
strncpy(data->hostnqn, ctrl->opts->host->nqn, NVMF_NQN_SIZE);
|
strncpy(data->hostnqn, ctrl->opts->host->nqn, NVMF_NQN_SIZE);
|
||||||
|
@ -441,7 +441,7 @@ int nvmf_connect_io_queue(struct nvme_ctrl *ctrl, u16 qid)
|
||||||
if (!data)
|
if (!data)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
memcpy(&data->hostid, &ctrl->opts->host->id, sizeof(uuid_le));
|
memcpy(&data->hostid, &ctrl->opts->host->id, sizeof(uuid_be));
|
||||||
data->cntlid = cpu_to_le16(ctrl->cntlid);
|
data->cntlid = cpu_to_le16(ctrl->cntlid);
|
||||||
strncpy(data->subsysnqn, ctrl->opts->subsysnqn, NVMF_NQN_SIZE);
|
strncpy(data->subsysnqn, ctrl->opts->subsysnqn, NVMF_NQN_SIZE);
|
||||||
strncpy(data->hostnqn, ctrl->opts->host->nqn, NVMF_NQN_SIZE);
|
strncpy(data->hostnqn, ctrl->opts->host->nqn, NVMF_NQN_SIZE);
|
||||||
|
|
|
@ -34,7 +34,7 @@ struct nvmf_host {
|
||||||
struct kref ref;
|
struct kref ref;
|
||||||
struct list_head list;
|
struct list_head list;
|
||||||
char nqn[NVMF_NQN_SIZE];
|
char nqn[NVMF_NQN_SIZE];
|
||||||
uuid_le id;
|
uuid_be id;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -794,7 +794,7 @@ struct nvmf_connect_command {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct nvmf_connect_data {
|
struct nvmf_connect_data {
|
||||||
uuid_le hostid;
|
uuid_be hostid;
|
||||||
__le16 cntlid;
|
__le16 cntlid;
|
||||||
char resv4[238];
|
char resv4[238];
|
||||||
char subsysnqn[NVMF_NQN_FIELD_LEN];
|
char subsysnqn[NVMF_NQN_FIELD_LEN];
|
||||||
|
|
Loading…
Reference in New Issue