linux/drivers/usb/host
Kirill Smelkov cc62a7eb63 USB: EHCI: Allow users to override 80% max periodic bandwidth
There are cases, when 80% max isochronous bandwidth is too limiting.

For example I have two USB video capture cards which stream uncompressed
video, and to stream full NTSC + PAL videos we'd need

    NTSC 640x480 YUV422 @30fps      ~17.6 MB/s
    PAL  720x576 YUV422 @25fps      ~19.7 MB/s

isoc bandwidth.

Now, due to limited alt settings in capture devices NTSC one ends up
streaming with max_pkt_size=2688  and  PAL with max_pkt_size=2892, both
with interval=1. In terms of microframe time allocation this gives

    NTSC    ~53us
    PAL     ~57us

and together

    ~110us  >  100us == 80% of 125us uframe time.

So those two devices can't work together simultaneously because the'd
over allocate isochronous bandwidth.

80% seemed a bit arbitrary to me, and I've tried to raise it to 90% and
both devices started to work together, so I though sometimes it would be
a good idea for users to override hardcoded default of max 80% isoc
bandwidth.

After all, isn't it a user who should decide how to load the bus? If I
can live with 10% or even 5% bulk bandwidth that should be ok. I'm a USB
newcomer, but that 80% set in stone by USB 2.0 specification seems to be
chosen pretty arbitrary to me, just to serve as a reasonable default.

NOTE 1
~~~~~~

for two streams with max_pkt_size=3072 (worst case) both time
allocation would be 60us+60us=120us which is 96% periodic bandwidth
leaving 4% for bulk and control.  Alan Stern suggested that bulk then
would be problematic (less than 300*8 bittimes left per microframe), but
I think that is still enough for control traffic.

NOTE 2
~~~~~~

Sarah Sharp expressed concern that maxing out periodic bandwidth
could lead to vendor-specific hardware bugs on host controllers, because

> It's entirely possible that you'll run into
> vendor-specific bugs if you try to pack the schedule with isochronous
> transfers.  I don't think any hardware designer would seriously test or
> validate their hardware with a schedule that is basically a violation of
> the USB bus spec (more than 80% for periodic transfers).

So far I've only tested this patch on my HP Mini 5103 with N10 chipset

    kirr@mini:~$ lspci
    00:00.0 Host bridge: Intel Corporation N10 Family DMI Bridge
    00:02.0 VGA compatible controller: Intel Corporation N10 Family Integrated Graphics Controller
    00:02.1 Display controller: Intel Corporation N10 Family Integrated Graphics Controller
    00:1b.0 Audio device: Intel Corporation N10/ICH 7 Family High Definition Audio Controller (rev 02)
    00:1c.0 PCI bridge: Intel Corporation N10/ICH 7 Family PCI Express Port 1 (rev 02)
    00:1c.3 PCI bridge: Intel Corporation N10/ICH 7 Family PCI Express Port 4 (rev 02)
    00:1d.0 USB Controller: Intel Corporation N10/ICH 7 Family USB UHCI Controller #1 (rev 02)
    00:1d.1 USB Controller: Intel Corporation N10/ICH 7 Family USB UHCI Controller #2 (rev 02)
    00:1d.2 USB Controller: Intel Corporation N10/ICH 7 Family USB UHCI Controller #3 (rev 02)
    00:1d.3 USB Controller: Intel Corporation N10/ICH 7 Family USB UHCI Controller #4 (rev 02)
    00:1d.7 USB Controller: Intel Corporation N10/ICH 7 Family USB2 EHCI Controller (rev 02)
    00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev e2)
    00:1f.0 ISA bridge: Intel Corporation NM10 Family LPC Controller (rev 02)
    00:1f.2 SATA controller: Intel Corporation N10/ICH7 Family SATA AHCI Controller (rev 02)
    01:00.0 Network controller: Broadcom Corporation BCM4313 802.11b/g/n Wireless LAN Controller (rev 01)
    02:00.0 Ethernet controller: Marvell Technology Group Ltd. 88E8059 PCI-E Gigabit Ethernet Controller (rev 11)

