* [PATCH] nvmet: fix per feat data len for get_feature
@ 2019-12-10 7:22 Chaitanya Kulkarni
2019-12-11 5:09 ` Chaitanya Kulkarni
2019-12-12 9:07 ` Christoph Hellwig
0 siblings, 2 replies; 6+ messages in thread
From: Chaitanya Kulkarni @ 2019-12-10 7:22 UTC (permalink / raw)
To: linux-nvme; +Cc: hch, Chaitanya Kulkarni, Amit Engel
From: Amit Engel <amit.engel@dell.com>
From: Amit Engel <amit.engel@dell.com>
The existing implementation for the get_feature admin-cmd does not
use per-feature data len. This patch introduces a new helper function
nvmet_feat_data_len(), which is used to calculate per feature data len.
Right now we only set data len for fid 0x81 (NVME_FEAT_HOST_ID).
Fixes: commit e9061c397839 ("nvmet: Remove the data_len field from the nvmet_req struct")
Signed-off-by: Amit Engel <amit.engel@dell.com>
[chaitanya.kulkarni@wdc.com:
1. Don't re-calculate cdw10 nvmet_get_feature(), that also fixes the
endianness.
3. Rename nvmet_feature_data_len() -> nvmet_feat_data_len().
4. Get rid of the extra variable feature in nvmet_feat_data_len().
5. Mark nvmet_feat_data_len() staic since we are the only user.
6. Kernel patch style fixes.
]
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
Hi,
This patch is originally posted by Amit. I've fixed some of the issues
I found during the review, listed in the commit log.
Regards,
Chaitanya
---
drivers/nvme/target/admin-cmd.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/drivers/nvme/target/admin-cmd.c b/drivers/nvme/target/admin-cmd.c
index 56c21b501185..72a7e41f3018 100644
--- a/drivers/nvme/target/admin-cmd.c
+++ b/drivers/nvme/target/admin-cmd.c
@@ -24,6 +24,16 @@ u32 nvmet_get_log_page_len(struct nvme_command *cmd)
return len;
}
+static u32 nvmet_feat_data_len(struct nvmet_req *req, u32 cdw10)
+{
+ switch (cdw10 & 0xff) {
+ case NVME_FEAT_HOST_ID:
+ return sizeof(req->sq->ctrl->hostid);
+ default:
+ return 0;
+ }
+}
+
u64 nvmet_get_log_page_offset(struct nvme_command *cmd)
{
return le64_to_cpu(cmd->get_log_page.lpo);
@@ -778,7 +788,7 @@ static void nvmet_execute_get_features(struct nvmet_req *req)
u32 cdw10 = le32_to_cpu(req->cmd->common.cdw10);
u16 status = 0;
- if (!nvmet_check_data_len(req, 0))
+ if (!nvmet_check_data_len(req, nvmet_feat_data_len(req, cdw10)))
return;
switch (cdw10 & 0xff) {
--
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] 6+ messages in thread
* Re: [PATCH] nvmet: fix per feat data len for get_feature
2019-12-10 7:22 [PATCH] nvmet: fix per feat data len for get_feature Chaitanya Kulkarni
@ 2019-12-11 5:09 ` Chaitanya Kulkarni
2019-12-12 9:07 ` Christoph Hellwig
1 sibling, 0 replies; 6+ messages in thread
From: Chaitanya Kulkarni @ 2019-12-11 5:09 UTC (permalink / raw)
To: linux-nvme; +Cc: hch, Amit.Engel
On 12/09/2019 11:22 PM, Chaitanya Kulkarni wrote:
> From: Amit Engel <amit.engel@dell.com>
>
> From: Amit Engel <amit.engel@dell.com>
>
Seems like original author is added twice in this patch.
Should I send a separate patch to remove that ?
> The existing implementation for the get_feature admin-cmd does not
> use per-feature data len. This patch introduces a new helper function
> nvmet_feat_data_len(), which is used to calculate per feature data len.
> Right now we only set data len for fid 0x81 (NVME_FEAT_HOST_ID).
>
> Fixes: commit e9061c397839 ("nvmet: Remove the data_len field from the nvmet_req struct")
>
> Signed-off-by: Amit Engel <amit.engel@dell.com>
> [chaitanya.kulkarni@wdc.com:
> 1. Don't re-calculate cdw10 nvmet_get_feature(), that also fixes the
> endianness.
> 3. Rename nvmet_feature_data_len() -> nvmet_feat_data_len().
> 4. Get rid of the extra variable feature in nvmet_feat_data_len().
> 5. Mark nvmet_feat_data_len() staic since we are the only user.
> 6. Kernel patch style fixes.
> ]
> Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] nvmet: fix per feat data len for get_feature
2019-12-10 7:22 [PATCH] nvmet: fix per feat data len for get_feature Chaitanya Kulkarni
2019-12-11 5:09 ` Chaitanya Kulkarni
@ 2019-12-12 9:07 ` Christoph Hellwig
2019-12-12 9:14 ` Engel, Amit
1 sibling, 1 reply; 6+ messages in thread
From: Christoph Hellwig @ 2019-12-12 9:07 UTC (permalink / raw)
To: Chaitanya Kulkarni; +Cc: hch, linux-nvme, Amit.Engel
Looks good except for the double author line:
Reviewed-by: Christoph Hellwig <hch@lst.de>
_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [PATCH] nvmet: fix per feat data len for get_feature
2019-12-12 9:07 ` Christoph Hellwig
@ 2019-12-12 9:14 ` Engel, Amit
2019-12-12 9:39 ` Christoph Hellwig
0 siblings, 1 reply; 6+ messages in thread
From: Engel, Amit @ 2019-12-12 9:14 UTC (permalink / raw)
To: Christoph Hellwig, Chaitanya Kulkarni; +Cc: linux-nvme
Chaitanya, do you fix the double author line? Do you want me to do it?
Amit
-----Original Message-----
From: Christoph Hellwig <hch@lst.de>
Sent: Thursday, December 12, 2019 11:07 AM
To: Chaitanya Kulkarni
Cc: linux-nvme@lists.infradead.org; hch@lst.de; Engel, Amit
Subject: Re: [PATCH] nvmet: fix per feat data len for get_feature
[EXTERNAL EMAIL]
Looks good except for the double author line:
Reviewed-by: Christoph Hellwig <hch@lst.de>
_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] nvmet: fix per feat data len for get_feature
2019-12-12 9:14 ` Engel, Amit
@ 2019-12-12 9:39 ` Christoph Hellwig
2019-12-12 9:40 ` Engel, Amit
0 siblings, 1 reply; 6+ messages in thread
From: Christoph Hellwig @ 2019-12-12 9:39 UTC (permalink / raw)
To: Engel, Amit; +Cc: linux-nvme, Christoph Hellwig, Chaitanya Kulkarni
On Thu, Dec 12, 2019 at 09:14:15AM +0000, Engel, Amit wrote:
> Chaitanya, do you fix the double author line? Do you want me to do it?
We usually handle such minor nitpicks when applying the patch, no need
to resend.
_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [PATCH] nvmet: fix per feat data len for get_feature
2019-12-12 9:39 ` Christoph Hellwig
@ 2019-12-12 9:40 ` Engel, Amit
0 siblings, 0 replies; 6+ messages in thread
From: Engel, Amit @ 2019-12-12 9:40 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: linux-nvme, Chaitanya Kulkarni
Sure, thank you
-----Original Message-----
From: Christoph Hellwig <hch@lst.de>
Sent: Thursday, December 12, 2019 11:39 AM
To: Engel, Amit
Cc: Christoph Hellwig; Chaitanya Kulkarni; linux-nvme@lists.infradead.org
Subject: Re: [PATCH] nvmet: fix per feat data len for get_feature
[EXTERNAL EMAIL]
On Thu, Dec 12, 2019 at 09:14:15AM +0000, Engel, Amit wrote:
> Chaitanya, do you fix the double author line? Do you want me to do it?
We usually handle such minor nitpicks when applying the patch, no need to resend.
_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-12-12 9:40 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-10 7:22 [PATCH] nvmet: fix per feat data len for get_feature Chaitanya Kulkarni
2019-12-11 5:09 ` Chaitanya Kulkarni
2019-12-12 9:07 ` Christoph Hellwig
2019-12-12 9:14 ` Engel, Amit
2019-12-12 9:39 ` Christoph Hellwig
2019-12-12 9:40 ` Engel, Amit
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).