1.. _zperf:
2
3zperf: Network Traffic Generator
4################################
5
6.. contents::
7    :local:
8    :depth: 2
9
10Overview
11********
12
13zperf is a shell utility which allows to generate network traffic in Zephyr. The
14tool may be used to evaluate network bandwidth.
15
16zperf is compatible with iPerf_2.0.5. Note that in newer iPerf versions,
17an error message like this is printed and the server reported statistics
18are missing.
19
20.. code-block:: console
21
22   LAST PACKET NOT RECEIVED!!!
23
24zperf can be enabled in any application, a dedicated sample is also present
25in Zephyr. See :zephyr:code-sample:`zperf sample application <zperf>` for details.
26
27Sample Usage
28************
29
30If Zephyr acts as a client, iPerf must be executed in server mode.
31For example, the following command line must be used for UDP testing:
32
33.. code-block:: console
34
35   $ iperf -s -l 1K -u -V -B 2001:db8::2
36
37For TCP testing, the command line would look like this:
38
39.. code-block:: console
40
41   $ iperf -s -l 1K -V -B 2001:db8::2
42
43
44In the Zephyr console, zperf can be executed as follows:
45
46.. code-block:: console
47
48   zperf udp upload 2001:db8::2 5001 10 1K 1M
49
50
51For TCP the zperf command would look like this:
52
53.. code-block:: console
54
55   zperf tcp upload 2001:db8::2 5001 10 1K 1M
56
57
58If the IP addresses of Zephyr and the host machine are specified in the
59config file, zperf can be started as follows:
60
61.. code-block:: console
62
63   zperf udp upload2 v6 10 1K 1M
64
65
66or like this if you want to test TCP:
67
68.. code-block:: console
69
70   zperf tcp upload2 v6 10 1K 1M
71
72
73If Zephyr is acting as a server, set the download mode as follows for UDP:
74
75.. code-block:: console
76
77   zperf udp download 5001
78
79
80or like this for TCP:
81
82.. code-block:: console
83
84   zperf tcp download 5001
85
86
87and in the host side, iPerf must be executed with the following
88command line if you are testing UDP:
89
90.. code-block:: console
91
92   $ iperf -l 1K -u -V -c 2001:db8::1 -p 5001
93
94
95and this if you are testing TCP:
96
97.. code-block:: console
98
99   $ iperf -l 1K -V -c 2001:db8::1 -p 5001
100
101
102iPerf output can be limited by using the -b option if Zephyr is not
103able to receive all the packets in orderly manner.
104