nvme: enforce minimum and maximum I/O queues
Don't allow the user to request more than the valid maximum number of I/O queues (65535) or 0 I/O queues, since this can't be encoded. Change-Id: I2d6e0bba03476085842bad683b273cdf9d6e6d5e Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
parent
2144f0e97f
commit
90095a79fe
@ -628,6 +628,15 @@ nvme_ctrlr_set_num_qpairs(struct spdk_nvme_ctrlr *ctrlr)
|
||||
|
||||
status.done = false;
|
||||
|
||||
if (ctrlr->opts.num_io_queues > SPDK_NVME_MAX_IO_QUEUES) {
|
||||
nvme_printf(ctrlr, "Limiting requested num_io_queues %u to max %d\n",
|
||||
ctrlr->opts.num_io_queues, SPDK_NVME_MAX_IO_QUEUES);
|
||||
ctrlr->opts.num_io_queues = SPDK_NVME_MAX_IO_QUEUES;
|
||||
} else if (ctrlr->opts.num_io_queues < 1) {
|
||||
nvme_printf(ctrlr, "Requested num_io_queues 0, increasing to 1\n");
|
||||
ctrlr->opts.num_io_queues = 1;
|
||||
}
|
||||
|
||||
rc = nvme_ctrlr_cmd_set_num_queues(ctrlr, ctrlr->opts.num_io_queues,
|
||||
nvme_completion_poll_cb, &status);
|
||||
if (rc != 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user