All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] nvme-fabrics: don't check ioccsz/iorcsz for discovery
@ 2023-12-20  9:27 Max Gurtovoy
  2023-12-20 19:29 ` Sagi Grimberg
  0 siblings, 1 reply; 7+ messages in thread
From: Max Gurtovoy @ 2023-12-20  9:27 UTC (permalink / raw)
  To: dwagner, kbusch, hch, sagi, linux-nvme; +Cc: oren, Max Gurtovoy

IOCCSZ and IORCSZ are reserved for discovery controllers. Avoid checking
their values during identify controller phase.

Fixes: 2fcd3ab39826 ("nvme-fabrics: check ioccsz and iorcsz")
Reported-by: Daniel Wagner <dwagner@suse.de>
Tested-by: Daniel Wagner <dwagner@suse.de>
Signed-off-by: Max Gurtovoy <mgurtovoy@nvidia.com>
---
 drivers/nvme/host/core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index ee2e4c49892d..b218ac88fcf8 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -3068,14 +3068,14 @@ static int nvme_check_ctrl_fabric_info(struct nvme_ctrl *ctrl, struct nvme_id_ct
 		return -EINVAL;
 	}
 
-	if (ctrl->ioccsz < 4) {
+	if (!nvme_discovery_ctrl(ctrl) && ctrl->ioccsz < 4) {
 		dev_err(ctrl->device,
 			"I/O queue command capsule supported size %d < 4\n",
 			ctrl->ioccsz);
 		return -EINVAL;
 	}
 
-	if (ctrl->iorcsz < 1) {
+	if (!nvme_discovery_ctrl(ctrl) && ctrl->iorcsz < 1) {
 		dev_err(ctrl->device,
 			"I/O queue response capsule supported size %d < 1\n",
 			ctrl->iorcsz);
-- 
2.18.1



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

* Re: [PATCH 1/1] nvme-fabrics: don't check ioccsz/iorcsz for discovery
  2023-12-20  9:27 [PATCH 1/1] nvme-fabrics: don't check ioccsz/iorcsz for discovery Max Gurtovoy
@ 2023-12-20 19:29 ` Sagi Grimberg
  2023-12-20 19:40   ` Caleb Sander
  0 siblings, 1 reply; 7+ messages in thread
From: Sagi Grimberg @ 2023-12-20 19:29 UTC (permalink / raw)
  To: Max Gurtovoy, dwagner, kbusch, hch, linux-nvme; +Cc: oren


> IOCCSZ and IORCSZ are reserved for discovery controllers. Avoid checking
> their values during identify controller phase.
> 
> Fixes: 2fcd3ab39826 ("nvme-fabrics: check ioccsz and iorcsz")
> Reported-by: Daniel Wagner <dwagner@suse.de>
> Tested-by: Daniel Wagner <dwagner@suse.de>
> Signed-off-by: Max Gurtovoy <mgurtovoy@nvidia.com>
> ---
>   drivers/nvme/host/core.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index ee2e4c49892d..b218ac88fcf8 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -3068,14 +3068,14 @@ static int nvme_check_ctrl_fabric_info(struct nvme_ctrl *ctrl, struct nvme_id_ct
>   		return -EINVAL;
>   	}
>   
> -	if (ctrl->ioccsz < 4) {
> +	if (!nvme_discovery_ctrl(ctrl) && ctrl->ioccsz < 4) {
>   		dev_err(ctrl->device,
>   			"I/O queue command capsule supported size %d < 4\n",
>   			ctrl->ioccsz);
>   		return -EINVAL;
>   	}
>   
> -	if (ctrl->iorcsz < 1) {
> +	if (!nvme_discovery_ctrl(ctrl) && ctrl->iorcsz < 1) {
>   		dev_err(ctrl->device,
>   			"I/O queue response capsule supported size %d < 1\n",
>   			ctrl->iorcsz);

I still think we should at least warn (and ignore) for discovery
controllers.


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

* Re: [PATCH 1/1] nvme-fabrics: don't check ioccsz/iorcsz for discovery
  2023-12-20 19:29 ` Sagi Grimberg
