All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nvme: don't send unsupported NVME_ID_CNS_CS_CTRL
@ 2022-06-08 16:03 Caleb Sander
  2022-06-08 16:05 ` Christoph Hellwig
  0 siblings, 1 reply; 2+ messages in thread
From: Caleb Sander @ 2022-06-08 16:03 UTC (permalink / raw)
  To: Keith Busch, Jens Axboe, Christoph Hellwig, Sagi Grimberg, linux-nvme
  Cc: Caleb Sander, Michael Liang

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@purestorage.com>
Reviewed-by: Michael Liang <mliang@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



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

* Re: [PATCH] nvme: don't send unsupported NVME_ID_CNS_CS_CTRL
  2022-06-08 16:03 [PATCH] nvme: don't send unsupported NVME_ID_CNS_CS_CTRL Caleb Sander
@ 2022-06-08 16:05 ` Christoph Hellwig
  0 siblings, 0 replies; 2+ messages in thread
From: Christoph Hellwig @ 2022-06-08 16:05 UTC (permalink / raw)
  To: Caleb Sander
  Cc: Keith Busch, Jens Axboe, Christoph Hellwig, Sagi Grimberg,
	linux-nvme, Michael Liang

On Wed, Jun 08, 2022 at 10:03:05AM -0600, Caleb Sander wrote:
> 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.

No, it does not "violate" the spec.  All NVMe TPs can be implement
for older spec versions as well, and regularly do.  So yes, your
array will return an error here and that is perfectly fine.


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

end of thread, other threads:[~2022-06-08 16:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-08 16:03 [PATCH] nvme: don't send unsupported NVME_ID_CNS_CS_CTRL Caleb Sander
2022-06-08 16:05 ` 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.