diff options
author | jimharris <jimharris@FreeBSD.org> | 2015-05-14 21:27:31 +0000 |
---|---|---|
committer | jimharris <jimharris@FreeBSD.org> | 2015-05-14 21:27:31 +0000 |
commit | 701899b4c60bea7ac2e6131cebeb547762f23317 (patch) | |
tree | ea8b9ca6563a24db92f1b6ca3b0665c25fe8169d | |
parent | 30e0f73c2f69f805f1c7381f9bcb0a03802f5038 (diff) | |
download | FreeBSD-src-701899b4c60bea7ac2e6131cebeb547762f23317.zip FreeBSD-src-701899b4c60bea7ac2e6131cebeb547762f23317.tar.gz |
MFC r281280:
nvme: fall back to a smaller MSI-X vector allocation if necessary
Previously, if per-CPU MSI-X vectors could not be allocated,
nvme(4) would fall back to INTx with a single I/O queue pair.
This change will still fall back to a single I/O queue pair, but
allocate MSI-X vectors instead of reverting to INTx.
Sponsored by: Intel
-rw-r--r-- | sys/dev/nvme/nvme_ctrlr.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/sys/dev/nvme/nvme_ctrlr.c b/sys/dev/nvme/nvme_ctrlr.c index cf3b3b2..6b0d6f3 100644 --- a/sys/dev/nvme/nvme_ctrlr.c +++ b/sys/dev/nvme/nvme_ctrlr.c @@ -1144,9 +1144,17 @@ nvme_ctrlr_construct(struct nvme_controller *ctrlr, device_t dev) /* One vector per IO queue, plus one vector for admin queue. */ num_vectors = ctrlr->num_io_queues + 1; - if (pci_msix_count(dev) < num_vectors) { + /* + * If we cannot even allocate 2 vectors (one for admin, one for + * I/O), then revert to INTx. + */ + if (pci_msix_count(dev) < 2) { ctrlr->msix_enabled = 0; goto intx; + } else if (pci_msix_count(dev) < num_vectors) { + ctrlr->per_cpu_io_queues = FALSE; + ctrlr->num_io_queues = 1; + num_vectors = 2; /* one for admin, one for I/O */ } if (pci_alloc_msix(dev, &num_vectors) != 0) { |