Author: jimharris
Date: Mon Jan 11 17:26:06 2016
New Revision: 293667
URL: https://svnweb.freebsd.org/changeset/base/293667

Log:
  MFC r293324:
  
    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.

Modified:
  stable/10/sys/dev/nvme/nvme_ctrlr.c

Modified: stable/10/sys/dev/nvme/nvme_ctrlr.c
==============================================================================
--- stable/10/sys/dev/nvme/nvme_ctrlr.c Mon Jan 11 17:24:18 2016        
(r293666)
+++ stable/10/sys/dev/nvme/nvme_ctrlr.c Mon Jan 11 17:26:06 2016        
(r293667)
@@ -1000,7 +1000,9 @@ nvme_ctrlr_construct(struct nvme_control
        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 */
@@ -1010,26 +1012,28 @@ nvme_ctrlr_construct(struct nvme_control
        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");
        }
 
        /*
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to