summary refs log tree commit diff
path: root/drivers
diff options
context:
space:
mode:
authorMinwoo Im <minwoo.im.dev@gmail.com>2021-01-08 23:46:57 +0900
committerChristoph Hellwig <hch@lst.de>2021-02-02 10:26:10 +0100
commitf9063a53274d25a878310db3fb645bfa9e49c917 (patch)
tree5f20c63489399b51bda5a9e7f315ac78b864506d /drivers
parent60b152a50820a125336ecae26da489059fc61ce1 (diff)
downloadlinux-f9063a53274d25a878310db3fb645bfa9e49c917.tar.gz
nvme: support command retry delay for admin command
The controller can request a delay retrying a failed command by setting
the Command Retry Delay (CRD) field in the Completion Queue Entry.

Currentlty this features is only applied to commands on the I/O queue, but
not to commands on the admin queue.  Retreive the nvme_ctrl from the
request so that no namespace is required and apply the feature to all
commands.

Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/nvme/host/core.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index ff0f42652abb..636a88c93194 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -279,14 +279,13 @@ static blk_status_t nvme_error_status(u16 status)
 
 static void nvme_retry_req(struct request *req)
 {
-	struct nvme_ns *ns = req->q->queuedata;
 	unsigned long delay = 0;
 	u16 crd;
 
 	/* The mask and shift result must be <= 3 */
 	crd = (nvme_req(req)->status & NVME_SC_CRD) >> 11;
-	if (ns && crd)
-		delay = ns->ctrl->crdt[crd - 1] * 100;
+	if (crd)
+		delay = nvme_req(req)->ctrl->crdt[crd - 1] * 100;
 
 	nvme_req(req)->retries++;
 	blk_mq_requeue_request(req, false);