tselmeci wrote on Tuesday, October 06, 2015:
Hello!
We’ve got a custom PCB with Freescale Kinetis K63F @96MHz (Cortex M4). It’s running FreeRTOS-8.0.0, ported by Freescale, sources are taken from KSDK-1.2.0. I’ve added FreeRTOS Labs TCP/IP stack version 150825. The PHY is LAN8720a, uses RMII interface.
In order to test the stability and reliability of K63F ethernet HW/driver and my NetworkInterface.c implementation, I’ve made a small test suite comprising of a UDP and a TCP “flood” test. The only difference between them (apparently) is the protocol being used (TCP/UDP). Anyway, the working mechanism is the same:
- sender (PC / linux) generates a packet with random length (not greater than 1500 bytes);
- sender transmits the packet;
- receiver (K63F / FreeRTOS) receives the packet, checks the CRC, updates internal stats etc;
- receiver sends a packet back with the same format but with different contents (and size) to the sender (PC);
- PC checks the validity of the incoming message (CRC etc), updates stats etc;
- and this goes in an endless loop;
I’ve got two questions regarding the network stack:
-
the transfer speed can’t be increased over ~380kB/s in each direction (TX/RX). If the payload size is smaller (e.g. ~800 bytes), it can RX/TX up to 460-470 packets in a second. If the payload is greater (e.g. ~1450 bytes), it can RX/TX less packets, but the final transfer speed will be somewhere around ~380kB/s. I believe there can be a HW bottleneck (memory bandwidth with memcpy tests is around ~100MB/s), or my NetworkInterface.c implementation is probably not optimal. What I’m curious is that according to your experiences what’s the expectable highest RX/TX speed on such a machine like mine? What transfer speeds have you faced?
-
My UDP stress test appears to be able to run forever (>23 GB RX and >23 GB TX data, I’ve stopped it manually), but TCP test goes wrong. After ~12 hours of running (>14 GB RX and >14GB TX data) at the mentioned ~330kB/s speed (in each direction) something happens and the transfer speed falls back to ~30-40kB/s and some transfer errors occur (the CRC detects corrupt packets in my test program). With this reduced speed and some occasional badly received packets it still can run ~12 hours, when it totally crashes and the transfer speed goes down to 0-1 kB/s (0-1 packets/s). At first, I can imagine my NetworkInterface.c still needs some tuning, and the ethernet buffers for the Ethernet HW may also be need to be tuned. However, what is strange is that if I stop the test when the TCP speed is so slow (MCU is not restarted) and initiate a UDP test, it runs at ~330kB/s as it should. If I restart the TCP test, the TCP transfer speed is still too low. This is the only sign that makes me ask you whether this can be a TCP/IP stack related issue? Have you got any idea? If needed, I can provide you with the source code of my UDP/TCP tests. Of course I haven’t given up examining my codes.
Thanks in advance,
tselmeci