Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 29 Nov 2010 01:36:15 +0000 (UTC)
From:      Pyun YongHyeon <yongari@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r216027 - stable/8/sys/dev/jme
Message-ID:  <201011290136.oAT1aFqk076367@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: yongari
Date: Mon Nov 29 01:36:15 2010
New Revision: 216027
URL: http://svn.freebsd.org/changeset/base/216027

Log:
  MFC r215848:
    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:
  stable/8/sys/dev/jme/if_jme.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/dev/jme/if_jme.c
==============================================================================
--- stable/8/sys/dev/jme/if_jme.c	Mon Nov 29 01:34:43 2010	(r216026)
+++ stable/8/sys/dev/jme/if_jme.c	Mon Nov 29 01:36:15 2010	(r216027)
@@ -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 }
 };
 
@@ -586,11 +579,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;
@@ -599,9 +597,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;
@@ -794,13 +791,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]);
@@ -828,7 +819,7 @@ jme_detach(device_t dev)
 {
 	struct jme_softc *sc;
 	struct ifnet *ifp;
-	int i, msic;
+	int i;
 
 	sc = device_get_softc(dev);
 
@@ -863,14 +854,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]);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201011290136.oAT1aFqk076367>