All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nvmet: Add support for HOST_ID feature.
@ 2017-08-28 12:07 Omri Mann
  2017-08-28 13:43 ` Sagi Grimberg
  2017-08-28 14:36 ` Christoph Hellwig
  0 siblings, 2 replies; 6+ messages in thread
From: Omri Mann @ 2017-08-28 12:07 UTC (permalink / raw)


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(+)

diff --git a/drivers/nvme/target/admin-cmd.c b/drivers/nvme/target/admin-cmd.c
index a53bb66..071de0b 100644
--- a/drivers/nvme/target/admin-cmd.c
+++ b/drivers/nvme/target/admin-cmd.c
@@ -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;
diff --git a/drivers/nvme/target/nvmet.h b/drivers/nvme/target/nvmet.h
index e3b244c..841f35d 100644
--- a/drivers/nvme/target/nvmet.h
+++ b/drivers/nvme/target/nvmet.h
@@ -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 {
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH] nvmet: Add support for HOST_ID feature.
  2017-08-28 12:07 [PATCH] nvmet: Add support for HOST_ID feature Omri Mann
@ 2017-08-28 13:43 ` Sagi Grimberg
  2017-08-28 18:10   ` Verkamp, Daniel
  2017-08-28 14:36 ` Christoph Hellwig
  1 sibling, 1 reply; 6+ messages in thread
From: Sagi Grimberg @ 2017-08-28 13:43 UTC (permalink / raw)


> diff --git a/drivers/nvme/target/nvmet.h b/drivers/nvme/target/nvmet.h
> index e3b244c..841f35d 100644
> --- a/drivers/nvme/target/nvmet.h
> +++ b/drivers/nvme/target/nvmet.h
> @@ -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,

Reviewed-by: Sagi Grimberg <sagi at grimberg.me>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] nvmet: Add support for HOST_ID feature.
  2017-08-28 12:07 [PATCH] nvmet: Add support for HOST_ID feature Omri Mann
  2017-08-28 13:43 ` Sagi Grimberg
@ 2017-08-28 14:36 ` Christoph Hellwig
  1 sibling, 0 replies; 6+ messages in thread
From: Christoph Hellwig @ 2017-08-28 14:36 UTC (permalink / raw)


On Mon, Aug 28, 2017@03:07:37PM +0300, Omri Mann wrote:
> Add host_id feature 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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] nvmet: Add support for HOST_ID feature.
  2017-08-28 13:43 ` Sagi Grimberg
@ 2017-08-28 18:10   ` Verkamp, Daniel
  2017-08-28 20:15     ` Sagi Grimberg
  0 siblings, 1 reply; 6+ messages in thread
From: Verkamp, Daniel @ 2017-08-28 18:10 UTC (permalink / raw)


> -----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 for HOST_ID feature.
> 
> > diff --git a/drivers/nvme/target/nvmet.h b/drivers/nvme/target/nvmet.h
> > index e3b244c..841f35d 100644
> > --- a/drivers/nvme/target/nvmet.h
> > +++ b/drivers/nvme/target/nvmet.h
> > @@ -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,
> 
> 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] nvmet: Add support for HOST_ID feature.
  2017-08-28 18:10   ` Verkamp, Daniel
@ 2017-08-28 20:15     ` Sagi Grimberg
  2017-08-29  8:32       ` Christoph Hellwig
  0 siblings, 1 reply; 6+ messages in thread
From: Sagi Grimberg @ 2017-08-28 20:15 UTC (permalink / raw)



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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] nvmet: Add support for HOST_ID feature.
  2017-08-28 20:15     ` Sagi Grimberg
@ 2017-08-29  8:32       ` Christoph Hellwig
  0 siblings, 0 replies; 6+ messages in thread
From: Christoph Hellwig @ 2017-08-29  8:32 UTC (permalink / raw)


On Mon, Aug 28, 2017@11:15:57PM +0300, Sagi Grimberg wrote:
> That's true, We should work with uuid_t for hostids. thanks Daniel.

And we already do on the host side, it's just that the target didn't
need to parse it yet.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-08-29  8:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-28 12:07 [PATCH] nvmet: Add support for HOST_ID feature Omri Mann
2017-08-28 13:43 ` Sagi Grimberg
2017-08-28 18:10   ` Verkamp, Daniel
2017-08-28 20:15     ` Sagi Grimberg
2017-08-29  8:32       ` Christoph Hellwig
2017-08-28 14:36 ` Christoph Hellwig

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.