From owner-svn-src-all@FreeBSD.ORG Wed Apr 8 21:46:19 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CC4C3102; Wed, 8 Apr 2015 21:46:19 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B8521DDC; Wed, 8 Apr 2015 21:46:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t38LkJWh058301; Wed, 8 Apr 2015 21:46:19 GMT (envelope-from jimharris@FreeBSD.org) Received: (from jimharris@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t38LkJ9s058300; Wed, 8 Apr 2015 21:46:19 GMT (envelope-from jimharris@FreeBSD.org) Message-Id: <201504082146.t38LkJ9s058300@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jimharris set sender to jimharris@FreeBSD.org using -f From: Jim Harris Date: Wed, 8 Apr 2015 21:46:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r281280 - head/sys/dev/nvme X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Apr 2015 21:46:19 -0000 Author: jimharris Date: Wed Apr 8 21:46:18 2015 New Revision: 281280 URL: https://svnweb.freebsd.org/changeset/base/281280 Log: 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. MFC after: 1 week 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 Wed Apr 8 21:10:13 2015 (r281279) +++ head/sys/dev/nvme/nvme_ctrlr.c Wed Apr 8 21:46:18 2015 (r281280) @@ -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) {