From owner-p4-projects@FreeBSD.ORG Mon Dec 22 12:42:06 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 00A531065674; Mon, 22 Dec 2008 12:42:06 +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 B8AA71065673 for ; Mon, 22 Dec 2008 12:42:05 +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 A77B78FC0C for ; Mon, 22 Dec 2008 12:42:05 +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 mBMCg5jY053247 for ; Mon, 22 Dec 2008 12:42:05 GMT (envelope-from weongyo@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id mBMCg5M2053245 for perforce@freebsd.org; Mon, 22 Dec 2008 12:42:05 GMT (envelope-from weongyo@FreeBSD.org) Date: Mon, 22 Dec 2008 12:42:05 GMT Message-Id: <200812221242.mBMCg5M2053245@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 155117 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: Mon, 22 Dec 2008 12:42:06 -0000 http://perforce.freebsd.org/chv.cgi?CH=155117 Change 155117 by weongyo@weongyo_ws on 2008/12/22 12:41:27 change our tactics to detach USB NDIS driver already attached and working to send a `SURPRISE REMOVED' PNP event to the NDIS driver's handler if they have then try to cacel timers for buggy NDIS driver. As last, it try to halt the device using ndis_halt_nic(). Until the previous version, most drivers I've tested worked to attach the device but there were problems to detach, for example, panics, page faults or unknown system hang (serial-console didn't work to enter DDB). Now it looks it becomes more stable to detach USB adapters. Affected files ... .. //depot/projects/ndisusb/sys/dev/if_ndis/if_ndis_usb.c#5 edit Differences ... ==== //depot/projects/ndisusb/sys/dev/if_ndis/if_ndis_usb.c#5 (text+ko) ==== @@ -65,6 +65,7 @@ #include #include #include +#include #include SYSCTL_NODE(_hw, OID_AUTO, ndisusb, CTLFLAG_RD, 0, "NDIS USB driver parameters"); @@ -233,6 +234,9 @@ sc->ndisusb_iin_buf = NULL; } + ndis_pnpevent_nic(self, NDIS_PNP_EVENT_SURPRISE_REMOVED); + ndis_cancel_timerlist(); + usbd_add_drv_event(USB_EVENT_DRIVER_DETACH, uaa->device, self); return ndis_detach(self);