return true;
 }
 
+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;
+
+       nvme_req(req)->retries++;
+       blk_mq_requeue_request(req, false);
+       blk_mq_delay_kick_requeue_list(req->q, delay);
+}
+
 void nvme_complete_rq(struct request *req)
 {
        blk_status_t status = nvme_error_status(req);
                }
 
                if (!blk_queue_dying(req->q)) {
-                       nvme_req(req)->retries++;
-                       blk_mq_requeue_request(req, true);
+                       nvme_retry_req(req);
                        return;
                }
        }
        return ret;
 }
 
+static int nvme_configure_acre(struct nvme_ctrl *ctrl)
+{
+       struct nvme_feat_host_behavior *host;
+       int ret;
+
+       /* Don't bother enabling the feature if retry delay is not reported */
+       if (!ctrl->crdt[0])
+               return 0;
+
+       host = kzalloc(sizeof(*host), GFP_KERNEL);
+       if (!host)
+               return 0;
+
+       host->acre = NVME_ENABLE_ACRE;
+       ret = nvme_set_features(ctrl, NVME_FEAT_HOST_BEHAVIOR, 0,
+                               host, sizeof(*host), NULL);
+       kfree(host);
+       return ret;
+}
+
 static int nvme_configure_apst(struct nvme_ctrl *ctrl)
 {
        /*
                ctrl->quirks &= ~NVME_QUIRK_NO_DEEPEST_PS;
        }
 
+       ctrl->crdt[0] = le16_to_cpu(id->crdt1);
+       ctrl->crdt[1] = le16_to_cpu(id->crdt2);
+       ctrl->crdt[2] = le16_to_cpu(id->crdt3);
+
        ctrl->oacs = le16_to_cpu(id->oacs);
        ctrl->oncs = le16_to_cpup(&id->oncs);
        ctrl->oaes = le32_to_cpu(id->oaes);
        if (ret < 0)
                return ret;
 
+       ret = nvme_configure_acre(ctrl);
+       if (ret < 0)
+               return ret;
+
        ctrl->identified = true;
 
        return 0;
 
        __le32                  rtd3e;
        __le32                  oaes;
        __le32                  ctratt;
-       __u8                    rsvd100[156];
+       __u8                    rsvd100[28];
+       __le16                  crdt1;
+       __le16                  crdt2;
+       __le16                  crdt3;
+       __u8                    rsvd134[122];
        __le16                  oacs;
        __u8                    acl;
        __u8                    aerl;
        NVME_HOST_MEM_RETURN    = (1 << 1),
 };
 
+struct nvme_feat_host_behavior {
+       __u8 acre;
+       __u8 resv1[511];
+};
+
+enum {
+       NVME_ENABLE_ACRE        = 1,
+};
+
 /* Admin commands */
 
 enum nvme_admin_opcode {
        NVME_FEAT_RRL           = 0x12,
        NVME_FEAT_PLM_CONFIG    = 0x13,
        NVME_FEAT_PLM_WINDOW    = 0x14,
+       NVME_FEAT_HOST_BEHAVIOR = 0x16,
        NVME_FEAT_SW_PROGRESS   = 0x80,
        NVME_FEAT_HOST_ID       = 0x81,
        NVME_FEAT_RESV_MASK     = 0x82,
        NVME_SC_ANA_TRANSITION          = 0x303,
        NVME_SC_HOST_PATH_ERROR         = 0x370,
 
+       NVME_SC_CRD                     = 0x1800,
        NVME_SC_DNR                     = 0x4000,
 };