summaryrefslogtreecommitdiff
path: root/drivers/net/wimax/i2400m/usb-fw.c
diff options
context:
space:
mode:
authorInaky Perez-Gonzalez <inaky@linux.intel.com>2009-10-20 11:10:59 +0900
committerInaky Perez-Gonzalez <inaky@linux.intel.com>2009-11-03 12:49:40 -0800
commitfaf57162e462eafe87458e21bf641f9d138f8171 (patch)
treec59c3a457768924a37b2feb80125b35cd15ac056 /drivers/net/wimax/i2400m/usb-fw.c
parentfae92216da87d1c78aa51c4503acb312a47266e9 (diff)
downloadlwn-faf57162e462eafe87458e21bf641f9d138f8171.tar.gz
lwn-faf57162e462eafe87458e21bf641f9d138f8171.zip
wimax/i2400m: handle USB stalls
When the device stalls, clear it and retry; if it keeps failing too often, reset the device. This specially happens when running on virtual machines; the real hardware doesn't seem to trip on stalls too much, except for a few reports in the mailing list (still to be confirmed this is the cause, although it seems likely. NOTE: it is not clear if the URB has to be resubmitted fully or start only at the offset of the first transaction sent. Can't find documentation to clarify one end or the other. Tests that just resubmit the whole URB seemed to work in my environment. Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Diffstat (limited to 'drivers/net/wimax/i2400m/usb-fw.c')
-rw-r--r--drivers/net/wimax/i2400m/usb-fw.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/net/wimax/i2400m/usb-fw.c b/drivers/net/wimax/i2400m/usb-fw.c
index 8ec8b6d56a13..d8f6ce29efff 100644
--- a/drivers/net/wimax/i2400m/usb-fw.c
+++ b/drivers/net/wimax/i2400m/usb-fw.c
@@ -113,6 +113,28 @@ retry:
}
result = len;
break;
+ case -EPIPE:
+ /*
+ * Stall -- maybe the device is choking with our
+ * requests. Clear it and give it some time. If they
+ * happen to often, it might be another symptom, so we
+ * reset.
+ *
+ * No error handling for usb_clear_halt(0; if it
+ * works, the retry works; if it fails, this switch
+ * does the error handling for us.
+ */
+ if (edc_inc(&i2400mu->urb_edc,
+ 10 * EDC_MAX_ERRORS, EDC_ERROR_TIMEFRAME)) {
+ dev_err(dev, "BM-CMD: too many stalls in "
+ "URB; resetting device\n");
+ usb_queue_reset_device(i2400mu->usb_iface);
+ /* fallthrough */
+ } else {
+ usb_clear_halt(i2400mu->usb_dev, pipe);
+ msleep(10); /* give the device some time */
+ goto retry;
+ }
case -EINVAL: /* while removing driver */
case -ENODEV: /* dev disconnect ... */
case -ENOENT: /* just ignore it */