USB: Dealias -110 code (more complete)
authorPete Zaitcev <zaitcev@redhat.com>
Tue, 19 Sep 2006 05:49:02 +0000 (22:49 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 27 Sep 2006 18:59:00 +0000 (11:59 -0700)
The purpose of this patch is to split off the case when a device does
not reply on the lower level (which is reported by HC hardware), and
a case when the device accepted the request, but does not reply at
upper level. This redefinition allows to diagnose issues easier,
without asking the user if the -110 happened "immediately".

The usbmon splits such cases already thanks to its timestamp, but
it's not always available.

I adjusted all drivers which I found affected (by searching for "urb").
Out of tree drivers may suffer a little bit, but I do not expect much
breakage. At worst they may print a few messages.

Signed-off-by: Pete Zaitcev <zaitcev@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
24 files changed:
Documentation/usb/error-codes.txt
drivers/isdn/gigaset/bas-gigaset.c
drivers/isdn/hisax/hfc_usb.h
drivers/media/dvb/dvb-usb/dvb-usb-urb.c
drivers/media/dvb/ttusb-dec/ttusb_dec.c
drivers/media/video/ov511.c
drivers/media/video/pwc/pwc-if.c
drivers/media/video/w9968cf.c
drivers/net/irda/irda-usb.c
drivers/net/wireless/zd1201.c
drivers/usb/host/isp116x.h
drivers/usb/host/ohci.h
drivers/usb/host/sl811-hcd.c
drivers/usb/input/hid-core.c
drivers/usb/input/itmtouch.c
drivers/usb/input/mtouchusb.c
drivers/usb/input/touchkitusb.c
drivers/usb/input/usbtouchscreen.c
drivers/usb/misc/auerswald.c
drivers/usb/net/pegasus.c
drivers/usb/net/rtl8150.c
drivers/usb/net/usbnet.c
drivers/usb/storage/transport.c
sound/usb/usbmidi.c

index 867f4c38f3564ae8fcfa8aa92df2b8eb41cfa31a..39c68f8c4e6c7cd8969fa1f0ae03a1afd1bcc424 100644 (file)
@@ -98,13 +98,13 @@ one or more packets could finish before an error stops further endpoint I/O.
                        error, a failure to respond (often caused by
                        device disconnect), or some other fault.
 
--ETIMEDOUT (**)                No response packet received within the prescribed
+-ETIME (**)            No response packet received within the prescribed
                        bus turn-around time.  This error may instead be
                        reported as -EPROTO or -EILSEQ.
 
-                       Note that the synchronous USB message functions
-                       also use this code to indicate timeout expired
-                       before the transfer completed.
+-ETIMEDOUT             Synchronous USB message functions use this code
+                       to indicate timeout expired before the transfer
+                       completed, and no other error was reported by HC.
 
 -EPIPE (**)            Endpoint stalled.  For non-control endpoints,
                        reset this status with usb_clear_halt().
@@ -163,6 +163,3 @@ usb_get_*/usb_set_*():
 usb_control_msg():
 usb_bulk_msg():
 -ETIMEDOUT             Timeout expired before the transfer completed.
-                       In the future this code may change to -ETIME,
-                       whose definition is a closer match to this sort
-                       of error.
index 3845defd49010b840f781740ddbc7d5290e15f5d..5cfbe6a380101cb2f099b83acbb124e4b09e70a2 100644 (file)
@@ -192,7 +192,7 @@ static char *get_usb_statmsg(int status)
                return "bit stuffing error, timeout, or unknown USB error";
        case -EILSEQ:
                return "CRC mismatch, timeout, or unknown USB error";
-       case -ETIMEDOUT:
+       case -ETIME:
                return "timed out";
        case -EPIPE:
                return "endpoint stalled";
index ec52c1a7c22afca97308f353e139eead2dd2b33a..6349367ed48096a93c436be1e5bfb84deb817873 100644 (file)
@@ -137,11 +137,11 @@ static struct hfcusb_symbolic_list urb_errlist[] = {
        {-ENXIO, "URB already queued"},
        {-EFBIG, "Too much ISO frames requested"},
        {-ENOSR, "Buffer error (overrun)"},
-       {-EPIPE, "Specified endpoint is stalled (device not responding)"},
+       {-EPIPE, "Specified endpoint is stalled"},
        {-EOVERFLOW, "Babble (bad cable?)"},
        {-EPROTO, "Bit-stuff error (bad cable?)"},
-       {-EILSEQ, "CRC/Timeout"},
-       {-ETIMEDOUT, "NAK (device does not respond)"},
+       {-EILSEQ, "CRC or missing token"},
+       {-ETIME, "Device did not respond"},
        {-ESHUTDOWN, "Device unplugged"},
        {-1, NULL}
 };
index 9002f35aa952822f7144b15bfeddf76fff08c2b8..88b283731bb8c84e1dcf7c4a90cc15b0604fd1c6 100644 (file)
@@ -80,7 +80,6 @@ static void dvb_usb_urb_complete(struct urb *urb, struct pt_regs *ptregs)
 
        switch (urb->status) {
                case 0:         /* success */
-               case -ETIMEDOUT:    /* NAK */
                        break;
                case -ECONNRESET:   /* kill */
                case -ENOENT:
index 6c1cb770bcf5d28ccecd3ea2d743fc7099bea056..c9d663549dff849cff3666ed72a1c4af2e790dbf 100644 (file)
@@ -215,7 +215,7 @@ static void ttusb_dec_handle_irq( struct urb *urb, struct pt_regs *regs)
                case -ECONNRESET:
                case -ENOENT:
                case -ESHUTDOWN:
-               case -ETIMEDOUT:
+               case -ETIME:
                        /* this urb is dead, cleanup */
                        dprintk("%s:urb shutting down with status: %d\n",
                                        __FUNCTION__, urb->status);
index 1b07a61c2ebb7dd98854e7d40dcea077189868cb..5d8cd283fcd8e747767eb5b4e7e6470be5568322 100644 (file)
@@ -301,10 +301,11 @@ static struct symbolic_list senlist[] = {
 static struct symbolic_list urb_errlist[] = {
        { -ENOSR,       "Buffer error (overrun)" },
        { -EPIPE,       "Stalled (device not responding)" },
-       { -EOVERFLOW,   "Babble (bad cable?)" },
+       { -EOVERFLOW,   "Babble (device sends too much data)" },
        { -EPROTO,      "Bit-stuff error (bad cable?)" },
-       { -EILSEQ,      "CRC/Timeout" },
-       { -ETIMEDOUT,   "NAK (device does not respond)" },
+       { -EILSEQ,      "CRC/Timeout (bad cable?)" },
+       { -ETIME,       "Device does not respond to token" },
+       { -ETIMEDOUT,   "Device does not respond to command" },
        { -1, NULL }
 };
 
index d4703944df9c12c39bb719b311da043da60cb1d9..53c4b5790d5c6dd8aa08bf132dee83c611f0ef27 100644 (file)
@@ -711,7 +711,7 @@ static void pwc_isoc_handler(struct urb *urb, struct pt_regs *regs)
                        case -EOVERFLOW:        errmsg = "Babble (bad cable?)"; break;
                        case -EPROTO:           errmsg = "Bit-stuff error (bad cable?)"; break;
                        case -EILSEQ:           errmsg = "CRC/Timeout (could be anything)"; break;
-                       case -ETIMEDOUT:        errmsg = "NAK (device does not respond)"; break;
+                       case -ETIME:            errmsg = "Device does not respond"; break;
                }
                PWC_DEBUG_FLOW("pwc_isoc_handler() called with status %d [%s].\n", urb->status, errmsg);
                /* Give up after a number of contiguous errors on the USB bus.
index 20f211b55ad4c4d17726c579affbfa8cccfb7e46..2912326a5aef1c6adace62d91a25bd2b8d930ea1 100644 (file)
@@ -586,15 +586,14 @@ static struct w9968cf_symbolic_list urb_errlist[] = {
        { -EFBIG,     "Too much ISO frames requested" },
        { -ENOSR,     "Buffer error (overrun)" },
        { -EPIPE,     "Specified endpoint is stalled (device not responding)"},
-       { -EOVERFLOW, "Babble (bad cable?)" },
+       { -EOVERFLOW, "Babble (too much data)" },
        { -EPROTO,    "Bit-stuff error (bad cable?)" },
        { -EILSEQ,    "CRC/Timeout" },
-       { -ETIMEDOUT, "NAK (device does not respond)" },
+       { -ETIME,     "Device does not respond to token" },
+       { -ETIMEDOUT, "Device does not respond to command" },
        { -1, NULL }
 };
 
-
-
 /****************************************************************************
  * Memory management functions                                              *
  ****************************************************************************/
index 2a0d538b387fca39f69414aca82d6060ea371a0c..383cef1f5999fbe93e994ddaad893ea7a113d6f1 100644 (file)
@@ -671,10 +671,8 @@ static void irda_usb_net_timeout(struct net_device *netdev)
                         * Jean II */
                        done = 1;
                        break;
-               case -ECONNABORTED:             /* -103 */
-               case -ECONNRESET:               /* -104 */
-               case -ETIMEDOUT:                /* -110 */
-               case -ENOENT:                   /* -2 (urb unlinked by us)  */
+               case -ECONNRESET:
+               case -ENOENT:                   /* urb unlinked by us */
                default:                        /* ??? - Play safe */
                        urb->status = 0;
                        netif_wake_queue(self->netdev);
@@ -712,10 +710,8 @@ static void irda_usb_net_timeout(struct net_device *netdev)
                         * Jean II */
                        done = 1;
                        break;
-               case -ECONNABORTED:             /* -103 */
-               case -ECONNRESET:               /* -104 */
-               case -ETIMEDOUT:                /* -110 */
-               case -ENOENT:                   /* -2 (urb unlinked by us)  */
+               case -ECONNRESET:
+               case -ENOENT:                   /* urb unlinked by us */
                default:                        /* ??? - Play safe */
                        if(skb != NULL) {
                                dev_kfree_skb_any(skb);
@@ -845,14 +841,14 @@ static void irda_usb_receive(struct urb *urb, struct pt_regs *regs)
                        self->stats.rx_crc_errors++;    
                        /* Also precursor to a hot-unplug on UHCI. */
                        /* Fallthrough... */
-               case -ECONNRESET:               /* -104 */
+               case -ECONNRESET:
                        /* Random error, if I remember correctly */
                        /* uhci_cleanup_unlink() is going to kill the Rx
                         * URB just after we return. No problem, at this
                         * point the URB will be idle ;-) - Jean II */
-               case -ESHUTDOWN:                /* -108 */
+               case -ESHUTDOWN:
                        /* That's usually a hot-unplug. Submit will fail... */
-               case -ETIMEDOUT:                /* -110 */
+               case -ETIME:
                        /* Usually precursor to a hot-unplug on OHCI. */
                default:
                        self->stats.rx_errors++;
index c52e9bcf8d02f3fc688de9d7f1c17c49b51c9288..f50ec10675d12b3cdfb2c873e9febdf6886af968 100644 (file)
@@ -119,7 +119,7 @@ static void zd1201_usbfree(struct urb *urb, struct pt_regs *regs)
        switch(urb->status) {
                case -EILSEQ:
                case -ENODEV:
-               case -ETIMEDOUT:
+               case -ETIME:
                case -ENOENT:
                case -EPIPE:
                case -EOVERFLOW:
@@ -201,7 +201,7 @@ static void zd1201_usbrx(struct urb *urb, struct pt_regs *regs)
        switch(urb->status) {
                case -EILSEQ:
                case -ENODEV:
-               case -ETIMEDOUT:
+               case -ETIME:
                case -ENOENT:
                case -EPIPE:
                case -EOVERFLOW:
index a1b7c3813d3a955321d08961b0a5fc98faecbff4..b91e2edd9c5c1415ebecfe7aa056cddcb15c4fc6 100644 (file)
@@ -233,7 +233,7 @@ static const int cc_to_error[16] = {
        /* Bit Stuff  */ -EPROTO,
        /* Data Togg  */ -EILSEQ,
        /* Stall      */ -EPIPE,
-       /* DevNotResp */ -ETIMEDOUT,
+       /* DevNotResp */ -ETIME,
        /* PIDCheck   */ -EPROTO,
        /* UnExpPID   */ -EPROTO,
        /* DataOver   */ -EOVERFLOW,
index 650d1bf21c1d88a96f363fc864baa8be481fe64e..93fdc3c353416dd46269532156130f2645547a85 100644 (file)
@@ -159,7 +159,7 @@ static const int cc_to_error [16] = {
        /* Bit Stuff  */               -EPROTO,
        /* Data Togg  */               -EILSEQ,
        /* Stall      */               -EPIPE,
-       /* DevNotResp */               -ETIMEDOUT,
+       /* DevNotResp */               -ETIME,
        /* PIDCheck   */               -EPROTO,
        /* UnExpPID   */               -EPROTO,
        /* DataOver   */               -EOVERFLOW,
index 8c17da37600be23a3bdf9c688ebb2c3f7bd73a09..3a586aab39395580ef2fa68c3b0e393bd9adbc3b 100644 (file)
@@ -597,7 +597,7 @@ done(struct sl811 *sl811, struct sl811h_ep *ep, u8 bank, struct pt_regs *regs)
        /* error? retry, until "3 strikes" */
        } else if (++ep->error_count >= 3) {
                if (status & SL11H_STATMASK_TMOUT)
-                       urbstat = -ETIMEDOUT;
+                       urbstat = -ETIME;
                else if (status & SL11H_STATMASK_OVF)
                        urbstat = -EOVERFLOW;
                else
index fc5b662ea177a36fc9c53f5a1e368c04e09db7c4..2a3e9e9b4b3dc73b2b7d0e801506e21b8040d1a9 100644 (file)
@@ -1023,7 +1023,8 @@ static void hid_irq_in(struct urb *urb, struct pt_regs *regs)
                        return;
                case -EILSEQ:           /* protocol error or unplug */
                case -EPROTO:           /* protocol error or unplug */
-               case -ETIMEDOUT:        /* NAK */
+               case -ETIME:            /* protocol error or unplug */
+               case -ETIMEDOUT:        /* Should never happen, but... */
                        clear_bit(HID_IN_RUNNING, &hid->iofl);
                        hid_io_error(hid);
                        return;
index 86acb5f1907aeebe10e644a53dc37ea02e2781ac..61966d719ca3c577e7c8f4cdbe2999da6dbac0f9 100644 (file)
@@ -87,7 +87,7 @@ static void itmtouch_irq(struct urb *urb, struct pt_regs *regs)
        case 0:
                /* success */
                break;
-       case -ETIMEDOUT:
+       case -ETIME:
                /* this urb is timing out */
                dbg("%s - urb timed out - was the device unplugged?",
                    __FUNCTION__);
index a9ccda8810e00af0fddd555c5326b587efeafeed..5dce951f2751a2eeb8d0a3a2bff79765d924cbca 100644 (file)
@@ -107,7 +107,7 @@ static void mtouchusb_irq(struct urb *urb, struct pt_regs *regs)
        case 0:
                /* success */
                break;
-       case -ETIMEDOUT:
+       case -ETIME:
                /* this urb is timing out */
                dbg("%s - urb timed out - was the device unplugged?",
                    __FUNCTION__);
index 0149043ffb975366b6e41cc3522734773c83ee32..30b9f820e7a894e7b1db04ec347483b5177d3735 100644 (file)
@@ -201,7 +201,7 @@ static void touchkit_irq(struct urb *urb, struct pt_regs *regs)
        case 0:
                /* success */
                break;
-       case -ETIMEDOUT:
+       case -ETIME:
                /* this urb is timing out */
                dbg("%s - urb timed out - was the device unplugged?",
                    __FUNCTION__);
index a1be7840ea0257f20350dc21c1cd708f74d118b8..4640d1000d83c024f54c80876536c62ee61de6dd 100644 (file)
@@ -508,7 +508,7 @@ static void usbtouch_irq(struct urb *urb, struct pt_regs *regs)
        case 0:
                /* success */
                break;
-       case -ETIMEDOUT:
+       case -ETIME:
                /* this urb is timing out */
                dbg("%s - urb timed out - was the device unplugged?",
                    __FUNCTION__);
index 4a329d8488b70e3de782a6e97ff709a0da8c1002..4fd2110b34110066606726197e966eb271b00846 100644 (file)
@@ -806,7 +806,7 @@ static void auerbuf_releasebuf( pauerbuf_t bp)
 0              Initial, OK
 -EINPROGRESS   during submission until end
 -ENOENT                if urb is unlinked
--ETIMEDOUT     Transfer timed out, NAK
+-ETIME         Device did not respond
 -ENOMEM                Memory Overflow
 -ENODEV                Specified USB-device or bus doesn't exist
 -ENXIO         URB already queued
@@ -832,7 +832,7 @@ static int auerswald_status_retry (int status)
 {
        switch (status) {
        case 0:
-       case -ETIMEDOUT:
+       case -ETIME:
        case -EOVERFLOW:
        case -EAGAIN:
        case -EPIPE:
index ab21f960d255f250c01f43912744103ab73cd03f..b8e25af13f023ed8e5c9c6b115f05b28a2ce45c2 100644 (file)
@@ -619,7 +619,7 @@ static void read_bulk_callback(struct urb *urb, struct pt_regs *regs)
        switch (urb->status) {
        case 0:
                break;
-       case -ETIMEDOUT:
+       case -ETIME:
                if (netif_msg_rx_err(pegasus))
                        pr_debug("%s: reset MAC\n", net->name);
                pegasus->flags &= ~PEGASUS_RX_BUSY;
index a72685b96061dfb862a85aa8368e7758ce227089..2364c20993874f381c4975430000a56fb8a4a9a4 100644 (file)
@@ -438,7 +438,7 @@ static void read_bulk_callback(struct urb *urb, struct pt_regs *regs)
                break;
        case -ENOENT:
                return; /* the urb is in unlink state */
-       case -ETIMEDOUT:
+       case -ETIME:
                warn("may be reset is needed?..");
                goto goon;
        default:
index 8e8e74d40530352a8ae7cefb02d550dc593122a4..98a522f1e264412bc7b15971aee924125930eedd 100644 (file)
@@ -425,9 +425,9 @@ static void rx_complete (struct urb *urb, struct pt_regs *regs)
            // we get controller i/o faults during khubd disconnect() delays.
            // throttle down resubmits, to avoid log floods; just temporarily,
            // so we still recover when the fault isn't a khubd delay.
-           case -EPROTO:               // ehci
-           case -ETIMEDOUT:            // ohci
-           case -EILSEQ:               // uhci
+           case -EPROTO:
+           case -ETIME:
+           case -EILSEQ:
                dev->stats.rx_errors++;
                if (!timer_pending (&dev->delay)) {
                        mod_timer (&dev->delay, jiffies + THROTTLE_JIFFIES);
@@ -821,9 +821,9 @@ static void tx_complete (struct urb *urb, struct pt_regs *regs)
 
                // like rx, tx gets controller i/o faults during khubd delays
                // and so it uses the same throttling mechanism.
-               case -EPROTO:           // ehci
-               case -ETIMEDOUT:        // ohci
-               case -EILSEQ:           // uhci
+               case -EPROTO:
+               case -ETIME:
+               case -EILSEQ:
                        if (!timer_pending (&dev->delay)) {
                                mod_timer (&dev->delay,
                                        jiffies + THROTTLE_JIFFIES);
index d6acc92a4ae36ac66757450f9522f7cb667128f6..f23514c4e649bdd6947ce0301cf730e2344ef540 100644 (file)
@@ -294,11 +294,6 @@ static int interpret_urb_result(struct us_data *us, unsigned int pipe,
                        return USB_STOR_XFER_ERROR;
                return USB_STOR_XFER_STALLED;
 
-       /* timeout or excessively long NAK */
-       case -ETIMEDOUT:
-               US_DEBUGP("-- timeout or NAK\n");
-               return USB_STOR_XFER_ERROR;
-
        /* babble - the device tried to send more than we wanted to read */
        case -EOVERFLOW:
                US_DEBUGP("-- babble\n");
index 5105b6b057484ffb0408e509e90f70a45e3d799e..abe29dadd979365e01d1458ac00531dd292d1984 100644 (file)
@@ -181,9 +181,9 @@ static int snd_usbmidi_urb_error(int status)
        case -ENODEV:
                return -ENODEV;
        /* errors that might occur during unplugging */
-       case -EPROTO:    /* EHCI */
-       case -ETIMEDOUT: /* OHCI */
-       case -EILSEQ:    /* UHCI */
+       case -EPROTO:
+       case -ETIME:
+       case -EILSEQ:
                return -EIO;
        default:
                snd_printk(KERN_ERR "urb status %d\n", status);