forked from Minki/linux
USB: xhci: Handle short control packets correctly.
When there is a short packet on a control transfer, the xHCI host controller hardware will generate two events. The first event will be for the data stage TD with a completion code for a short packet. The second event will be for the status stage with a successful completion code. Before this patch, the xHCI driver would giveback the short control URB when it received the event for the data stage TD. Then it would become confused when it saw a status stage event for the endpoint for an URB it had already finished processing. Change the xHCI host controller driver to wait for the status stage event when it receives a short transfer completion code for a data stage TD. Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
8e595a5d30
commit
62889610f5
@ -892,15 +892,23 @@ static int handle_tx_event(struct xhci_hcd *xhci,
|
|||||||
if (event_trb != ep_ring->dequeue) {
|
if (event_trb != ep_ring->dequeue) {
|
||||||
/* The event was for the status stage */
|
/* The event was for the status stage */
|
||||||
if (event_trb == td->last_trb) {
|
if (event_trb == td->last_trb) {
|
||||||
td->urb->actual_length =
|
/* Did we already see a short data stage? */
|
||||||
td->urb->transfer_buffer_length;
|
if (td->urb->actual_length != 0)
|
||||||
|
status = -EREMOTEIO;
|
||||||
|
else
|
||||||
|
td->urb->actual_length =
|
||||||
|
td->urb->transfer_buffer_length;
|
||||||
} else {
|
} else {
|
||||||
/* Maybe the event was for the data stage? */
|
/* Maybe the event was for the data stage? */
|
||||||
if (GET_COMP_CODE(event->transfer_len) != COMP_STOP_INVAL)
|
if (GET_COMP_CODE(event->transfer_len) != COMP_STOP_INVAL) {
|
||||||
/* We didn't stop on a link TRB in the middle */
|
/* We didn't stop on a link TRB in the middle */
|
||||||
td->urb->actual_length =
|
td->urb->actual_length =
|
||||||
td->urb->transfer_buffer_length -
|
td->urb->transfer_buffer_length -
|
||||||
TRB_LEN(event->transfer_len);
|
TRB_LEN(event->transfer_len);
|
||||||
|
xhci_dbg(xhci, "Waiting for status stage event\n");
|
||||||
|
urb = NULL;
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user