-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(esp_tinyusb): Fix NCM NTB buffers configuration #114
fix(esp_tinyusb): Fix NCM NTB buffers configuration #114
Conversation
c3bc126
to
77024e4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two general ideas:
- Default value for
CFG_TUD_NCM_IN_NTB_N
: 2 or 3? - Based on the NCM specification the NTB - is a
NCM Transfer Block
. So the shortendNCM NTB
meansNCM NCM Transfer Block
which might be not necessary.
Maybe, just check the menuconfig description based on this thought.
@roma-jam @tore-espressif PTAL at the performance results from IPERF. I did not observe any significant performance when configuring the NCM Device settings, but as stated in my comment, I still observed somer reliability issues when running some higher traffic through the device, whit fairly "low" count of the NTB buffs. I am thinking, what would be a reasonable setting of ranges in Kconfig for the NTB buffs count. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the testing and providing iperf results!
LGTM
P.S. Do not forget to squash before merge.
ee84b11
to
3a9f7a6
Compare
@peter-marcisovsky @roma-jam Thank you for all the testing. I also run some tests (with Win10), here are my results:
|
I am getting
Good findings. Running speed tests looks like a better idea, I did not think about it. On Linux I am getting Going to 16384 lengths was for some reason so bad. I was getting huge latency. Can you try 16k buff lengths as well?
I think, those buffer settings we are configuring in this MR, are valid only for NCM device, not for RNDIS device. Maybe there is some different setting for RNDIS which we can configure. @tore-espressif thank you for the investigations, and idea of using Speed test (so obvious..) I will update the MR based on this findings. |
No no, I still got the message (if I enabled it :D ). But it is expected behavior. USB is bottleneck in this data stream
I doubt it would be so bad in the office. 7.5Mbps is good enough for Full Speed bulk transfer
I did not test, will do
NCM is mentioned in #46 too... in the 'Benchmark' table |
3a9f7a6
to
ddd359a
Compare
@peter-marcisovsky I tested again, and it seems that TinyUSB driver breaks if the buffer are > (10*1024) bytes. So I'd limit max buffer length to 10240. |
ddd359a
to
80ecd79
Compare
851765f
to
959e79b
Compare
Description
This MR adds a possibility to configure NCM transfer blocks via menuconfig.
A table below shows RAM usage and performance dependency on NTB buffers configuration, NTB buffers count and NTB buffers length. Memory occupation was measured using NCM Device Example on esp32s3.
Measuring the performance did prove a significant gain dependency on NTB buffers configurations, similarly to the description in tinyusb upstream is caliming for RP2040.
NTB Buffers count 1/1 and length 3200/3200 is a default value in tinyusb upstream.
The most efficient settings (RAM to performance gain ratio) seems to be the 4th option (NTB Buffers count 3/3, Buffers length 8192/8192).
Increasing the NTB Buffers count and length did also help to mitigate the tud_network_can_xmit: request blocked warning messages while running NCM device.
Related
Closes #113
Relates to #107
Testing
Performance measurement using Iperf did not prove to be useful.
Online speed test was used for the performance measurement (using the esp32s3 NCM device WIFi station to wired interface)
Below is a performance comparison between the
NTB Buffers(IN/OUT) count: 1/1, length(bytes): 3200/3200
NTB Buffers(IN/OUT) count: 4/4, length(bytes): 8192/8192
Checklist
Before submitting a Pull Request, please ensure the following: