[PATCH] nvme: don't send unsupported NVME_ID_CNS_CS_CTRL

Caleb Sander csander at purestorage.com
Wed Jun 8 09:03:05 PDT 2022


Identify CNS values 0x05 to 0x0F are reserved in NVMe base spec 1.4.
0x06 was only added in spec 2.0. Our array implementing spec version 1.3
correctly responds to this Identify with "Invalid Field in Command".
The driver ignores an error status code here, but the reserved CNS value
violates the spec and causes unnecessary traffic on the NVMe connection.

Require controller version 2.0 to send this command instead of 1.1.

Signed-off-by: Caleb Sander <csander at purestorage.com>
Reviewed-by: Michael Liang <mliang at purestorage.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 24165daee..ebffc3545 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -2934,11 +2934,11 @@ static int nvme_init_non_mdts_limits(struct nvme_ctrl *ctrl)
 	    !(ctrl->quirks & NVME_QUIRK_DISABLE_WRITE_ZEROES))
 		ctrl->max_zeroes_sectors = ctrl->max_hw_sectors;
 	else
 		ctrl->max_zeroes_sectors = 0;
 
-	if (nvme_ctrl_limited_cns(ctrl))
+	if (ctrl->vs < NVME_VS(2, 0, 0))
 		return 0;
 
 	id = kzalloc(sizeof(*id), GFP_KERNEL);
 	if (!id)
 		return 0;
-- 
2.25.1




More information about the Linux-nvme mailing list