All of lore.kernel.org
 help / color / mirror / Atom feed
From: Noboru Iwamatsu <n_iwamatsu@jp.fujitsu.com>
To: xen-devel@lists.xensource.com
Subject: [PATCH] usbback: fix invalid urb->interval for highspeed interrupt endpoint
Date: Mon, 06 Apr 2009 16:56:45 +0900	[thread overview]
Message-ID: <49D9B5BD.5090903@jp.fujitsu.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 656 bytes --]

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.


Signed-off-by: Noboru Iwamatsu <n_iwamatsu@jp.fujitsu.com>

[-- Attachment #2: usbback_interrupt_urb_interval_fix.patch --]
[-- Type: text/plain, Size: 891 bytes --]

diff --git a/drivers/xen/usbback/usbback.c b/drivers/xen/usbback/usbback.c
--- a/drivers/xen/usbback/usbback.c
+++ b/drivers/xen/usbback/usbback.c
@@ -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;

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

                 reply	other threads:[~2009-04-06  7:56 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=49D9B5BD.5090903@jp.fujitsu.com \
    --to=n_iwamatsu@jp.fujitsu.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.