All of lore.kernel.org
 help / color / mirror / Atom feed
From: Minas Harutyunyan <minas.harutyunyan@synopsys.com>
To: John Keeping <john@metanate.com>,
	Minas Harutyunyan <minas.harutyunyan@synopsys.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"arthur.petrosyan@synopsys.com" <arthur.petrosyan@synopsys.com>
Subject: Re: [PATCH] usb: dwc2: gadget: fix ISOC frame overflow handling
Date: Mon, 5 Nov 2018 08:28:07 +0000	[thread overview]
Message-ID: <410670D7E743164D87FA6160E7907A56013A79E7CE@am04wembxa.internal.synopsys.com> (raw)
In-Reply-To: 20181023134355.29829-1-john@metanate.com

Hi John,

On 10/23/2018 5:43 PM, John Keeping wrote:
> By clearing the overrun flag as soon as the target frame is next
> incremented, we can end up incrementing the target frame more than
> expected in dwc2_gadget_handle_ep_disabled() when the endpoint's
> interval is greater than 1.  This happens if the target frame has just
> wrapped at the point when the endpoint is disabled and the frame number
> has not yet done so.
> 
> Instead, wait until the frame number also wraps and then clear the
> overrun flag.
> 
> Signed-off-by: John Keeping <john@metanate.com>
> ---
>   drivers/usb/dwc2/gadget.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
> index 2d6d2c8244de..8da2c052dfa1 100644
> --- a/drivers/usb/dwc2/gadget.c
> +++ b/drivers/usb/dwc2/gadget.c
> @@ -117,7 +117,7 @@ static inline void dwc2_gadget_incr_frame_num(struct dwc2_hsotg_ep *hs_ep)
>   	if (hs_ep->target_frame > DSTS_SOFFN_LIMIT) {
>   		hs_ep->frame_overrun = true;
>   		hs_ep->target_frame &= DSTS_SOFFN_LIMIT;
> -	} else {
> +	} else if (hs_ep->parent->frame_number < hs_ep->target_frame) {
>   		hs_ep->frame_overrun = false;
>   	}
>   }
> 
Did you tested mentioned by you scenario? If you see issue can you 
provide debug log and point the issue line in the log.

Thanks,
Minas


WARNING: multiple messages have this Message-ID (diff)
From: Minas Harutyunyan <Minas.Harutyunyan@synopsys.com>
To: John Keeping <john@metanate.com>,
	Minas Harutyunyan <minas.harutyunyan@synopsys.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"arthur.petrosyan@synopsys.com" <arthur.petrosyan@synopsys.com>
Subject: usb: dwc2: gadget: fix ISOC frame overflow handling
Date: Mon, 5 Nov 2018 08:28:07 +0000	[thread overview]
Message-ID: <410670D7E743164D87FA6160E7907A56013A79E7CE@am04wembxa.internal.synopsys.com> (raw)

Hi John,

On 10/23/2018 5:43 PM, John Keeping wrote:
> By clearing the overrun flag as soon as the target frame is next
> incremented, we can end up incrementing the target frame more than
> expected in dwc2_gadget_handle_ep_disabled() when the endpoint's
> interval is greater than 1.  This happens if the target frame has just
> wrapped at the point when the endpoint is disabled and the frame number
> has not yet done so.
> 
> Instead, wait until the frame number also wraps and then clear the
> overrun flag.
> 
> Signed-off-by: John Keeping <john@metanate.com>
> ---
>   drivers/usb/dwc2/gadget.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
> index 2d6d2c8244de..8da2c052dfa1 100644
> --- a/drivers/usb/dwc2/gadget.c
> +++ b/drivers/usb/dwc2/gadget.c
> @@ -117,7 +117,7 @@ static inline void dwc2_gadget_incr_frame_num(struct dwc2_hsotg_ep *hs_ep)
>   	if (hs_ep->target_frame > DSTS_SOFFN_LIMIT) {
>   		hs_ep->frame_overrun = true;
>   		hs_ep->target_frame &= DSTS_SOFFN_LIMIT;
> -	} else {
> +	} else if (hs_ep->parent->frame_number < hs_ep->target_frame) {
>   		hs_ep->frame_overrun = false;
>   	}
>   }
> 
Did you tested mentioned by you scenario? If you see issue can you 
provide debug log and point the issue line in the log.

Thanks,
Minas

  reply	other threads:[~2018-11-05  8:28 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-23 13:43 [PATCH] usb: dwc2: gadget: fix ISOC frame overflow handling John Keeping
2018-10-23 13:43 ` John Keeping
2018-11-05  8:28 ` Minas Harutyunyan [this message]
2018-11-05  8:28   ` Minas Harutyunyan
2018-11-08 17:36   ` [PATCH] " John Keeping
2018-11-08 17:36     ` John Keeping
2018-11-09  8:43     ` [PATCH] " Minas Harutyunyan
2018-11-09  8:43       ` Minas Harutyunyan
2018-11-09 14:36       ` [PATCH] " Minas Harutyunyan
2018-11-09 14:36         ` Minas Harutyunyan
2018-11-09 18:42         ` [PATCH] " John Keeping
2018-11-09 18:42           ` John Keeping
2018-11-12  8:53           ` [PATCH] " Minas Harutyunyan
2018-11-12  8:53             ` Minas Harutyunyan
2018-11-12 22:46             ` [PATCH] " John Keeping
2018-11-12 22:46               ` John Keeping
2018-12-14  9:00               ` [PATCH] " Minas Harutyunyan
2018-12-14  9:00                 ` Minas Harutyunyan
2018-12-18 14:35                 ` [PATCH] " John Keeping
2018-12-18 14:35                   ` John Keeping
2018-12-19 14:09                   ` [PATCH] " Minas Harutyunyan
2018-12-19 14:09                     ` Minas Harutyunyan
2018-12-21 16:05                     ` [PATCH] " John Keeping
2018-12-21 16:05                       ` John Keeping
2018-12-24  7:18                       ` [PATCH] " Minas Harutyunyan
2018-12-24  7:18                         ` Minas Harutyunyan

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=410670D7E743164D87FA6160E7907A56013A79E7CE@am04wembxa.internal.synopsys.com \
    --to=minas.harutyunyan@synopsys.com \
    --cc=arthur.petrosyan@synopsys.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=john@metanate.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /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.