diff --git a/share/man/man4/nvme.4 b/share/man/man4/nvme.4 index 99075ea545f..52b760225d5 100644 --- a/share/man/man4/nvme.4 +++ b/share/man/man4/nvme.4 @@ -151,6 +151,17 @@ This value may also be set in the kernel config file with .Bd -literal -offset indent .Cd options NVME_USE_NVD=0 .Ed +.Pp +When there is an error, +.Nm +prints only the most relevant information about the command by default. +To enable dumping of all information about the command, set the following tunable +value in +.Xr loader.conf 5 : +.Bd -literal -offset indent +hw.nvme.verbose_cmd_dump=1 +.Ed +.Pp .Sh SYSCTL VARIABLES The following controller-level sysctls are currently implemented: .Bl -tag -width indent diff --git a/sys/dev/nvme/nvme.c b/sys/dev/nvme/nvme.c index 84fe58a9f93..449f2367c54 100644 --- a/sys/dev/nvme/nvme.c +++ b/sys/dev/nvme/nvme.c @@ -54,6 +54,9 @@ struct nvme_consumer nvme_consumer[NVME_MAX_CONSUMERS]; uma_zone_t nvme_request_zone; int32_t nvme_retry_count; +int nvme_verbose_cmd_dump; + +TUNABLE_INT("hw.nvme.verbose_cmd_dump", &nvme_verbose_cmd_dump); MALLOC_DEFINE(M_NVME, "nvme", "nvme(4) memory allocations"); diff --git a/sys/dev/nvme/nvme_private.h b/sys/dev/nvme/nvme_private.h index f68ebbe7589..730990f9541 100644 --- a/sys/dev/nvme/nvme_private.h +++ b/sys/dev/nvme/nvme_private.h @@ -114,6 +114,7 @@ MALLOC_DECLARE(M_NVME); extern uma_zone_t nvme_request_zone; extern int32_t nvme_retry_count; +extern int32_t nvme_verbose_cmd_dump; struct nvme_completion_poll_status { diff --git a/sys/dev/nvme/nvme_qpair.c b/sys/dev/nvme/nvme_qpair.c index 63405695521..098b6d63f53 100644 --- a/sys/dev/nvme/nvme_qpair.c +++ b/sys/dev/nvme/nvme_qpair.c @@ -178,6 +178,16 @@ nvme_qpair_print_command(struct nvme_qpair *qpair, struct nvme_command *cmd) nvme_admin_qpair_print_command(qpair, cmd); else nvme_io_qpair_print_command(qpair, cmd); + if (nvme_verbose_cmd_dump) { + nvme_printf(qpair->ctrlr, + "nsid:%#x rsvd2:%#x rsvd3:%#x mptr:%#jx prp1:%#jx prp2:%#jx\n", + cmd->nsid, cmd->rsvd2, cmd->rsvd3, (uintmax_t)cmd->mptr, + (uintmax_t)cmd->prp1, (uintmax_t)cmd->prp2); + nvme_printf(qpair->ctrlr, + "cdw10: %#x cdw11:%#x cdw12:%#x cdw13:%#x cdw14:%#x cdw15:%#x\n", + cmd->cdw10, cmd->cdw11, cmd->cdw12, cmd->cdw13, cmd->cdw14, + cmd->cdw15); + } } struct nvme_status_string {