Re: [RFC 1/6] usb/dwc3: fix resource_index

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

 



HI,

On Fri, Sep 07, 2012 at 10:03:45AM +0530, Pratyush Anand wrote:
> We are clearing resource_index when we issue END TRANSFER command.

which is just fine, actually...

> Consider a situation, when we have executed END TRANSFER, core has
> generated xfernotready, but gadget is too slow and have not queued
> any request. So we set PENDING flag. Now application queues another
> request. Software does not have notion for current microframe to submit
> isoc TRBs. So, it will issue END TRANSFER again. If we have forced
> resource_index to zero during first END TRANSFER, then second END
> TRANSFER will be issued with wrong resource_index (0), which is not
> correct and confusing for core. I have observed that core does generate
> xfernotready even if END TRANSFER is issued with resource_index 0, but
> then it is not able to start transfer again.

then you should just clear PENDING flag, right ?

> Moreover I have observed that START TRANSFER returns a new
> resource_index only if SET XFER RESOURCE is issued again.
> 
> Signed-off-by: Pratyush Anand <pratyush.anand@xxxxxx>
> ---
>  drivers/usb/dwc3/gadget.c |    5 +----
>  1 files changed, 1 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
> index f13daa2..0f6874c 100644
> --- a/drivers/usb/dwc3/gadget.c
> +++ b/drivers/usb/dwc3/gadget.c
> @@ -530,6 +530,7 @@ static int __dwc3_gadget_ep_enable(struct dwc3_ep *dep,
>  		if (ret)
>  			return ret;
>  
> +		dep->resource_index = 0;
>  		dep->endpoint.desc = desc;
>  		dep->comp_desc = comp_desc;
>  		dep->type = usb_endpoint_type(desc);
> @@ -1919,16 +1920,12 @@ static void dwc3_stop_active_transfer(struct dwc3 *dwc, u32 epnum)
>  
>  	dep = dwc->eps[epnum];
>  
> -	if (!dep->resource_index)
> -		return;

the thing is that this will let us fall into a situation where we issue
END_TRANSFER even when resource_index is zero, which isn't good at all.

-- 
balbi

Attachment: signature.asc
Description: Digital signature


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

  Powered by Linux