@ 2023-12-20 19:40   ` Caleb Sander
  2023-12-21  9:02     ` Sagi Grimberg
  0 siblings, 1 reply; 7+ messages in thread
From: Caleb Sander @ 2023-12-20 19:40 UTC (permalink / raw)
  To: Sagi Grimberg; +Cc: Max Gurtovoy, dwagner, kbusch, hch, linux-nvme, oren

Why? As Max points out, the base NVMe spec says those fields are
reserved for discovery controllers.

On Wed, Dec 20, 2023 at 2:31 PM Sagi Grimberg <sagi@grimberg.me> wrote:
>
>
> > IOCCSZ and IORCSZ are reserved for discovery controllers. Avoid checking
> > their values during identify controller phase.
> >
> > Fixes: 2fcd3ab39826 ("nvme-fabrics: check ioccsz and iorcsz")
> > Reported-by: Daniel Wagner <dwagner@suse.de>
> > Tested-by: Daniel Wagner <dwagner@suse.de>
> > Signed-off-by: Max Gurtovoy <mgurtovoy@nvidia.com>
> > ---
> >   drivers/nvme/host/core.c | 4 ++--
> >   1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> > index ee2e4c49892d..b218ac88fcf8 100644
> > --- a/drivers/nvme/host/core.c
> > +++ b/drivers/nvme/host/core.c
> > @@ -3068,14 +3068,14 @@ static int nvme_check_ctrl_fabric_info(struct nvme_ctrl *ctrl, struct nvme_id_ct
> >               return -EINVAL;
> >       }
> >
> > -     if (ctrl->ioccsz < 4) {
> > +     if (!nvme_discovery_ctrl(ctrl) && ctrl->ioccsz < 4) {
> >               dev_err(ctrl->device,
> >                       "I/O queue command capsule supported size %d < 4\n",
> >                       ctrl->ioccsz);
> >               return -EINVAL;
> >       }
> >
> > -     if (ctrl->iorcsz < 1) {
> > +     if (!nvme_discovery_ctrl(ctrl) && ctrl->iorcsz < 1) {
> >               dev_err(ctrl->device,
> >                       "I/O queue response capsule supported size %d < 1\n",
> >                       ctrl->iorcsz);
>
> I still think we should at least warn (and ignore) for discovery
> controllers.
>


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

* Re: [PATCH 1/1] nvme-fabrics: don't check ioccsz/iorcsz for discovery
  2023-12-20 19:40   ` Caleb Sander
@ 2023-12-21  9:02     ` Sagi Grimberg
  2023-12-21 13:45       ` Caleb Sander
  0 siblings, 1 reply; 7+ messages in thread
From: Sagi Grimberg @ 2023-12-21  9:02 UTC (permalink / raw)
  To: Caleb Sander; +Cc: Max Gurtovoy, dwagner, kbusch, hch, linux-nvme, oren


> Why? As Max points out, the base NVMe spec says those fields are
> reserved for discovery controllers.

Oh, didn't understand that it was already the case, I thought
that the intention was to made it as such. Can you point us
to this part in the spec?


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

* Re: [PATCH 1/1] nvme-fabrics: don't check ioccsz/iorcsz for discovery
  2023-12-21  9:02     ` Sagi Grimberg
@ 2023-12-21 13:45       ` Caleb Sander
  2023-12-21 17:19         ` Keith Busch
  2023-12-25  9:21         ` Sagi Grimberg
  0 siblings, 2 replies; 7+ messages in thread
From: Caleb Sander @ 2023-12-21 13:45 UTC (permalink / raw)
  To: Sagi Grimberg; +Cc: Max Gurtovoy, dwagner, kbusch, hch, linux-nvme, oren

On Thu, Dec 21, 2023 at 4:02 AM Sagi Grimberg <sagi@grimberg.me> wrote:
>
>
> > Why? As Max points out, the base NVMe spec says those fields are
> > reserved for discovery controllers.
>
> Oh, didn't understand that it was already the case, I thought
> that the intention was to made it as such. Can you point us
> to this part in the spec?

https://nvmexpress.org/wp-content/uploads/NVM-Express-Base-Specification-2.0c-2022.10.04-Ratified.pdf
Figure 275: Identify – Identify Controller Data Structure, I/O Command
Set Independent
Both fields IOCCSZ and IORCSZ have "R" in the "Disc" column,
indicating that they are reserved for discovery controllers.


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

* Re: [PATCH 1/1] nvme-fabrics: don't check ioccsz/iorcsz for discovery
  2023-12-21 13:45       ` Caleb Sander
@ 2023-12-21 17:19         ` Keith Busch
  2023-12-25  9:21         ` Sagi Grimberg
  1 sibling, 0 replies; 7+ messages in thread
From: Keith Busch @ 2023-12-21 17:19 UTC (permalink / raw)
  To: Caleb Sander; +Cc: Sagi Grimberg, Max Gurtovoy, dwagner, hch, linux-nvme, oren

On Thu, Dec 21, 2023 at 08:45:05AM -0500, Caleb Sander wrote:
> On Thu, Dec 21, 2023 at 4:02 AM Sagi Grimberg <sagi@grimberg.me> wrote:
> >
> >
> > > Why? As Max points out, the base NVMe spec says those fields are
> > > reserved for discovery controllers.
> >
> > Oh, didn't understand that it was already the case, I thought
> > that the intention was to made it as such. Can you point us
> > to this part in the spec?
> 
> https://nvmexpress.org/wp-content/uploads/NVM-Express-Base-Specification-2.0c-2022.10.04-Ratified.pdf
> Figure 275: Identify – Identify Controller Data Structure, I/O Command
> Set Independent
> Both fields IOCCSZ and IORCSZ have "R" in the "Disc" column,
> indicating that they are reserved for discovery controllers.

Sounds good to me. I've applied for nvme-6.8.


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

* Re: [PATCH 1/1] nvme-fabrics: don't check ioccsz/iorcsz for discovery
  2023-12-21 13:45       ` Caleb Sander
  2023-12-21 17:19         ` Keith Busch
@ 2023-12-25  9:21         ` Sagi Grimberg
  1 sibling, 0 replies; 7+ messages in thread
From: Sagi Grimberg @ 2023-12-25  9:21 UTC (permalink / raw)
  To: Caleb Sander; +Cc: Max Gurtovoy, dwagner, kbusch, hch, linux-nvme, oren


>>> Why? As Max points out, the base NVMe spec says those fields are
>>> reserved for discovery controllers.
>>
>> Oh, didn't understand that it was already the case, I thought
>> that the intention was to made it as such. Can you point us
>> to this part in the spec?
> 
> https://nvmexpress.org/wp-content/uploads/NVM-Express-Base-Specification-2.0c-2022.10.04-Ratified.pdf
> Figure 275: Identify – Identify Controller Data Structure, I/O Command
> Set Independent
> Both fields IOCCSZ and IORCSZ have "R" in the "Disc" column,
> indicating that they are reserved for discovery controllers.

Thanks Caleb.


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

end of thread, other threads:[~2023-12-25  9:21 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-20  9:27 [PATCH 1/1] nvme-fabrics: don't check ioccsz/iorcsz for discovery Max Gurtovoy
2023-12-20 19:29 ` Sagi Grimberg
2023-12-20 19:40   ` Caleb Sander
2023-12-21  9:02     ` Sagi Grimberg
2023-12-21 13:45       ` Caleb Sander
2023-12-21 17:19         ` Keith Busch
2023-12-25  9:21         ` Sagi Grimberg

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.