aboutsummaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2017-08-28 23:54:20 +0000
committerWarner Losh <imp@FreeBSD.org>2017-08-28 23:54:20 +0000
commitc02565f9fa7c43ad2fd9293176ebb26583cfee47 (patch)
tree442dfc453061e41e414cd1c609c1256e715ed9a8 /sys/dev
parentbe650b3469ee1628bfe84e227ba19c65168dcdb4 (diff)
Notes
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/nvme/nvme_ctrlr.c8
-rw-r--r--sys/dev/nvme/nvme_private.h1
-rw-r--r--sys/dev/nvme/nvme_sim.c2
3 files changed, 10 insertions, 1 deletions
diff --git a/sys/dev/nvme/nvme_ctrlr.c b/sys/dev/nvme/nvme_ctrlr.c
index 85c2c35968921..95fa39fce5f47 100644
--- a/sys/dev/nvme/nvme_ctrlr.c
+++ b/sys/dev/nvme/nvme_ctrlr.c
@@ -146,6 +146,14 @@ nvme_ctrlr_construct_io_qpairs(struct nvme_controller *ctrlr)
num_trackers = min(num_trackers, (num_entries-1));
/*
+ * Our best estimate for the maximum number of I/Os that we should
+ * noramlly have in flight at one time. This should be viewed as a hint,
+ * not a hard limit and will need to be revisitted when the upper layers
+ * of the storage system grows multi-queue support.
+ */
+ ctrlr->max_hw_pend_io = num_trackers * ctrlr->num_io_queues / 4;
+
+ /*
* This was calculated previously when setting up interrupts, but
* a controller could theoretically support fewer I/O queues than
* MSI-X vectors. So calculate again here just to be safe.
diff --git a/sys/dev/nvme/nvme_private.h b/sys/dev/nvme/nvme_private.h
index 487ce735ac078..8293e563cab3d 100644
--- a/sys/dev/nvme/nvme_private.h
+++ b/sys/dev/nvme/nvme_private.h
@@ -263,6 +263,7 @@ struct nvme_controller {
uint32_t num_io_queues;
uint32_t num_cpus_per_ioq;
+ uint32_t max_hw_pend_io;
/* Fields for tracking progress during controller initialization. */
struct intr_config_hook config_hook;
diff --git a/sys/dev/nvme/nvme_sim.c b/sys/dev/nvme/nvme_sim.c
index 8e89fbe755da7..6f2de462c4e74 100644
--- a/sys/dev/nvme/nvme_sim.c
+++ b/sys/dev/nvme/nvme_sim.c
@@ -253,7 +253,7 @@ nvme_sim_new_controller(struct nvme_controller *ctrlr)
int unit;
struct nvme_sim_softc *sc = NULL;
- max_trans = ctrlr->num_io_queues;
+ max_trans = ctrlr->max_hw_pend_io;
unit = device_get_unit(ctrlr->dev);
devq = cam_simq_alloc(max_trans);
if (devq == NULL)