Skip to contentSkip to conversation

usbback: fix invalid urb->interval for highspeed interrupt endpoint

PATCH New Noboru Iwamatsu 1 participant 1 message Apr 6, 2009 Xen hypervisor interface

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usbback: fix invalid urb->interval for highspeed interrupt endpoint

Hi,

Current usbback fails to submit the interrupt urb for high-speed endpoints. This patch fixes this issue.

usb_fill_int_urb() is a helper function to initialize a interrupt urb, and sets the usb->interval value as follows,

void usb_fill_int_urb(struct urb *urb, ..., int interval) {

	...

	if (dev->speed == USB_SPEED_HIGH)
		urb->interval = 1 << (interval - 1);
	else
		urb->interval = interval;

	...
}

The interval value that usbback got from the RING_REQ is already modified to an exponent of two.

So, usbback must not initialize a interrupt urb with double-modified interval value.

drivers/xen/usbback/usbback.c +12 -0
@@ -470,6 +470,18 @@ static void usbbk_init_urb(usbif_request
 				pending_req->buffer, req->buffer_length,
 				usbbk_urb_complete,
 				pending_req, req->u.intr.interval);
+		/*
+		 * high speed interrupt endpoints use a logarithmic encoding of
+		 * the endpoint interval, and usb_fill_int_urb() initializes a
+		 * interrupt urb with the encoded interval value.
+		 *
+		 * req->u.intr.interval is the interval value that already
+		 * encoded in the frontend part, and the above usb_fill_int_urb()
+		 * initializes the urb->interval with double encoded value.
+		 *
+		 * so, simply overwrite the urb->interval with original value.
+		 */
+		urb->interval = req->u.intr.interval;
 		urb->transfer_flags = req->transfer_flags;
 
 		break;

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel