git: 7be0b0688538 - main - nvme: Remove duplicate command printing routine
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 07 Aug 2023 22:45:38 UTC
The branch main has been updated by imp:
URL: https://cgit.FreeBSD.org/src/commit/?id=7be0b0688538ced679254703076b34c4e9eb507c
commit 7be0b0688538ced679254703076b34c4e9eb507c
Author: Warner Losh <imp@FreeBSD.org>
AuthorDate: 2023-08-07 22:34:54 +0000
Commit: Warner Losh <imp@FreeBSD.org>
CommitDate: 2023-08-07 22:44:30 +0000
nvme: Remove duplicate command printing routine
Both nvme_dump_command and nvme_qpair_print_command print nvme
commands. The former latter better. Recode the one call to
nvme_dump_command to use nvme_qpair_print_command and delete the
former. No sense having two nearly identical routines. A future commit
will convert to sbuf.
Sponsored by: Netflix
Reviewed by: chuck, mav, jhb
Differential Revision: https://reviews.freebsd.org/D41309
---
sys/dev/nvme/nvme.c | 13 -------------
sys/dev/nvme/nvme_private.h | 3 ++-
sys/dev/nvme/nvme_qpair.c | 2 +-
sys/dev/nvme/nvme_sysctl.c | 2 +-
4 files changed, 4 insertions(+), 16 deletions(-)
diff --git a/sys/dev/nvme/nvme.c b/sys/dev/nvme/nvme.c
index 22d197dc9367..1b06e674551c 100644
--- a/sys/dev/nvme/nvme.c
+++ b/sys/dev/nvme/nvme.c
@@ -82,19 +82,6 @@ nvme_shutdown(device_t dev)
return (0);
}
-void
-nvme_dump_command(struct nvme_command *cmd)
-{
-
- printf(
-"opc:%x f:%x cid:%x nsid:%x r2:%x r3:%x mptr:%jx prp1:%jx prp2:%jx cdw:%x %x %x %x %x %x\n",
- cmd->opc, cmd->fuse, cmd->cid, le32toh(cmd->nsid),
- cmd->rsvd2, cmd->rsvd3,
- (uintmax_t)le64toh(cmd->mptr), (uintmax_t)le64toh(cmd->prp1), (uintmax_t)le64toh(cmd->prp2),
- le32toh(cmd->cdw10), le32toh(cmd->cdw11), le32toh(cmd->cdw12),
- le32toh(cmd->cdw13), le32toh(cmd->cdw14), le32toh(cmd->cdw15));
-}
-
int
nvme_attach(device_t dev)
{
diff --git a/sys/dev/nvme/nvme_private.h b/sys/dev/nvme/nvme_private.h
index 95915902642e..9d82c8fba69c 100644
--- a/sys/dev/nvme/nvme_private.h
+++ b/sys/dev/nvme/nvme_private.h
@@ -443,7 +443,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_qpair_print_command(struct nvme_qpair *qpair,
+ struct nvme_command *cmd);
void nvme_qpair_print_completion(struct nvme_qpair *qpair,
struct nvme_completion *cpl);
diff --git a/sys/dev/nvme/nvme_qpair.c b/sys/dev/nvme/nvme_qpair.c
index a09be6bba7d9..40c9f6053b95 100644
--- a/sys/dev/nvme/nvme_qpair.c
+++ b/sys/dev/nvme/nvme_qpair.c
@@ -174,7 +174,7 @@ nvme_io_qpair_print_command(struct nvme_qpair *qpair,
}
}
-static void
+void
nvme_qpair_print_command(struct nvme_qpair *qpair, struct nvme_command *cmd)
{
if (qpair->id == 0)
diff --git a/sys/dev/nvme/nvme_sysctl.c b/sys/dev/nvme/nvme_sysctl.c
index a48dad04d90f..24c397973fbc 100644
--- a/sys/dev/nvme/nvme_sysctl.c
+++ b/sys/dev/nvme/nvme_sysctl.c
@@ -72,7 +72,7 @@ nvme_dump_queue(struct nvme_qpair *qpair)
for (i = 0; i < qpair->num_entries; i++) {
cmd = &qpair->cmd[i];
printf("%05d: ", i);
- nvme_dump_command(cmd);
+ nvme_qpair_print_command(qpair, cmd);
}
}