nvme: Print CRD, M and DNR status bits on errors.

It may help with some issues debugging.

MFC after:	1 week
This commit is contained in:
Alexander Motin 2022-08-05 10:58:19 -04:00
parent 101480e926
commit a69c096462
3 changed files with 13 additions and 7 deletions

View File

@ -98,7 +98,7 @@ nvme_dump_command(struct nvme_command *cmd)
void
nvme_dump_completion(struct nvme_completion *cpl)
{
uint8_t p, sc, sct, m, dnr;
uint8_t p, sc, sct, crd, m, dnr;
uint16_t status;
status = le16toh(cpl->status);
@ -106,13 +106,14 @@ nvme_dump_completion(struct nvme_completion *cpl)
p = NVME_STATUS_GET_P(status);
sc = NVME_STATUS_GET_SC(status);
sct = NVME_STATUS_GET_SCT(status);
crd = NVME_STATUS_GET_CRD( status);
m = NVME_STATUS_GET_M(status);
dnr = NVME_STATUS_GET_DNR(status);
printf("cdw0:%08x sqhd:%04x sqid:%04x "
"cid:%04x p:%x sc:%02x sct:%x m:%x dnr:%x\n",
"cid:%04x p:%x sc:%02x sct:%x crd:%x m:%x dnr:%x\n",
le32toh(cpl->cdw0), le16toh(cpl->sqhd), le16toh(cpl->sqid),
cpl->cid, p, sc, sct, m, dnr);
cpl->cid, p, sc, sct, crd, m, dnr);
}
int

View File

@ -204,6 +204,7 @@
#define NVME_STATUS_GET_P(st) (((st) >> NVME_STATUS_P_SHIFT) & NVME_STATUS_P_MASK)
#define NVME_STATUS_GET_SC(st) (((st) >> NVME_STATUS_SC_SHIFT) & NVME_STATUS_SC_MASK)
#define NVME_STATUS_GET_SCT(st) (((st) >> NVME_STATUS_SCT_SHIFT) & NVME_STATUS_SCT_MASK)
#define NVME_STATUS_GET_CRD(st) (((st) >> NVME_STATUS_CRD_SHIFT) & NVME_STATUS_CRD_MASK)
#define NVME_STATUS_GET_M(st) (((st) >> NVME_STATUS_M_SHIFT) & NVME_STATUS_M_MASK)
#define NVME_STATUS_GET_DNR(st) (((st) >> NVME_STATUS_DNR_SHIFT) & NVME_STATUS_DNR_MASK)

View File

@ -344,14 +344,18 @@ static void
nvme_qpair_print_completion(struct nvme_qpair *qpair,
struct nvme_completion *cpl)
{
uint16_t sct, sc;
uint8_t sct, sc, crd, m, dnr;
sct = NVME_STATUS_GET_SCT(cpl->status);
sc = NVME_STATUS_GET_SC(cpl->status);
crd = NVME_STATUS_GET_CRD(cpl->status);
m = NVME_STATUS_GET_M(cpl->status);
dnr = NVME_STATUS_GET_DNR(cpl->status);
nvme_printf(qpair->ctrlr, "%s (%02x/%02x) sqid:%d cid:%d cdw0:%x\n",
get_status_string(sct, sc), sct, sc, cpl->sqid, cpl->cid,
cpl->cdw0);
nvme_printf(qpair->ctrlr, "%s (%02x/%02x) crd:%x m:%x dnr:%x "
"sqid:%d cid:%d cdw0:%x\n",
get_status_string(sct, sc), sct, sc, crd, m, dnr,
cpl->sqid, cpl->cid, cpl->cdw0);
}
static bool