diff --git a/sys/dev/nvme/nvme_ctrlr.c b/sys/dev/nvme/nvme_ctrlr.c index 85c2c359689..95fa39fce5f 100644 --- a/sys/dev/nvme/nvme_ctrlr.c +++ b/sys/dev/nvme/nvme_ctrlr.c @@ -145,6 +145,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 diff --git a/sys/dev/nvme/nvme_private.h b/sys/dev/nvme/nvme_private.h index 487ce735ac0..8293e563cab 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 8e89fbe755d..6f2de462c4e 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)