Skip to contentSkip to conversation

nvme-fabrics: don't check ioccsz/iorcsz for discovery

PATCH In review Max Gurtovoy 4 participants 7 messages Dec 20, 2023 – Dec 25, 2023 NVMe

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nvme-fabrics: don't check ioccsz/iorcsz for discovery

IOCCSZ and IORCSZ are reserved for discovery controllers. Avoid checking their values during identify controller phase.

Fixes 2fcd3ab39826 ("nvme-fabrics: check ioccsz and iorcsz")
---
 drivers/nvme/host/core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/nvme/host/core.c +2 -2
index ee2e4c49892d..b218ac88fcf8 100644
@@ -3068,14 +3068,14 @@ static int nvme_check_ctrl_fabric_info(struct nvme_ctrl *ctrl, struct nvme_id_ct
 		return -EINVAL;
 	}
 
-	if (ctrl->ioccsz < 4) {
+	if (!nvme_discovery_ctrl(ctrl) && ctrl->ioccsz < 4) {
 		dev_err(ctrl->device,
 			"I/O queue command capsule supported size %d < 4\n",
 			ctrl->ioccsz);
 		return -EINVAL;
 	}
 
-	if (ctrl->iorcsz < 1) {
+	if (!nvme_discovery_ctrl(ctrl) && ctrl->iorcsz < 1) {
 		dev_err(ctrl->device,
 			"I/O queue response capsule supported size %d < 1\n",
 			ctrl->iorcsz);
Signature · 1 line
2.18.1
maintainer
#1 lore raw
Quoted 23 lines

IOCCSZ and IORCSZ are reserved for discovery controllers. Avoid checking their values during identify controller phase.

Fixes 2fcd3ab39826 ("nvme-fabrics: check ioccsz and iorcsz")
---
  drivers/nvme/host/core.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/nvme/host/core.c +1 -1
index ee2e4c49892d..b218ac88fcf8 100644
@@ -3068,14 +3068,14 @@ static int nvme_check_ctrl_fabric_info(struct nvme_ctrl *ctrl, struct nvme_id_ct
  		return -EINVAL;
  	}
 
-	if (ctrl->ioccsz < 4) {
+	if (!nvme_discovery_ctrl(ctrl) && ctrl->ioccsz < 4) {
  		dev_err(ctrl->device,

drivers/nvme/host/core.c static int nvme_check_ctrl_fabric_info(struct nvme_ctrl *ctrl, struct nvme_id_ct · line 3081

Quoted 10 lines
drivers/nvme/host/core.c +1 -1
  			"I/O queue command capsule supported size %d < 4\n",
  			ctrl->ioccsz);
  		return -EINVAL;
  	}
 
-	if (ctrl->iorcsz < 1) {
+	if (!nvme_discovery_ctrl(ctrl) && ctrl->iorcsz < 1) {
  		dev_err(ctrl->device,
  			"I/O queue response capsule supported size %d < 1\n",
  			ctrl->iorcsz);

I still think we should at least warn (and ignore) for discovery controllers.

#2 lore raw

Why? As Max points out, the base NVMe spec says those fields are reserved for discovery controllers.

Quoted 38 lines · Sagi Grimberg
Quoted 24 lines

IOCCSZ and IORCSZ are reserved for discovery controllers. Avoid checking their values during identify controller phase.

Fixes 2fcd3ab39826 ("nvme-fabrics: check ioccsz and iorcsz")
---
  drivers/nvme/host/core.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/nvme/host/core.c +1 -1
index ee2e4c49892d..b218ac88fcf8 100644
@@ -3068,14 +3068,14 @@ static int nvme_check_ctrl_fabric_info(struct nvme_ctrl *ctrl, struct nvme_id_ct
              return -EINVAL;
      }
 
-     if (ctrl->ioccsz < 4) {
+     if (!nvme_discovery_ctrl(ctrl) && ctrl->ioccsz < 4) {
              dev_err(ctrl->device,

drivers/nvme/host/core.c static int nvme_check_ctrl_fabric_info(struct nvme_ctrl *ctrl, struct nvme_id_ct · line 3081

Quoted 10 lines
drivers/nvme/host/core.c +1 -1
                      "I/O queue command capsule supported size %d < 4\n",
                      ctrl->ioccsz);
              return -EINVAL;
      }
 
-     if (ctrl->iorcsz < 1) {
+     if (!nvme_discovery_ctrl(ctrl) && ctrl->iorcsz < 1) {
              dev_err(ctrl->device,
                      "I/O queue response capsule supported size %d < 1\n",
                      ctrl->iorcsz);

I still think we should at least warn (and ignore) for discovery controllers.

maintainer
#3 lore raw
Quoted 3 lines

Why? As Max points out, the base NVMe spec says those fields are reserved for discovery controllers.

Oh, didn't understand that it was already the case, I thought that the intention was to made it as such. Can you point us to this part in the spec?

#4 lore raw
Quoted 8 lines · Sagi Grimberg
Quoted 4 lines

Why? As Max points out, the base NVMe spec says those fields are reserved for discovery controllers.

Oh, didn't understand that it was already the case, I thought that the intention was to made it as such. Can you point us to this part in the spec?

https://nvmexpress.org/wp-content/uploads/NVM-Express-Base-Specification-2.0c-2022.10.04-Ratified.pdf
Figure 275: Identify – Identify Controller Data Structure, I/O Command Set Independent
Both fields IOCCSZ and IORCSZ have "R" in the "Disc" column, indicating that they are reserved for discovery controllers.

maintainer
#5 lore raw
Quoted 10 lines · Caleb Sander
Quoted 8 lines · Sagi Grimberg
Quoted 4 lines

Why? As Max points out, the base NVMe spec says those fields are reserved for discovery controllers.

Oh, didn't understand that it was already the case, I thought that the intention was to made it as such. Can you point us to this part in the spec?

Quoted 5 lines

https://nvmexpress.org/wp-content/uploads/NVM-Express-Base-Specification-2.0c-2022.10.04-Ratified.pdf
Figure 275: Identify – Identify Controller Data Structure, I/O Command Set Independent
Both fields IOCCSZ and IORCSZ have "R" in the "Disc" column, indicating that they are reserved for discovery controllers.

Sounds good to me. I've applied for nvme-6.8.

maintainer
#6 lore raw
In reply to Caleb Sander
Quoted 8 lines
Quoted 7 lines
Quoted 3 lines

Why? As Max points out, the base NVMe spec says those fields are reserved for discovery controllers.

Oh, didn't understand that it was already the case, I thought that the intention was to made it as such. Can you point us to this part in the spec?

Quoted 5 lines

https://nvmexpress.org/wp-content/uploads/NVM-Express-Base-Specification-2.0c-2022.10.04-Ratified.pdf
Figure 275: Identify – Identify Controller Data Structure, I/O Command Set Independent
Both fields IOCCSZ and IORCSZ have "R" in the "Disc" column, indicating that they are reserved for discovery controllers.

Thanks Caleb.