Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

USB: Dealias -110 code (more complete)

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>

authored by

Pete Zaitcev and committed by
Greg Kroah-Hartman
38e2bfc9 ec17cf1c

+48 -60
+4 -7
Documentation/usb/error-codes.txt
··· 98 98 error, a failure to respond (often caused by 99 99 device disconnect), or some other fault. 100 100 101 - -ETIMEDOUT (**) No response packet received within the prescribed 101 + -ETIME (**) No response packet received within the prescribed 102 102 bus turn-around time. This error may instead be 103 103 reported as -EPROTO or -EILSEQ. 104 104 105 - Note that the synchronous USB message functions 106 - also use this code to indicate timeout expired 107 - before the transfer completed. 105 + -ETIMEDOUT Synchronous USB message functions use this code 106 + to indicate timeout expired before the transfer 107 + completed, and no other error was reported by HC. 108 108 109 109 -EPIPE (**) Endpoint stalled. For non-control endpoints, 110 110 reset this status with usb_clear_halt(). ··· 163 163 usb_control_msg(): 164 164 usb_bulk_msg(): 165 165 -ETIMEDOUT Timeout expired before the transfer completed. 166 - In the future this code may change to -ETIME, 167 - whose definition is a closer match to this sort 168 - of error.
+1 -1
drivers/isdn/gigaset/bas-gigaset.c
··· 192 192 return "bit stuffing error, timeout, or unknown USB error"; 193 193 case -EILSEQ: 194 194 return "CRC mismatch, timeout, or unknown USB error"; 195 - case -ETIMEDOUT: 195 + case -ETIME: 196 196 return "timed out"; 197 197 case -EPIPE: 198 198 return "endpoint stalled";
+3 -3
drivers/isdn/hisax/hfc_usb.h
··· 137 137 {-ENXIO, "URB already queued"}, 138 138 {-EFBIG, "Too much ISO frames requested"}, 139 139 {-ENOSR, "Buffer error (overrun)"}, 140 - {-EPIPE, "Specified endpoint is stalled (device not responding)"}, 140 + {-EPIPE, "Specified endpoint is stalled"}, 141 141 {-EOVERFLOW, "Babble (bad cable?)"}, 142 142 {-EPROTO, "Bit-stuff error (bad cable?)"}, 143 - {-EILSEQ, "CRC/Timeout"}, 144 - {-ETIMEDOUT, "NAK (device does not respond)"}, 143 + {-EILSEQ, "CRC or missing token"}, 144 + {-ETIME, "Device did not respond"}, 145 145 {-ESHUTDOWN, "Device unplugged"}, 146 146 {-1, NULL} 147 147 };
-1
drivers/media/dvb/dvb-usb/dvb-usb-urb.c
··· 80 80 81 81 switch (urb->status) { 82 82 case 0: /* success */ 83 - case -ETIMEDOUT: /* NAK */ 84 83 break; 85 84 case -ECONNRESET: /* kill */ 86 85 case -ENOENT:
+1 -1
drivers/media/dvb/ttusb-dec/ttusb_dec.c
··· 215 215 case -ECONNRESET: 216 216 case -ENOENT: 217 217 case -ESHUTDOWN: 218 - case -ETIMEDOUT: 218 + case -ETIME: 219 219 /* this urb is dead, cleanup */ 220 220 dprintk("%s:urb shutting down with status: %d\n", 221 221 __FUNCTION__, urb->status);
+4 -3
drivers/media/video/ov511.c
··· 301 301 static struct symbolic_list urb_errlist[] = { 302 302 { -ENOSR, "Buffer error (overrun)" }, 303 303 { -EPIPE, "Stalled (device not responding)" }, 304 - { -EOVERFLOW, "Babble (bad cable?)" }, 304 + { -EOVERFLOW, "Babble (device sends too much data)" }, 305 305 { -EPROTO, "Bit-stuff error (bad cable?)" }, 306 - { -EILSEQ, "CRC/Timeout" }, 307 - { -ETIMEDOUT, "NAK (device does not respond)" }, 306 + { -EILSEQ, "CRC/Timeout (bad cable?)" }, 307 + { -ETIME, "Device does not respond to token" }, 308 + { -ETIMEDOUT, "Device does not respond to command" }, 308 309 { -1, NULL } 309 310 }; 310 311
+1 -1
drivers/media/video/pwc/pwc-if.c
··· 711 711 case -EOVERFLOW: errmsg = "Babble (bad cable?)"; break; 712 712 case -EPROTO: errmsg = "Bit-stuff error (bad cable?)"; break; 713 713 case -EILSEQ: errmsg = "CRC/Timeout (could be anything)"; break; 714 - case -ETIMEDOUT: errmsg = "NAK (device does not respond)"; break; 714 + case -ETIME: errmsg = "Device does not respond"; break; 715 715 } 716 716 PWC_DEBUG_FLOW("pwc_isoc_handler() called with status %d [%s].\n", urb->status, errmsg); 717 717 /* Give up after a number of contiguous errors on the USB bus.
+3 -4
drivers/media/video/w9968cf.c
··· 586 586 { -EFBIG, "Too much ISO frames requested" }, 587 587 { -ENOSR, "Buffer error (overrun)" }, 588 588 { -EPIPE, "Specified endpoint is stalled (device not responding)"}, 589 - { -EOVERFLOW, "Babble (bad cable?)" }, 589 + { -EOVERFLOW, "Babble (too much data)" }, 590 590 { -EPROTO, "Bit-stuff error (bad cable?)" }, 591 591 { -EILSEQ, "CRC/Timeout" }, 592 - { -ETIMEDOUT, "NAK (device does not respond)" }, 592 + { -ETIME, "Device does not respond to token" }, 593 + { -ETIMEDOUT, "Device does not respond to command" }, 593 594 { -1, NULL } 594 595 }; 595 - 596 - 597 596 598 597 /**************************************************************************** 599 598 * Memory management functions *
+7 -11
drivers/net/irda/irda-usb.c
··· 671 671 * Jean II */ 672 672 done = 1; 673 673 break; 674 - case -ECONNABORTED: /* -103 */ 675 - case -ECONNRESET: /* -104 */ 676 - case -ETIMEDOUT: /* -110 */ 677 - case -ENOENT: /* -2 (urb unlinked by us) */ 674 + case -ECONNRESET: 675 + case -ENOENT: /* urb unlinked by us */ 678 676 default: /* ??? - Play safe */ 679 677 urb->status = 0; 680 678 netif_wake_queue(self->netdev); ··· 710 712 * Jean II */ 711 713 done = 1; 712 714 break; 713 - case -ECONNABORTED: /* -103 */ 714 - case -ECONNRESET: /* -104 */ 715 - case -ETIMEDOUT: /* -110 */ 716 - case -ENOENT: /* -2 (urb unlinked by us) */ 715 + case -ECONNRESET: 716 + case -ENOENT: /* urb unlinked by us */ 717 717 default: /* ??? - Play safe */ 718 718 if(skb != NULL) { 719 719 dev_kfree_skb_any(skb); ··· 841 845 self->stats.rx_crc_errors++; 842 846 /* Also precursor to a hot-unplug on UHCI. */ 843 847 /* Fallthrough... */ 844 - case -ECONNRESET: /* -104 */ 848 + case -ECONNRESET: 845 849 /* Random error, if I remember correctly */ 846 850 /* uhci_cleanup_unlink() is going to kill the Rx 847 851 * URB just after we return. No problem, at this 848 852 * point the URB will be idle ;-) - Jean II */ 849 - case -ESHUTDOWN: /* -108 */ 853 + case -ESHUTDOWN: 850 854 /* That's usually a hot-unplug. Submit will fail... */ 851 - case -ETIMEDOUT: /* -110 */ 855 + case -ETIME: 852 856 /* Usually precursor to a hot-unplug on OHCI. */ 853 857 default: 854 858 self->stats.rx_errors++;
+2 -2
drivers/net/wireless/zd1201.c
··· 119 119 switch(urb->status) { 120 120 case -EILSEQ: 121 121 case -ENODEV: 122 - case -ETIMEDOUT: 122 + case -ETIME: 123 123 case -ENOENT: 124 124 case -EPIPE: 125 125 case -EOVERFLOW: ··· 201 201 switch(urb->status) { 202 202 case -EILSEQ: 203 203 case -ENODEV: 204 - case -ETIMEDOUT: 204 + case -ETIME: 205 205 case -ENOENT: 206 206 case -EPIPE: 207 207 case -EOVERFLOW:
+1 -1
drivers/usb/host/isp116x.h
··· 233 233 /* Bit Stuff */ -EPROTO, 234 234 /* Data Togg */ -EILSEQ, 235 235 /* Stall */ -EPIPE, 236 - /* DevNotResp */ -ETIMEDOUT, 236 + /* DevNotResp */ -ETIME, 237 237 /* PIDCheck */ -EPROTO, 238 238 /* UnExpPID */ -EPROTO, 239 239 /* DataOver */ -EOVERFLOW,
+1 -1
drivers/usb/host/ohci.h
··· 159 159 /* Bit Stuff */ -EPROTO, 160 160 /* Data Togg */ -EILSEQ, 161 161 /* Stall */ -EPIPE, 162 - /* DevNotResp */ -ETIMEDOUT, 162 + /* DevNotResp */ -ETIME, 163 163 /* PIDCheck */ -EPROTO, 164 164 /* UnExpPID */ -EPROTO, 165 165 /* DataOver */ -EOVERFLOW,
+1 -1
drivers/usb/host/sl811-hcd.c
··· 597 597 /* error? retry, until "3 strikes" */ 598 598 } else if (++ep->error_count >= 3) { 599 599 if (status & SL11H_STATMASK_TMOUT) 600 - urbstat = -ETIMEDOUT; 600 + urbstat = -ETIME; 601 601 else if (status & SL11H_STATMASK_OVF) 602 602 urbstat = -EOVERFLOW; 603 603 else
+2 -1
drivers/usb/input/hid-core.c
··· 1023 1023 return; 1024 1024 case -EILSEQ: /* protocol error or unplug */ 1025 1025 case -EPROTO: /* protocol error or unplug */ 1026 - case -ETIMEDOUT: /* NAK */ 1026 + case -ETIME: /* protocol error or unplug */ 1027 + case -ETIMEDOUT: /* Should never happen, but... */ 1027 1028 clear_bit(HID_IN_RUNNING, &hid->iofl); 1028 1029 hid_io_error(hid); 1029 1030 return;
+1 -1
drivers/usb/input/itmtouch.c
··· 87 87 case 0: 88 88 /* success */ 89 89 break; 90 - case -ETIMEDOUT: 90 + case -ETIME: 91 91 /* this urb is timing out */ 92 92 dbg("%s - urb timed out - was the device unplugged?", 93 93 __FUNCTION__);
+1 -1
drivers/usb/input/mtouchusb.c
··· 107 107 case 0: 108 108 /* success */ 109 109 break; 110 - case -ETIMEDOUT: 110 + case -ETIME: 111 111 /* this urb is timing out */ 112 112 dbg("%s - urb timed out - was the device unplugged?", 113 113 __FUNCTION__);
+1 -1
drivers/usb/input/touchkitusb.c
··· 201 201 case 0: 202 202 /* success */ 203 203 break; 204 - case -ETIMEDOUT: 204 + case -ETIME: 205 205 /* this urb is timing out */ 206 206 dbg("%s - urb timed out - was the device unplugged?", 207 207 __FUNCTION__);
+1 -1
drivers/usb/input/usbtouchscreen.c
··· 508 508 case 0: 509 509 /* success */ 510 510 break; 511 - case -ETIMEDOUT: 511 + case -ETIME: 512 512 /* this urb is timing out */ 513 513 dbg("%s - urb timed out - was the device unplugged?", 514 514 __FUNCTION__);
+2 -2
drivers/usb/misc/auerswald.c
··· 806 806 0 Initial, OK 807 807 -EINPROGRESS during submission until end 808 808 -ENOENT if urb is unlinked 809 - -ETIMEDOUT Transfer timed out, NAK 809 + -ETIME Device did not respond 810 810 -ENOMEM Memory Overflow 811 811 -ENODEV Specified USB-device or bus doesn't exist 812 812 -ENXIO URB already queued ··· 832 832 { 833 833 switch (status) { 834 834 case 0: 835 - case -ETIMEDOUT: 835 + case -ETIME: 836 836 case -EOVERFLOW: 837 837 case -EAGAIN: 838 838 case -EPIPE:
+1 -1
drivers/usb/net/pegasus.c
··· 619 619 switch (urb->status) { 620 620 case 0: 621 621 break; 622 - case -ETIMEDOUT: 622 + case -ETIME: 623 623 if (netif_msg_rx_err(pegasus)) 624 624 pr_debug("%s: reset MAC\n", net->name); 625 625 pegasus->flags &= ~PEGASUS_RX_BUSY;
+1 -1
drivers/usb/net/rtl8150.c
··· 438 438 break; 439 439 case -ENOENT: 440 440 return; /* the urb is in unlink state */ 441 - case -ETIMEDOUT: 441 + case -ETIME: 442 442 warn("may be reset is needed?.."); 443 443 goto goon; 444 444 default:
+6 -6
drivers/usb/net/usbnet.c
··· 425 425 // we get controller i/o faults during khubd disconnect() delays. 426 426 // throttle down resubmits, to avoid log floods; just temporarily, 427 427 // so we still recover when the fault isn't a khubd delay. 428 - case -EPROTO: // ehci 429 - case -ETIMEDOUT: // ohci 430 - case -EILSEQ: // uhci 428 + case -EPROTO: 429 + case -ETIME: 430 + case -EILSEQ: 431 431 dev->stats.rx_errors++; 432 432 if (!timer_pending (&dev->delay)) { 433 433 mod_timer (&dev->delay, jiffies + THROTTLE_JIFFIES); ··· 821 821 822 822 // like rx, tx gets controller i/o faults during khubd delays 823 823 // and so it uses the same throttling mechanism. 824 - case -EPROTO: // ehci 825 - case -ETIMEDOUT: // ohci 826 - case -EILSEQ: // uhci 824 + case -EPROTO: 825 + case -ETIME: 826 + case -EILSEQ: 827 827 if (!timer_pending (&dev->delay)) { 828 828 mod_timer (&dev->delay, 829 829 jiffies + THROTTLE_JIFFIES);
-5
drivers/usb/storage/transport.c
··· 294 294 return USB_STOR_XFER_ERROR; 295 295 return USB_STOR_XFER_STALLED; 296 296 297 - /* timeout or excessively long NAK */ 298 - case -ETIMEDOUT: 299 - US_DEBUGP("-- timeout or NAK\n"); 300 - return USB_STOR_XFER_ERROR; 301 - 302 297 /* babble - the device tried to send more than we wanted to read */ 303 298 case -EOVERFLOW: 304 299 US_DEBUGP("-- babble\n");
+3 -3
sound/usb/usbmidi.c
··· 181 181 case -ENODEV: 182 182 return -ENODEV; 183 183 /* errors that might occur during unplugging */ 184 - case -EPROTO: /* EHCI */ 185 - case -ETIMEDOUT: /* OHCI */ 186 - case -EILSEQ: /* UHCI */ 184 + case -EPROTO: 185 + case -ETIME: 186 + case -EILSEQ: 187 187 return -EIO; 188 188 default: 189 189 snd_printk(KERN_ERR "urb status %d\n", status);