Re: [PATCH 9/9 v7] xHCI: Isoc urb enqueue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Andiry,

I tested this patchset with several of my USB devices, and all seem to
work fine:
 - SIIG USB3 hard drive
 - USB2 flash drives
 - USB to serial adapters (pl2303, ftdi, and pegasus drivers)
 - USB to ethernet adapters
 - single-TT and mulit-TT HS hubs
 - HS logitech webcam (uvcvideo driver)
 - FS logitech Clicksmart 310 webcam (gspca_spca500 driver)
 - C-Media Electronics, Inc USB speaker (snd_usb_audio)

However, to get my high speed webcam to work, I needed to apply your
older patch to statically add more ring segments for isochronous
endpoints.  That patch is attached.  Can you include it in your next
patchset?  The work to dynamically expand rings is on my
xhci-ring-expansion-simplified branch, but it really needs to be cleaned
up and tested.  It's probably better to include the static ring
expansion patch for now.

If you make the other small changes I suggested (including
not touching urb->status) and update to the master branch, then I can
ack the patchset.  Thanks for putting so much time and effort into
these. :)

I will test the power management patchset next, but I need to debug a
suspend issue with my laptop on 2.6.35 first.

Sarah Sharp

On Fri, Jun 25, 2010 at 04:49:17PM +0800, Andiry Xu wrote:
> >From b8955c161db7be7a55025d35d90c91c0c5e6f9bd Mon Sep 17 00:00:00 2001
> From: Andiry Xu <andiry.xu@xxxxxxx>
> Date: Tue, 9 Mar 2010 19:00:29 +0800
> Subject: [PATCH 9/9] xHCI: Isoc urb enqueue
> 
> Enable isochronous urb enqueue.
> 
> Signed-off-by: Andiry Xu <andiry.xu@xxxxxxx>
> ---
>  drivers/usb/host/xhci.c |    7 ++++++-
>  1 files changed, 6 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
> index 171ebf1..b30e4b3 100644
> --- a/drivers/usb/host/xhci.c
> +++ b/drivers/usb/host/xhci.c
> @@ -772,7 +772,12 @@ int xhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, gfp_t mem_flags)
>  				slot_id, ep_index);
>  		spin_unlock_irqrestore(&xhci->lock, flags);
>  	} else {
> -		ret = -EINVAL;
> +		spin_lock_irqsave(&xhci->lock, flags);
> +		if (xhci->xhc_state & XHCI_STATE_DYING)
> +			goto dying;
> +		ret = xhci_queue_isoc_tx_prepare(xhci, GFP_ATOMIC, urb,
> +				slot_id, ep_index);
> +		spin_unlock_irqrestore(&xhci->lock, flags);
>  	}
>  exit:
>  	return ret;
> -- 
> 1.7.0.4
> 
> 
> 
>From 9347cb981906916d55cf53e3ff16bd2bad03e846 Mon Sep 17 00:00:00 2001
From: Andiry Xu <andiry.xu@xxxxxxx>
Date: Tue, 20 Apr 2010 17:18:24 +0800
Subject: [PATCH] xHCI: allocate bigger ring for isochronous endpoint

Isochronous endpoint needs a bigger size of transfer ring. Isochronous URB
consists of multiple packets, each packet needs a isoc td to carry, and
there will be multiple trbs inserted to the ring at one time. One segment
is too small for isochronous endpoints, and it will result in
room_on_ring() check failure and the URB is failed to enqueue.

Allocate bigger ring for isochronous endpoint. 8 segments should be enough.
This will be replaced with dynamic ring expansion in the future.

Signed-off-by: Andiry Xu <andiry.xu@xxxxxxx>
---
 drivers/usb/host/xhci-mem.c |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
index b6dc3ef..4df2e1a 100644
--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -1090,8 +1090,18 @@ int xhci_endpoint_init(struct xhci_hcd *xhci,
 	ep_ctx = xhci_get_ep_ctx(xhci, virt_dev->in_ctx, ep_index);
 
 	/* Set up the endpoint ring */
-	virt_dev->eps[ep_index].new_ring =
-		xhci_ring_alloc(xhci, 1, true, mem_flags);
+	/*
+	 * Isochronous endpoint ring needs bigger size because one isoc URB
+	 * carriess multiple packets and it will insert multiple tds to the
+	 * ring.
+	 * This should be replaced with dynamic ring resizing in the future.
+	 */
+	if (usb_endpoint_xfer_isoc(&ep->desc))
+		virt_dev->eps[ep_index].new_ring =
+			xhci_ring_alloc(xhci, 8, true, mem_flags);
+	else
+		virt_dev->eps[ep_index].new_ring =
+			xhci_ring_alloc(xhci, 1, true, mem_flags);
 	if (!virt_dev->eps[ep_index].new_ring) {
 		/* Attempt to use the ring cache */
 		if (virt_dev->num_rings_cached == 0)
-- 
1.6.3.3


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux