git: 94feb210599a - stable/14 - nvme: Export constants for min and max queue sizes

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Tue, 27 Aug 2024 01:06:24 UTC
The branch stable/14 has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=94feb210599a358462ad48ccc792ec4d78e03ee3

commit 94feb210599a358462ad48ccc792ec4d78e03ee3
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2024-03-23 00:21:20 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2024-08-26 18:27:21 +0000

    nvme: Export constants for min and max queue sizes
    
    These are useful for NVMe over Fabrics.
    
    Reviewed by:    imp
    Sponsored by:   Chelsio Communications
    Differential Revision:  https://reviews.freebsd.org/D44441
    
    (cherry picked from commit 1931b75e004f25cf1d2db809bfd9baba40c04521)
---
 sys/dev/nvme/nvme.h         | 7 +++++++
 sys/dev/nvme/nvme_private.h | 8 --------
 2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/sys/dev/nvme/nvme.h b/sys/dev/nvme/nvme.h
index 137aff792868..ee387d54985e 100644
--- a/sys/dev/nvme/nvme.h
+++ b/sys/dev/nvme/nvme.h
@@ -63,6 +63,13 @@
 /* Many items are expressed in terms of power of two times MPS */
 #define NVME_MPS_SHIFT			12
 
+/* Limits on queue sizes: See 4.1.3 Queue Size in NVMe 1.4b. */
+#define NVME_MIN_ADMIN_ENTRIES		2
+#define NVME_MAX_ADMIN_ENTRIES		4096
+
+#define NVME_MIN_IO_ENTRIES		2
+#define NVME_MAX_IO_ENTRIES		65536
+
 /* Register field definitions */
 #define NVME_CAP_LO_REG_MQES_SHIFT			(0)
 #define NVME_CAP_LO_REG_MQES_MASK			(0xFFFF)
diff --git a/sys/dev/nvme/nvme_private.h b/sys/dev/nvme/nvme_private.h
index 72797d30a3bf..26dc75ba4141 100644
--- a/sys/dev/nvme/nvme_private.h
+++ b/sys/dev/nvme/nvme_private.h
@@ -57,9 +57,6 @@ MALLOC_DECLARE(M_NVME);
 
 #define NVME_ADMIN_TRACKERS	(16)
 #define NVME_ADMIN_ENTRIES	(128)
-/* min and max are defined in admin queue attributes section of spec */
-#define NVME_MIN_ADMIN_ENTRIES	(2)
-#define NVME_MAX_ADMIN_ENTRIES	(4096)
 
 /*
  * NVME_IO_ENTRIES defines the size of an I/O qpair's submission and completion
@@ -74,11 +71,6 @@ MALLOC_DECLARE(M_NVME);
 #define NVME_MIN_IO_TRACKERS	(4)
 #define NVME_MAX_IO_TRACKERS	(1024)
 
-/*
- * NVME_MAX_IO_ENTRIES is not defined, since it is specified in CC.MQES
- *  for each controller.
- */
-
 #define NVME_INT_COAL_TIME	(0)	/* disabled */
 #define NVME_INT_COAL_THRESHOLD (0)	/* 0-based */