diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2013-10-11 11:29:13 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-10-11 19:45:43 -0400 |
commit | d0ce5c6b9208c79fc725c578eebdeb5724faf17d (patch) | |
tree | 4b720313bb5b9e2d7c9392c25a12bca901e92136 /drivers/usb/host/ehci-hcd.c | |
parent | ffa0248e643175cea3887c7058916af53104d8e5 (diff) |
USB: EHCI: use a bandwidth-allocation table
This patch significantly changes the scheduling code in ehci-hcd.
Instead of calculating the current bandwidth utilization by trudging
through the schedule and adding up the times used by the existing
transfers, we will now maintain a table holding the time used for each
of 64 microframes. This will drastically speed up the bandwidth
computations.
In addition, it eliminates a theoretical bug. An isochronous endpoint
may have bandwidth reserved even at times when it has no transfers
listed in the schedule. The table will keep track of the reserved
bandwidth, whereas adding up entries in the schedule would miss it.
As a corollary, we can keep bandwidth reserved for endpoints even
when they aren't in active use. Eventually the bandwidth will be
reserved when a new alternate setting is installed; for now the
endpoint's reservation takes place when its first URB is submitted.
A drawback of this approach is that transfers with an interval larger
than 64 microframes will have to be charged for bandwidth as though
the interval was 64. In practice this shouldn't matter much;
transfers with longer intervals tend to be rather short anyway (things
like hubs or HID devices).
Another minor drawback is that we will keep track of two different
period and phase values: the actual ones and the ones used for
bandwidth allocation (which are limited to 64). This adds only a
small amount of overhead: 3 bytes for each endpoint.
The patch also adds a new debugfs file named "bandwidth" to display
the information stored in the new table.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/host/ehci-hcd.c')
-rw-r--r-- | drivers/usb/host/ehci-hcd.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index b2e4e4b3cfae..398e8fa3032f 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c | |||
@@ -956,6 +956,7 @@ rescan: | |||
956 | goto idle_timeout; | 956 | goto idle_timeout; |
957 | 957 | ||
958 | /* BUG_ON(!list_empty(&stream->free_list)); */ | 958 | /* BUG_ON(!list_empty(&stream->free_list)); */ |
959 | reserve_release_iso_bandwidth(ehci, stream, -1); | ||
959 | kfree(stream); | 960 | kfree(stream); |
960 | goto done; | 961 | goto done; |
961 | } | 962 | } |
@@ -982,6 +983,8 @@ idle_timeout: | |||
982 | if (qh->clearing_tt) | 983 | if (qh->clearing_tt) |
983 | goto idle_timeout; | 984 | goto idle_timeout; |
984 | if (list_empty (&qh->qtd_list)) { | 985 | if (list_empty (&qh->qtd_list)) { |
986 | if (qh->ps.bw_uperiod) | ||
987 | reserve_release_intr_bandwidth(ehci, qh, -1); | ||
985 | qh_destroy(ehci, qh); | 988 | qh_destroy(ehci, qh); |
986 | break; | 989 | break; |
987 | } | 990 | } |