From: Tokunori Ikegami <ikegami.t@gmail.com>
To: linux-nvme@lists.infradead.org
Cc: Tokunori Ikegami <ikegami.t@gmail.com>
Subject: [PATCH] nvme: add crd value to output error log
Date: Mon, 10 Aug 2026 02:34:45 +0900 [thread overview]
Message-ID: <20260809173545.54749-1-ikegami.t@gmail.com> (raw)
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
reply other threads:[~2026-08-09 17:36 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260809173545.54749-1-ikegami.t@gmail.com \
--to=ikegami.t@gmail.com \
--cc=linux-nvme@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.