nvmet: Add support for HOST_ID feature.
Subsystems (2)
PATCH 1/1 nvmet: Add support for HOST_ID feature.
Add host_id feature to NVMeoF targets. This will be required in order to support reservations.
Signed-off-by: Omri Mann <omri at excelero.com>
--- drivers/nvme/target/admin-cmd.c | 7 +++++++ drivers/nvme/target/nvmet.h | 1 + 2 files changed, 8 insertions(+)
drivers/nvme/target/admin-cmd.c +7 -0
@@ -461,6 +461,10 @@ static void nvmet_execute_set_features(struct nvmet_req *req) req->sq->ctrl->kato =DIV_ROUND_UP (val32,1000 );nvmet_set_result (req, req->sq->ctrl->kato);break ; +case NVME_FEAT_HOST_ID : + status =nvmet_copy_from_sgl (req,0 , &req->sq->ctrl->host_id, +8 ); +break ;default : status =NVME_SC_INVALID_FIELD |NVME_SC_DNR ;break ;
@@ -509,6 +513,9 @@ static void nvmet_execute_get_features(struct nvmet_req *req)case NVME_FEAT_KATO :nvmet_set_result (req, req->sq->ctrl->kato *1000 );break ; +case NVME_FEAT_HOST_ID : + status =nvmet_copy_to_sgl (req,0 , &req->sq->ctrl->host_id,8 ); +break ;default : status =NVME_SC_INVALID_FIELD |NVME_SC_DNR ;break ;
drivers/nvme/target/nvmet.h +1 -0
@@ -132,6 +132,7 @@ struct nvmet_ctrl {char subsysnqn[NVMF_NQN_FIELD_LEN ];char hostnqn[NVMF_NQN_FIELD_LEN ]; +u64 host_id; };struct nvmet_subsys {
Signature · 1 line
1.8.3.1
Sagi Grimberg
maintainerPATCH 1/1 nvmet: Add support for HOST_ID feature.
drivers/nvme/target/nvmet.h struct nvmet_ctrl { · line 135
Quoted 9 lines
drivers/nvme/target/nvmet.h +1
-0@@ -132,6 +132,7 @@ struct nvmet_ctrl {char subsysnqn[NVMF_NQN_FIELD_LEN ];char hostnqn[NVMF_NQN_FIELD_LEN ]; +u64 host_id;
I'd move it to the first cacheline given it will be accessed in the hot path.
Other than that, looks fine,
PATCH 1/1 nvmet: Add support for HOST_ID feature.
Quoted 21 lines
-----Original Message-----
From: Linux-nvme [mailto:linux-nvme-bounces at lists.infradead.org] On Behalf Of Sagi Grimberg
Sent: Monday, August 28, 2017 6:44 AM
To: Omri Mann <omri at excelero.com>; linux-nvme at lists.infradead.org
Cc: Mike Christie <mchristi at redhat.com>
Subject: Re: [PATCH] nvmet: Add support forHOST_IDfeature.drivers/nvme/target/nvmet.h struct nvmet_ctrl { · line 135
Quoted 9 lines
drivers/nvme/target/nvmet.h +1
-0@@ -132,6 +132,7 @@ struct nvmet_ctrl {char subsysnqn[NVMF_NQN_FIELD_LEN ];char hostnqn[NVMF_NQN_FIELD_LEN ]; +u64 host_id;I'd move it to the first cacheline given it will be accessed in the hot path.
Quoted 3 lines
Other than that, looks fine,
Reviewed-by Sagi Grimberg <sagi at grimberg.me>
The specification says that NVMe-oF must use a 128-bit host ID - from NVMe 1.3, 5.21.1.19.2:
"The Host Identifier is a mandatory feature in NVMe over Fabrics. The Host Identifier shall be an extended 128-bit Host Identifier."
The target should also check the EXHID bit in the Get Features - Host Identifier command.
Thanks,
-- Daniel Verkamp
Sagi Grimberg
maintainerPATCH 1/1 nvmet: Add support for HOST_ID feature.
Quoted 6 lines
The specification says that NVMe-oF must use a 128-bit host ID - from NVMe 1.3, 5.21.1.19.2:
"The Host Identifier is a mandatory feature in NVMe over Fabrics. The Host Identifier shall be an extended 128-bit Host Identifier."
The target should also check the EXHID bit in the Get Features - Host Identifier command.
That's true, We should work with uuid_t for hostids. thanks Daniel.
PATCH 1/1 nvmet: Add support for HOST_ID feature.
Quoted 1 line · Sagi Grimberg
That's true, We should work with
uuid_tfor hostids. thanks Daniel.
And we already do on the host side, it's just that the target didn't need to parse it yet.
PATCH 1/1 nvmet: Add support for HOST_ID feature.
In reply to Omri MannQuoted 2 lines · Omri Mann
Add
host_idfeature to NVMeoF targets. This will be required in order to support reservations.
For Fabrics the host id is set in the connect command and Set Features must return an error (see section 5.21.1.19.2 in NVMe 1.3). But the Get Features is still useful.