[PATCH] nvme-core: avoid identify with CNS 06h to discovery controller

Martin George martinus.gpy at gmail.com
Sat Mar 11 09:26:03 PST 2023


nvme_init_non_mdts_limits() currenty invokes an identify command with
CNS 06h to both discovery and i/o controllers. But as per the NVMe-oF
specification, this is not supported on discovery controllers:

"The Discovery controller shall support the Identify command with a
CNS value of 01h (Identify Controller data structure); all other CNS
values are reserved."

So ensure this identify command with CNS 06h is sent to i/o controllers
alone and not to discovery controllers.

Signed-off-by: Martin George <marting at netapp.com>
---
 drivers/nvme/host/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index d4be525f8100..62d1048c6506 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -3063,7 +3063,7 @@ static int nvme_init_non_mdts_limits(struct nvme_ctrl *ctrl)
 	else
 		ctrl->max_zeroes_sectors = 0;
 
-	if (nvme_ctrl_limited_cns(ctrl))
+	if (nvme_ctrl_limited_cns(ctrl) || nvme_discovery_ctrl(ctrl))
 		return 0;
 
 	id = kzalloc(sizeof(*id), GFP_KERNEL);
-- 
2.34.1




More information about the Linux-nvme mailing list