linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nvmet: fix KATO offset in Set Features
@ 2016-12-07 18:39 Daniel Verkamp
  2016-12-07 19:09 ` Daniel Verkamp
  2016-12-09 19:59 ` [PATCH v2] nvmet: fix KATO offset in Set Features Daniel Verkamp
  0 siblings, 2 replies; 12+ messages in thread
From: Daniel Verkamp @ 2016-12-07 18:39 UTC (permalink / raw)


The Set Features implementation for Keep Alive Timer was using the wrong
structure when retrieving the KATO value; it was treating the Set
Features command as a Property Set command.

The NVMe spec defines the Keep Alive Timer feature as having one input
in CDW11 (4 bytes at offset 44 in the command) whereas the code was
reading 8 bytes at offset 48.

Since the Linux NVMe over Fabrics host never sets this feature, this
code has presumably never been tested.

Signed-off-by: Daniel Verkamp <daniel.verkamp at intel.com>
---
 drivers/nvme/target/admin-cmd.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/nvme/target/admin-cmd.c b/drivers/nvme/target/admin-cmd.c
index 6fe4c48..bdae9ef 100644
--- a/drivers/nvme/target/admin-cmd.c
+++ b/drivers/nvme/target/admin-cmd.c
@@ -391,8 +391,7 @@ static void nvmet_execute_set_features(struct nvmet_req *req)
 			(subsys->max_qid - 1) | ((subsys->max_qid - 1) << 16));
 		break;
 	case NVME_FEAT_KATO:
-		val = le64_to_cpu(req->cmd->prop_set.value);
-		val32 = val & 0xffff;
+		val32 = le32_to_cpu(req->cmd->common.cdw10[1]);
 		req->sq->ctrl->kato = DIV_ROUND_UP(val32, 1000);
 		nvmet_set_result(req, req->sq->ctrl->kato);
 		break;
-- 
2.9.3

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

end of thread, other threads:[~2016-12-22 12:52 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-07 18:39 [PATCH] nvmet: fix KATO offset in Set Features Daniel Verkamp
2016-12-07 19:09 ` Daniel Verkamp
2016-12-09 18:28   ` Christoph Hellwig
2016-12-09 20:04     ` Daniel Verkamp
2016-12-21 10:27       ` Christoph Hellwig
     [not found]         ` <830460a5-ce31-b882-8f06-4a906763eb50@broadcom.com>
2016-12-22  6:41           ` Q: nvme_rdma and reconnect Christoph Hellwig
2016-12-22 12:08             ` Sagi Grimberg
2016-12-22 12:10               ` Christoph Hellwig
2016-12-22 12:52                 ` Sagi Grimberg
2016-12-22 12:46               ` Hannes Reinecke
2016-12-22 12:50                 ` Christoph Hellwig
2016-12-09 19:59 ` [PATCH v2] nvmet: fix KATO offset in Set Features Daniel Verkamp

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).