Re: [RfC PATCH] xhci: fix usb3 streams

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

 



Hi Gerd,

Thanks for catching this!  I have a UAS device now, but won't have time
to test it for a week or so.

Can you please Cc me on patches to the xHCI driver in the future?
Otherwise it gets lost in the other linux-usb mailing list traffic.

One nit-picky comment below, but everything else looks good.

On Mon, Aug 26, 2013 at 02:31:10PM +0200, Gerd Hoffmann wrote:
> +
> +int xhci_update_stream_ring(struct xhci_ring *ring, bool insert)
> +{
> +	struct xhci_segment *seg;
> +	unsigned long key;
> +	bool present;
> +	int ret;
> +
> +	BUG_ON(ring->trb_address_map == NULL);
> +	seg = ring->first_seg;
> +	do {
> +		key = (unsigned long)(seg->dma >> TRB_SEGMENT_SHIFT);
> +		present = radix_tree_lookup(ring->trb_address_map, key) != NULL;
> +		if (!present && insert) {
> +			ret = radix_tree_insert(ring->trb_address_map, key, ring);
> +			if (ret)
> +				return ret;
> +		}
> +		if (present && !insert) {
> +			radix_tree_delete(ring->trb_address_map, key);
> +		}
> +		seg = seg->next;
> +	} while (seg != ring->first_seg);
> +
> +	return 0;
> +}
> +
> @@ -663,6 +697,7 @@ struct xhci_stream_info *xhci_alloc_stream_info(struct xhci_hcd *xhci,
>  		if (!cur_ring)
>  			goto cleanup_rings;
>  		cur_ring->stream_id = cur_stream;
> +		cur_ring->trb_address_map = &stream_info->trb_address_map;
>  		/* Set deq ptr, cycle bit, and stream context type */
>  		addr = cur_ring->first_seg->dma |
>  			SCT_FOR_CTX(SCT_PRI_TR) |
> @@ -672,10 +707,7 @@ struct xhci_stream_info *xhci_alloc_stream_info(struct xhci_hcd *xhci,
>  		xhci_dbg(xhci, "Setting stream %d ring ptr to 0x%08llx\n",
>  				cur_stream, (unsigned long long) addr);
>  
> -		key = (unsigned long)
> -			(cur_ring->first_seg->dma >> TRB_SEGMENT_SHIFT);
> -		ret = radix_tree_insert(&stream_info->trb_address_map,
> -				key, cur_ring);
> +		ret = xhci_update_stream_ring(cur_ring, 1);

Could you use true instead of 1 here?

Sarah Sharp
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




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

  Powered by Linux