From: Zhuang Jin Can <jin.can.zhuang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
To: Alan Stern <stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz@public.gmane.org>
Cc: Felipe Balbi <balbi-l0cyMroinI0@public.gmane.org>,
USB list <linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Kernel development list
<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
liping.zhou-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
david.a.cohen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org
Subject: Re: [PATCH] usb: dwc3: ep0: fix delayed status is queued too early
Date: Thu, 8 May 2014 12:00:47 -0400 [thread overview]
Message-ID: <20140508160046.GJ19925@intel.com> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1405071252550.1325-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
On Wed, May 07, 2014 at 12:59:06PM -0400, Alan Stern wrote:
> On Thu, 8 May 2014, Zhuang Jin Can wrote:
>
> > > A similar problem can occur in the opposite sense: The thread queuing
> > > the delayed status request might be delayed for so long that another
> > > SETUP packet arrives from the host first. In that case, the delayed
> > > status request is a response for a stale transfer, so it must not be
> > > sent to the host.
> > >
> > > Do dwc3 and composite.c handle this case correctly?
> > >
> > So the situation you describe is that we get the STATUS XferNotReady
> > event, but gadget queues a status request when control transfer already
> > failed.
>
> When the host already timed out the control transfer and started a new
> one. Here's what I'm talking about:
>
> Host sends a Set-Configuration request.
>
> The UDC driver calls the gadget driver's setup function.
>
> The setup function returns DELAYED_STATUS.
>
> After a few seconds, the host gets tired of waiting and
> sends a Get-Descriptor request
My understanding is dwc3 will return NYET to host for this
Get-Descriptor request transaction, as dwc3 is still in STATUS phase,
there's no buffer to receive anything in ep0-out. And your below
comments is not applicapable to dwc3.
>
> The gadget driver finally submits the delayed request response
> to the Set-Configuration request. But it is now too late,
> because the host expects a response to the Get-Descriptor
> request.
>
> > dwc3 can't move to SETUP phase until the status request arrives,
> > so any SETUP transaction from host will fail. If status request
> > eventually arrives, it already missed the first control transfer, and
> > I don't know how the controller will behave. If we still can get a
> > STATUS XferComplete event without actually transfer anything on the
> > bus, then we can move back to SETUP PHASE which will remove the stale
> > delayed status request and start the new SETUP transaction. But I think
> > in this situation, the host should already lose it patience and start
> > to reset the bus.
>
> My point is that the UDC driver can't handle this. Therefore the
> gadget driver has to prevent this from happening.
>
> That means composite.c has to avoid sending delayed status responses if
> a new SETUP packet has been received already.
>
> > Per my understanding, it's impossible for dwc3 to send a stale STATUS
> > request for a new SETUP transaction.
>
> dwc3 won't know that the status response is stale. It will think the
> response was meant for the new transfer, not the old one.
>
> Alan Stern
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-usb" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
WARNING: multiple messages have this Message-ID (diff)
From: Zhuang Jin Can <jin.can.zhuang@intel.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Felipe Balbi <balbi@ti.com>, USB list <linux-usb@vger.kernel.org>,
linux-omap@vger.kernel.org,
Kernel development list <linux-kernel@vger.kernel.org>,
liping.zhou@intel.com, david.a.cohen@linux.intel.com
Subject: Re: [PATCH] usb: dwc3: ep0: fix delayed status is queued too early
Date: Thu, 8 May 2014 12:00:47 -0400 [thread overview]
Message-ID: <20140508160046.GJ19925@intel.com> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1405071252550.1325-100000@iolanthe.rowland.org>
On Wed, May 07, 2014 at 12:59:06PM -0400, Alan Stern wrote:
> On Thu, 8 May 2014, Zhuang Jin Can wrote:
>
> > > A similar problem can occur in the opposite sense: The thread queuing
> > > the delayed status request might be delayed for so long that another
> > > SETUP packet arrives from the host first. In that case, the delayed
> > > status request is a response for a stale transfer, so it must not be
> > > sent to the host.
> > >
> > > Do dwc3 and composite.c handle this case correctly?
> > >
> > So the situation you describe is that we get the STATUS XferNotReady
> > event, but gadget queues a status request when control transfer already
> > failed.
>
> When the host already timed out the control transfer and started a new
> one. Here's what I'm talking about:
>
> Host sends a Set-Configuration request.
>
> The UDC driver calls the gadget driver's setup function.
>
> The setup function returns DELAYED_STATUS.
>
> After a few seconds, the host gets tired of waiting and
> sends a Get-Descriptor request
My understanding is dwc3 will return NYET to host for this
Get-Descriptor request transaction, as dwc3 is still in STATUS phase,
there's no buffer to receive anything in ep0-out. And your below
comments is not applicapable to dwc3.
>
> The gadget driver finally submits the delayed request response
> to the Set-Configuration request. But it is now too late,
> because the host expects a response to the Get-Descriptor
> request.
>
> > dwc3 can't move to SETUP phase until the status request arrives,
> > so any SETUP transaction from host will fail. If status request
> > eventually arrives, it already missed the first control transfer, and
> > I don't know how the controller will behave. If we still can get a
> > STATUS XferComplete event without actually transfer anything on the
> > bus, then we can move back to SETUP PHASE which will remove the stale
> > delayed status request and start the new SETUP transaction. But I think
> > in this situation, the host should already lose it patience and start
> > to reset the bus.
>
> My point is that the UDC driver can't handle this. Therefore the
> gadget driver has to prevent this from happening.
>
> That means composite.c has to avoid sending delayed status responses if
> a new SETUP packet has been received already.
>
> > Per my understanding, it's impossible for dwc3 to send a stale STATUS
> > request for a new SETUP transaction.
>
> dwc3 won't know that the status response is stale. It will think the
> response was meant for the new transfer, not the old one.
>
> Alan Stern
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-usb" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2014-05-08 16:00 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-07 21:53 [PATCH] usb: dwc3: ep0: fix delayed status is queued too early Zhuang Jin Can
2014-05-07 15:03 ` Alan Stern
2014-05-07 15:03 ` Alan Stern
2014-05-08 4:39 ` Zhuang Jin Can
2014-05-07 16:59 ` Alan Stern
2014-05-07 16:59 ` Alan Stern
[not found] ` <Pine.LNX.4.44L0.1405071252550.1325-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2014-05-08 16:00 ` Zhuang Jin Can [this message]
2014-05-08 16:00 ` Zhuang Jin Can
2014-05-08 14:25 ` Alan Stern
2014-05-08 14:25 ` Alan Stern
2014-05-09 3:01 ` Zhuang Jin Can
2014-05-08 15:22 ` Alan Stern
2014-05-08 15:22 ` Alan Stern
2014-05-09 5:03 ` Zhuang Jin Can
2014-05-08 19:55 ` Paul Zimmerman
2014-05-08 21:18 ` Alan Stern
2014-05-08 23:01 ` Paul Zimmerman
2014-05-09 14:08 ` Alan Stern
[not found] ` <20140507215344.GH19925-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-05-14 1:45 ` Zhuang Jin Can
2014-05-14 1:45 ` Zhuang Jin Can
2014-05-13 15:05 ` Felipe Balbi
2014-05-13 15:05 ` Felipe Balbi
2014-05-14 3:28 ` Zhuang Jin Can
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=20140508160046.GJ19925@intel.com \
--to=jin.can.zhuang-ral2jqcrhueavxtiumwx3w@public.gmane.org \
--cc=balbi-l0cyMroinI0@public.gmane.org \
--cc=david.a.cohen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=liping.zhou-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz@public.gmane.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.