On Thu, Oct 8, 2015 at 1:37 PM, Peter Chen <peter.chen@xxxxxxxxxxxxx> wrote: > On Mon, Oct 05, 2015 at 07:27:23PM +0530, Jayan John wrote: >> We are developing a custom USB device on a iMX6q platform with a Chipidea >> HDRC. The device uses a single NCM interface for communication with another >> OTG device i.e. Chipidea HDRC again. I see very poor iperf UDP performance >> after role reversal with iperf server running on gadget. >> >> Kernel: 3.10.17 using Wandboard config >> >> Test sequence: >> 1. Connect both boards (board A and board B) using OTG cable >> 2. Board A is assigned as A device and board B is assigned as B device >> 3. B device initiates role reversal >> echo -n host > /sys/kernel/debug/ci_hdrc.0/role >> 4. A device switches to gadget mode >> echo -n gadget > /sys/kernel/debug/ci_hdrc.0/role >> 5. Assign IPV6 address on board A (now gadget).. ifconfig usb0 2012::1/64 up >> 6. Assign IPV6 address on board B (now host).. ifconfig usb0 2012::2/64 up >> 7. Run iperf server on board A.. iperf -V -s -u >> 8. Run iperf client on board B.. iperf -u -t 10 -V -c 2012::1 -b 150M >> >> iperf server logs: >> [ 4] local fe80::6cc9:b6ff:fec5:be28 port 5001 connected with >> fe80::54e0:86ff:fea6:8987 port 35629 >> [ 4] 0.0-10.0 sec 63.7 MBytes 53.4 Mbits/sec 0.171 ms 61701/107109 (58%) >> [ 4] 0.0-10.0 sec 1 datagrams received out-of-order >> [ 3] local fe80::6cc9:b6ff:fec5:be28 port 5001 connected with >> fe80::54e0:86ff:fea6:8987 port 33609 >> [ 3] 0.0-10.0 sec 62.1 MBytes 52.1 Mbits/sec 0.215 ms 62551/106825 (59%) >> [ 3] 0.0-10.0 sec 1 datagrams received out-of-order >> >> Query: >> 1. The UDP packet loss is seen only in the case of iperf server on gadget >> after role reversal. I see there are patches (12) from Peter for performance >> improvements on the newer kernels. Will they help? > > If you only see this problem after role switch, compare the controller > registers may help it. > >> 2. The issue is not seen if UDP socket buffer size/ datagram size on iperf is >> increased i.e. iperf -u -t 10 -l 32k -V -c 2012::1 -b 150M. Is this only >> hiding an issue with Chipidea driver e.g. TXFIFO or burst size? >> 3. Should ncm be tweaked to have different buffer size or NTB handling? > > NCM stack may be updated from v3.10, I just tried (without role switch), it > can get 110Mbps, and about 3% loss rate using your command at v4.3-rc1. > > -- > > Best Regards, > Peter Chen Thanks Peter, I will try that. I saw the packet loss only after role switch. I will close this thread for now, as I intend to make a kernel upgrade before I continue investigation on this issue. I will update the community/ push a patch when I root cause/ fix this. BR, Jayan -- 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