svn commit: r282923 - stable/10/sys/dev/nvme

Jim Harris jimharris at FreeBSD.org
Thu May 14 21:27:32 UTC 2015


Author: jimharris
Date: Thu May 14 21:27:31 2015
New Revision: 282923
URL: https://svnweb.freebsd.org/changeset/base/282923

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

Modified:
  stable/10/sys/dev/nvme/nvme_ctrlr.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/nvme/nvme_ctrlr.c
==============================================================================
--- stable/10/sys/dev/nvme/nvme_ctrlr.c	Thu May 14 21:08:48 2015	(r282922)
+++ stable/10/sys/dev/nvme/nvme_ctrlr.c	Thu May 14 21:27:31 2015	(r282923)
@@ -1144,9 +1144,17 @@ nvme_ctrlr_construct(struct nvme_control
 	/* 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) {


More information about the svn-src-all mailing list