On Fri, Apr 16, 2010 at 03:32:23AM -0700, Xu, Andiry wrote: > > -----Original Message----- > > From: Sarah Sharp [mailto:sarah.a.sharp@xxxxxxxxx] > > > > I've been trying out the patches to enable isochronous transfers under > > xHCI, and they work fine on my USB speaker. However, I've been having > > trouble getting my high speed USB webcam to work. The NEC Express > Card > > I have rejects the first alternate setting that the uvcvideo driver > > tries to install (altsetting 11), saying that it takes too much > > bandwidth. This happens even when I plug the device directly into the > > roothub with no other devices plugged in. > > > > I would like to know if this is correct behavior for the host, as I > > can't believe a device would advertise an alternate setting that took > up > > too much bandwidth by itself. Device descriptors and a log snippet > are > > attached. > > I'm also verifying usb webcam these days. The host controller also > rejects alternate setting, indicating not enough bandwidth. Fortunately > the webcam I used is using gspca and the patch for gspca below does > work. After several times of failure, it will set the alt setting > successfully. See the log and descriptors. Good to know that works! I'll resubmit it as a real patch then. > But I don't think it's normal behavior. The xHC should accept the alt > setting request at the first time. I'm also using the NEC chips, perhaps > it's a HW or FW issue but I can't make sure. I have a patch to fix this. I wasn't setting the Average TRB Length or Max ESIT fields in the isoc endpoint descriptor. Apparently the NEC chip only needs the avg. TRB length to accept the alternate setting, but the xHCI spec says it's really the max ESIT payload that is used for scheduling, so I've set both. I'll send the patch in a view minutes. Unfortunately, with my gspca full speed webcam, I hang my machine after installing the interface, when the driver first submits an isochronous URB. It's a "scheduling while atomic" error with a very odd backtrace. But it happens every time I plug in the webcam, so I know it's related to that. Gzipped log file is attached. Ignore the values of the tx_info field in the endpoint, I had a bug with the math in the patch that I've since fixed. > Another problem of the isoc transfer is the size of the transfer ring. > Currently in xhci_endpoint_init() of xhci-mem.c, the ring allocated > for each endpoint just contains one segment, which can hold 64 - 1 = > 63 trbs. But the gspca will submit 3 urbs at one time, each consists > of 32 packets. Each packet needs an isoc TD to carry, and the driver > will insert 96 trbs to the ring at one time. It will cause the > room_on_ring check failure since the xHC cannot process the trbs in > time. After I modify the parameter of xhci_ring_alloc() in > xhci_endpoint_init() to allocate 2 segments, the webcam works > smoothly. It looks like dynamic ring allocation is necessary for isoc > endpoint since it will put multiple trbs on the ring and the fixed > size is too small. Yes, it looks like dynamic ring resizing is necessary, but feel free to submit your patch for xhci_endpoint_init() for now. Sarah Sharp > > 8<---------------------- > > > > From 0e6bc81b178364ee9771c64a06ab006588c73ae6 Mon Sep 17 00:00:00 2001 > > From: Sarah Sharp <sarah.a.sharp@xxxxxxxxxxxxxxx> > > Date: Mon, 12 Apr 2010 11:23:46 -0700 > > > > Subject: [PATCH] gspca: Try a less bandwidth-intensive alt setting. > > > > Under OHCI, UHCI, and EHCI, if an alternate interface setting took too > > much of the bus bandwidth, then submit_urb() would fail. The xHCI > host > > controller does bandwidth checking when the alternate interface > setting is > > installed, so usb_set_interface() can fail. If it does, try the next > > alternate interface setting. > > > > Signed-off-by: Sarah Sharp <sarah.a.sharp@xxxxxxxxxxxxxxx> > > --- > > drivers/media/video/gspca/gspca.c | 10 ++++++---- > > 1 files changed, 6 insertions(+), 4 deletions(-) > > > > diff --git a/drivers/media/video/gspca/gspca.c > > b/drivers/media/video/gspca/gspca.c > > index 222af47..6de3117 100644 > > --- a/drivers/media/video/gspca/gspca.c > > +++ b/drivers/media/video/gspca/gspca.c > > @@ -643,6 +643,7 @@ static struct usb_host_endpoint *get_ep(struct > > gspca_dev *gspca_dev) > > xfer = gspca_dev->cam.bulk ? USB_ENDPOINT_XFER_BULK > > : USB_ENDPOINT_XFER_ISOC; > > i = gspca_dev->alt; /* previous alt setting > */ > > +find_alt: > > if (gspca_dev->cam.reverse_alts) { > > while (++i < gspca_dev->nbalt) { > > ep = alt_xfer(&intf->altsetting[i], xfer); > > @@ -666,10 +667,11 @@ static struct usb_host_endpoint *get_ep(struct > > gspca_dev *gspca_dev) > > if (gspca_dev->nbalt > 1) { > > gspca_input_destroy_urb(gspca_dev); > > ret = usb_set_interface(gspca_dev->dev, > gspca_dev->iface, i); > > - if (ret < 0) { > > - err("set alt %d err %d", i, ret); > > - ep = NULL; > > - } > > + /* xHCI hosts will reject set interface requests > > + * if they take too much bandwidth, so try again. > > + */ > > + if (ret < 0) > > + goto find_alt; > > gspca_input_create_urb(gspca_dev); > > } > > return ep; > > -- > > 1.6.3.3 > > > Bus 008 Device 002: ID 04fc:0561 Sunplus Technology Co., Ltd Flexcam 100 > Device Descriptor: > bLength 18 > bDescriptorType 1 > bcdUSB 1.10 > bDeviceClass 255 Vendor Specific Class > bDeviceSubClass 255 Vendor Specific Subclass > bDeviceProtocol 0 > bMaxPacketSize0 8 > idVendor 0x04fc Sunplus Technology Co., Ltd > idProduct 0x0561 Flexcam 100 > bcdDevice 0.00 > iManufacturer 1 Sunplus Technology Co., Ltd. > iProduct 2 Generic Digital camera > iSerial 0 > bNumConfigurations 1 > Configuration Descriptor: > bLength 9 > bDescriptorType 2 > wTotalLength 233 > bNumInterfaces 1 > bConfigurationValue 1 > iConfiguration 0 > bmAttributes 0x80 > (Bus Powered) > MaxPower 100mA > Interface Descriptor: > bLength 9 > bDescriptorType 4 > bInterfaceNumber 0 > bAlternateSetting 0 > bNumEndpoints 1 > bInterfaceClass 255 Vendor Specific Class > bInterfaceSubClass 0 > bInterfaceProtocol 0 > iInterface 0 > Endpoint Descriptor: > bLength 7 > bDescriptorType 5 > bEndpointAddress 0x81 EP 1 IN > bmAttributes 1 > Transfer Type Isochronous > Synch Type None > Usage Type Data > wMaxPacketSize 0x0000 1x 0 bytes > bInterval 1 > Interface Descriptor: > bLength 9 > bDescriptorType 4 > bInterfaceNumber 0 > bAlternateSetting 1 > bNumEndpoints 1 > bInterfaceClass 255 Vendor Specific Class > bInterfaceSubClass 0 > bInterfaceProtocol 0 > iInterface 0 > Endpoint Descriptor: > bLength 7 > bDescriptorType 5 > bEndpointAddress 0x81 EP 1 IN > bmAttributes 1 > Transfer Type Isochronous > Synch Type None > Usage Type Data > wMaxPacketSize 0x0080 1x 128 bytes > bInterval 1 > Interface Descriptor: > bLength 9 > bDescriptorType 4 > bInterfaceNumber 0 > bAlternateSetting 2 > bNumEndpoints 1 > bInterfaceClass 255 Vendor Specific Class > bInterfaceSubClass 0 > bInterfaceProtocol 0 > iInterface 0 > Endpoint Descriptor: > bLength 7 > bDescriptorType 5 > bEndpointAddress 0x81 EP 1 IN > bmAttributes 1 > Transfer Type Isochronous > Synch Type None > Usage Type Data > wMaxPacketSize 0x0370 1x 880 bytes > bInterval 1 > Interface Descriptor: > bLength 9 > bDescriptorType 4 > bInterfaceNumber 0 > bAlternateSetting 3 > bNumEndpoints 1 > bInterfaceClass 255 Vendor Specific Class > bInterfaceSubClass 0 > bInterfaceProtocol 0 > iInterface 0 > Endpoint Descriptor: > bLength 7 > bDescriptorType 5 > bEndpointAddress 0x81 EP 1 IN > bmAttributes 1 > Transfer Type Isochronous > Synch Type None > Usage Type Data > wMaxPacketSize 0x0200 1x 512 bytes > bInterval 1 > Interface Descriptor: > bLength 9 > bDescriptorType 4 > bInterfaceNumber 0 > bAlternateSetting 4 > bNumEndpoints 1 > bInterfaceClass 255 Vendor Specific Class > bInterfaceSubClass 0 > bInterfaceProtocol 0 > iInterface 0 > Endpoint Descriptor: > bLength 7 > bDescriptorType 5 > bEndpointAddress 0x81 EP 1 IN > bmAttributes 1 > Transfer Type Isochronous > Synch Type None > Usage Type Data > wMaxPacketSize 0x0280 1x 640 bytes > bInterval 1 > Interface Descriptor: > bLength 9 > bDescriptorType 4 > bInterfaceNumber 0 > bAlternateSetting 5 > bNumEndpoints 1 > bInterfaceClass 255 Vendor Specific Class > bInterfaceSubClass 0 > bInterfaceProtocol 0 > iInterface 0 > Endpoint Descriptor: > bLength 7 > bDescriptorType 5 > bEndpointAddress 0x81 EP 1 IN > bmAttributes 1 > Transfer Type Isochronous > Synch Type None > Usage Type Data > wMaxPacketSize 0x0300 1x 768 bytes > bInterval 1 > Interface Descriptor: > bLength 9 > bDescriptorType 4 > bInterfaceNumber 0 > bAlternateSetting 6 > bNumEndpoints 1 > bInterfaceClass 255 Vendor Specific Class > bInterfaceSubClass 0 > bInterfaceProtocol 0 > iInterface 0 > Endpoint Descriptor: > bLength 7 > bDescriptorType 5 > bEndpointAddress 0x81 EP 1 IN > bmAttributes 1 > Transfer Type Isochronous > Synch Type None > Usage Type Data > wMaxPacketSize 0x0380 1x 896 bytes > bInterval 1 > Interface Descriptor: > bLength 9 > bDescriptorType 4 > bInterfaceNumber 0 > bAlternateSetting 7 > bNumEndpoints 1 > bInterfaceClass 255 Vendor Specific Class > bInterfaceSubClass 0 > bInterfaceProtocol 0 > iInterface 0 > Endpoint Descriptor: > bLength 7 > bDescriptorType 5 > bEndpointAddress 0x81 EP 1 IN > bmAttributes 1 > Transfer Type Isochronous > Synch Type None > Usage Type Data > wMaxPacketSize 0x03ff 1x 1023 bytes > bInterval 1 > Interface Descriptor: > bLength 9 > bDescriptorType 4 > bInterfaceNumber 0 > bAlternateSetting 8 > bNumEndpoints 1 > bInterfaceClass 255 Vendor Specific Class > bInterfaceSubClass 0 > bInterfaceProtocol 0 > iInterface 0 > Endpoint Descriptor: > bLength 7 > bDescriptorType 5 > bEndpointAddress 0x81 EP 1 IN > bmAttributes 1 > Transfer Type Isochronous > Synch Type None > Usage Type Data > wMaxPacketSize 0x0220 1x 544 bytes > bInterval 1 > Interface Descriptor: > bLength 9 > bDescriptorType 4 > bInterfaceNumber 0 > bAlternateSetting 9 > bNumEndpoints 1 > bInterfaceClass 255 Vendor Specific Class > bInterfaceSubClass 0 > bInterfaceProtocol 0 > iInterface 0 > Endpoint Descriptor: > bLength 7 > bDescriptorType 5 > bEndpointAddress 0x81 EP 1 IN > bmAttributes 1 > Transfer Type Isochronous > Synch Type None > Usage Type Data > wMaxPacketSize 0x0290 1x 656 bytes > bInterval 1 > Interface Descriptor: > bLength 9 > bDescriptorType 4 > bInterfaceNumber 0 > bAlternateSetting 10 > bNumEndpoints 1 > bInterfaceClass 255 Vendor Specific Class > bInterfaceSubClass 0 > bInterfaceProtocol 0 > iInterface 0 > Endpoint Descriptor: > bLength 7 > bDescriptorType 5 > bEndpointAddress 0x81 EP 1 IN > bmAttributes 1 > Transfer Type Isochronous > Synch Type None > Usage Type Data > wMaxPacketSize 0x02c0 1x 704 bytes > bInterval 1 > Interface Descriptor: > bLength 9 > bDescriptorType 4 > bInterfaceNumber 0 > bAlternateSetting 11 > bNumEndpoints 1 > bInterfaceClass 255 Vendor Specific Class > bInterfaceSubClass 0 > bInterfaceProtocol 0 > iInterface 0 > Endpoint Descriptor: > bLength 7 > bDescriptorType 5 > bEndpointAddress 0x81 EP 1 IN > bmAttributes 1 > Transfer Type Isochronous > Synch Type None > Usage Type Data > wMaxPacketSize 0x0360 1x 864 bytes > bInterval 1 > Interface Descriptor: > bLength 9 > bDescriptorType 4 > bInterfaceNumber 0 > bAlternateSetting 12 > bNumEndpoints 1 > bInterfaceClass 255 Vendor Specific Class > bInterfaceSubClass 0 > bInterfaceProtocol 0 > iInterface 0 > Endpoint Descriptor: > bLength 7 > bDescriptorType 5 > bEndpointAddress 0x81 EP 1 IN > bmAttributes 1 > Transfer Type Isochronous > Synch Type None > Usage Type Data > wMaxPacketSize 0x03c0 1x 960 bytes > bInterval 1 > Interface Descriptor: > bLength 9 > bDescriptorType 4 > bInterfaceNumber 0 > bAlternateSetting 13 > bNumEndpoints 1 > bInterfaceClass 255 Vendor Specific Class > bInterfaceSubClass 0 > bInterfaceProtocol 0 > iInterface 0 > Endpoint Descriptor: > bLength 7 > bDescriptorType 5 > bEndpointAddress 0x81 EP 1 IN > bmAttributes 1 > Transfer Type Isochronous > Synch Type None > Usage Type Data > wMaxPacketSize 0x034d 1x 845 bytes > bInterval 1 > Device Status: 0x0000 > (Bus Powered) > > [ 613.660157] xhci_hcd 0000:02:00.0: Can't reset device (slot ID 1) in enabled/disabled state > [ 613.660165] xhci_hcd 0000:02:00.0: Not freeing device rings. > [ 613.660188] usb 8-4: new full speed USB device using xhci_hcd and address 0 > [ 613.728243] xhci_hcd 0000:02:00.0: WARN: short transfer on control ep > [ 613.736243] xhci_hcd 0000:02:00.0: WARN: short transfer on control ep > [ 613.746239] xhci_hcd 0000:02:00.0: WARN: short transfer on control ep > [ 613.747450] usb 8-4: configuration #1 chosen from 1 choice > [ 613.897124] Linux video capture interface: v2.00 > [ 613.939447] gspca: main v2.7.0 registered > [ 613.961659] gspca: probing 04fc:0561 > [ 614.429514] gspca: probe ok > [ 614.429557] usbcore: registered new interface driver spca561 > [ 614.430108] spca561: registered > [ 617.122122] usb 8-4: Not enough bandwidth for new device state. > [ 617.122140] usb 8-4: Not enough bandwidth for altsetting 7 > [ 617.122146] gspca: set alt 7 err -28 > [ 617.122378] usb 8-4: Not enough bandwidth for new device state. > [ 617.122392] usb 8-4: Not enough bandwidth for altsetting 6 > [ 617.122397] gspca: set alt 6 err -28 > [ 619.093780] usb 8-4: Not enough bandwidth for new device state. > [ 619.093788] usb 8-4: Not enough bandwidth for altsetting 7 > [ 619.093791] gspca: set alt 7 err -28 > [ 619.094016] usb 8-4: Not enough bandwidth for new device state. > [ 619.094024] usb 8-4: Not enough bandwidth for altsetting 6 > [ 619.094026] gspca: set alt 6 err -28
Attachment:
isoc-log.tar.gz
Description: Binary data