2013-07-08 08:58:40 +00:00
|
|
|
#
|
|
|
|
# \brief Test for using netperf
|
|
|
|
# \author Alexander Boettcher
|
|
|
|
# \date 2013-04-18
|
|
|
|
#
|
|
|
|
|
2017-02-08 12:28:11 +00:00
|
|
|
proc gpio_drv { } { if {[have_spec rpi] && [have_spec hw]} { return hw_gpio_drv }
|
|
|
|
if {[have_spec rpi] && [have_spec foc]} { return foc_gpio_drv }
|
|
|
|
return gpio_drv }
|
|
|
|
|
2017-03-20 09:48:46 +00:00
|
|
|
if {[get_cmd_switch --autopilot] && [have_include "power_on/qemu"]} {
|
|
|
|
puts "\nRunning netperf in autopilot on Qemu is not recommended.\n"
|
2013-11-27 15:17:47 +00:00
|
|
|
exit
|
|
|
|
}
|
|
|
|
|
2017-01-03 12:17:41 +00:00
|
|
|
if {[have_spec odroid_xu] || [have_spec wand_quad]} {
|
2015-02-24 13:53:15 +00:00
|
|
|
puts "Run script does not support this platform."
|
|
|
|
exit 0
|
|
|
|
}
|
|
|
|
|
2015-05-06 14:13:04 +00:00
|
|
|
if {![info exists use_usb_driver]} {
|
2015-09-03 12:55:05 +00:00
|
|
|
set use_usb_driver [expr [have_spec omap4] || [have_spec arndale] || [have_spec rpi]]
|
2015-05-06 14:13:04 +00:00
|
|
|
}
|
2015-09-03 12:55:05 +00:00
|
|
|
set use_nic_driver [expr !$use_usb_driver && ![have_spec imx53] && !$use_wifi_driver]
|
2013-07-11 09:14:57 +00:00
|
|
|
|
2015-02-20 12:39:10 +00:00
|
|
|
if {[expr !$use_usb_driver && !$use_nic_driver && !$use_wifi_driver]} {
|
2015-09-29 08:21:08 +00:00
|
|
|
puts "Run script is not supported on this platform.";
|
|
|
|
exit 0
|
|
|
|
}
|
2013-07-08 08:58:40 +00:00
|
|
|
|
2015-02-20 12:39:10 +00:00
|
|
|
# provide wifi related variables in case we do not use the wifi driver
|
|
|
|
if {!$use_wifi_driver} {
|
|
|
|
set wifi_ssid ""
|
|
|
|
set wifi_psk ""
|
|
|
|
}
|
|
|
|
|
2013-07-08 08:58:40 +00:00
|
|
|
#
|
|
|
|
# Build
|
|
|
|
#
|
|
|
|
|
|
|
|
set version "2.6.0"
|
|
|
|
|
|
|
|
# sanity check that the right version is used
|
|
|
|
set wrong_version [catch {
|
|
|
|
spawn netperf-$version -V
|
|
|
|
expect {
|
|
|
|
{Netperf version 2.6.0} { }
|
|
|
|
eof { return }
|
|
|
|
timeout { return }
|
|
|
|
}
|
|
|
|
}]
|
|
|
|
|
|
|
|
if {$wrong_version} {
|
|
|
|
puts -nonewline "\nPlease compile a netperf client of version $version "
|
|
|
|
puts "for your host system."
|
2017-01-30 10:08:37 +00:00
|
|
|
puts "The sources are available in 'contrib/netperf-<hash>' (after you "
|
|
|
|
puts "prepared the port by calling 'tool/ports/prepare_port netperf')."
|
2013-07-08 08:58:40 +00:00
|
|
|
puts "Please name the binary netperf-$version\n"
|
|
|
|
exit 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
# netperf configuration
|
|
|
|
set packet_size 1024
|
|
|
|
set netperf_tests "TCP_STREAM TCP_MAERTS"
|
|
|
|
|
2015-01-08 21:09:08 +00:00
|
|
|
# start run script generation
|
2013-07-11 09:14:57 +00:00
|
|
|
|
2013-07-08 08:58:40 +00:00
|
|
|
if {$use_usb_driver} { set network_driver "usb_drv" }
|
|
|
|
if {$use_nic_driver} { set network_driver "nic_drv" }
|
2015-02-20 12:39:10 +00:00
|
|
|
if {$use_wifi_driver} { set network_driver "wifi_drv" }
|
2013-07-08 08:58:40 +00:00
|
|
|
|
|
|
|
set build_components {
|
|
|
|
core init
|
2015-05-28 11:43:13 +00:00
|
|
|
drivers/timer
|
2013-07-08 08:58:40 +00:00
|
|
|
}
|
|
|
|
|
2013-11-22 11:39:44 +00:00
|
|
|
append build_components " $netperf_target "
|
2015-02-20 12:39:10 +00:00
|
|
|
lappend_if $use_nic_driver build_components drivers/nic
|
2013-07-08 08:58:40 +00:00
|
|
|
lappend_if $use_usb_driver build_components drivers/usb
|
|
|
|
lappend_if $use_nic_bridge build_components server/nic_bridge
|
2013-08-26 11:58:58 +00:00
|
|
|
lappend_if [have_spec gpio] build_components drivers/gpio
|
2013-07-08 08:58:40 +00:00
|
|
|
|
2015-02-20 12:39:10 +00:00
|
|
|
append_if $use_wifi_driver build_components {
|
|
|
|
drivers/wifi
|
|
|
|
server/fs_rom
|
|
|
|
server/ram_fs
|
|
|
|
server/report_rom
|
2015-08-17 13:14:48 +00:00
|
|
|
lib/vfs/jitterentropy
|
2015-02-20 12:39:10 +00:00
|
|
|
}
|
|
|
|
|
2015-05-28 11:43:13 +00:00
|
|
|
source ${genode_dir}/repos/base/run/platform_drv.inc
|
|
|
|
append_platform_drv_build_components
|
|
|
|
|
2013-07-08 08:58:40 +00:00
|
|
|
build $build_components
|
|
|
|
|
|
|
|
create_boot_directory
|
|
|
|
|
|
|
|
#
|
|
|
|
# Generate config
|
|
|
|
#
|
|
|
|
|
2013-09-18 14:24:25 +00:00
|
|
|
set lx_ip_addr "10.0.2.55"
|
|
|
|
|
2013-07-08 08:58:40 +00:00
|
|
|
set config {
|
|
|
|
<config verbose="yes">
|
|
|
|
<parent-provides>
|
|
|
|
<service name="ROM"/>
|
|
|
|
<service name="RAM"/>
|
|
|
|
<service name="IRQ"/>
|
|
|
|
<service name="IO_MEM"/>
|
|
|
|
<service name="IO_PORT"/>
|
|
|
|
<service name="PD"/>
|
|
|
|
<service name="RM"/>
|
|
|
|
<service name="CPU"/>
|
|
|
|
<service name="LOG"/>
|
|
|
|
</parent-provides>
|
|
|
|
<default-route>
|
|
|
|
<any-service> <parent/> <any-child/> </any-service>
|
|
|
|
</default-route>
|
|
|
|
|
|
|
|
<start name="timer">
|
|
|
|
<resource name="RAM" quantum="1M"/>
|
|
|
|
<provides> <service name="Timer"/> </provides>
|
|
|
|
</start> }
|
|
|
|
|
2017-02-08 12:28:11 +00:00
|
|
|
append_if [have_spec gpio] config "
|
|
|
|
<start name=\"[gpio_drv]\">
|
|
|
|
<resource name=\"RAM\" quantum=\"4M\"/>
|
|
|
|
<provides><service name=\"Gpio\"/></provides>
|
2013-08-26 11:58:58 +00:00
|
|
|
<config/>
|
2017-02-08 12:28:11 +00:00
|
|
|
</start>"
|
2013-08-26 11:58:58 +00:00
|
|
|
|
2013-07-08 08:58:40 +00:00
|
|
|
append_if $use_nic_bridge config {
|
|
|
|
<start name="nic_bridge">
|
2016-11-28 14:13:14 +00:00
|
|
|
<resource name="RAM" quantum="5M"/>
|
2013-07-08 08:58:40 +00:00
|
|
|
<provides><service name="Nic"/></provides>
|
2013-09-18 14:24:25 +00:00
|
|
|
<config>}
|
|
|
|
append_if [expr $use_nic_bridge && [have_spec linux]] config "
|
2016-11-24 14:28:32 +00:00
|
|
|
<policy label_prefix=\"netserver_genode\" ip_addr=\"$lx_ip_addr\"/>"
|
2013-09-18 14:24:25 +00:00
|
|
|
append_if $use_nic_bridge config {
|
|
|
|
</config>
|
2013-07-08 08:58:40 +00:00
|
|
|
<route>
|
|
|
|
<service name="Nic"> }
|
|
|
|
append_if $use_nic_bridge config "
|
|
|
|
<child name=\"$network_driver\"/>"
|
|
|
|
append_if $use_nic_bridge config {
|
|
|
|
</service>
|
|
|
|
<any-service> <parent/> <any-child/> </any-service>
|
|
|
|
</route>
|
|
|
|
</start> }
|
|
|
|
|
2017-03-20 10:17:49 +00:00
|
|
|
proc usb_drv_ram_quota {} {
|
|
|
|
if {[have_spec x86]} { return 18M }
|
|
|
|
return 14M
|
|
|
|
}
|
|
|
|
|
2013-07-08 08:58:40 +00:00
|
|
|
append_if $use_usb_driver config {
|
|
|
|
<start name="usb_drv">
|
2017-03-20 10:17:49 +00:00
|
|
|
<resource name="RAM" quantum="} [usb_drv_ram_quota] {"/>
|
2013-07-08 08:58:40 +00:00
|
|
|
<provides>
|
|
|
|
<service name="Nic"/>
|
|
|
|
</provides>}
|
|
|
|
append_if $use_usb_driver config "
|
|
|
|
<config uhci=\"$use_usb_11\" ehci=\"$use_usb_20\" xhci=\"$use_usb_30\">"
|
|
|
|
append_if $use_usb_driver config {
|
2014-04-22 09:50:56 +00:00
|
|
|
<nic mac="02:00:00:00:01:01" />
|
2013-07-08 08:58:40 +00:00
|
|
|
</config>
|
|
|
|
</start>}
|
|
|
|
|
|
|
|
append_if $use_nic_driver config {
|
|
|
|
<start name="nic_drv">
|
2017-03-09 13:03:46 +00:00
|
|
|
<binary name="} [nic_drv_binary] {"/>
|
2017-03-20 10:17:49 +00:00
|
|
|
<resource name="RAM" quantum="8M"/>
|
2013-07-08 08:58:40 +00:00
|
|
|
<provides><service name="Nic"/></provides>
|
|
|
|
</start>}
|
|
|
|
|
2015-02-20 12:39:10 +00:00
|
|
|
append_if $use_wifi_driver config {
|
|
|
|
<start name="report_rom">
|
|
|
|
<resource name="RAM" quantum="2M"/>
|
|
|
|
<provides> <service name="Report" /> <service name="ROM" /> </provides>
|
|
|
|
<config> <rom/> </config>
|
|
|
|
</start>
|
|
|
|
<start name="config_fs">
|
|
|
|
<binary name="ram_fs"/>
|
|
|
|
<resource name="RAM" quantum="4M"/>
|
|
|
|
<provides> <service name="File_system"/> </provides>
|
|
|
|
<config>
|
2016-11-24 14:28:32 +00:00
|
|
|
<policy label_prefix="config_rom" root="/"/>
|
2015-02-20 12:39:10 +00:00
|
|
|
<policy label="wifi_drv -> config" root="/" writeable="yes"/>
|
|
|
|
<content>
|
|
|
|
<inline name="wlan_configuration">}
|
|
|
|
append_if $use_wifi_driver config "
|
2015-10-29 12:57:18 +00:00
|
|
|
<selected_network ssid=\"$wifi_ssid\" protection=\"WPA-PSK\" psk=\"$wifi_psk\"/>"
|
2015-02-20 12:39:10 +00:00
|
|
|
append_if $use_wifi_driver config {
|
|
|
|
</inline>
|
|
|
|
<inline name="wpa_supplicant.conf"></inline>
|
|
|
|
</content>
|
|
|
|
</config>
|
|
|
|
</start>
|
|
|
|
<start name="config_rom">
|
|
|
|
<binary name="fs_rom"/>
|
|
|
|
<resource name="RAM" quantum="4M"/>
|
|
|
|
<provides><service name="ROM"/></provides>
|
|
|
|
<route>
|
|
|
|
<service name="File_system"> <child name="config_fs" /> </service>
|
|
|
|
<any-service> <parent/> <any-child/> </any-service>
|
|
|
|
</route>
|
|
|
|
</start>
|
|
|
|
<start name="wifi_drv">
|
|
|
|
<resource name="RAM" quantum="32M"/>
|
|
|
|
<provides> <service name="Nic"/> </provides>
|
|
|
|
<config>
|
2017-01-30 10:08:37 +00:00
|
|
|
<libc stdout="/dev/log" stderr="/dev/log" rtc="/dev/rtc"/>
|
|
|
|
<vfs>
|
|
|
|
<dir name="dev">
|
|
|
|
<log/>
|
|
|
|
<jitterentropy name="random"/>
|
|
|
|
<jitterentropy name="urandom"/>
|
|
|
|
</dir>
|
|
|
|
<dir name="config"> <fs label="config"/> </dir>
|
|
|
|
</vfs>
|
2015-02-20 12:39:10 +00:00
|
|
|
</config>
|
|
|
|
<route>
|
|
|
|
<service name="Rtc"> <any-child/> </service>
|
|
|
|
<service name="File_system"> <child name="config_fs"/> </service>
|
2017-01-18 16:10:07 +00:00
|
|
|
<service name="ROM" label="wlan_configuration"> <child name="config_rom" /> </service>
|
2015-05-26 18:12:17 +00:00
|
|
|
<service name="Report"> <child name="report_rom"/> </service>
|
2015-02-20 12:39:10 +00:00
|
|
|
<any-service> <parent/> <any-child /> </any-service>
|
|
|
|
</route>
|
|
|
|
</start>}
|
|
|
|
|
2015-05-28 11:43:13 +00:00
|
|
|
append_platform_drv_config
|
2013-07-08 08:58:40 +00:00
|
|
|
|
|
|
|
append config {
|
|
|
|
<start name="netserver_genode">
|
2013-11-22 11:39:44 +00:00
|
|
|
}
|
|
|
|
append config "<binary name=\"$netperf_app\"/>"
|
|
|
|
append config {
|
|
|
|
<resource name="RAM" quantum="32M"/>
|
2013-07-08 08:58:40 +00:00
|
|
|
<config>
|
|
|
|
<arg value="netserver"/>
|
|
|
|
<arg value="-D"/>
|
|
|
|
<arg value="-4"/>
|
2013-09-23 13:58:45 +00:00
|
|
|
<arg value="-f"/>
|
|
|
|
<libc tx_buf_size="2M" rx_buf_size="2M"}
|
2013-11-27 15:17:47 +00:00
|
|
|
append_if [have_spec linux] config " ip_addr=\"$lx_ip_addr\" netmask=\"255.255.255.0\" gateway=\"10.0.2.1\""
|
2014-04-14 09:57:22 +00:00
|
|
|
append config {
|
2017-01-30 10:08:37 +00:00
|
|
|
stdout="/dev/log" stderr="/dev/log"/>
|
|
|
|
<vfs> <dir name="dev"> <log/> </dir> </vfs>
|
2013-07-08 08:58:40 +00:00
|
|
|
</config>}
|
|
|
|
append_if $use_nic_bridge config {
|
|
|
|
<route>
|
|
|
|
<service name="Nic"> <child name="nic_bridge"/> </service>
|
|
|
|
<any-service> <parent/> <any-child/> </any-service>
|
|
|
|
</route>}
|
|
|
|
append config {
|
|
|
|
</start>
|
|
|
|
</config>
|
|
|
|
}
|
|
|
|
|
|
|
|
install_config $config
|
|
|
|
|
|
|
|
#
|
|
|
|
# Boot modules
|
|
|
|
#
|
|
|
|
|
|
|
|
# generic modules
|
|
|
|
set boot_modules {
|
|
|
|
core init timer
|
|
|
|
ld.lib.so libc.lib.so libm.lib.so
|
|
|
|
}
|
|
|
|
|
2013-11-22 11:39:44 +00:00
|
|
|
append boot_modules " $netperf_app "
|
|
|
|
append boot_modules " $netperf_stack "
|
2013-07-08 08:58:40 +00:00
|
|
|
lappend_if $use_nic_bridge boot_modules nic_bridge
|
|
|
|
|
|
|
|
# platform-specific modules
|
2017-02-08 12:28:11 +00:00
|
|
|
lappend_if [have_spec gpio] boot_modules [gpio_drv]
|
2013-07-08 08:58:40 +00:00
|
|
|
lappend_if $use_usb_driver boot_modules usb_drv
|
2017-03-09 13:03:46 +00:00
|
|
|
lappend_if $use_nic_driver boot_modules [nic_drv_binary]
|
2013-07-08 08:58:40 +00:00
|
|
|
|
2015-02-20 12:39:10 +00:00
|
|
|
append_if $use_wifi_driver boot_modules {
|
|
|
|
ram_fs fs_rom report_rom
|
|
|
|
libcrypto.lib.so libssl.lib.so
|
|
|
|
wpa_driver_nl80211.lib.so wpa_supplicant.lib.so
|
|
|
|
vfs_jitterentropy.lib.so
|
|
|
|
wifi.lib.so wifi_drv
|
|
|
|
|
2016-02-29 14:26:19 +00:00
|
|
|
iwlwifi-6000-4.ucode
|
2015-02-20 12:39:10 +00:00
|
|
|
iwlwifi-6000g2a-6.ucode
|
|
|
|
iwlwifi-6000g2b-6.ucode
|
2016-02-29 14:26:19 +00:00
|
|
|
iwlwifi-7260-16.ucode
|
|
|
|
iwlwifi-7265-16.ucode
|
|
|
|
iwlwifi-7265D-16.ucode
|
|
|
|
iwlwifi-8000C-16.ucode
|
2015-02-20 12:39:10 +00:00
|
|
|
}
|
|
|
|
|
2015-05-28 11:43:13 +00:00
|
|
|
append_platform_drv_boot_modules
|
|
|
|
|
2013-07-08 08:58:40 +00:00
|
|
|
build_boot_image $boot_modules
|
|
|
|
|
|
|
|
#
|
|
|
|
# Execute test case
|
|
|
|
#
|
|
|
|
|
|
|
|
# qemu config
|
2017-03-20 09:48:46 +00:00
|
|
|
append qemu_args " -m 128 -nographic "
|
2013-07-08 08:58:40 +00:00
|
|
|
|
|
|
|
append_if [have_spec x86] qemu_args " -net nic,model=e1000 "
|
|
|
|
append_if [have_spec lan9118] qemu_args " -net nic,model=lan9118 "
|
|
|
|
|
|
|
|
append qemu_args " -net user -redir tcp:12865::12865 -redir tcp:49153::49153 "
|
|
|
|
|
2015-03-16 10:18:36 +00:00
|
|
|
if {[have_spec linux]} {
|
|
|
|
run_genode_until {.*family AF_INET.*\n} 60
|
|
|
|
} else {
|
|
|
|
run_genode_until $ip_match_string 60
|
|
|
|
}
|
|
|
|
|
2015-01-08 21:09:08 +00:00
|
|
|
set serial_id [output_spawn_id]
|
2013-07-08 08:58:40 +00:00
|
|
|
|
|
|
|
set force_ports ""
|
2015-01-08 21:09:08 +00:00
|
|
|
if {[have_include "power_on/qemu"]} {
|
2013-07-08 08:58:40 +00:00
|
|
|
set ip_addr "localhost"
|
|
|
|
set force_ports "-P 49153,49153"
|
2013-09-06 12:49:50 +00:00
|
|
|
} elseif [have_spec linux] {
|
|
|
|
set ip_addr $lx_ip_addr
|
2013-07-08 08:58:40 +00:00
|
|
|
} else {
|
2013-11-22 11:39:44 +00:00
|
|
|
regexp $ip_match_string $output all ip_addr
|
2013-07-08 08:58:40 +00:00
|
|
|
puts ""
|
|
|
|
}
|
|
|
|
|
2015-03-16 10:18:36 +00:00
|
|
|
# give the TCP/IP stack some time to settle down
|
|
|
|
sleep 3
|
|
|
|
|
2013-07-08 08:58:40 +00:00
|
|
|
# start netperf client connecting to netperf server running native on Genode
|
|
|
|
foreach netperf_test $netperf_tests {
|
|
|
|
puts "\n---------------------------- $netperf_test -----------------------"
|
|
|
|
|
|
|
|
spawn netperf-$version -H $ip_addr -P 1 -v 2 -t $netperf_test -c -C -- -m $packet_size $force_ports
|
|
|
|
set netperf_id $spawn_id
|
|
|
|
|
2014-06-16 08:13:10 +00:00
|
|
|
set spawn_id_list [list $netperf_id $serial_id]
|
|
|
|
|
2015-06-04 14:17:43 +00:00
|
|
|
# reset output, so that we get on the second run not the result of the first
|
|
|
|
set output ""
|
2014-06-16 08:13:10 +00:00
|
|
|
run_genode_until "Segment" 60 $spawn_id_list
|
2013-07-08 08:58:40 +00:00
|
|
|
|
|
|
|
# get throughput from netperf output
|
|
|
|
set throughput [regexp -all -inline {([0-9]+[ ]+){3}[0-9]+\.[0-9]+[ ]+[0-9]+\.[0-9]+} $output]
|
|
|
|
set throughput [regexp -all -inline {[0-9]+\.[0-9]+} $throughput]
|
|
|
|
|
|
|
|
# calculate packets per second rate
|
|
|
|
set all_bytes [regexp -all -inline {([0-9]+[ ]+){5}} $output]
|
|
|
|
set all_bytes [lindex $all_bytes 0 4]
|
|
|
|
|
|
|
|
set elapsed_time [regexp -all -inline {([0-9]+[ ]+){3}[0-9]+\.[0-9]+[ ]+} $output]
|
|
|
|
set elapsed_time [lindex $elapsed_time 0 3]
|
|
|
|
set packets_second [expr $all_bytes / $packet_size / $elapsed_time]
|
|
|
|
|
|
|
|
puts "\ncalculation: overall bytes / size per packet / time = packets per second"
|
|
|
|
puts -nonewline " $all_bytes Bytes / $packet_size Bytes / $elapsed_time s = "
|
|
|
|
puts "[format %8.0f $packets_second] packets/s\n"
|
|
|
|
|
|
|
|
# format output parseable for post proccessing scripts
|
2013-11-22 08:21:21 +00:00
|
|
|
puts -nonewline "! PERF: $netperf_test"
|
|
|
|
if {$use_nic_bridge} { puts -nonewline "_bridge" }
|
|
|
|
if {$use_usb_driver} {
|
|
|
|
if {![string compare $use_usb_11 "yes"]} { puts -nonewline "_uhci" }
|
|
|
|
if {![string compare $use_usb_20 "yes"]} { puts -nonewline "_ohci" }
|
|
|
|
if {![string compare $use_usb_30 "yes"]} { puts -nonewline "_xhci" }
|
2013-07-08 08:58:40 +00:00
|
|
|
}
|
2013-11-22 08:21:21 +00:00
|
|
|
puts " [lindex $throughput 1] MBit/s ok"
|
2013-07-08 08:58:40 +00:00
|
|
|
}
|