From owner-p4-projects@FreeBSD.ORG Sat Dec 20 10:45:51 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 276201065675; Sat, 20 Dec 2008 10:45:51 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DFE371065670 for ; Sat, 20 Dec 2008 10:45:50 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id CFBE08FC13 for ; Sat, 20 Dec 2008 10:45:50 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id mBKAjoDb002195 for ; Sat, 20 Dec 2008 10:45:50 GMT (envelope-from weongyo@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id mBKAjo1e002193 for perforce@freebsd.org; Sat, 20 Dec 2008 10:45:50 GMT (envelope-from weongyo@FreeBSD.org) Date: Sat, 20 Dec 2008 10:45:50 GMT Message-Id: <200812201045.mBKAjo1e002193@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to weongyo@FreeBSD.org using -f From: Weongyo Jeong To: Perforce Change Reviews Cc: Subject: PERFORCE change 155052 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Dec 2008 10:45:51 -0000 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++) {