I encounter the following problem with a USB3 camera device using kernel version 4.8.10 but also with previous kernel versions. The camera device is transmitting image data via endpoint 0x82 to the host. If the data from the device could not be transmitted in time the device is going to stall the endpoint. When the stalled endpoint condition is detected by our userspace driver we cancel all previously submitted URBs. Afterwards a 'Clear Feature' is submitted to clear the halt condition for this endpoint and then the transfer of the image data is restarted. With the enabled xhci module debug messages I see the following messages and the transfer is successfully resumed: --- kernel: xhci_hcd 0000:00:14.0: Stalled endpoint kernel: xhci_hcd 0000:00:14.0: Cleaning up stalled endpoint ring --- But sometimes I run into the problem that there could no longer any data via endpoint 0x82 be received. If I refer to the debug message from the xhci module I see the warning that I'm queueing URBs to an already halted endpoint. But also the message that the reset of the callback has been previously called. If I compare the debug message to the successful message I see the following output: --- kernel: xhci_hcd 0000:00:14.0: Stalled endpoint kernel: xhci_hcd 0000:00:14.0: event_trb is a no-op TRB. Skip it --- Leading to the following message when the URBs are submitted. kernel: xhci_hcd 0000:00:14.0: Endpoint 0x82 ep reset callback called kernel: xhci_hcd 0000:00:14.0: WARN halted endpoint, queueing URB anyway. kernel: xhci_hcd 0000:00:14.0: WARN halted endpoint, queueing URB anyway. Is this an error of the xhci module? I do think that cleaning up the stalled endpoint is something which should be done by the xhci module. If I understand the flow correctly the endpoint is cleaned up immediately but in this case it is skipped. Is this a correct behaviour? What have to be done to correctly clean up the stalled endpoint? Furthermore enabling the debug messages of the xhci module seems to reduce the chance of this error to occur. Here is an excerpt from the xhci debug messages of this stall condition: --- kernel: xhci_hcd 0000:00:14.0: Finding endpoint context kernel: xhci_hcd 0000:00:14.0: Cycle state = 0x0 kernel: xhci_hcd 0000:00:14.0: New dequeue segment = ffff8fb02406c8c0 (virtual) kernel: xhci_hcd 0000:00:14.0: New dequeue pointer = 0x2dd985de0 (DMA) kernel: xhci_hcd 0000:00:14.0: Set TR Deq Ptr cmd, new deq seg = ffff8fb02406c8c0 (0x2dd985000 dma), new deq ptr = ffff8fb05d985de0 (0x2dd985de0 dma), new cycle = 0 kernel: xhci_hcd 0000:00:14.0: // Ding dong! kernel: xhci_hcd 0000:00:14.0: Successful Set TR Deq Ptr cmd, deq = @2dd985de0 kernel: xhci_hcd 0000:00:14.0: Cancel URB ffff8faffb76f600, dev 5, ep 0x82, starting at offset 0x2dd985de0 kernel: xhci_hcd 0000:00:14.0: // Ding dong! kernel: xhci_hcd 0000:00:14.0: Stopped on Transfer TRB kernel: xhci_hcd 0000:00:14.0: Removing canceled TD starting at 0x2dd985de0 (dma). kernel: xhci_hcd 0000:00:14.0: Finding endpoint context kernel: xhci_hcd 0000:00:14.0: Cycle state = 0x0 kernel: xhci_hcd 0000:00:14.0: New dequeue segment = ffff8fb02406c8c0 (virtual) kernel: xhci_hcd 0000:00:14.0: New dequeue pointer = 0x2dd985df0 (DMA) kernel: xhci_hcd 0000:00:14.0: Set TR Deq Ptr cmd, new deq seg = ffff8fb02406c8c0 (0x2dd985000 dma), new deq ptr = ffff8fb05d985df0 (0x2dd985df0 dma), new cycle = 0 kernel: xhci_hcd 0000:00:14.0: // Ding dong! kernel: xhci_hcd 0000:00:14.0: Cancel URB ffff8faffb76fa80, dev 5, ep 0x82, starting at offset 0x2dd985df0 kernel: xhci_hcd 0000:00:14.0: // Ding dong! kernel: xhci_hcd 0000:00:14.0: Successful Set TR Deq Ptr cmd, deq = @2dd985df0 kernel: xhci_hcd 0000:00:14.0: Removing canceled TD starting at 0x2dd985df0 (dma). kernel: xhci_hcd 0000:00:14.0: TRB to noop at offset 0x2dd985df0 kernel: xhci_hcd 0000:00:14.0: Cancel URB ffff8fb08f5b6f00, dev 5, ep 0x82, starting at offset 0x2dd985e00 kernel: xhci_hcd 0000:00:14.0: // Ding dong! kernel: xhci_hcd 0000:00:14.0: Removing canceled TD starting at 0x2dd985e00 (dma). kernel: xhci_hcd 0000:00:14.0: TRB to noop at offset 0x2dd985e00 kernel: xhci_hcd 0000:00:14.0: Stalled endpoint kernel: xhci_hcd 0000:00:14.0: event_trb is a no-op TRB. Skip it kernel: xhci_hcd 0000:00:14.0: ep 0x81 - asked for 4096 bytes, 4088 bytes untransferred kernel: xhci_hcd 0000:00:14.0: Cancel URB ffff8fb08f5b63c0, dev 5, ep 0x82, starting at offset 0x2dd985e10 kernel: xhci_hcd 0000:00:14.0: // Ding dong! kernel: xhci_hcd 0000:00:14.0: Removing canceled TD starting at 0x2dd985e10 (dma). kernel: xhci_hcd 0000:00:14.0: TRB to noop at offset 0x2dd985e10 kernel: xhci_hcd 0000:00:14.0: Cancel URB ffff8fb08f5b6840, dev 5, ep 0x82, starting at offset 0x2dd985e20 kernel: xhci_hcd 0000:00:14.0: // Ding dong! kernel: xhci_hcd 0000:00:14.0: Removing canceled TD starting at 0x2dd985e20 (dma). kernel: xhci_hcd 0000:00:14.0: TRB to noop at offset 0x2dd985e20 kernel: xhci_hcd 0000:00:14.0: Cancel URB ffff8fb08f5b60c0, dev 5, ep 0x82, starting at offset 0x2dd985e30 kernel: xhci_hcd 0000:00:14.0: // Ding dong! kernel: xhci_hcd 0000:00:14.0: Removing canceled TD starting at 0x2dd985e30 (dma). kernel: xhci_hcd 0000:00:14.0: TRB to noop at offset 0x2dd985e30 kernel: xhci_hcd 0000:00:14.0: Cancel URB ffff8fb08f5b6480, dev 5, ep 0x82, starting at offset 0x2dd985e40 kernel: xhci_hcd 0000:00:14.0: // Ding dong! kernel: xhci_hcd 0000:00:14.0: Removing canceled TD starting at 0x2dd985e40 (dma). kernel: xhci_hcd 0000:00:14.0: TRB to noop at offset 0x2dd985e40 kernel: xhci_hcd 0000:00:14.0: Cancel URB ffff8faffb5b0f00, dev 5, ep 0x82, starting at offset 0x2dd985e50 kernel: xhci_hcd 0000:00:14.0: // Ding dong! kernel: xhci_hcd 0000:00:14.0: Removing canceled TD starting at 0x2dd985e50 (dma). kernel: xhci_hcd 0000:00:14.0: TRB to noop at offset 0x2dd985e50 kernel: xhci_hcd 0000:00:14.0: Cancel URB ffff8faffb5b0900, dev 5, ep 0x82, starting at offset 0x2dd985e60 kernel: xhci_hcd 0000:00:14.0: // Ding dong! kernel: xhci_hcd 0000:00:14.0: Removing canceled TD starting at 0x2dd985e60 (dma). kernel: xhci_hcd 0000:00:14.0: TRB to noop at offset 0x2dd985e60 kernel: xhci_hcd 0000:00:14.0: Cancel URB ffff8faffb5b0240, dev 5, ep 0x82, starting at offset 0x2dd985e70 kernel: xhci_hcd 0000:00:14.0: // Ding dong! kernel: xhci_hcd 0000:00:14.0: Removing canceled TD starting at 0x2dd985e70 (dma). kernel: xhci_hcd 0000:00:14.0: TRB to noop at offset 0x2dd985e70 kernel: xhci_hcd 0000:00:14.0: Cancel URB ffff8faffb5b03c0, dev 5, ep 0x82, starting at offset 0x2dd985e80 kernel: xhci_hcd 0000:00:14.0: // Ding dong! kernel: xhci_hcd 0000:00:14.0: Removing canceled TD starting at 0x2dd985e80 (dma). kernel: xhci_hcd 0000:00:14.0: TRB to noop at offset 0x2dd985e80 kernel: xhci_hcd 0000:00:14.0: Cancel URB ffff8faffb5b0b40, dev 5, ep 0x82, starting at offset 0x2dd985e90 kernel: xhci_hcd 0000:00:14.0: // Ding dong! kernel: xhci_hcd 0000:00:14.0: Removing canceled TD starting at 0x2dd985e90 (dma). kernel: xhci_hcd 0000:00:14.0: TRB to noop at offset 0x2dd985e90 kernel: xhci_hcd 0000:00:14.0: Cancel URB ffff8faffb5b0840, dev 5, ep 0x82, starting at offset 0x2dd985ea0 kernel: xhci_hcd 0000:00:14.0: // Ding dong! kernel: xhci_hcd 0000:00:14.0: Removing canceled TD starting at 0x2dd985ea0 (dma). kernel: xhci_hcd 0000:00:14.0: TRB to noop at offset 0x2dd985ea0 kernel: xhci_hcd 0000:00:14.0: Endpoint 0x82 ep reset callback called kernel: xhci_hcd 0000:00:14.0: WARN halted endpoint, queueing URB anyway. kernel: xhci_hcd 0000:00:14.0: WARN halted endpoint, queueing URB anyway. kernel: xhci_hcd 0000:00:14.0: WARN halted endpoint, queueing URB anyway. kernel: xhci_hcd 0000:00:14.0: WARN halted endpoint, queueing URB anyway. kernel: xhci_hcd 0000:00:14.0: WARN halted endpoint, queueing URB anyway. kernel: xhci_hcd 0000:00:14.0: WARN halted endpoint, queueing URB anyway. kernel: xhci_hcd 0000:00:14.0: WARN halted endpoint, queueing URB anyway. kernel: xhci_hcd 0000:00:14.0: WARN halted endpoint, queueing URB anyway. --- $ lsusb -vd 1409: Bus 004 Device 003: ID 1409:3370 IDS Imaging Development Systems GmbH Couldn't open device, some information will be missing Device Descriptor: bLength 18 bDescriptorType 1 bcdUSB 3.00 bDeviceClass 255 Vendor Specific Class bDeviceSubClass 255 Vendor Specific Subclass bDeviceProtocol 255 Vendor Specific Protocol bMaxPacketSize0 9 idVendor 0x1409 IDS Imaging Development Systems GmbH idProduct 0x3370 bcdDevice 0.00 iManufacturer 1 iProduct 2 iSerial 0 bNumConfigurations 1 Configuration Descriptor: bLength 9 bDescriptorType 2 wTotalLength 57 bNumInterfaces 1 bConfigurationValue 1 iConfiguration 0 bmAttributes 0x80 (Bus Powered) MaxPower 224mA Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 0 bAlternateSetting 0 bNumEndpoints 3 bInterfaceClass 255 Vendor Specific Class bInterfaceSubClass 255 Vendor Specific Subclass bInterfaceProtocol 255 Vendor Specific Protocol iInterface 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x82 EP 2 IN bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0400 1x 1024 bytes bInterval 0 bMaxBurst 15 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x01 EP 1 OUT bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0400 1x 1024 bytes bInterval 0 bMaxBurst 15 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x81 EP 1 IN bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0400 1x 1024 bytes bInterval 0 bMaxBurst 15 If helpful I could also provide an USB3 analyzer log. Regards, David -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html