Skip to content

Commit

Permalink
samples: zperf: Port to native IP stack
Browse files Browse the repository at this point in the history
Port the zperf network performance tool to native IP stack.

TCP support is missing from this version.

Change-Id: I2648e7d81014bb0cae8cf50854b0ae5f89a6567c
Signed-off-by: Jukka Rissanen <[email protected]>
  • Loading branch information
jukkar committed Dec 2, 2016
1 parent c07222b commit 51da830
Show file tree
Hide file tree
Showing 20 changed files with 1,679 additions and 725 deletions.
7 changes: 4 additions & 3 deletions samples/net/zperf/Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
BOARD = galileo
BOARD ?= qemu_x86
#BOARD ?= frdm_k64f

ifeq (${PROFILER}, 1)
PROF="_prof"
endif

CONF_FILE = prj_galileo_ethernet${PROF}.conf
MDEF_FILE = prj${PROF}.mdef
CONF_FILE ?= prj_${BOARD}${PROF}.conf

include ${ZEPHYR_BASE}/Makefile.inc
include $(ZEPHYR_BASE)/samples/net/common/Makefile.ipstack
31 changes: 30 additions & 1 deletion samples/net/zperf/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ Features
=========

- Compatible with iPerf_2.0.5.
- Support for micro and nano kernel modes.
- Client or server mode allowed without need to modify the source code.
- Working with task profiler (PROFILER=1 to be set when building zperf)

Expand All @@ -17,3 +16,33 @@ Supported Boards

zperf is board-agnostic. However, zperf requires a network interface.
So far, zperf has been tested only on the Intel Galileo Development Board.

Usage
=====

If the zephyr is a client, then you can start the iperf in host with these
command line options if you want to test UDP:

$ iperf -s -l 1K -u -V -B 2001:db8::2

In zephyr start zperf like this

zperf> udp.upload 2001:db8::2 5001 10 1K 1M

or if you have set the zephyr and peer host IP addresses in config file,
then you can simply say

zperf> udp.upload2 v6 10 1K 1M


If the zephyr is acting as a server, then first start zephyr in download
mode like this:

zperf> udp.download 5001

and in host side start iperf like this

$ iperf -l 1K -u -V -c 2001:db8::1 -p 5001

Note the you might need to rate limit the output using -b option
if zephyr is not able to receive all the packets in orderly manner.
5 changes: 0 additions & 5 deletions samples/net/zperf/prj.mdef

This file was deleted.

48 changes: 48 additions & 0 deletions samples/net/zperf/prj_frdm_k64f.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
CONFIG_NETWORKING=y
CONFIG_NET_LOG=y
CONFIG_NET_IPV6=y
CONFIG_NET_IPV4=y
CONFIG_NET_DHCPV4=n
CONFIG_NET_UDP=y
CONFIG_NET_TCP=n
CONFIG_NET_STATISTICS=y

CONFIG_NET_NBUF_RX_COUNT=100
CONFIG_NET_NBUF_TX_COUNT=100
CONFIG_NET_NBUF_DATA_COUNT=200
CONFIG_NET_NBUF_DATA_SIZE=128
CONFIG_NET_IF_UNICAST_IPV6_ADDR_COUNT=3
CONFIG_NET_IF_MCAST_IPV6_ADDR_COUNT=2
CONFIG_NET_IF_UNICAST_IPV4_ADDR_COUNT=2
CONFIG_NET_MAX_CONTEXTS=10
CONFIG_NET_CONTEXT_SYNC_RECV=y

CONFIG_NANO_TIMEOUTS=y
CONFIG_INIT_STACKS=y
CONFIG_TEST_RANDOM_GENERATOR=y
CONFIG_SYS_LOG_SHOW_COLOR=y
CONFIG_PRINTK=y

CONFIG_ETH_KSDK=y
CONFIG_NET_L2_ETHERNET=y
CONFIG_ETH_KSDK_0=y
CONFIG_ETH_KSDK_0_MAC0=1
CONFIG_ETH_KSDK_0_MAC1=2
CONFIG_ETH_KSDK_0_MAC2=3
CONFIG_ETH_KSDK_0_MAC3=4
CONFIG_ETH_KSDK_0_MAC4=5
CONFIG_ETH_KSDK_0_MAC5=6
#CONFIG_ETH_KSDK_0_RANDOM_MAC=y

CONFIG_NET_SHELL=y
CONFIG_CONSOLE_HANDLER=y
CONFIG_CONSOLE_HANDLER_SHELL=y
CONFIG_ENABLE_SHELL=y
CONFIG_PRINTK=y
CONFIG_MINIMAL_LIBC_EXTENDED=y

