git: 82f70a0070a3 - main - nvme: name the Create I/O queue cdw11 fields, use Medium QPRIO
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 08 Sep 2026 00:21:16 UTC
The branch main has been updated by seuros:
URL: https://cgit.FreeBSD.org/src/commit/?id=82f70a0070a30a448eeeb47471749c8b382273c3
commit 82f70a0070a30a448eeeb47471749c8b382273c3
Author: Abdelkader Boudih <seuros@FreeBSD.org>
AuthorDate: 2026-09-08 00:20:16 +0000
Commit: Abdelkader Boudih <seuros@FreeBSD.org>
CommitDate: 2026-09-08 00:20:16 +0000
nvme: name the Create I/O queue cdw11 fields, use Medium QPRIO
The Create I/O queue commands carried magic 0x1/0x3 cdw11 values, and
the implicit QPRIO of zero classifies every I/O queue Urgent the
moment weighted round robin arbitration is enabled. No functional
change with the round robin default.
Approved by: ngie (co-mentor)
Reviewed by: ngie, imp, adrian
Differential Revision: https://reviews.freebsd.org/D59153
---
sys/dev/nvme/nvme.h | 14 ++++++++++++++
sys/dev/nvme/nvme_ctrlr_cmd.c | 9 +++++----
2 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/sys/dev/nvme/nvme.h b/sys/dev/nvme/nvme.h
index fb2c26b1f344..b7e82e83a13f 100644
--- a/sys/dev/nvme/nvme.h
+++ b/sys/dev/nvme/nvme.h
@@ -234,6 +234,20 @@ enum nvme_psdt {
#define NVME_CMD_PSDT_SHIFT (6)
#define NVME_CMD_PSDT_MASK (0x3)
+/* Create I/O Submission Queue, cdw11 */
+#define NVME_CREATE_IO_SQ_PC (0x1)
+#define NVME_CREATE_IO_SQ_QPRIO_SHIFT (1)
+#define NVME_CREATE_IO_SQ_QPRIO_MASK (0x3)
+
+/* Create I/O Completion Queue, cdw11 */
+#define NVME_CREATE_IO_CQ_PC (0x1)
+#define NVME_CREATE_IO_CQ_IEN (0x2)
+
+/* Queue priority classes, used with weighted round robin arbitration. */
+#define NVME_QPRIO_URGENT (0)
+#define NVME_QPRIO_HIGH (1)
+#define NVME_QPRIO_MEDIUM (2)
+#define NVME_QPRIO_LOW (3)
#define NVME_STATUS_P_SHIFT (0)
#define NVME_STATUS_P_MASK (0x1)
diff --git a/sys/dev/nvme/nvme_ctrlr_cmd.c b/sys/dev/nvme/nvme_ctrlr_cmd.c
index 1a48a058edd8..728b49f5e41d 100644
--- a/sys/dev/nvme/nvme_ctrlr_cmd.c
+++ b/sys/dev/nvme/nvme_ctrlr_cmd.c
@@ -89,8 +89,8 @@ nvme_ctrlr_cmd_create_io_cq(struct nvme_controller *ctrlr,
* structure.
*/
cmd->cdw10 = htole32(((io_que->num_entries-1) << 16) | io_que->id);
- /* 0x3 = interrupts enabled | physically contiguous */
- cmd->cdw11 = htole32((io_que->vector << 16) | 0x3);
+ cmd->cdw11 = htole32((io_que->vector << 16) |
+ NVME_CREATE_IO_CQ_IEN | NVME_CREATE_IO_CQ_PC);
cmd->prp1 = htole64(io_que->cpl_bus_addr);
nvme_ctrlr_submit_admin_request(ctrlr, req);
@@ -113,8 +113,9 @@ nvme_ctrlr_cmd_create_io_sq(struct nvme_controller *ctrlr,
* structure.
*/
cmd->cdw10 = htole32(((io_que->num_entries-1) << 16) | io_que->id);
- /* 0x1 = physically contiguous */
- cmd->cdw11 = htole32((io_que->id << 16) | 0x1);
+ cmd->cdw11 = htole32((io_que->id << 16) |
+ NVMEF(NVME_CREATE_IO_SQ_QPRIO, NVME_QPRIO_MEDIUM) |
+ NVME_CREATE_IO_SQ_PC);
cmd->prp1 = htole64(io_que->cmd_bus_addr);
nvme_ctrlr_submit_admin_request(ctrlr, req);