The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=1602f0013bddc7b59b0b8de94c0e6cd742ffc9be
commit 1602f0013bddc7b59b0b8de94c0e6cd742ffc9be Author: John Baldwin <[email protected]> AuthorDate: 2026-02-20 19:21:18 +0000 Commit: John Baldwin <[email protected]> CommitDate: 2026-02-20 20:39:02 +0000 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 --- sbin/nvmecontrol/fabrics.c | 2 +- sbin/nvmecontrol/nvmecontrol.8 | 6 +++--- sys/dev/nvmf/nvmf.h | 3 ++- tools/tools/nvmf/nvmfdd/nvmfdd.c | 3 ++- 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 <[email protected]> .\" -.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",
