linux-stable/drivers/usb/core
Sarah Sharp 79abb1ab13 USB: Support for bandwidth allocation.
Originally, the USB core had no support for allocating bandwidth when a
particular configuration or alternate setting for an interface was
selected.  Instead, the device driver's URB submission would fail if
there was not enough bandwidth for a periodic endpoint.  Drivers could
work around this, by using the scatter-gather list API to guarantee
bandwidth.

This patch adds host controller API to allow the USB core to allocate or
deallocate bandwidth for an endpoint.  Endpoints are added to or dropped
from a copy of the current schedule by calling add_endpoint() or
drop_endpoint(), and then the schedule is atomically evaluated with a
call to check_bandwidth().  This allows all the endpoints for a new
configuration or alternate setting to be added at the same time that the
endpoints from the old configuration or alt setting are dropped.

Endpoints must be added to the schedule before any URBs are submitted to
them.  The HCD must be allowed to reject a new configuration or alt
setting before the control transfer is sent to the device requesting the
change.  It may reject the change because there is not enough bandwidth,
not enough internal resources (such as memory on an embedded host
controller), or perhaps even for security reasons in a virtualized
environment.

If the call to check_bandwidth() fails, the USB core must call
reset_bandwidth().  This causes the schedule to be reverted back to the
state it was in just after the last successful check_bandwidth() call.

If the call succeeds, the host controller driver (and hardware) will have
changed its internal state to match the new configuration or alternate
setting.  The USB core can then issue a control transfer to the device to
change the configuration or alt setting.  This allows the core to test new
configurations or alternate settings before unbinding drivers bound to
interfaces in the old configuration.

WIP:

The USB core must add endpoints from all interfaces in a configuration
to the schedule, because a driver may claim that interface at any time.
A slight optimization might be to add the endpoints to the schedule once
a driver claims that interface.  FIXME

This patch does not cover changing alternate settings, but it does
handle a configuration change or de-configuration.  FIXME

The code for managing the schedule is currently HCD specific.  A generic
scheduling algorithm could be added for host controllers without
built-in scheduling support.  For now, if a host controller does not
define the check_bandwidth() function, the call to
usb_hcd_check_bandwidth() will always succeed.

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-06-15 21:44:49 -07:00
..
buffer.c USB: pass mem_flags to dma_alloc_coherent 2009-04-23 14:15:28 -07:00
config.c USB: Parse and store the SuperSpeed endpoint companion descriptors. 2009-06-15 21:44:49 -07:00
devices.c USB: drivers: use USB API functions rather than constants 2009-03-24 16:20:28 -07:00
devio.c USB: add reset endpoint operations 2009-04-17 10:50:27 -07:00
driver.c USB: Avoid PM error messages during resume if a device was disconnected 2009-06-15 21:44:47 -07:00
endpoint.c usb: convert endpoint devices to bus-less childs of the usb interface 2009-06-15 21:44:45 -07:00
file.c USB: remove err() macro from usb core code 2008-10-17 14:41:11 -07:00
generic.c USB: Enhance usage of pm_message_t 2009-01-07 10:00:03 -08:00
hcd-pci.c USB: new flag for resume-from-hibernation 2009-06-15 21:44:44 -07:00
hcd.c USB: Support for bandwidth allocation. 2009-06-15 21:44:49 -07:00
hcd.h USB: Support for bandwidth allocation. 2009-06-15 21:44:49 -07:00
hub.c USB: Support for addressing a USB device under xHCI 2009-06-15 21:44:49 -07:00
hub.h USB: Add USB 3.0 roothub support to USB core. 2009-06-15 21:44:48 -07:00
inode.c Push BKL down into ->remount_fs() 2009-06-11 21:36:11 -04:00
Kconfig USB: usbfs: deprecate and hide option for !embedded 2009-06-15 21:44:41 -07:00
Makefile USB: add the usbfs devices file to debugfs 2009-06-15 21:44:43 -07:00
message.c USB: Support for bandwidth allocation. 2009-06-15 21:44:49 -07:00
notify.c USB : correct comments in usb/core/notify.c 2008-02-01 14:34:44 -08:00
otg_whitelist.h USB: fix codingstyle issues in drivers/usb/core/*.h 2008-02-01 14:35:07 -08:00
quirks.c USB: add quirk to avoid config and interface strings 2009-03-24 16:20:25 -07:00
sysfs.c USB: core/sysfs: fix sparse warnings 2009-06-15 21:44:41 -07:00
urb.c USB: Support for bandwidth allocation. 2009-06-15 21:44:49 -07:00
usb.c USB: Support for addressing a USB device under xHCI 2009-06-15 21:44:49 -07:00
usb.h usb: convert endpoint devices to bus-less childs of the usb interface 2009-06-15 21:44:45 -07:00