[PATCH V3 2/3] nvme: introduce acre flag in nvme_ctrl
Minwoo Im
minwoo.im.dev at gmail.com
Thu Jan 14 08:31:09 EST 2021
Advanced Command Retry Enable (ACRE) flag is added in nvme_ctrl
instance to indicate that Set Features for Host Behavior Support with
ACRE enabled is whether successfully done or not during reset_work.
This flag will be used to decide to retry commands that fail or not in
the followed patch.
Signed-off-by: Minwoo Im <minwoo.im.dev at gmail.com>
---
drivers/nvme/host/core.c | 6 ++++++
drivers/nvme/host/nvme.h | 1 +
2 files changed, 7 insertions(+)
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index a8cee380b3c0..a286e3422c61 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -2498,6 +2498,8 @@ static int nvme_configure_acre(struct nvme_ctrl *ctrl)
struct nvme_feat_host_behavior *host;
int ret;
+ ctrl->acre = false;
+
/* Don't bother enabling the feature if retry delay is not reported */
if (!ctrl->crdt[0] && !ctrl->crdt[1] && !ctrl->crdt[2])
return 0;
@@ -2509,6 +2511,10 @@ static int nvme_configure_acre(struct nvme_ctrl *ctrl)
host->acre = NVME_ENABLE_ACRE;
ret = nvme_set_features(ctrl, NVME_FEAT_HOST_BEHAVIOR, 0,
host, sizeof(*host), NULL);
+
+ if (!ret)
+ ctrl->acre = true;
+
kfree(host);
return ret;
}
diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
index 88a6b97247f5..db8b45e8ffde 100644
--- a/drivers/nvme/host/nvme.h
+++ b/drivers/nvme/host/nvme.h
@@ -270,6 +270,7 @@ struct nvme_ctrl {
#ifdef CONFIG_BLK_DEV_ZONED
u32 max_zone_append;
#endif
+ bool acre;
u16 crdt[3];
u16 oncs;
u16 oacs;
--
2.17.1
More information about the Linux-nvme
mailing list