summaryrefslogtreecommitdiffstats
path: root/sys/dev/usb/usb_request.c
diff options
context:
space:
mode:
authorhselasky <hselasky@FreeBSD.org>2011-08-19 09:01:34 +0000
committerhselasky <hselasky@FreeBSD.org>2011-08-19 09:01:34 +0000
commit867f8b172a259a86dfad1dde86cbf6e31ebf1959 (patch)
treecd5f5742ec579d282ede567c6681719f59522192 /sys/dev/usb/usb_request.c
parentb8fd2dd0fde3a036af67a6ffd6ddbc2755167116 (diff)
downloadFreeBSD-src-867f8b172a259a86dfad1dde86cbf6e31ebf1959.zip
FreeBSD-src-867f8b172a259a86dfad1dde86cbf6e31ebf1959.tar.gz
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
Diffstat (limited to 'sys/dev/usb/usb_request.c')
-rw-r--r--sys/dev/usb/usb_request.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/sys/dev/usb/usb_request.c b/sys/dev/usb/usb_request.c
index fc47bbf..347f946 100644
--- a/sys/dev/usb/usb_request.c
+++ b/sys/dev/usb/usb_request.c
@@ -67,6 +67,11 @@
#include <dev/usb/usb_bus.h>
#include <sys/ctype.h>
+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_xfer *xfer, usb_error_t error)
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;
OpenPOWER on IntegriCloud