Skip to contentSkip to conversation

nvme-tcp: check sgl supported by target

PATCH Applied Max Gurtovoy 4 participants 9 messages Mar 30, 2021 – Apr 2, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 nvme-tcp: check sgl supported by target

SGLs support is mandatory for NVMe/tcp, make sure that the target is aligned to the specification.

---
 drivers/nvme/host/tcp.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/nvme/host/tcp.c +5 -0
index a0f00cb8f9f3..e5fbb921165e 100644
@@ -1973,6 +1973,11 @@ static int nvme_tcp_setup_ctrl(struct nvme_ctrl *ctrl, bool new)
 		goto destroy_admin;
 	}
 
+	if (!(ctrl->sgls & ((1 << 0) | (1 << 1)))) {
+		dev_err(ctrl->device, "Mandatory sgls are not supported!\n");
+		goto destroy_admin;
+	}
+
 	if (opts->queue_size > ctrl->sqsize + 1)
 		dev_warn(ctrl->device,
 			"queue_size %zu > ctrl sqsize %u, clamping down\n",
Signature · 7 lines
2.25.4


_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
#1 lore raw

PATCH 2/2 nvme-fc: check sgl supported by target

SGLs support is mandatory for NVMe/tcp, make sure that the target is aligned to the specification.

---
 drivers/nvme/host/fc.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/nvme/host/fc.c +5 -0
index 6ffa8de2a0d7..03032d9b0573 100644
@@ -3100,6 +3100,11 @@ nvme_fc_create_association(struct nvme_fc_ctrl *ctrl)
 	}
 
 	/* FC-NVME supports normal SGL Data Block Descriptors */
+	if (!(ctrl->ctrl.sgls & ((1 << 0) | (1 << 1)))) {
+		dev_err(ctrl->ctrl.device,
+			"Mandatory sgls are not supported!\n");
+		goto out_disconnect_admin_queue;
+	}
 
 	if (opts->queue_size > ctrl->ctrl.maxcmd) {
 		/* warn if maxcmd is lower than queue_size */
Signature · 7 lines
2.25.4


_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
Reviewed-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] nvme-fc: check sgl supported by target

Quoted 4 lines · Max Gurtovoy

SGLs support is mandatory for NVMe/tcp, make sure that the target is aligned to the specification.

s/"NVMe/tcp"/"NVMe-FC"/ ? if so that can be done by at the time of applying the patch, if not just ignore this comment.

Looks good.

_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme

#3 lore raw

Re: [PATCH 2/2] nvme-fc: check sgl supported by target

Quoted 7 lines · Chaitanya Kulkarni
Quoted 4 lines · Max Gurtovoy

SGLs support is mandatory for NVMe/tcp, make sure that the target is aligned to the specification.

s/"NVMe/tcp"/"NVMe-FC"/ ? if so that can be done by at the time of applying the patch, if not just ignore this comment.

Good catch. Yes, this should be updated.

Thanks.

Quoted 6 lines

Looks good.

_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme

maintainer
#5 lore raw
In reply to Max Gurtovoy
Quoted 2 lines · Max Gurtovoy

SGLs support is mandatory for NVMe/tcp, make sure that the target is aligned to the specification.

Logging an error seems fine. Are there existing controllers that do this? If so, what currently happens? If they just have a broken Identify Controller structure but still work with this driver, should we proceed with trying to use it anyway with the existing assumption?

Quoted 12 lines
---
 drivers/nvme/host/tcp.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/nvme/host/tcp.c +0 -0
index a0f00cb8f9f3..e5fbb921165e 100644
@@ -1973,6 +1973,11 @@ static int nvme_tcp_setup_ctrl(struct nvme_ctrl *ctrl, bool new)
 		goto destroy_admin;

drivers/nvme/host/tcp.c static int nvme_tcp_setup_ctrl(struct nvme_ctrl *ctrl, bool new) · line 1983

Quoted 10 lines
drivers/nvme/host/tcp.c +5 -0
 	}
 
+	if (!(ctrl->sgls & ((1 << 0) | (1 << 1)))) {
+		dev_err(ctrl->device, "Mandatory sgls are not supported!\n");
+		goto destroy_admin;
+	}
+
 	if (opts->queue_size > ctrl->sqsize + 1)
 		dev_warn(ctrl->device,
 			"queue_size %zu > ctrl sqsize %u, clamping down\n",

_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme

#6 lore raw
Quoted 8 lines · Keith Busch
Quoted 2 lines · Max Gurtovoy

SGLs support is mandatory for NVMe/tcp, make sure that the target is aligned to the specification.

Logging an error seems fine. Are there existing controllers that do this? If so, what currently happens? If they just have a broken Identify Controller structure but still work with this driver, should we proceed with trying to use it anyway with the existing assumption?

At least I've not seen any, in case they do exists should we consider adding a quirk if at all any of those controller's start showing up ?

_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme

#7 lore raw
Quoted 4 lines · Chaitanya Kulkarni
Quoted 3 lines · Keith Busch
Quoted 2 lines · Max Gurtovoy

SGLs support is mandatory for NVMe/tcp, make sure that the target is aligned to the specification.

Quoted 8 lines
Quoted 5 lines

Logging an error seems fine. Are there existing controllers that do this? If so, what currently happens? If they just have a broken Identify Controller structure but still work with this driver, should we proceed with trying to use it anyway with the existing assumption?

At least I've not seen any, in case they do exists should we consider adding a quirk if at all any of those controller's start showing up ?

I also haven't seen controllers with broken ID-CTRL, and adding a quirk in the future is better than ignoring the error and hope for good behavior from the controller.

_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme