From 46c73d1d3ebc38feed1d97c6980252a0a01f6a5b Mon Sep 17 00:00:00 2001 From: Alan Stern Date: Tue, 3 Sep 2013 13:59:03 -0400 Subject: USB: EHCI: handle isochronous underruns with tasklets This patch updates the iso_stream_schedule() routine in ehci-sched.c to handle cases where an underrun causes an isochronous endpoint's queue to empty out, but the client driver wants to maintain synchronization with the device (i.e., the URB_ISO_ASAP flag is not set). This could not happen until recently, when ehci-hcd switched over to completing URBs in a tasklet. (This may seem like an unlikely case to worry about, but underruns are all too common with the snd-usb-audio driver, which doesn't use URB_ISO_ASAP.) As part of the fix, some URBs may need to be given back when they are submitted. This is necessary when the URB's scheduled slots all fall before the current value of ehci->last_iso_frame, and as an optimization we do it also when the slots all fall before the current frame number. As a second part of the fix, we may need to skip some but not all of an URB's packets. This is necessary when some of the URB's scheduled slots fall before the current value of ehci->last_iso_frame and some of them fall after the current frame number. A new field (first_packet) is added to struct ehci_iso_sched, to indicate how many packets should be skipped. Signed-off-by: Alan Stern CC: Ming Lei Signed-off-by: Greg Kroah-Hartman --- drivers/usb/host/ehci.h | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/usb/host/ehci.h') diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h index 291db7d09f2..2d401927e14 100644 --- a/drivers/usb/host/ehci.h +++ b/drivers/usb/host/ehci.h @@ -434,6 +434,7 @@ struct ehci_iso_packet { struct ehci_iso_sched { struct list_head td_list; unsigned span; + unsigned first_packet; struct ehci_iso_packet packet [0]; }; -- cgit v1.2.3-18-g5258