svn commit: r293324 - head/sys/dev/nvme

Jim Harris jimharris at FreeBSD.org
Thu Jan 7 16:08:06 UTC 2016


Author: jimharris
Date: Thu Jan  7 16:08:04 2016
New Revision: 293324
URL: https://svnweb.freebsd.org/changeset/base/293324

Log:
  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

Modified:
  head/sys/dev/nvme/nvme_ctrlr.c

Modified: head/sys/dev/nvme/nvme_ctrlr.c
==============================================================================
--- head/sys/dev/nvme/nvme_ctrlr.c	Thu Jan  7 16:06:23 2016	(r293323)
+++ head/sys/dev/nvme/nvme_ctrlr.c	Thu Jan  7 16:08:04 2016	(r293324)
@@ -999,7 +999,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 */
@@ -1009,26 +1011,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");
 	}
 
 	/*


More information about the svn-src-head mailing list