* [PATCH] nvme: add crd value to output error log
@ 2026-08-09 17:34 Tokunori Ikegami
0 siblings, 0 replies; only message in thread
From: Tokunori Ikegami @ 2026-08-09 17:34 UTC (permalink / raw)
To: linux-nvme; +Cc: Tokunori Ikegami
Also add NVME_CRD to get the status CRD value.
Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
---
drivers/nvme/host/core.c | 15 +++++++++------
include/linux/nvme.h | 1 +
2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 453c1f0b2dd0..0178de333ceb 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -326,7 +326,7 @@ static void nvme_retry_req(struct request *req)
struct nvme_ns *ns = req->q->queuedata;
/* The mask and shift result must be <= 3 */
- crd = (nvme_req(req)->status & NVME_STATUS_CRD) >> 11;
+ crd = NVME_CRD(nvme_req(req)->status);
if (crd)
delay = nvme_req(req)->ctrl->crdt[crd - 1] * 100;
@@ -344,7 +344,7 @@ static void nvme_log_error(struct request *req)
struct nvme_request *nr = nvme_req(req);
if (ns) {
- pr_err_ratelimited("%s: %s(0x%x) @ LBA %llu, %u blocks, %s (sct 0x%x / sc 0x%x) %s%s\n",
+ pr_err_ratelimited("%s: %s(0x%x) @ LBA %llu, %u blocks, %s (sct 0x%x / sc 0x%x) %s%scrd=%u\n",
ns->disk ? ns->disk->disk_name : "?",
nvme_get_opcode_str(nr->cmd->common.opcode),
nr->cmd->common.opcode,
@@ -354,11 +354,12 @@ static void nvme_log_error(struct request *req)
NVME_SCT(nr->status), /* Status Code Type */
nr->status & NVME_SC_MASK, /* Status Code */
nr->status & NVME_STATUS_MORE ? "MORE " : "",
- nr->status & NVME_STATUS_DNR ? "DNR " : "");
+ nr->status & NVME_STATUS_DNR ? "DNR " : "",
+ NVME_CRD(nr->status));
return;
}
- pr_err_ratelimited("%s: %s(0x%x), %s (sct 0x%x / sc 0x%x) %s%s\n",
+ pr_err_ratelimited("%s: %s(0x%x), %s (sct 0x%x / sc 0x%x) %s%scrd=%u\n",
dev_name(nr->ctrl->device),
nvme_get_admin_opcode_str(nr->cmd->common.opcode),
nr->cmd->common.opcode,
@@ -366,7 +367,8 @@ static void nvme_log_error(struct request *req)
NVME_SCT(nr->status), /* Status Code Type */
nr->status & NVME_SC_MASK, /* Status Code */
nr->status & NVME_STATUS_MORE ? "MORE " : "",
- nr->status & NVME_STATUS_DNR ? "DNR " : "");
+ nr->status & NVME_STATUS_DNR ? "DNR " : "",
+ NVME_CRD(nr->status));
}
static void nvme_log_err_passthru(struct request *req)
@@ -374,7 +376,7 @@ static void nvme_log_err_passthru(struct request *req)
struct nvme_ns *ns = req->q->queuedata;
struct nvme_request *nr = nvme_req(req);
- pr_err_ratelimited("%s: %s(0x%x), %s (sct 0x%x / sc 0x%x) %s%s"
+ pr_err_ratelimited("%s: %s(0x%x), %s (sct 0x%x / sc 0x%x) %s%scrd=%u "
"cdw10=0x%x cdw11=0x%x cdw12=0x%x cdw13=0x%x cdw14=0x%x cdw15=0x%x\n",
ns ? ns->disk->disk_name : dev_name(nr->ctrl->device),
ns ? nvme_get_opcode_str(nr->cmd->common.opcode) :
@@ -385,6 +387,7 @@ static void nvme_log_err_passthru(struct request *req)
nr->status & NVME_SC_MASK, /* Status Code */
nr->status & NVME_STATUS_MORE ? "MORE " : "",
nr->status & NVME_STATUS_DNR ? "DNR " : "",
+ NVME_CRD(nr->status),
le32_to_cpu(nr->cmd->common.cdw10),
le32_to_cpu(nr->cmd->common.cdw11),
le32_to_cpu(nr->cmd->common.cdw12),
diff --git a/include/linux/nvme.h b/include/linux/nvme.h
index 041f30931a90..56b27c3ba909 100644
--- a/include/linux/nvme.h
+++ b/include/linux/nvme.h
@@ -2248,6 +2248,7 @@ enum {
};
#define NVME_SCT(status) ((status) >> 8 & 7)
+#define NVME_CRD(status) (((status) & NVME_STATUS_CRD) >> 11)
struct nvme_completion {
/*
--
2.53.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-08-09 17:36 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-09 17:34 [PATCH] nvme: add crd value to output error log Tokunori Ikegami
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox