USB: dummy-hcd: bandwidth limits for non-bulk transfers
commitffc4ea79bc06f42283da10ea06bb17b9a3e2b2b4
authorAlan Stern <stern@rowland.harvard.edu>
Tue, 26 Sep 2017 19:16:05 +0000 (26 15:16 -0400)
committerFelipe Balbi <felipe.balbi@linux.intel.com>
Wed, 11 Oct 2017 10:07:35 +0000 (11 13:07 +0300)
treeaa1ce1da2947226fc8d672f084dd9c3f8bab0ed4
parent8a5776a5f49812d29fe4b2d0a2d71675c3facf3f
USB: dummy-hcd: bandwidth limits for non-bulk transfers

Part of the emulation performed by dummy-hcd is accounting for
bandwidth utilization.  The total amount of data transferred in a
single frame is supposed to be no larger than an actual USB connection
could accommodate.

Currently the driver performs bandwidth limiting only for bulk
transfers; control and periodic transfers are effectively unlimited.
(Presumably drivers were not expected to request extremely large
control or interrupt transfers.)  This patch improves the situation
somewhat by restricting them as well.

The emulation still isn't perfect.  On a real system, even 0-length
transfers use some bandwidth because of transaction overhead
(IN, OUT, ACK, NACK packets) and packet overhead (SYNC, PID, bit
stuffing, CRC, EOP).  Adding in those factors is left as an exercise
for a later patch.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
drivers/usb/gadget/udc/dummy_hcd.c