and the system works stable with 110us/uframe (~88%) isoc bandwith allocated for
above-mentioned isochronous transfers.

NOTE 3
~~~~~~

This feature is off by default. I mean max periodic bandwidth is set to
100us/uframe by default exactly as it was before the patch. So only those of us
who need the extreme settings are taking the risk - normal users who do not
alter uframe_periodic_max sysfs attribute should not see any change at all.

NOTE 4
~~~~~~

I've tried to update documentation in Documentation/ABI/ thoroughly, but
only "TBD" was put into Documentation/usb/ehci.txt -- the text there seems
to be outdated and much needing refreshing, before it could be amended.

Cc: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-07-08 14:51:33 -07:00
..
whci Fix common misspellings 2011-03-31 11:26:23 -03:00
Kconfig USB: UHCI: Support big endian GRUSBHC HC 2011-05-19 16:45:32 -07:00
Makefile USB: Add EHCI and OHCH glue for OCTEON II SOCs. 2010-10-29 19:08:44 +01:00
ehci-ath79.c USB: EHCI: Support controllers with big endian capability regs 2011-05-03 11:43:21 -07:00
ehci-atmel.c USB: EHCI: Support controllers with big endian capability regs 2011-05-03 11:43:21 -07:00
ehci-au1xxx.c USB: ehci-au1xxx: fix suspend callback 2011-05-06 18:16:39 -07:00
ehci-cns3xxx.c USB: EHCI: Support controllers with big endian capability regs 2011-05-03 11:43:21 -07:00
ehci-dbg.c USB: EHCI: Support controllers with big endian capability regs 2011-05-03 11:43:21 -07:00
ehci-fsl.c USB: EHCI: Support controllers with big endian capability regs 2011-05-03 11:43:21 -07:00
ehci-fsl.h USB: ehci-fsl: add MPC5121E specific suspend and resume 2011-05-02 16:59:36 -07:00
ehci-grlib.c USB: EHCI: Add bus glue for GRLIB GRUSBHC controller 2011-05-03 11:43:48 -07:00
ehci-hcd.c USB: EHCI: Allow users to override 80% max periodic bandwidth 2011-07-08 14:51:33 -07:00
ehci-hub.c USB: EHCI: Move sysfs related bits into ehci-sysfs.c 2011-07-08 14:51:32 -07:00
ehci-ixp4xx.c USB: EHCI: Support controllers with big endian capability regs 2011-05-03 11:43:21 -07:00
ehci-lpm.c USB: Mark EHCI LPM functions as __maybe_unused 2011-02-17 10:47:55 -08:00
ehci-mem.c USB: EHCI: AMD periodic frame list table quirk 2010-11-16 13:36:40 -08:00
ehci-msm.c ehci-msm : use ehci_setup 2011-07-08 14:51:29 -07:00
ehci-mxc.c USB: EHCI: Support controllers with big endian capability regs 2011-05-03 11:43:21 -07:00
ehci-octeon.c USB: EHCI: Support controllers with big endian capability regs 2011-05-03 11:43:21 -07:00
ehci-omap.c Merge branch 2.6.39-rc7 into usb-linus 2011-05-10 13:30:45 -07:00
ehci-orion.c USB: EHCI: Support controllers with big endian capability regs 2011-05-03 11:43:21 -07:00
ehci-pci.c Intel xhci: Support EHCI/xHCI port switching. 2011-05-27 12:07:36 -07:00
ehci-pmcmsp.c USB: EHCI: Support controllers with big endian capability regs 2011-05-03 11:43:21 -07:00
ehci-ppc-of.c USB: EHCI: Support controllers with big endian capability regs 2011-05-03 11:43:21 -07:00
ehci-ps3.c USB: EHCI: Support controllers with big endian capability regs 2011-05-03 11:43:21 -07:00
ehci-q.c EHCI: don't rescan interrupt QHs needlessly 2011-05-17 11:20:24 -07:00
ehci-s5p.c USB: ehci-s5p: add PM support 2011-06-06 16:32:36 -07:00
ehci-sched.c USB: EHCI: Allow users to override 80% max periodic bandwidth 2011-07-08 14:51:33 -07:00
ehci-sh.c USB: EHCI: Support controllers with big endian capability regs 2011-05-03 11:43:21 -07:00
ehci-spear.c USB: EHCI: Support controllers with big endian capability regs 2011-05-03 11:43:21 -07:00
ehci-sysfs.c USB: EHCI: Allow users to override 80% max periodic bandwidth 2011-07-08 14:51:33 -07:00
ehci-tegra.c USB: EHCI: Support controllers with big endian capability regs 2011-05-03 11:43:21 -07:00
ehci-vt8500.c USB: EHCI: Support controllers with big endian capability regs 2011-05-03 11:43:21 -07:00
ehci-w90x900.c USB: EHCI: Support controllers with big endian capability regs 2011-05-03 11:43:21 -07:00
ehci-xilinx-of.c USB: EHCI: Support controllers with big endian capability regs 2011-05-03 11:43:21 -07:00
ehci.h USB: EHCI: Allow users to override 80% max periodic bandwidth 2011-07-08 14:51:33 -07:00
fhci-dbg.c
fhci-hcd.c Fix common misspellings 2011-03-31 11:26:23 -03:00
fhci-hub.c
fhci-mem.c
fhci-q.c
fhci-sched.c
fhci-tds.c Fix common misspellings 2011-03-31 11:26:23 -03:00
fhci.h Fix common misspellings 2011-03-31 11:26:23 -03:00
fsl-mph-dr-of.c USB: ehci-fsl: Fix 'have_sysif_regs' detection 2011-01-22 18:38:58 -08:00
hwa-hc.c
imx21-dbg.c treewide: fix a few typos in comments 2011-05-10 10:16:21 +02:00
imx21-hcd.c Fix common misspellings 2011-03-31 11:26:23 -03:00
imx21-hcd.h
isp116x-hcd.c USB: remove remaining usages of hcd->state from usbcore and fix regression 2011-05-19 16:34:04 -07:00
isp116x.h Fix common misspellings 2011-03-31 11:26:23 -03:00
isp1362-hcd.c sanitize <linux/prefetch.h> usage 2011-05-20 12:50:29 -07:00
isp1362.h
isp1760-hcd.c usb/isp1760: Fix possible unlink problems 2011-05-19 16:34:04 -07:00
isp1760-hcd.h usb/isp1760: Improve urb queueing, get rid of BUG():s in normal code paths 2011-05-02 17:03:50 -07:00
isp1760-if.c dt/usb: Eliminate users of of_platform_{,un}register_driver 2011-02-28 13:22:45 -07:00
octeon2-common.c usb: Configure octeon2 glue logic for proper uSOF cycle period. 2011-05-03 10:09:32 -07:00
ohci-at91.c
ohci-ath79.c USB: ohci: add bus glue for the Atheros AR71XX/AR7240 SoCs 2011-04-13 16:58:19 -07:00
ohci-au1xxx.c USB: ohci-au1xxx: fix warning "__BIG_ENDIAN" is not defined 2011-04-13 15:44:03 -07:00
ohci-cns3xxx.c USB: cns3xxx: Add EHCI and OHCI bus glue for cns3xxx SOCs 2010-11-29 18:32:47 +03:00
ohci-da8xx.c
ohci-dbg.c
ohci-ep93xx.c
ohci-hcd.c USB: remove remaining usages of hcd->state from usbcore and fix regression 2011-05-19 16:34:04 -07:00
ohci-hub.c USB 3.0 Hub Changes 2011-03-13 18:07:11 -07:00
ohci-jz4740.c USB: ohci-jz4740: Fix spelling in MODULE_ALIAS 2010-11-11 07:14:07 -08:00
ohci-mem.c
ohci-octeon.c USB: Add EHCI and OHCH glue for OCTEON II SOCs. 2010-10-29 19:08:44 +01:00
ohci-omap.c
ohci-omap3.c usb: host: omap: ehci and ohci simplification 2011-03-01 17:02:49 +02:00
ohci-pci.c OHCI: fix regression caused by nVidia shutdown workaround 2011-05-17 11:20:23 -07:00
ohci-pnx4008.c
ohci-pnx8550.c
ohci-ppc-of.c dt/usb: Eliminate users of of_platform_{,un}register_driver 2011-02-28 13:22:45 -07:00
ohci-ppc-soc.c
ohci-ps3.c
ohci-pxa27x.c drivers/usb/host/ohci-pxa27x.c: add missing clk_put 2011-06-07 09:07:47 -07:00
ohci-q.c USB host: Move AMD PLL quirk to pci-quirks.c 2011-03-01 16:01:45 -05:00
ohci-s3c2410.c USB: ohci-s3c2410: return proper error if clk_get fails 2011-05-06 18:16:40 -07:00
ohci-sa1111.c
ohci-sh.c usb: ohci-sh: Set IRQ as shared. 2010-11-01 17:01:27 -04:00
ohci-sm501.c
ohci-spear.c USB host: Adding USB ehci & ohci support for spear platform 2010-11-16 13:53:29 -08:00
ohci-ssb.c
ohci-tmio.c tmio: Silence warnings introduced by mfd changes 2011-03-23 10:42:01 +01:00
ohci.h Merge branch 'remove' of master.kernel.org:/home/rmk/linux-2.6-arm 2011-03-16 19:05:40 -07:00
oxu210hp-hcd.c USB: remove remaining usages of hcd->state from usbcore and fix regression 2011-05-19 16:34:04 -07:00
oxu210hp.h
pci-quirks.c Intel xhci: Support EHCI/xHCI port switching. 2011-05-27 12:07:36 -07:00
pci-quirks.h Intel xhci: Support EHCI/xHCI port switching. 2011-05-27 12:07:36 -07:00
r8a66597-hcd.c USB 3.0 Hub Changes 2011-03-13 18:07:11 -07:00
r8a66597.h usb: r8a66597-hcd: Change mistake of the outsw function 2010-10-22 10:22:11 -07:00
sl811-hcd.c Merge branch 'usb-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6 2011-05-23 12:33:02 -07:00
sl811.h
sl811_cs.c pcmcia: Convert pcmcia_device_id declarations to const 2011-05-06 07:46:22 +02:00
u132-hcd.c usb: u132-hcd: Drop __TIME__ usage 2011-04-13 16:36:06 -07:00
uhci-debug.c USB: UHCI: Add support for big endian descriptors 2011-05-19 16:43:20 -07:00
uhci-grlib.c USB: UHCI: Support big endian GRUSBHC HC 2011-05-19 16:45:32 -07:00
uhci-hcd.c Merge branch 'usb-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6 2011-05-23 12:33:02 -07:00
uhci-hcd.h USB: UHCI: Add support for big endian descriptors 2011-05-19 16:43:20 -07:00
uhci-hub.c USB: UHCI: Wrap I/O register accesses 2011-05-06 18:24:01 -07:00
uhci-pci.c USB: UHCI: Move PCI specific functions to uhci-pci.c 2011-05-06 18:24:00 -07:00
uhci-q.c USB: UHCI: Add support for big endian descriptors 2011-05-19 16:43:20 -07:00
xhci-dbg.c Merge 3.0-rc2 into usb-linus as it's needed by some USB patches 2011-06-14 06:51:23 -07:00
xhci-ext-caps.h xHCI: prolong host controller halt time limit 2011-03-13 18:07:09 -07:00
xhci-hub.c xhci: move the common code to a function to get max ports and port array 2011-05-12 12:54:22 -07:00
xhci-mem.c Merge 3.0-rc2 into usb-linus as it's needed by some USB patches 2011-06-14 06:51:23 -07:00
xhci-pci.c xhci: Disable MSI for some Fresco Logic hosts. 2011-06-02 18:22:58 -07:00
xhci-ring.c Merge 3.0-rc2 into usb-linus as it's needed by some USB patches 2011-06-14 06:51:23 -07:00
xhci.c Merge 3.0-rc2 into usb-linus as it's needed by some USB patches 2011-06-14 06:51:23 -07:00
xhci.h Merge 3.0-rc2 into usb-linus as it's needed by some USB patches 2011-06-14 06:51:23 -07:00