Commit 90095a79 authored by Daniel Verkamp's avatar Daniel Verkamp
Browse files

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: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
parent 2144f0e9
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -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) {