aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2026-02-20 19:21:18 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2026-02-20 20:39:02 +0000
commit1602f0013bddc7b59b0b8de94c0e6cd742ffc9be (patch)
tree2615d2b4d97c046ad1590af59f3d8ec15945762f
parent0788e7c40ddbeedfd9713842440a8db2a8f7ea2f (diff)
nvmf: Limit the default I/O queue size to 128 entries
Previously the size defaulted to the maximum supported size reported by the remote host. The value of 128 matches the default on Linux and avoids excessive resource usage for I/O queues. Sponsored by: Chelsio Communications
-rw-r--r--sbin/nvmecontrol/fabrics.c2
-rw-r--r--sbin/nvmecontrol/nvmecontrol.86
-rw-r--r--sys/dev/nvmf/nvmf.h3
-rw-r--r--tools/tools/nvmf/nvmfdd/nvmfdd.c3
4 files changed, 8 insertions, 6 deletions
diff --git a/sbin/nvmecontrol/fabrics.c b/sbin/nvmecontrol/fabrics.c
index 5fdbf68127d4..b120118cf022 100644
--- a/sbin/nvmecontrol/fabrics.c
+++ b/sbin/nvmecontrol/fabrics.c
@@ -485,7 +485,7 @@ connect_nvm_queues(const struct nvmf_association_params *aparams,
/* Validate I/O queue size. */
memset(io, 0, sizeof(*io) * num_io_queues);
if (queue_size == 0)
- queue_size = (u_int)mqes + 1;
+ queue_size = MIN(NVMF_DEFAULT_IO_ENTRIES, (u_int)mqes + 1);
else if (queue_size > (u_int)mqes + 1) {
warnx("I/O queue size exceeds controller maximum (%u)",
mqes + 1);
diff --git a/sbin/nvmecontrol/nvmecontrol.8 b/sbin/nvmecontrol/nvmecontrol.8
index 61574715a26c..2e666f5259ff 100644
--- a/sbin/nvmecontrol/nvmecontrol.8
+++ b/sbin/nvmecontrol/nvmecontrol.8
@@ -33,7 +33,7 @@
.\"
.\" Author: Jim Harris <jimharris@FreeBSD.org>
.\"
-.Dd January 31, 2026
+.Dd February 20, 2026
.Dt NVMECONTROL 8
.Os
.Sh NAME
@@ -828,8 +828,8 @@ NVMe Qualified Name to use for this host.
By default an NQN is auto-generated from the current host's UUID.
.It Fl Q Ar entries
Number of entries in each I/O queue.
-By default the maximum queue size reported by the MQES field
-of the remote host's CAP property is used.
+The default is the minimum of 128 or the maximum queue size reported
+by the MQES field of the remote host's CAP property.
.El
.Ss connect-all
Query the Discovery Controller at
diff --git a/sys/dev/nvmf/nvmf.h b/sys/dev/nvmf/nvmf.h
index 9b2b4c1dea40..e53eecca156e 100644
--- a/sys/dev/nvmf/nvmf.h
+++ b/sys/dev/nvmf/nvmf.h
@@ -27,11 +27,12 @@
#define NVMF_NN (1024)
/*
- * Default timeouts for Fabrics hosts. These match values used by
+ * Default settings for Fabrics hosts. These match values used by
* Linux.
*/
#define NVMF_DEFAULT_RECONNECT_DELAY 10
#define NVMF_DEFAULT_CONTROLLER_LOSS 600
+#define NVMF_DEFAULT_IO_ENTRIES 128
/*
* (data, size) is the userspace buffer for a packed nvlist.
diff --git a/tools/tools/nvmf/nvmfdd/nvmfdd.c b/tools/tools/nvmf/nvmfdd/nvmfdd.c
index 0f181682aac2..9cc426c3ede9 100644
--- a/tools/tools/nvmf/nvmfdd/nvmfdd.c
+++ b/tools/tools/nvmf/nvmfdd/nvmfdd.c
@@ -474,7 +474,8 @@ main(int ac, char **av)
memset(&qparams, 0, sizeof(qparams));
tcp_qpair_params(&qparams, false, address, port);
- io = nvmf_connect(na, &qparams, 1, info.mqes + 1, hostid,
+ io = nvmf_connect(na, &qparams, 1,
+ MIN(NVMF_DEFAULT_IO_ENTRIES, info.mqes + 1), hostid,
nvmf_cntlid(admin), av[2], hostnqn, 0);
if (io == NULL) {
warn("Failed to create I/O queue: %s",