Re: [RFT/PATCH 18/38] usb: dwc3: gadget: check for Missed Isoc from event status

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

 



Hi Felipe,

On 4/9/2018 4:28 AM, Felipe Balbi wrote:
> In case we get an event with status set to Missed Isoc, this means we
> have missed an isochronous interval and should issue End Transfer
> command and wait for the following XferNotReady.

Why does DWC3 need to issue End Transfer if there are still queued requests?

> 
> Let's do that early, rather than late.
> 
> Signed-off-by: Felipe Balbi <felipe.balbi@xxxxxxxxxxxxxxx>
> ---
>   drivers/usb/dwc3/core.h   |  5 +++--
>   drivers/usb/dwc3/gadget.c | 14 +++++++++++---
>   2 files changed, 14 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
> index 5ee895113906..8862118c3b79 100644
> --- a/drivers/usb/dwc3/core.h
> +++ b/drivers/usb/dwc3/core.h
> @@ -1192,11 +1192,12 @@ struct dwc3_event_depevt {
>   /* Within XferNotReady */
>   #define DEPEVT_STATUS_TRANSFER_ACTIVE	BIT(3)
>   
> -/* Within XferComplete */
> +/* Within XferComplete or XferInProgress */
>   #define DEPEVT_STATUS_BUSERR	BIT(0)
>   #define DEPEVT_STATUS_SHORT	BIT(1)
>   #define DEPEVT_STATUS_IOC	BIT(2)
> -#define DEPEVT_STATUS_LST	BIT(3)
> +#define DEPEVT_STATUS_LST	BIT(3) /* XferComplete */
> +#define DEPEVT_STATUS_MISSED_ISOC BIT(3) /* XferInProgress */
>   
>   /* Stream event only */
>   #define DEPEVT_STREAMEVT_FOUND		1
> diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
> index 0b003367cc7c..ed44b85e59dc 100644
> --- a/drivers/usb/dwc3/gadget.c
> +++ b/drivers/usb/dwc3/gadget.c
> @@ -2361,9 +2361,6 @@ static void dwc3_gadget_ep_cleanup_completed_requests(struct dwc3_ep *dep,
>   			 * entry is added into request list.
>   			 */
>   			dep->flags = DWC3_EP_PENDING_REQUEST;
> -		} else {
> -			dwc3_stop_active_transfer(dep, true);
> -			dep->flags = DWC3_EP_ENABLED;
>   		}
>   	}
>   }
> @@ -2383,14 +2380,25 @@ static void dwc3_gadget_endpoint_transfer_in_progress(struct dwc3_ep *dep,
>   {
>   	struct dwc3		*dwc = dep->dwc;
>   	unsigned		status = 0;
> +	bool			stop = false;
>   
>   	dwc3_gadget_endpoint_frame_from_event(dep, event);
>   
>   	if (event->status & DEPEVT_STATUS_BUSERR)
>   		status = -ECONNRESET;
>   
> +	if (event->status & DEPEVT_STATUS_MISSED_ISOC) {
> +		status = -ECONNRESET;

Missed isoc shouldn't cause this error status or if it should return an 
error status at all. Maybe the status can be -EXDEV, similar to the host 
side (/Documentation/driver-api/usb/error-codes.rst).

> +		stop = true;
> +	}
> +
>   	dwc3_gadget_ep_cleanup_completed_requests(dep, event, status);
>   
> +	if (stop) {
> +		dwc3_stop_active_transfer(dep, true);
> +		dep->flags = DWC3_EP_ENABLED;
> +	}
> +
>   	/*
>   	 * WORKAROUND: This is the 2nd half of U1/U2 -> U0 workaround.
>   	 * See dwc3_gadget_linksts_change_interrupt() for 1st half.
> 

BR,
Thinh
--
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