nvme: Remove duplicate completion printing routine
Both nvme_dump_completion and nvme_qpair_print_completion print completions. The latter is better. Recode the two instances of nvme_dump_completion to use nvme_qpair_print_completion and delete the former. No sense having two nearly identical routines. A future commit will convert this to sbuf. Sponsored by: Netflix Reviewed by: chuck Differential Revision: https://reviews.freebsd.org/D41308
This commit is contained in:
parent
f8b4f9aab5
commit
6f76d49386
@ -95,27 +95,6 @@ nvme_dump_command(struct nvme_command *cmd)
|
||||
le32toh(cmd->cdw13), le32toh(cmd->cdw14), le32toh(cmd->cdw15));
|
||||
}
|
||||
|
||||
void
|
||||
nvme_dump_completion(struct nvme_completion *cpl)
|
||||
{
|
||||
uint8_t p, sc, sct, crd, m, dnr;
|
||||
uint16_t status;
|
||||
|
||||
status = le16toh(cpl->status);
|
||||
|
||||
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 crd:%x m:%x dnr:%x\n",
|
||||
le32toh(cpl->cdw0), le16toh(cpl->sqhd), le16toh(cpl->sqid),
|
||||
cpl->cid, p, sc, sct, crd, m, dnr);
|
||||
}
|
||||
|
||||
int
|
||||
nvme_attach(device_t dev)
|
||||
{
|
||||
|
@ -444,7 +444,8 @@ void nvme_ns_destruct(struct nvme_namespace *ns);
|
||||
void nvme_sysctl_initialize_ctrlr(struct nvme_controller *ctrlr);
|
||||
|
||||
void nvme_dump_command(struct nvme_command *cmd);
|
||||
void nvme_dump_completion(struct nvme_completion *cpl);
|
||||
void nvme_qpair_print_completion(struct nvme_qpair *qpair,
|
||||
struct nvme_completion *cpl);
|
||||
|
||||
int nvme_attach(device_t dev);
|
||||
int nvme_shutdown(device_t dev);
|
||||
|
@ -341,21 +341,22 @@ get_status_string(uint16_t sct, uint16_t sc)
|
||||
return (entry->str);
|
||||
}
|
||||
|
||||
static void
|
||||
void
|
||||
nvme_qpair_print_completion(struct nvme_qpair *qpair,
|
||||
struct nvme_completion *cpl)
|
||||
{
|
||||
uint8_t sct, sc, crd, m, dnr;
|
||||
uint8_t sct, sc, crd, m, dnr, p;
|
||||
|
||||
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);
|
||||
p = NVME_STATUS_GET_P(cpl->status);
|
||||
|
||||
nvme_printf(qpair->ctrlr, "%s (%02x/%02x) crd:%x m:%x dnr:%x "
|
||||
nvme_printf(qpair->ctrlr, "%s (%02x/%02x) crd:%x m:%x dnr:%x p:%d "
|
||||
"sqid:%d cid:%d cdw0:%x\n",
|
||||
get_status_string(sct, sc), sct, sc, crd, m, dnr,
|
||||
get_status_string(sct, sc), sct, sc, crd, m, dnr, p,
|
||||
cpl->sqid, cpl->cid, cpl->cdw0);
|
||||
}
|
||||
|
||||
@ -654,8 +655,8 @@ nvme_qpair_process_completions(struct nvme_qpair *qpair)
|
||||
nvme_printf(qpair->ctrlr,
|
||||
"cpl (cid = %u) does not map to outstanding cmd\n",
|
||||
cpl.cid);
|
||||
/* nvme_dump_completion expects device endianess */
|
||||
nvme_dump_completion(&qpair->cpl[qpair->cq_head]);
|
||||
nvme_qpair_print_completion(qpair,
|
||||
&qpair->cpl[qpair->cq_head]);
|
||||
KASSERT(0, ("received completion for unknown cmd"));
|
||||
}
|
||||
|
||||
|
@ -65,7 +65,7 @@ nvme_dump_queue(struct nvme_qpair *qpair)
|
||||
for (i = 0; i < qpair->num_entries; i++) {
|
||||
cpl = &qpair->cpl[i];
|
||||
printf("%05d: ", i);
|
||||
nvme_dump_completion(cpl);
|
||||
nvme_qpair_print_completion(qpair, cpl);
|
||||
}
|
||||
|
||||
printf("Submission queue:\n");
|
||||
|
Loading…
Reference in New Issue
Block a user