RE: [PATCH] usb: dwc3: Fix assignment of EP transfer resources

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

 



Hi John

>-----Original Message-----
>From: John Youn [mailto:John.Youn@xxxxxxxxxxxx] 
>Sent: Wednesday, February 10, 2016 1:25 AM
>To: Felipe Balbi; B, Ravi
>Cc: John.Youn@xxxxxxxxxxxx; linux-usb@xxxxxxxxxxxxxxx
>Subject: [PATCH] usb: dwc3: Fix assignment of EP transfer resources

>The assignement of EP transfer resources was not handled properly in the
>dwc3 driver. Commit aebda6187181 ("usb: dwc3: Reset the transfer
>resource index on SET_INTERFACE") previously fixed one aspect of this
>where resources may be exhausted with multiple calls to SET_INTERFACE.
>However, it introduced an issue where composite devices with multiple
>interfaces can be assigned the same transfer resources for different
>endpoints.

>This patch solves both issues.

>The assigning of transfer resource should go as follows:

>Each hardware endpoint requires a transfer resource before it can
>perform any USB transfer. The transfer resources are allocated using two
>commands: DEPSTARTCFG and DEPXFERCFG.

>In the controller, there is a transfer resource index that is set by the
>DEPSTARTCFG command. The DEPXFERCFG command assigns the resource to an
>endpoint and increments the transfer resource index.

>Upon startup of the driver, the transfer resource index should be set to
>0 by issuing DEPSTARTCFG(0). EP0-out and EP0-in are then assigned a
>resource by DEPXFERCFG. They are assigned resource indexes 0 and 1.

>Every time a SET_CONFIGURATION usb request occurs the DEPSTARTCFG(2)
>command should be issued to reset the index to 2. Transfer resources 0
>and 1 remain assigned to EP0-out and EP0-in.

>Then for every endpoint in the configuration (endpoints that will be
>enabled by the upper layer) call DEPXFERCFG to assign the next
>resource. On SET_INTERFACE, the same or different endpoints may be
>enabled. If the endpoint already has an assigned transfer resource,
>don't assign a new one.

>Fixes: aebda6187181 ("usb: dwc3: Reset the transfer resource index on SET_INTERFACE")
>Reported-by: Ravi Babu <ravibabu@xxxxxx>
>Signed-off-by: John Youn <johnyoun@xxxxxxxxxxxx>
>---
>Hi Ravi,

>Here is a patch that should solve your issue. Can you review and test
>it out?

>I have tested with multiple SET_INTERFACE for a single interface.

I have run the same test case with composite gadget with two interface(NCM+ACM), the resource conflict is not seen.
It resolve the issue. Thanks for the patch.

Regards
Ravi 

 >drivers/usb/dwc3/core.h   |  3 +++
 >drivers/usb/dwc3/ep0.c    |  4 ----
 >drivers/usb/dwc3/gadget.c | 36 +++++++++++++++++++++++++++++++++---
 >3 files changed, 36 insertions(+), 7 deletions(-)


--
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