From owner-svn-src-all@FreeBSD.ORG Fri Nov 26 01:58:25 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A4E3F1065679; Fri, 26 Nov 2010 01:58:25 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 882BB8FC2A; Fri, 26 Nov 2010 01:58:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAQ1wP95023838; Fri, 26 Nov 2010 01:58:25 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAQ1wPVY023836; Fri, 26 Nov 2010 01:58:25 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201011260158.oAQ1wPVY023836@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 26 Nov 2010 01:58:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215848 - head/sys/dev/jme X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Fri, 26 Nov 2010 01:58:25 -0000 Author: yongari Date: Fri Nov 26 01:58:25 2010 New Revision: 215848 URL: http://svn.freebsd.org/changeset/base/215848 Log: Allocate 1 MSI/MSI-X vector. Originally jme(4) was designed to support multi-queue but the hardware limitation made it hard to implement supporting multi-queue. Allocating more than necessary vectors is resource waste and it can be added back when we implement multi-queue support. Modified: head/sys/dev/jme/if_jme.c Modified: head/sys/dev/jme/if_jme.c ============================================================================== --- head/sys/dev/jme/if_jme.c Fri Nov 26 01:48:29 2010 (r215847) +++ head/sys/dev/jme/if_jme.c Fri Nov 26 01:58:25 2010 (r215848) @@ -201,13 +201,6 @@ static struct resource_spec jme_irq_spec static struct resource_spec jme_irq_spec_msi[] = { { SYS_RES_IRQ, 1, RF_ACTIVE }, - { SYS_RES_IRQ, 2, RF_ACTIVE }, - { SYS_RES_IRQ, 3, RF_ACTIVE }, - { SYS_RES_IRQ, 4, RF_ACTIVE }, - { SYS_RES_IRQ, 5, RF_ACTIVE }, - { SYS_RES_IRQ, 6, RF_ACTIVE }, - { SYS_RES_IRQ, 7, RF_ACTIVE }, - { SYS_RES_IRQ, 8, RF_ACTIVE }, { -1, 0, 0 } }; @@ -578,11 +571,16 @@ jme_attach(device_t dev) device_printf(dev, "MSI count : %d\n", msic); } + /* Use 1 MSI/MSI-X. */ + if (msixc > 1) + msixc = 1; + if (msic > 1) + msic = 1; /* Prefer MSIX over MSI. */ if (msix_disable == 0 || msi_disable == 0) { - if (msix_disable == 0 && msixc == JME_MSIX_MESSAGES && + if (msix_disable == 0 && msixc > 0 && pci_alloc_msix(dev, &msixc) == 0) { - if (msic == JME_MSIX_MESSAGES) { + if (msixc == 1) { device_printf(dev, "Using %d MSIX messages.\n", msixc); sc->jme_flags |= JME_FLAG_MSIX; @@ -591,9 +589,8 @@ jme_attach(device_t dev) pci_release_msi(dev); } if (msi_disable == 0 && (sc->jme_flags & JME_FLAG_MSIX) == 0 && - msic == JME_MSI_MESSAGES && - pci_alloc_msi(dev, &msic) == 0) { - if (msic == JME_MSI_MESSAGES) { + msic > 0 && pci_alloc_msi(dev, &msic) == 0) { + if (msic == 1) { device_printf(dev, "Using %d MSI messages.\n", msic); sc->jme_flags |= JME_FLAG_MSI; @@ -786,13 +783,7 @@ jme_attach(device_t dev) taskqueue_start_threads(&sc->jme_tq, 1, PI_NET, "%s taskq", device_get_nameunit(sc->jme_dev)); - if ((sc->jme_flags & JME_FLAG_MSIX) != 0) - msic = JME_MSIX_MESSAGES; - else if ((sc->jme_flags & JME_FLAG_MSI) != 0) - msic = JME_MSI_MESSAGES; - else - msic = 1; - for (i = 0; i < msic; i++) { + for (i = 0; i < 1; i++) { error = bus_setup_intr(dev, sc->jme_irq[i], INTR_TYPE_NET | INTR_MPSAFE, jme_intr, NULL, sc, &sc->jme_intrhand[i]); @@ -820,7 +811,7 @@ jme_detach(device_t dev) { struct jme_softc *sc; struct ifnet *ifp; - int i, msic; + int i; sc = device_get_softc(dev); @@ -855,14 +846,7 @@ jme_detach(device_t dev) sc->jme_ifp = NULL; } - msic = 1; - if ((sc->jme_flags & JME_FLAG_MSIX) != 0) - msic = JME_MSIX_MESSAGES; - else if ((sc->jme_flags & JME_FLAG_MSI) != 0) - msic = JME_MSI_MESSAGES; - else - msic = 1; - for (i = 0; i < msic; i++) { + for (i = 0; i < 1; i++) { if (sc->jme_intrhand[i] != NULL) { bus_teardown_intr(dev, sc->jme_irq[i], sc->jme_intrhand[i]);