From owner-svn-src-all@FreeBSD.ORG Fri Aug 19 09:01:34 2011 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 707561065672; Fri, 19 Aug 2011 09:01:34 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5FB7E8FC08; Fri, 19 Aug 2011 09:01:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7J91Y6f095450; Fri, 19 Aug 2011 09:01:34 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7J91YHR095448; Fri, 19 Aug 2011 09:01:34 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201108190901.p7J91YHR095448@svn.freebsd.org> From: Hans Petter Selasky Date: Fri, 19 Aug 2011 09:01:34 +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: r225000 - head/sys/dev/usb 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, 19 Aug 2011 09:01:34 -0000 Author: hselasky Date: Fri Aug 19 09:01:34 2011 New Revision: 225000 URL: http://svn.freebsd.org/changeset/base/225000 Log: Add sysctl to not reset the device on clear stall failures, to temporarily mitigate problems with VMs. Approved by: re (kib) MFC after: 1 week Modified: head/sys/dev/usb/usb_request.c Modified: head/sys/dev/usb/usb_request.c ============================================================================== --- head/sys/dev/usb/usb_request.c Fri Aug 19 08:29:10 2011 (r224999) +++ head/sys/dev/usb/usb_request.c Fri Aug 19 09:01:34 2011 (r225000) @@ -67,6 +67,11 @@ #include #include +static int usb_no_cs_fail; + +SYSCTL_INT(_hw_usb, OID_AUTO, no_cs_fail, CTLFLAG_RW, + &usb_no_cs_fail, 0, "USB clear stall failures are ignored, if set"); + #ifdef USB_DEBUG static int usb_pr_poll_delay = USB_PORT_RESET_DELAY; static int usb_pr_recovery_delay = USB_PORT_RESET_RECOVERY; @@ -238,7 +243,7 @@ usb_do_clear_stall_callback(struct usb_x switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: - +tr_transferred: /* reset error counter */ udev->clear_stall_errors = 0; @@ -297,6 +302,13 @@ tr_setup: break; DPRINTF("Clear stall failed.\n"); + + /* + * Some VMs like VirtualBox always return failure on + * clear-stall which we sometimes should just ignore. + */ + if (usb_no_cs_fail) + goto tr_transferred; if (udev->clear_stall_errors == USB_CS_RESET_LIMIT) goto tr_setup;