Skip to content

Commit

Permalink
nvme: support command retry delay for admin command
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Christoph Hellwig <[email protected]>
  • Loading branch information
minwooim authored and Christoph Hellwig committed Feb 2, 2021
1 parent 60b152a commit f9063a5
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions drivers/nvme/host/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit f9063a5

Please sign in to comment.