mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-21 11:13:30 +00:00
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. MFC after: 1 week Sponsored by: Intel
This commit is contained in:
parent
8a7ad10169
commit
e5ce537999
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=281280
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user