CONFIG_NET_SAMPLES_IP_ADDRESSES=y
CONFIG_NET_SAMPLES_MY_IPV6_ADDR="2001:db8::1"
CONFIG_NET_SAMPLES_PEER_IPV6_ADDR="2001:db8::2"
CONFIG_NET_SAMPLES_MY_IPV4_ADDR="192.0.2.1"
CONFIG_NET_SAMPLES_PEER_IPV4_ADDR="192.0.2.2"
49 changes: 49 additions & 0 deletions samples/net/zperf/prj_frdm_k64f_prof.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
CONFIG_NETWORKING=y
CONFIG_NET_LOG=y
CONFIG_NET_IPV6=y
CONFIG_NET_IPV4=y
CONFIG_NET_DHCPV4=y
CONFIG_NET_YAIP=y
CONFIG_NET_UDP=y
CONFIG_NET_TCP=y
CONFIG_NET_STATISTICS=y

CONFIG_NET_NBUF_RX_COUNT=14
CONFIG_NET_NBUF_TX_COUNT=14
CONFIG_NET_NBUF_DATA_COUNT=30
CONFIG_NET_NBUF_DATA_SIZE=128
CONFIG_NET_IF_UNICAST_IPV6_ADDR_COUNT=5
CONFIG_NET_IF_MCAST_IPV6_ADDR_COUNT=5
CONFIG_NET_IF_UNICAST_IPV4_ADDR_COUNT=2
CONFIG_NET_MAX_CONTEXTS=10

CONFIG_NANO_TIMEOUTS=y
CONFIG_INIT_STACKS=y
CONFIG_TEST_RANDOM_GENERATOR=y
CONFIG_SYS_LOG_SHOW_COLOR=y
CONFIG_PRINTK=y

CONFIG_ETH_KSDK=y
CONFIG_NET_L2_ETHERNET=y
CONFIG_ETH_KSDK_0=y
CONFIG_ETH_KSDK_0_MAC0=1
CONFIG_ETH_KSDK_0_MAC1=2
CONFIG_ETH_KSDK_0_MAC2=3
CONFIG_ETH_KSDK_0_MAC3=4
CONFIG_ETH_KSDK_0_MAC4=5
CONFIG_ETH_KSDK_0_MAC5=6
CONFIG_ETH_KSDK_0_RANDOM_MAC=y

CONFIG_NET_SHELL=y

#
# Profiler
#
CONFIG_RING_BUFFER=y
CONFIG_NANO_TIMEOUTS=y
CONFIG_KERNEL_EVENT_LOGGER=y
CONFIG_KERNEL_EVENT_LOGGER_BUFFER_SIZE=10000
CONFIG_KERNEL_EVENT_LOGGER_CONTEXT_SWITCH=y
CONFIG_KERNEL_EVENT_LOGGER_INTERRUPT=y
CONFIG_KERNEL_EVENT_LOGGER_DYNAMIC=y
CONFIG_MINIMAL_LIBC_EXTENDED=y
6 changes: 0 additions & 6 deletions samples/net/zperf/prj_prof.mdef

This file was deleted.

41 changes: 41 additions & 0 deletions samples/net/zperf/prj_qemu_x86.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
CONFIG_NETWORKING=y
CONFIG_NET_LOG=y
CONFIG_NET_IPV6=y
CONFIG_NET_IPV4=y
CONFIG_NET_DHCPV4=n
CONFIG_NET_YAIP=y
CONFIG_NET_UDP=y
CONFIG_NET_TCP=n
CONFIG_NET_STATISTICS=y

CONFIG_NET_NBUF_RX_COUNT=14
CONFIG_NET_NBUF_TX_COUNT=14
CONFIG_NET_NBUF_DATA_COUNT=28
CONFIG_NET_NBUF_DATA_SIZE=512
CONFIG_NET_IF_UNICAST_IPV6_ADDR_COUNT=5
CONFIG_NET_IF_MCAST_IPV6_ADDR_COUNT=5
CONFIG_NET_IF_UNICAST_IPV4_ADDR_COUNT=1
CONFIG_NET_MAX_CONTEXTS=3
CONFIG_NET_CONTEXT_SYNC_RECV=y

CONFIG_NANO_TIMEOUTS=y
CONFIG_INIT_STACKS=y
CONFIG_TEST_RANDOM_GENERATOR=y
CONFIG_SYS_LOG_SHOW_COLOR=y

