Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 20 Dec 2008 10:45:50 GMT
From:      Weongyo Jeong <weongyo@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 155052 for review
Message-ID:  <200812201045.mBKAjo1e002193@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=155052

Change 155052 by weongyo@weongyo_ws on 2008/12/20 10:45:43

	introduce `ndisusb_halt' sysctl to control whether the ndisulator try
	to halt after attaching.  This is needed to solve some NDIS USB
	driver's problems.  For example ZyDAS 1211B NDIS driver doen't response
	against GET_CONFIG_DESCRIPTOR messages after halting; don't know it's
	NDIS driver's problem.  Some NDIS drivers doesn't work for halting by
	unknown problems.

Affected files ...

.. //depot/projects/ndisusb/sys/dev/if_ndis/if_ndis.c#14 edit

Differences ...

==== //depot/projects/ndisusb/sys/dev/if_ndis/if_ndis.c#14 (text+ko) ====

@@ -96,6 +96,11 @@
 #define DPRINTF(x)
 #endif
 
+SYSCTL_DECL(_hw_ndisusb);
+int ndisusb_halt = 1;
+SYSCTL_INT(_hw_ndisusb, OID_AUTO, halt, CTLFLAG_RW, &ndisusb_halt, 0,
+    "Halt NDIS USB driver when it's attached");
+
 MODULE_DEPEND(ndis, ether, 1, 1, 1);
 MODULE_DEPEND(ndis, wlan, 1, 1, 1);
 MODULE_DEPEND(ndis, ndisapi, 1, 1, 1);
@@ -946,6 +951,9 @@
 		return (error);
 	}
 
+	if (sc->ndis_iftype == PNPBus && ndisusb_halt == 0)
+		return (error);
+
 	/* We're done talking to the NIC for now; halt it. */
 	ndis_halt_nic(sc);
 
@@ -1963,11 +1971,13 @@
 	 */
 	ndis_stop(sc);
 
-	error = ndis_init_nic(sc);
-	if (error != 0) {
-		device_printf(sc->ndis_dev,
-		    "failed to initialize the device: %d\n", error);
-		return;
+	if (!(sc->ndis_iftype == PNPBus && ndisusb_halt == 0)) {
+		error = ndis_init_nic(sc);
+		if (error != 0) {
+			device_printf(sc->ndis_dev,
+			    "failed to initialize the device: %d\n", error);
+			return;
+		}
 	}
 
 	/* Init our MAC address */
@@ -3176,8 +3186,9 @@
 	ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE);
 	NDIS_UNLOCK(sc);
 
-	/* If we're detaching NIC we should call ndis_halt_nic().  */
-	ndis_halt_nic(sc);
+	if (!(sc->ndis_iftype == PNPBus && ndisusb_halt == 0) ||
+	    sc->ndisusb_status & NDISUSB_STATUS_DETACH)
+		ndis_halt_nic(sc);
 
 	NDIS_LOCK(sc);
 	for (i = 0; i < NDIS_EVENTS; i++) {



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