* [PATCH] nvme-core: avoid identify with CNS 06h to discovery controller
@ 2023-03-11 17:26 Martin George
2023-03-15 13:47 ` Christoph Hellwig
0 siblings, 1 reply; 3+ messages in thread
From: Martin George @ 2023-03-11 17:26 UTC (permalink / raw)
To: linux-nvme; +Cc: Martin George
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@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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] nvme-core: avoid identify with CNS 06h to discovery controller
2023-03-11 17:26 [PATCH] nvme-core: avoid identify with CNS 06h to discovery controller Martin George
@ 2023-03-15 13:47 ` Christoph Hellwig
2023-03-16 8:34 ` Martin George
0 siblings, 1 reply; 3+ messages in thread
From: Christoph Hellwig @ 2023-03-15 13:47 UTC (permalink / raw)
To: Martin George; +Cc: linux-nvme, Martin George
On Sat, Mar 11, 2023 at 10:56:03PM +0530, Martin George wrote:
> 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.
This looks correct, but can we go a step further and also skip it
for administrative controllers, i.e
> - if (nvme_ctrl_limited_cns(ctrl))
> + if (nvme_ctrl_limited_cns(ctrl) || nvme_discovery_ctrl(ctrl))
if (ctrl->subsys->subtype != NVME_NQN_NVME ||
nvme_ctrl_limited_cns(ctrl))
?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] nvme-core: avoid identify with CNS 06h to discovery controller
2023-03-15 13:47 ` Christoph Hellwig
@ 2023-03-16 8:34 ` Martin George
0 siblings, 0 replies; 3+ messages in thread
From: Martin George @ 2023-03-16 8:34 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: linux-nvme, Martin George
On Wed, 2023-03-15 at 06:47 -0700, Christoph Hellwig wrote:
> On Sat, Mar 11, 2023 at 10:56:03PM +0530, Martin George wrote:
> > 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.
>
> This looks correct, but can we go a step further and also skip it
> for administrative controllers, i.e
>
> > - if (nvme_ctrl_limited_cns(ctrl))
> > + if (nvme_ctrl_limited_cns(ctrl) ||
> > nvme_discovery_ctrl(ctrl))
>
> if (ctrl->subsys->subtype != NVME_NQN_NVME ||
> nvme_ctrl_limited_cns(ctrl))
>
> ?
Sure. Will send a new patch for the same.
-Martin
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-03-16 8:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-11 17:26 [PATCH] nvme-core: avoid identify with CNS 06h to discovery controller Martin George
2023-03-15 13:47 ` Christoph Hellwig
2023-03-16 8:34 ` Martin George
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).