CONFIG_NET_SLIP=y
CONFIG_NET_SLIP_TAP=y
CONFIG_NET_L2_ETHERNET=y
CONFIG_NET_SHELL=y

CONFIG_CONSOLE_HANDLER=y
CONFIG_CONSOLE_HANDLER_SHELL=y
CONFIG_ENABLE_SHELL=y
CONFIG_PRINTK=y
CONFIG_MINIMAL_LIBC_EXTENDED=y

CONFIG_NET_SAMPLES_IP_ADDRESSES=y
CONFIG_NET_SAMPLES_MY_IPV6_ADDR="2001:db8::1"
CONFIG_NET_SAMPLES_PEER_IPV6_ADDR="2001:db8::2"
CONFIG_NET_SAMPLES_MY_IPV4_ADDR="192.0.2.1"
CONFIG_NET_SAMPLES_PEER_IPV4_ADDR="192.0.2.2"
44 changes: 44 additions & 0 deletions samples/net/zperf/prj_quark_se_c1000_devboard.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
CONFIG_NETWORKING=y
CONFIG_NET_LOG=y
CONFIG_NET_IPV6=y
CONFIG_NET_IPV4=n
CONFIG_NET_UDP=y
CONFIG_NET_TCP=n
CONFIG_NET_STATISTICS=y

CONFIG_NET_NBUF_RX_COUNT=100
CONFIG_NET_NBUF_TX_COUNT=100
CONFIG_NET_NBUF_DATA_COUNT=100
CONFIG_NET_IF_UNICAST_IPV6_ADDR_COUNT=3
CONFIG_NET_IF_MCAST_IPV6_ADDR_COUNT=2
CONFIG_NET_MAX_CONTEXTS=10
CONFIG_NET_CONTEXT_SYNC_RECV=y

CONFIG_NANO_TIMEOUTS=y
CONFIG_ARC_INIT=n
CONFIG_INIT_STACKS=y
CONFIG_TEST_RANDOM_GENERATOR=y
CONFIG_SYS_LOG_SHOW_COLOR=y
CONFIG_PRINTK=y

CONFIG_NET_L2_IEEE802154=y
CONFIG_NET_L2_IEEE802154_ORFD=y
CONFIG_NET_L2_IEEE802154_ORFD_PAN_ID=0xabcd
CONFIG_NET_L2_IEEE802154_ORFD_CHANNEL=26
CONFIG_NET_L2_IEEE802154_FRAGMENT=y

CONFIG_TI_CC2520=y

CONFIG_NET_6LO=y
CONFIG_NET_6LO_CONTEXT=y

CONFIG_NET_SHELL=y
CONFIG_CONSOLE_HANDLER=y
CONFIG_CONSOLE_HANDLER_SHELL=y
CONFIG_ENABLE_SHELL=y
CONFIG_PRINTK=y
CONFIG_MINIMAL_LIBC_EXTENDED=y

CONFIG_NET_SAMPLES_IP_ADDRESSES=y
CONFIG_NET_SAMPLES_MY_IPV6_ADDR="2001:db8::1"
CONFIG_NET_SAMPLES_PEER_IPV6_ADDR="2001:db8::2"
11 changes: 3 additions & 8 deletions samples/net/zperf/src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,14 @@ ifeq (${PROFILER}, 1)
ccflags-y += -DPROFILER
endif


ccflags-y += -I${ZEPHYR_BASE}/net/ip/contiki
ccflags-y += -I${ZEPHYR_BASE}/net/ip/contiki/os/lib
ccflags-y += -I${ZEPHYR_BASE}/net/ip/contiki/os
ccflags-y += -I${ZEPHYR_BASE}/net/ip
ccflags-y += -I${ZEPHYR_BASE}/net/yaip/
ccflags-y += -I${ZEPHYR_BASE}/samples/task_profiler/profiler/src

obj-y += zperf_shell.o
obj-y += shell_utils.o
obj-y += zperf_udp_uploader.o
obj-y += zperf_udp_receiver.o
obj-y += zperf_session.o
obj-${CONFIG_NETWORKING_WITH_TCP} += zperf_tcp_receiver.o zperf_tcp_uploader.o
obj-$(CONFIG_NET_UDP) += zperf_udp_receiver.o zperf_udp_uploader.o
obj-${CONFIG_NET_TCP} += zperf_tcp_receiver.o zperf_tcp_uploader.o

ifeq (${PROFILER}, 1)
export PROFILER_NO_SHELL_REGISTER=1
Expand Down
Loading

0 comments on commit 51da830

Please sign in to comment.