* [PATCH] nvmet: use U32_MAX value to report NN
@ 2021-06-14 19:47 Chaitanya Kulkarni
2021-06-14 21:18 ` Keith Busch
0 siblings, 1 reply; 3+ messages in thread
From: Chaitanya Kulkarni @ 2021-06-14 19:47 UTC (permalink / raw)
To: linux-nvme; +Cc: hch, sagi, Chaitanya Kulkarni
For Spec regarding MNAN value:-
If the controller supports Asymmetric Namespace Access Reporting, then
this field shall be set to a non-zero value that is less than or equal
to the NN value.
Instead of using subsys->max_nsid that gets calculated dynamically,
use U32_MAX value to report NN. This way we will maintain the MNAN value
spec compliant.
Without this patch, code results in the following error :-
[337976.409142] nvme nvme1: Invalid MNAN value 1024
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
drivers/nvme/target/admin-cmd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/nvme/target/admin-cmd.c b/drivers/nvme/target/admin-cmd.c
index cd60a8184d04..c8c4a7ba4958 100644
--- a/drivers/nvme/target/admin-cmd.c
+++ b/drivers/nvme/target/admin-cmd.c
@@ -393,7 +393,7 @@ static void nvmet_execute_identify_ctrl(struct nvmet_req *req)
/* no enforcement soft-limit for maxcmd - pick arbitrary high value */
id->maxcmd = cpu_to_le16(NVMET_MAX_CMD);
- id->nn = cpu_to_le32(ctrl->subsys->max_nsid);
+ id->nn = cpu_to_le32(U32_MAX);
id->mnan = cpu_to_le32(NVMET_MAX_NAMESPACES);
id->oncs = cpu_to_le16(NVME_CTRL_ONCS_DSM |
NVME_CTRL_ONCS_WRITE_ZEROES);
--
2.22.1
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] nvmet: use U32_MAX value to report NN
2021-06-14 19:47 [PATCH] nvmet: use U32_MAX value to report NN Chaitanya Kulkarni
@ 2021-06-14 21:18 ` Keith Busch
2021-06-14 21:23 ` Chaitanya Kulkarni
0 siblings, 1 reply; 3+ messages in thread
From: Keith Busch @ 2021-06-14 21:18 UTC (permalink / raw)
To: Chaitanya Kulkarni; +Cc: linux-nvme, hch, sagi
On Mon, Jun 14, 2021 at 12:47:12PM -0700, Chaitanya Kulkarni wrote:
> @@ -393,7 +393,7 @@ static void nvmet_execute_identify_ctrl(struct nvmet_req *req)
> /* no enforcement soft-limit for maxcmd - pick arbitrary high value */
> id->maxcmd = cpu_to_le16(NVMET_MAX_CMD);
>
> - id->nn = cpu_to_le32(ctrl->subsys->max_nsid);
> + id->nn = cpu_to_le32(U32_MAX);
The NN field has to have the highest valid NSID, and FFFFFFFFh is not
valid. That's reserved for the broadcast.
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] nvmet: use U32_MAX value to report NN
2021-06-14 21:18 ` Keith Busch
@ 2021-06-14 21:23 ` Chaitanya Kulkarni
0 siblings, 0 replies; 3+ messages in thread
From: Chaitanya Kulkarni @ 2021-06-14 21:23 UTC (permalink / raw)
To: Keith Busch; +Cc: linux-nvme, hch, sagi
On 6/14/21 14:19, Keith Busch wrote:
> On Mon, Jun 14, 2021 at 12:47:12PM -0700, Chaitanya Kulkarni wrote:
>> @@ -393,7 +393,7 @@ static void nvmet_execute_identify_ctrl(struct nvmet_req *req)
>> /* no enforcement soft-limit for maxcmd - pick arbitrary high value */
>> id->maxcmd = cpu_to_le16(NVMET_MAX_CMD);
>>
>> - id->nn = cpu_to_le32(ctrl->subsys->max_nsid);
>> + id->nn = cpu_to_le32(U32_MAX);
> The NN field has to have the highest valid NSID, and FFFFFFFFh is not
> valid. That's reserved for the broadcast.
>
In that case we have to keep the dynamic id setting for the MNAN and
may have to keep the original proposed fix :-
drivers/nvme/target/admin-cmd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/nvme/target/admin-cmd.c
b/drivers/nvme/target/admin-cmd.c
index cd60a8184d04..a8ec377bb68d 100644
--- a/drivers/nvme/target/admin-cmd.c
+++ b/drivers/nvme/target/admin-cmd.c
@@ -394,7 +394,7 @@ static void nvmet_execute_identify_ctrl(struct
nvmet_req *req)
id->maxcmd = cpu_to_le16(NVMET_MAX_CMD);
id->nn = cpu_to_le32(ctrl->subsys->max_nsid);
- id->mnan = cpu_to_le32(NVMET_MAX_NAMESPACES);
+ id->mnan = cpu_to_le32(ctrl->subsys->max_nsid);
id->oncs = cpu_to_le16(NVME_CTRL_ONCS_DSM |
NVME_CTRL_ONCS_WRITE_ZEROES);
--
2.22.1
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-06-14 21:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-14 19:47 [PATCH] nvmet: use U32_MAX value to report NN Chaitanya Kulkarni
2021-06-14 21:18 ` Keith Busch
2021-06-14 21:23 ` Chaitanya Kulkarni
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.