svn commit: r348397 - head/sys/dev/ena

Marcin Wojtas mw at FreeBSD.org
Thu May 30 13:22:14 UTC 2019


Author: mw
Date: Thu May 30 13:22:12 2019
New Revision: 348397
URL: https://svnweb.freebsd.org/changeset/base/348397

Log:
  Check for number of MSI-x upon partial allocation in ENA
  
  The ENA driver needs at least 2 MSI-x - one for admin queue, and one for
  IO queues pair. If there were not enough resources to allocate more than
  one MSI-x, the device should not be attached.
  
  Submitted by:  Michal Krawczyk <mk at semihalf.com>
  Obtained from: Semihalf
  Sponsored by:  Amazon, Inc.

Modified:
  head/sys/dev/ena/ena.c

Modified: head/sys/dev/ena/ena.c
==============================================================================
--- head/sys/dev/ena/ena.c	Thu May 30 13:20:42 2019	(r348396)
+++ head/sys/dev/ena/ena.c	Thu May 30 13:22:12 2019	(r348397)
@@ -1865,6 +1865,14 @@ ena_enable_msix(struct ena_adapter *adapter)
 	}
 
 	if (msix_vecs != msix_req) {
+		if (msix_vecs == ENA_ADMIN_MSIX_VEC) {
+			device_printf(dev,
+			    "Not enough number of MSI-x allocated: %d\n",
+			    msix_vecs);
+			pci_release_msi(dev);
+			rc = ENOSPC;
+			goto err_msix_free;
+		}
 		device_printf(dev, "Enable only %d MSI-x (out of %d), reduce "
 		    "the number of queues\n", msix_vecs, msix_req);
 		adapter->num_queues = msix_vecs - ENA_ADMIN_MSIX_VEC;


More information about the svn-src-all mailing list