why a dwc3 usb controller didnot report xfercomplete event? Or the gadget driver missed that event?

279 views Asked by At

Android phone that use usb connect to a PC, open the rndis, then do iperf test between the phone and the PC. After a few of hour's test, the endpoint of rndis, ep1out, didnot receive a xfercomplete event that the gadget driver should receve after sent transfer command.

I try to enlarge event buffer size from 256 to 4096, also enlage the grxfifosize from delault value , but the issue remains.

The phone have 8 cortex-A53 core , but we leave 1 little core(cpu0) and 1 big core(cpu7) online, and set the dwc interrupt not routing to cpu0 by setting the smp_affinity of the dwc irq because of the throughput reason. So the dwc3_interrupt runs at cpu7 ,and the dwc3_thread_interrupt also runs at cpu7.

Very strange that if we routing the irq to cpu0, and the dwc3_thread_interrupt runs at different core(cpu7), the issue disappear, canot understand why.

The code is open souce from the synopsys that you can find at kernel/drivers/usb/dwc3/gadget.c

https://github.com/aosp-mirror/kernel_msm/blob/e8adfc30ff9282a728fd8b666b6418308164c415/drivers/usb/dwc3/gadget.c

Thanks in advance.

1

There are 1 answers

0
boogie On

Finally, found the answer, the event data in the eventbuffer was delayed behind the interrupt and the EVENTCOUNT register. When the issue happened, the data in the eventbuffer was dirty of the last round. By many times of reading the data, got the right one.

So, it was not missing the xfercomplete, but delayed. Don't know why the delay happened, the interrupt should be generated after the completes of the transferring.