aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/nvme
diff options
context:
space:
mode:
authorJim Harris <jimharris@FreeBSD.org>2016-01-07 16:08:04 +0000
committerJim Harris <jimharris@FreeBSD.org>2016-01-07 16:08:04 +0000
commitd85f84abb80933c07138584631bb91283e2c0952 (patch)
treefbcff1df1bbdf6db3b7d1db134a87465bd201a6c /sys/dev/nvme
parent58d0b8f3c3e2b5441ea4c2323feccc1b9454fed6 (diff)
downloadsrc-d85f84abb80933c07138584631bb91283e2c0952.tar.gz
src-d85f84abb80933c07138584631bb91283e2c0952.zip
nvme: simplify some of the nested ifs in interrupt setup code
This prepares for some follow-up commits which do more work in this area. MFC after: 3 days Sponsored by: Intel
Notes
Notes: svn path=/head/; revision=293324
Diffstat (limited to 'sys/dev/nvme')
-rw-r--r--sys/dev/nvme/nvme_ctrlr.c36
1 files changed, 20 insertions, 16 deletions
diff --git a/sys/dev/nvme/nvme_ctrlr.c b/sys/dev/nvme/nvme_ctrlr.c
index ee4b901a9c75..c0117fe0442b 100644
--- a/sys/dev/nvme/nvme_ctrlr.c
+++ b/sys/dev/nvme/nvme_ctrlr.c
@@ -999,7 +999,9 @@ nvme_ctrlr_construct(struct nvme_controller *ctrlr, device_t dev)
if (pci_msix_count(dev) < 2) {
ctrlr->msix_enabled = 0;
goto intx;
- } else if (pci_msix_count(dev) < num_vectors_requested) {
+ }
+
+ if (pci_msix_count(dev) < num_vectors_requested) {
ctrlr->per_cpu_io_queues = FALSE;
ctrlr->num_io_queues = 1;
num_vectors_requested = 2; /* one for admin, one for I/O */
@@ -1009,26 +1011,28 @@ nvme_ctrlr_construct(struct nvme_controller *ctrlr, device_t dev)
if (pci_alloc_msix(dev, &num_vectors_allocated) != 0) {
ctrlr->msix_enabled = 0;
goto intx;
- } else if (num_vectors_allocated < num_vectors_requested) {
+ }
+
+ if (num_vectors_allocated < num_vectors_requested) {
if (num_vectors_allocated < 2) {
pci_release_msi(dev);
ctrlr->msix_enabled = 0;
goto intx;
- } else {
- ctrlr->per_cpu_io_queues = FALSE;
- ctrlr->num_io_queues = 1;
- /*
- * Release whatever vectors were allocated, and just
- * reallocate the two needed for the admin and single
- * I/O qpair.
- */
- num_vectors_allocated = 2;
- pci_release_msi(dev);
- if (pci_alloc_msix(dev, &num_vectors_allocated) != 0)
- panic("could not reallocate any vectors\n");
- if (num_vectors_allocated != 2)
- panic("could not reallocate 2 vectors\n");
}
+
+ ctrlr->per_cpu_io_queues = FALSE;
+ ctrlr->num_io_queues = 1;
+ /*
+ * Release whatever vectors were allocated, and just
+ * reallocate the two needed for the admin and single
+ * I/O qpair.
+ */
+ num_vectors_allocated = 2;
+ pci_release_msi(dev);
+ if (pci_alloc_msix(dev, &num_vectors_allocated) != 0)
+ panic("could not reallocate any vectors\n");
+ if (num_vectors_allocated != 2)
+ panic("could not reallocate 2 vectors\n");
}
/*