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

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:

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.



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.