I went the osh park + digikey route to get an Ethernet connector for the Teensy 4.1, and I can report that it does work that way ![Smile :) :)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
After getting the lwip_iperf example working, I had to tune lwip for maximum performance. I thought I should document that in a thread.
First run, I got 68Mbit/s
tcptrace gave the following stats on that connection:
The RTT was around 650us. You can exchange one full receive window full of bytes every RTT. The bandwidth delay product tells you the minimum size of your receive window (buffer). 100Mbit * 0.000650s = 65,000 bits (8125 bytes).
You can also go the other direction and divide the receive window by the rtt to get the max theoretical transfer rate. 5840 bytes / 0.00065 seconds = 8984615 bytes/s. So it looks like I am receiver window limited. I changed the TCP_SND_BUF setting in lwipopts.h from 4*TCP_MSS (5840 bytes) to 8*TCP_MSS (11680 bytes) and ran iperf again.
tcptrace stats:
That's as much as I would expect to get out of 100M ethernet.
Using iperf's --tradeoff test for receive speed, I had to change TCP_WND to 8*TCP_MSS to get 94Mbit/s for the same reason. These were between two systems connected directly to ethernet. If one of them was on wifi, that would raise the latency and I'd need even larger buffers to reach full speeds.
After getting the lwip_iperf example working, I had to tune lwip for maximum performance. I thought I should document that in a thread.
First run, I got 68Mbit/s
![image-1.png](/proxy.php?image=https%3A%2F%2Fblog.dan.drown.org%2Fcontent%2Fimages%2F2020%2F06%2Fimage-1.png&hash=c68219c00b13f988ae36201e706bbfcc)
tcptrace gave the following stats on that connection:
Code:
min/avg/max receive window advertised: 5836/5839/5840 bytes
retransmitted data packets: 0
throughput: 8568722 bytes/s (68549776 bits/s)
The RTT was around 650us. You can exchange one full receive window full of bytes every RTT. The bandwidth delay product tells you the minimum size of your receive window (buffer). 100Mbit * 0.000650s = 65,000 bits (8125 bytes).
You can also go the other direction and divide the receive window by the rtt to get the max theoretical transfer rate. 5840 bytes / 0.00065 seconds = 8984615 bytes/s. So it looks like I am receiver window limited. I changed the TCP_SND_BUF setting in lwipopts.h from 4*TCP_MSS (5840 bytes) to 8*TCP_MSS (11680 bytes) and ran iperf again.
![image-2.png](/proxy.php?image=https%3A%2F%2Fblog.dan.drown.org%2Fcontent%2Fimages%2F2020%2F06%2Fimage-2.png&hash=17780c3f868b5ab5f4cd942c36e7f442)
tcptrace stats:
Code:
min/avg/max receive window advertised: 11678/11679/11680 bytes
retransmitted data packets: 0
throughput: 11810315 bytes/s (94482520 bits/s)
That's as much as I would expect to get out of 100M ethernet.
Using iperf's --tradeoff test for receive speed, I had to change TCP_WND to 8*TCP_MSS to get 94Mbit/s for the same reason. These were between two systems connected directly to ethernet. If one of them was on wifi, that would raise the latency and I'd need even larger buffers to reach full speeds.