public inbox for linux-nvme@lists.infradead.org
 help / color / mirror / Atom feed
From: Caleb Sander <csander@purestorage.com>
To: Keith Busch <kbusch@kernel.org>, Jens Axboe <axboe@fb.com>,
	Christoph Hellwig <hch@lst.de>, Sagi Grimberg <sagi@grimberg.me>,
	linux-nvme@lists.infradead.org
Cc: Caleb Sander <csander@purestorage.com>,
	Michael Liang <mliang@purestorage.com>
Subject: [PATCH] nvme: don't send unsupported NVME_ID_CNS_CS_CTRL
Date: Wed,  8 Jun 2022 10:03:05 -0600	[thread overview]
Message-ID: <20220608160305.1781896-1-csander@purestorage.com> (raw)

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



             reply	other threads:[~2022-06-08 16:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-08 16:03 Caleb Sander [this message]
2022-06-08 16:05 ` [PATCH] nvme: don't send unsupported NVME_ID_CNS_CS_CTRL Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220608160305.1781896-1-csander@purestorage.com \
    --to=csander@purestorage.com \
    --cc=axboe@fb.com \
    --cc=hch@lst.de \
    --cc=kbusch@kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=mliang@purestorage.com \
    --cc=sagi@grimberg.me \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox