git: 3ff90d91b433 - main - nvmf: Schedule requests across multiple I/O queues
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 11 Nov 2024 16:39:39 UTC
The branch main has been updated by jhb:
URL: https://cgit.FreeBSD.org/src/commit/?id=3ff90d91b433c1eafe857ba21470db5e5052b3b6
commit 3ff90d91b433c1eafe857ba21470db5e5052b3b6
Author: John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2024-11-11 16:37:32 +0000
Commit: John Baldwin <jhb@FreeBSD.org>
CommitDate: 2024-11-11 16:37:32 +0000
nvmf: Schedule requests across multiple I/O queues
Similar to nvme(4), use the current CPU to select which I/O queue to
use. The assignment in nvmf_attach() had to be moved down since
sc->num_io_queues is initialized in nvmf_establish_connection().
Note that nvmecontrol(8) still defaults to using a single I/O queue
for an association.
Sponsored by: Chelsio Communications
---
sys/dev/nvmf/host/nvmf.c | 5 ++---
sys/dev/nvmf/host/nvmf_var.h | 5 +++--
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/sys/dev/nvmf/host/nvmf.c b/sys/dev/nvmf/host/nvmf.c
index 804e7528c931..c726e36e1fae 100644
--- a/sys/dev/nvmf/host/nvmf.c
+++ b/sys/dev/nvmf/host/nvmf.c
@@ -479,9 +479,6 @@ nvmf_attach(device_t dev)
nvmf_init_aer(sc);
- /* TODO: Multiqueue support. */
- sc->max_pending_io = ivars->io_params[0].qsize /* * sc->num_io_queues */;
-
error = nvmf_establish_connection(sc, ivars);
if (error != 0)
goto out;
@@ -509,6 +506,8 @@ nvmf_attach(device_t dev)
NVME_CAP_HI_MPSMIN(sc->cap >> 32)));
}
+ sc->max_pending_io = ivars->io_params[0].qsize * sc->num_io_queues;
+
error = nvmf_init_sim(sc);
if (error != 0)
goto out;
diff --git a/sys/dev/nvmf/host/nvmf_var.h b/sys/dev/nvmf/host/nvmf_var.h
index 0e52f36a80a5..e9f33207fea1 100644
--- a/sys/dev/nvmf/host/nvmf_var.h
+++ b/sys/dev/nvmf/host/nvmf_var.h
@@ -14,6 +14,7 @@
#include <sys/_mutex.h>
#include <sys/_sx.h>
#include <sys/_task.h>
+#include <sys/smp.h>
#include <sys/queue.h>
#include <dev/nvme/nvme.h>
#include <dev/nvmf/nvmf_transport.h>
@@ -112,8 +113,8 @@ struct nvmf_completion_status {
static __inline struct nvmf_host_qpair *
nvmf_select_io_queue(struct nvmf_softc *sc)
{
- /* TODO: Support multiple queues? */
- return (sc->io[0]);
+ u_int idx = curcpu * sc->num_io_queues / (mp_maxid + 1);
+ return (sc->io[idx]);
}
static __inline bool