git: 1931b75e004f - main - nvme: Export constants for min and max queue sizes

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Sat, 23 Mar 2024 00:25:32 UTC
The branch main has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=1931b75e004f25cf1d2db809bfd9baba40c04521

commit 1931b75e004f25cf1d2db809bfd9baba40c04521
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2024-03-23 00:21:20 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2024-03-23 00:23:02 +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
---
 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 9013e79b8882..fd27e9b318e7 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 1b6ea03c909a..69141add4e48 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 */