All of lore.kernel.org
 help / color / mirror / Atom feed
From: Felipe Balbi <balbi@kernel.org>
To: Anurag Kumar Vulisha <anuragku@xilinx.com>,
	"gregkh\@linuxfoundation.org" <gregkh@linuxfoundation.org>
Cc: "v.anuragkumar\@gmail.com" <v.anuragkumar@gmail.com>,
	"linux-usb\@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"linux-kernel\@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"Thinh.Nguyen\@synopsys.com" <Thinh.Nguyen@synopsys.com>,
	Ajay Yugalkishore Pandey <APANDEY@xilinx.com>
Subject: RE: [PATCH v5 0/8] usb: dwc3: Fix broken BULK stream support to dwc3 gadget driver
Date: Tue, 09 Oct 2018 16:04:10 +0300	[thread overview]
Message-ID: <87h8hvnuet.fsf@linux.intel.com> (raw)
In-Reply-To: <BL0PR02MB56334E88A0D23DC1FA9905B0A7E70@BL0PR02MB5633.namprd02.prod.outlook.com>

[-- Attachment #1: Type: text/plain, Size: 3132 bytes --]


Hi,

Anurag Kumar Vulisha <anuragku@xilinx.com> writes:
>>> Thanks for spending your time in reviewing this patch. The reason for adding the
>>> timer is when streams are enabled there could be chances for the host and gadget
>>> controller to become out of sync, the gadget may wait for the host to issue prime
>>> transaction and the host may wait for the gadget to issue ERDY. To avoid such a
>>> potential deadlock conditions, timeout needs to be implemented in dwc3 driver.
>>
>>"in dwc3 driver" is an implementation choice. The situation you describe
>>could happen with any UDC, right?
>>
>
> Yes this could happen to other UDC drivers also, unless controller is capable of handling
>
>>> After timeout occurs, gadget will first stop transfer and restart the transfer again.
>>> This issue is mentioned in databook 2.90A section 9.5.2. I am not aware of how
>>> other controllers are handling the streams, but since this issue looks more like a
>>
>>We should get in touch with other UDC authors. We have at least Renesas,
>>net2280, bcd_udc and mtu3 supporting superspeed.
>>
>
> Thanks for pointing other drivers. Will refer these drivers to see how they are handling streams
>  
>>> dwc3 specific issue, I think it would be more convincing to add the timer in dwc3
>>> gadget driver rather than adding in udc framework. Also we are stopping the timer
>>
>>why? When the situation you describe is something that can happen with
>>any udc, why should we reimplement the solution on all UDCs supporting
>>streams when we can give generic support for handling certain
>>situations?
>>
>
> I agree with you. As you suggested will work on implementing changes in UDC
>
>>> when a valid StreamEvnt is found, which would be difficult to handle if the timer is
>>
>>Why difficult? udc-core would call:
>>
>>mod_timer(gadget->stream_timeout_timer, msecs_to_jiffies(50));
>>
>>Once you receive stream event, dwc3 would call:
>>
>>if (timer_pending(dwc->gadget.stream_timeout_timer))
>>	del_timer(dwc->gadget.stream_timeout_timer);
>>
>>Why is that difficult? You could even avoid anything to be written in
>>dwc3 and put the del_timer() inside usb_gadget_giveback_request()
>>itself. That why, dwc3 doesn't even have to know that there's a timer
>>running. Also, you're timer function, instead of calling dwc3's private
>>functions, should be relying on the gadget API.
>>
>>Your timer, apparently, should be fired per-request, then your timer
>>function would call:
>>
>>usb_ep_dequeue(request);
>>usb_ep_queue(request);
>>
>>If the timer expires. This would work for any UDC, not only dwc3. Then,
>>this is something we document for all UDCs and they'd have to adhere to
>>the API.
>>
>>In summary, not that many changes needed to dwc3. Nothing related to
>>timers inside dwc3. Almost everythin can, and should, be done
>>generically.
>
> Thanks a lot for giving a detailed explanation. Will implement the timeout
> changes into UDC core.

no problem. I just wanna make sure that this work happens in one place
and one place only :)

cheers

-- 
balbi

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

  reply	other threads:[~2018-10-09 13:11 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-15 14:29 [PATCH v5 0/8] usb: dwc3: Fix broken BULK stream support to dwc3 gadget driver Anurag Kumar Vulisha
2018-09-21  2:53 ` Tejas Joglekar
2018-09-21 13:31 ` Tejas Joglekar
2018-09-21 14:05   ` Anurag Kumar Vulisha
2018-09-24  4:57     ` Tejas Joglekar
2018-10-08 15:25 ` Anurag Kumar Vulisha
2018-10-09  5:36   ` Felipe Balbi
2018-10-09  6:38     ` Anurag Kumar Vulisha
2018-10-09  7:20       ` Felipe Balbi
2018-10-09 13:00         ` Anurag Kumar Vulisha
2018-10-09 13:04           ` Felipe Balbi [this message]
  -- strict thread matches above, loose matches on Subject: below --
2018-09-15 14:29 [v5,1/8] usb: dwc3: Correct the logic for checking TRB full in __dwc3_prepare_one_trb() Anurag Kumar Vulisha
2018-09-15 14:29 ` [PATCH v5 1/8] " Anurag Kumar Vulisha
2018-09-15 14:29 [v5,2/8] usb: dwc3: update stream id in depcmd Anurag Kumar Vulisha
2018-09-15 14:29 ` [PATCH v5 2/8] " Anurag Kumar Vulisha
2018-09-15 14:29 [v5,3/8] usb: dwc3: make controller clear transfer resources after complete Anurag Kumar Vulisha
2018-09-15 14:29 ` [PATCH v5 3/8] " Anurag Kumar Vulisha
2018-09-15 14:29 [v5,4/8] usb: dwc3: implement stream transfer timeout Anurag Kumar Vulisha
2018-09-15 14:29 ` [PATCH v5 4/8] " Anurag Kumar Vulisha
2018-09-15 14:29 [v5,5/8] usb: dwc3: don't issue no-op trb for stream capable endpoints Anurag Kumar Vulisha
2018-09-15 14:29 ` [PATCH v5 5/8] " Anurag Kumar Vulisha
2018-09-15 14:29 [v5,6/8] usb: dwc3: check for requests in started list " Anurag Kumar Vulisha
2018-09-15 14:29 ` [PATCH v5 6/8] " Anurag Kumar Vulisha
2018-09-15 14:30 [v5,7/8] usb: dwc3: Check for IOC/LST bit in both event->status and TRB->ctrl fields Anurag Kumar Vulisha
2018-09-15 14:30 ` [PATCH v5 7/8] " Anurag Kumar Vulisha
2018-09-15 14:30 [v5,8/8] usb: dwc3: Check MISSED ISOC bit only for ISOC endpoints Anurag Kumar Vulisha
2018-09-15 14:30 ` [PATCH v5 8/8] " Anurag Kumar Vulisha

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=87h8hvnuet.fsf@linux.intel.com \
    --to=balbi@kernel.org \
    --cc=APANDEY@xilinx.com \
    --cc=Thinh.Nguyen@synopsys.com \
    --cc=anuragku@xilinx.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=v.anuragkumar@gmail.com \
    /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.