zynq and tcp

s002wjh wrote on Thursday, October 29, 2015:

anyone know where can i find/download tutorial/example using freertos for zynq runing high performance tcp 600mbs or more. I have try the xilinx app 1026, it work great but i would like some kind RTOS running on zynq and has the same performance as the xapp1026

rtel wrote on Thursday, October 29, 2015:

First question - I am not familiar with xqpp1026, but if you look at the structure of the source code, and think how you might apply it to a real world application (one that is doing other things too, like generating real data, and processing real data, plus non TCP related activities), do you think you could achieve the same throughput?

Our TCP examples for the Zynq can be found here: http://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCPIP_FAT_Examples_Xilinx_Zynq.html Hopefully Hein will chip in with some throughput figures too.

s002wjh wrote on Thursday, October 29, 2015:

the app1026 does have freertos in socket mode, but i’m try to figure out how to implment in raw mode http://interactive.freertos.org/entries/31659559-Xilinx-Zynq-FreeRTOS-and-lwIP-demo-XAPP1026-Vivado-2014-2

heinbali01 wrote on Friday, October 30, 2015:

running high performance tcp 600mbs or more

Sounds like you have a 1000 mbit LAN?

Unfortunately we have only tested a Xilinx Zynq with a 100 mbs adapter.

Hopefully Hein will chip in with some throughput figures too.

On a 100 mbs LAN we saw a nett throughput of up to 10 MByte, which is about the maximum you can get. This test was done with FTP, transferring big files to or from a RAM-disk.

If you have any questions about porting +TCP to your 1 Gbps MAC, please post them here.

Also I have developed a ‘iperf’ server for FreeRTOS +TCP, in case you want to do performance testing.

I find that ‘iperf’ isn’t very interesting, and like Richard wrote, it is important to see the performance in real life.

figure out how to implement in raw mode

Within +TCP there is only one mode, which is the official BSD interface. But there are some back-doors, for those who prefer speed above compatibility:

  • The use of zero-copy for sending and receiving, both for UDP and TCP.
  • The use of call-backs from the IP-task such as OnReceive, OnSent, and OnError. These hooks are installable per socket.

An echo server which uses an OnReceive handler will have a higher performance because it uses less context switches and less copying.


s002wjh wrote on Friday, October 30, 2015:

you mention there is iperf? where can i download it? i got the demo working but i like do a comparsion between xapp1026 and the demo to see the performance difference.

and is there other demo example for zynq? for example if i want to use zynq usb-uart to display or get input command

heinbali01 wrote on Saturday, October 31, 2015:

Here you can find demo’s with +TCP and +FAT :


You will find a directory:


Note that the SDK by Xilinx will provide/create the library (BSP) sources, they’re not included in this download.
Some of the sources have been adapted for +TCP or +FAT, they can be found under their original name in the ‘portable’ directories:


About iperf sources: a couple of months ago I wrote an iperf server program for FreeRTOS+TCP. You can find it as an attachment to this post (iperf_plus_tcp.zip)
It uses a single task to handle all iperf clients, both UDP and TCP. This is possible by making all recv() and send() calls non-blocking and only block on a call to:

    xResult = FreeRTOS_select( xSocketSet, xBlockingTime );

The module can use zero-copy, if ‘ipconfigIPERF_USE_ZERO_COPY’ is defined as non-zero.

for example if i want to use zynq usb-uart to display or get input command

That will be possible but I don’t know how. But if you have Ethernet, why not make a simple telnet connection or send commands through UDP?


s002wjh wrote on Monday, November 02, 2015:

i try to get your iperf working, but encounter alot issue during building it. is there a note on how to get your iperf compile properly? do i need copy certain file from the zynq_demo or setupt certain repoistory etc?
when try to compile the file, its missing certain .h file, when adding/link to it, it lead to another missing file, on and on. is there a compelete package i can download so i dont have to manully search/added for the missing file? I did get the demo working by import it as project, but i’m try to compile the iperf as new app prj, this encounter alot issue of missing certain files.

heinbali01 wrote on Tuesday, November 03, 2015:


The iperf module as I sent it will only compile and work in a FreeRTOS +TCP project.

If you feel courageous enough, you can ‘translate’ it to your lwIP project.

Or you can try-out the Zynq +FAT +TCP projects that you can download from: http://www.freertos.org/labs

Or alternatively you can get some iperf source code that is written for lwIP. I’m sure that exists as well.


s002wjh wrote on Tuesday, November 03, 2015:

thanks, is there any code lay around some where that i can insert into the zynq+FAT+TCP demo for performance evaluation?

heinbali01 wrote on Tuesday, November 03, 2015:

where that i can insert into the zynq+FAT+TCP demo for performance evaluation

Do you have the zynq+FAT+TCP demo running already ?
If so I will integrate it into that application and make it available to you.

On the Sourceforge email I saw your question about speed / performance. Here is an answer to that:

test out whats the max throughput for freeRTOS tcp?

That is difficult to say.

lwIP has several layers of usage, and the so-called raw API’s are a bit faster than the BSD socket interface.

Like I wrote, +TCP has chosen to only offer a BSD socket interface and make several back-doors for users who need high-speed i/o. These back-doors allow direct call-backs and also zero-copy.

I won’t produce any (benchmark) numbers here because those numbers are not a fixed property of a stack. The speed of Ethernet / Internet depends on so many things, parameters, settings.

It is not very useful to measure the speed of ‘data-pumping’ like iperf does. It is much more interesting if the data goes to some application which works with it and sends replies.

Can you tell something about your application? What is it that needs so much speed? Is your LAN always quiet enough to guarantee so much bandwidth?


s002wjh wrote on Tuesday, November 03, 2015:

yes i have the demo running on xilinx board with zynq. if there is a integrate verision of demo for performance thatll be great. the LAN will always be quite, so the ethernet is dedicate for my use.

heinbali01 wrote on Tuesday, November 03, 2015:

I just saw that I had iperf_task_v1_0.c still included in ( my version of ) the Zynq +TCP project. It compiles without any change to it, so I won’t send a newer version.

Once the +TCP is up and running, you only have to call vIPerfInstall(), which will start-up the iperf-task.

I tested it with this compiler option:

#define ipconfigIPERF_DUAL_TCP    0

That means that the server will not make a return TCP connection to the client.

Please note that iperf_task_v1_0.c is not a FreeRTOS product. I wrote and tested it for one user on this forum, as an example of TCP + UDP servers.

When testing today, I get quite a low score on my 100 Mbps LAN:

hein@ubuntu:~$ iperf -c  --port 5001 --num 32M
Client connecting to, TCP port 5001
TCP window size: 21.6 KByte (default)
[  3] local port 35274 connected with port 5001
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0- 5.4 sec  32.0 MBytes  50.0 Mbits/sec


s002wjh wrote on Tuesday, November 03, 2015:

i notice for some reason when running it says its on 100M lan (on teraterm) even its connect to 1G Lan. any idea which setting in host or software i need to investigate? also if ping address -l 2048, it gets timeout. ping with less than 1024 runs fine. perhap the buffer set to less than 2k?

as far as iperf from hein, i put the vIperfInstall() after freertos_IPInit, i can connect to jperf but nothing was transmitting. The UDP runs fine getting almost 1Gb/s