mirror of
https://github.com/genodelabs/genode.git
synced 2025-02-07 11:50:24 +00:00
Revert "nic_router_flood: reworked to stress/analyze more"
This reverts commit ae559549198449d13cbb852a72c2e2f165f6ec6d.
This commit is contained in:
parent
22af4436f7
commit
1583782446
@ -6,19 +6,16 @@ if {![have_include power_on/qemu] ||
|
|||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
proc min_duration_sec { } { return 8 }
|
|
||||||
proc pause_sec { } { return 5 }
|
proc good_dst_ip { } { return "10.0.2.2" }
|
||||||
proc good_dst_ip { } { return "10.0.2.2" }
|
proc bad_dst_ip { } { return "10.0.0.123" }
|
||||||
proc bad_dst_ip { } { return "10.0.0.123" }
|
|
||||||
|
|
||||||
create_boot_directory
|
create_boot_directory
|
||||||
|
|
||||||
import_from_depot [depot_user]/src/[base_src] \
|
import_from_depot [depot_user]/src/[base_src] \
|
||||||
[depot_user]/pkg/[drivers_nic_pkg] \
|
[depot_user]/pkg/[drivers_nic_pkg] \
|
||||||
[depot_user]/src/dynamic_rom \
|
|
||||||
[depot_user]/src/init \
|
[depot_user]/src/init \
|
||||||
[depot_user]/src/nic_router \
|
[depot_user]/src/nic_router
|
||||||
[depot_user]/src/report_rom
|
|
||||||
|
|
||||||
build { app/ping test/net_flood }
|
build { app/ping test/net_flood }
|
||||||
|
|
||||||
@ -56,35 +53,29 @@ install_config {
|
|||||||
<provides> <service name="Nic"/> </provides>
|
<provides> <service name="Nic"/> </provides>
|
||||||
</start>
|
</start>
|
||||||
|
|
||||||
<start name="report_rom">
|
|
||||||
<resource name="RAM" quantum="4M"/>
|
|
||||||
<provides> <service name="Report"/> <service name="ROM"/> </provides>
|
|
||||||
<config verbose="yes"/>
|
|
||||||
</start>
|
|
||||||
|
|
||||||
<start name="nic_router" caps="200">
|
<start name="nic_router" caps="200">
|
||||||
<resource name="RAM" quantum="6M"/>
|
<resource name="RAM" quantum="10M"/>
|
||||||
<provides><service name="Nic"/></provides>
|
<provides><service name="Nic"/></provides>
|
||||||
<config ld_verbose="yes" verbose="no"
|
<config verbose="no"
|
||||||
verbose_packets="no"
|
verbose_packets="no"
|
||||||
verbose_packet_drop="yes"
|
verbose_packet_drop="yes"
|
||||||
verbose_domain_state="no"
|
verbose_domain_state="yes"
|
||||||
dhcp_discover_timeout_sec="1"
|
dhcp_discover_timeout_sec="1"
|
||||||
tcp_idle_timeout_sec="3600"
|
tcp_idle_timeout_sec="3600"
|
||||||
udp_idle_timeout_sec="3600"
|
udp_idle_timeout_sec="3600"
|
||||||
icmp_idle_timeout_sec="3600">
|
icmp_idle_timeout_sec="3600">
|
||||||
|
|
||||||
<report stats="yes" config="no" bytes="no" interval_sec="} [expr [pause_sec] - 1] {"/>
|
<policy label_prefix="flood_links" domain="flood_links"/>
|
||||||
<policy label_prefix="init -> " domain="downlinks"/>
|
<policy label_prefix="ping" domain="flood_links"/>
|
||||||
<uplink domain="uplink"/>
|
<uplink domain="uplink"/>
|
||||||
|
|
||||||
<domain name="uplink" verbose_packets="no">
|
<domain name="uplink" verbose_packets="no">
|
||||||
<nat domain="downlinks" udp-ports="16384"
|
<nat domain="flood_links" udp-ports="16384"
|
||||||
tcp-ports="16384"
|
tcp-ports="16384"
|
||||||
icmp-ids="16384"/>
|
icmp-ids="16384"/>
|
||||||
</domain>
|
</domain>
|
||||||
|
|
||||||
<domain name="downlinks" interface="10.0.1.1/24">
|
<domain name="flood_links" interface="10.0.1.1/24">
|
||||||
<dhcp-server ip_first="10.0.1.100"
|
<dhcp-server ip_first="10.0.1.100"
|
||||||
ip_last="10.0.1.200"/>
|
ip_last="10.0.1.200"/>
|
||||||
|
|
||||||
@ -96,92 +87,51 @@ install_config {
|
|||||||
</config>
|
</config>
|
||||||
<route>
|
<route>
|
||||||
<service name="Nic"> <child name="drivers"/> </service>
|
<service name="Nic"> <child name="drivers"/> </service>
|
||||||
<service name="Report"> <child name="report_rom"/> </service>
|
|
||||||
<any-service> <parent/> <any-child/> </any-service>
|
<any-service> <parent/> <any-child/> </any-service>
|
||||||
</route>
|
</route>
|
||||||
</start>
|
</start>
|
||||||
|
|
||||||
<start name="dynamic_rom">
|
<start name="flood_links_tcp">
|
||||||
<resource name="RAM" quantum="10M"/>
|
<binary name="test-net_flood"/>
|
||||||
<provides><service name="ROM"/> </provides>
|
<resource name="RAM" quantum="8M"/>
|
||||||
<config verbose="yes">
|
<config dst_ip="} [bad_dst_ip] {"
|
||||||
|
protocol="tcp"
|
||||||
<rom name="init.config">
|
verbose="no"/>
|
||||||
|
<route>
|
||||||
<inline description="pause phase">
|
<service name="Nic"> <child name="nic_router"/> </service>
|
||||||
<config/>
|
<any-service> <parent/> <any-child/> </any-service>
|
||||||
</inline>
|
</route>
|
||||||
|
</start>
|
||||||
<sleep milliseconds="} [expr [pause_sec] * 1000] {"/>
|
<start name="flood_links_udp">
|
||||||
|
<binary name="test-net_flood"/>
|
||||||
<inline description="test phase">
|
<resource name="RAM" quantum="8M"/>
|
||||||
<config>
|
<config dst_ip="} [bad_dst_ip] {"
|
||||||
|
protocol="udp"
|
||||||
<parent-provides>
|
verbose="no"/>
|
||||||
<service name="ROM"/>
|
<route>
|
||||||
<service name="RAM"/>
|
<service name="Nic"> <child name="nic_router"/> </service>
|
||||||
<service name="IRQ"/>
|
<any-service> <parent/> <any-child/> </any-service>
|
||||||
<service name="IO_MEM"/>
|
</route>
|
||||||
<service name="IO_PORT"/>
|
</start>
|
||||||
<service name="PD"/>
|
<start name="flood_links_icmp">
|
||||||
<service name="RM"/>
|
<binary name="test-net_flood"/>
|
||||||
<service name="CPU"/>
|
<resource name="RAM" quantum="8M"/>
|
||||||
<service name="LOG"/>
|
<config dst_ip="} [bad_dst_ip] {"
|
||||||
<service name="Timer"/>
|
protocol="icmp"
|
||||||
<service name="Nic"/>
|
verbose="no"/>
|
||||||
</parent-provides>
|
<route>
|
||||||
<default-route>
|
<service name="Nic"> <child name="nic_router"/> </service>
|
||||||
<any-service> <parent/> </any-service>
|
<any-service> <parent/> <any-child/> </any-service>
|
||||||
</default-route>
|
</route>
|
||||||
<default caps="100"/>
|
|
||||||
|
|
||||||
<start name="test_flood_tcp">
|
|
||||||
<binary name="test-net_flood"/>
|
|
||||||
<resource name="RAM" quantum="8M"/>
|
|
||||||
<config dst_ip="} [bad_dst_ip] {"
|
|
||||||
protocol="tcp"
|
|
||||||
verbose="no"
|
|
||||||
sec="} [min_duration_sec] {"/>
|
|
||||||
</start>
|
|
||||||
|
|
||||||
<start name="test_flood_udp">
|
|
||||||
<binary name="test-net_flood"/>
|
|
||||||
<resource name="RAM" quantum="8M"/>
|
|
||||||
<config dst_ip="} [bad_dst_ip] {"
|
|
||||||
protocol="udp"
|
|
||||||
verbose="no"
|
|
||||||
sec="} [min_duration_sec] {"/>
|
|
||||||
</start>
|
|
||||||
|
|
||||||
<start name="test_flood_icmp">
|
|
||||||
<binary name="test-net_flood"/>
|
|
||||||
<resource name="RAM" quantum="8M"/>
|
|
||||||
<config dst_ip="} [bad_dst_ip] {"
|
|
||||||
protocol="icmp"
|
|
||||||
verbose="no"
|
|
||||||
sec="} [min_duration_sec] {"/>
|
|
||||||
</start>
|
|
||||||
|
|
||||||
<start name="test_ping">
|
|
||||||
<binary name="ping"/>
|
|
||||||
<resource name="RAM" quantum="8M"/>
|
|
||||||
<config dst_ip="} [good_dst_ip] {"
|
|
||||||
period_sec="1"
|
|
||||||
count="} [expr [min_duration_sec] - 1] {"/>
|
|
||||||
</start>
|
|
||||||
|
|
||||||
</config>
|
|
||||||
</inline>
|
|
||||||
|
|
||||||
<sleep milliseconds="} [expr ([min_duration_sec] + 2) * 1000] {"/>
|
|
||||||
</rom>
|
|
||||||
</config>
|
|
||||||
</start>
|
</start>
|
||||||
|
|
||||||
<start name="init" caps="1000">
|
|
||||||
<resource name="RAM" quantum="50M"/>
|
<start name="ping">
|
||||||
|
<resource name="RAM" quantum="8M"/>
|
||||||
|
<config dst_ip="} [good_dst_ip] {"
|
||||||
|
period_sec="2"
|
||||||
|
count="999"/>
|
||||||
<route>
|
<route>
|
||||||
<service name="ROM" label="config"> <child name="dynamic_rom" label="init.config"/> </service>
|
|
||||||
<service name="Nic"> <child name="nic_router"/> </service>
|
<service name="Nic"> <child name="nic_router"/> </service>
|
||||||
<any-service> <parent/> <any-child/> </any-service>
|
<any-service> <parent/> <any-child/> </any-service>
|
||||||
</route>
|
</route>
|
||||||
@ -202,158 +152,4 @@ append qemu_args " -nographic "
|
|||||||
append qemu_args " -netdev user,id=net0 "
|
append qemu_args " -netdev user,id=net0 "
|
||||||
append qemu_args " -net nic,model=[qemu_nic_model],netdev=net0 "
|
append qemu_args " -net nic,model=[qemu_nic_model],netdev=net0 "
|
||||||
|
|
||||||
|
run_genode_until {.*ping\] 64 bytes from 10\.0\.2\.2: icmp_seq=30 .*\n} 120
|
||||||
#########################
|
|
||||||
## Execute and analyse ##
|
|
||||||
#########################
|
|
||||||
|
|
||||||
proc test {} {
|
|
||||||
|
|
||||||
global output
|
|
||||||
global serial_id
|
|
||||||
global ram_quota_1
|
|
||||||
global cap_quota_1
|
|
||||||
global used_ram_1
|
|
||||||
global used_cap_1
|
|
||||||
global shared_ram_1
|
|
||||||
global shared_cap_1
|
|
||||||
|
|
||||||
set ram_quota_2 {}
|
|
||||||
set cap_quota_2 {}
|
|
||||||
set used_ram_2 {}
|
|
||||||
set used_cap_2 {}
|
|
||||||
set shared_ram_2 {}
|
|
||||||
set shared_cap_2 {}
|
|
||||||
|
|
||||||
|
|
||||||
################
|
|
||||||
## Test phase ##
|
|
||||||
################
|
|
||||||
|
|
||||||
set output {}
|
|
||||||
set desired_str {}
|
|
||||||
append desired_str {.*child "test_ping" exited with exit value 0.*\n}
|
|
||||||
append desired_str {.*child "test_fl.*" exited with exit value 0.*\n}
|
|
||||||
append desired_str {.*child "test_fl.*" exited with exit value 0.*\n}
|
|
||||||
append desired_str {.*child "test_fl.*" exited with exit value 0.*\n}
|
|
||||||
|
|
||||||
run_genode_until $desired_str [expr [min_duration_sec] * 2] $serial_id
|
|
||||||
|
|
||||||
if {[regexp {refused_for} $output]} {
|
|
||||||
puts stderr "*** Error: connections were refused during the test"
|
|
||||||
exit -1
|
|
||||||
}
|
|
||||||
if {[regexp {drop packet} $output]} {
|
|
||||||
puts stderr "*** Error: packets were dropped during the test"
|
|
||||||
exit -1
|
|
||||||
}
|
|
||||||
if {[regexp {Warning: (?!submitting signal failed)} $output]} {
|
|
||||||
puts stderr "*** Error: unexpected warnings during test"
|
|
||||||
exit -1
|
|
||||||
}
|
|
||||||
if {[regexp {Error} $output]} {
|
|
||||||
puts stderr "*** Error: unexpected errors during test"
|
|
||||||
exit -1
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#################
|
|
||||||
## Pause phase ##
|
|
||||||
#################
|
|
||||||
|
|
||||||
set output {}
|
|
||||||
set desired_str {}
|
|
||||||
append desired_str {.*<ram quota=.*\n}
|
|
||||||
append desired_str {.*<cap quota=.*\n}
|
|
||||||
|
|
||||||
run_genode_until $desired_str [expr [pause_sec] * 2] $serial_id
|
|
||||||
|
|
||||||
set quota_ram {}
|
|
||||||
regexp {<ram quota=\"[0-9]+\" used=\"[0-9]+\" shared=\"[0-9]+} $output quota_ram
|
|
||||||
regexp {[0-9]+} [regexp -inline {quota=\"[0-9]+} $quota_ram] ram_quota_2
|
|
||||||
regexp {[0-9]+} [regexp -inline {used=\"[0-9]+} $quota_ram] used_ram_2
|
|
||||||
regexp {[0-9]+} [regexp -inline {shared=\"[0-9]+} $quota_ram] shared_ram_2
|
|
||||||
|
|
||||||
set quota_cap {}
|
|
||||||
regexp {<cap quota=\"[0-9]+\" used=\"[0-9]+\" shared=\"[0-9]+} $output quota_cap
|
|
||||||
regexp {[0-9]+} [regexp -inline {quota=\"[0-9]+} $quota_cap] cap_quota_2
|
|
||||||
regexp {[0-9]+} [regexp -inline {used=\"[0-9]+} $quota_cap] used_cap_2
|
|
||||||
regexp {[0-9]+} [regexp -inline {shared=\"[0-9]+} $quota_cap] shared_cap_2
|
|
||||||
|
|
||||||
if {$ram_quota_1 != $ram_quota_2} {
|
|
||||||
puts stderr "*** Error: routers ram quota changed"
|
|
||||||
exit -1
|
|
||||||
}
|
|
||||||
if {$cap_quota_1 != $cap_quota_2} {
|
|
||||||
puts stderr "*** Error: routers cap quota changed"
|
|
||||||
exit -1
|
|
||||||
}
|
|
||||||
if {($used_ram_1 - $used_ram_2) != ($shared_ram_1 - $shared_ram_2)} {
|
|
||||||
puts stderr "*** Error: unexpected change in routers used ram quota"
|
|
||||||
exit -1
|
|
||||||
}
|
|
||||||
if {($used_cap_1 - $used_cap_2) != ($shared_cap_1 - $shared_cap_2)} {
|
|
||||||
puts stderr "*** Error: unexpected change in routers used cap quota"
|
|
||||||
exit -1
|
|
||||||
}
|
|
||||||
if {$shared_ram_1 > 4096} {
|
|
||||||
puts stderr "*** Error: routers shared ram quota bigger than expected"
|
|
||||||
exit -1
|
|
||||||
}
|
|
||||||
if {$shared_cap_1 > 1} {
|
|
||||||
puts stderr "*** Error: routers shared cap quota bigger than expected"
|
|
||||||
exit -1
|
|
||||||
}
|
|
||||||
|
|
||||||
set ram_quota_1 $ram_quota_2
|
|
||||||
set cap_quota_1 $cap_quota_2
|
|
||||||
set used_ram_1 $used_ram_2
|
|
||||||
set used_cap_1 $used_cap_2
|
|
||||||
set shared_ram_1 $shared_ram_2
|
|
||||||
set shared_cap_1 $shared_cap_2
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
################
|
|
||||||
## Init phase ##
|
|
||||||
################
|
|
||||||
|
|
||||||
global output
|
|
||||||
global serial_id
|
|
||||||
global ram_quota_1
|
|
||||||
global cap_quota_1
|
|
||||||
global used_ram_1
|
|
||||||
global used_cap_1
|
|
||||||
global shared_ram_1
|
|
||||||
global shared_cap_1
|
|
||||||
|
|
||||||
set ram_quota_1 {}
|
|
||||||
set cap_quota_1 {}
|
|
||||||
set used_ram_1 {}
|
|
||||||
set used_cap_1 {}
|
|
||||||
set shared_ram_1 {}
|
|
||||||
set shared_cap_1 {}
|
|
||||||
|
|
||||||
set desired_str {}
|
|
||||||
append desired_str {.*<ram quota=.*\n}
|
|
||||||
append desired_str {.*<cap quota=.*\n}
|
|
||||||
|
|
||||||
run_genode_until $desired_str [expr [pause_sec] * 2]
|
|
||||||
|
|
||||||
set serial_id [output_spawn_id]
|
|
||||||
|
|
||||||
set quota_ram {}
|
|
||||||
regexp {<ram quota=\"[0-9]+\" used=\"[0-9]+\" shared=\"[0-9]+} $output quota_ram
|
|
||||||
regexp {[0-9]+} [regexp -inline {quota=\"[0-9]+} $quota_ram] ram_quota_1
|
|
||||||
regexp {[0-9]+} [regexp -inline {used=\"[0-9]+} $quota_ram] used_ram_1
|
|
||||||
regexp {[0-9]+} [regexp -inline {shared=\"[0-9]+} $quota_ram] shared_ram_1
|
|
||||||
|
|
||||||
set quota_cap {}
|
|
||||||
regexp {<cap quota=\"[0-9]+\" used=\"[0-9]+\" shared=\"[0-9]+} $output quota_cap
|
|
||||||
regexp {[0-9]+} [regexp -inline {quota=\"[0-9]+} $quota_cap] cap_quota_1
|
|
||||||
regexp {[0-9]+} [regexp -inline {used=\"[0-9]+} $quota_cap] used_cap_1
|
|
||||||
regexp {[0-9]+} [regexp -inline {shared=\"[0-9]+} $quota_cap] shared_cap_1
|
|
||||||
|
|
||||||
test
|
|
||||||
test
|
|
||||||
test
|
|
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
<xs:include schemaLocation="base_types.xsd"/>
|
<xs:include schemaLocation="base_types.xsd"/>
|
||||||
<xs:include schemaLocation="net_types.xsd"/>
|
<xs:include schemaLocation="net_types.xsd"/>
|
||||||
<xs:include schemaLocation="timeout_types.xsd"/>
|
|
||||||
|
|
||||||
<xs:simpleType name="Protocol">
|
<xs:simpleType name="Protocol">
|
||||||
<xs:restriction base="xs:string">
|
<xs:restriction base="xs:string">
|
||||||
@ -20,7 +19,6 @@
|
|||||||
<xs:attribute name="protocol" type="Protocol" />
|
<xs:attribute name="protocol" type="Protocol" />
|
||||||
<xs:attribute name="interface" type="Ipv4_address_prefix" />
|
<xs:attribute name="interface" type="Ipv4_address_prefix" />
|
||||||
<xs:attribute name="gateway" type="Ipv4_address" />
|
<xs:attribute name="gateway" type="Ipv4_address" />
|
||||||
<xs:attribute name="sec" type="Seconds" />
|
|
||||||
</xs:complexType>
|
</xs:complexType>
|
||||||
</xs:element><!-- config -->
|
</xs:element><!-- config -->
|
||||||
|
|
||||||
|
@ -65,9 +65,6 @@ class Main : public Nic_handler,
|
|||||||
Protocol const _protocol { _config.attribute_value("protocol", Protocol::ICMP) };
|
Protocol const _protocol { _config.attribute_value("protocol", Protocol::ICMP) };
|
||||||
Port _dst_port { FIRST_DST_PORT };
|
Port _dst_port { FIRST_DST_PORT };
|
||||||
size_t _ping_sz { _init_ping_sz() };
|
size_t _ping_sz { _init_ping_sz() };
|
||||||
unsigned long _ping_cnt { 0 };
|
|
||||||
uint64_t _sec { _config.attribute_value("sec", (uint64_t)10) };
|
|
||||||
uint64_t _time_us { 0 };
|
|
||||||
|
|
||||||
size_t _init_ping_sz() const;
|
size_t _init_ping_sz() const;
|
||||||
|
|
||||||
@ -267,7 +264,7 @@ void Main::_broadcast_arp_request(Ipv4_address const &dst_ip)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Main::_send_ping(Duration time)
|
void Main::_send_ping(Duration)
|
||||||
{
|
{
|
||||||
/* if we do not yet know the Ethernet destination, request it via ARP */
|
/* if we do not yet know the Ethernet destination, request it via ARP */
|
||||||
if (_dst_mac == Mac_address()) {
|
if (_dst_mac == Mac_address()) {
|
||||||
@ -366,23 +363,9 @@ void Main::_send_ping(Duration time)
|
|||||||
ip.total_length(size_guard.head_size() - ip_off);
|
ip.total_length(size_guard.head_size() - ip_off);
|
||||||
ip.update_checksum();
|
ip.update_checksum();
|
||||||
});
|
});
|
||||||
_ping_cnt++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Net::Packet_stream_source::Packet_alloc_failed) { }
|
catch (Net::Packet_stream_source::Packet_alloc_failed) { }
|
||||||
uint64_t const new_time_us = time.trunc_to_plain_us().value;
|
|
||||||
if (new_time_us - _time_us > 1000000) {
|
|
||||||
if (!_ping_cnt) {
|
|
||||||
error("test failed (could not send packet for a second)");
|
|
||||||
_env.parent().exit(-1);
|
|
||||||
}
|
|
||||||
log("alive (", _ping_cnt, " pkt/sec)");
|
|
||||||
if (!--_sec) {
|
|
||||||
_env.parent().exit(0); }
|
|
||||||
|
|
||||||
_ping_cnt = 0;
|
|
||||||
_time_us = new_time_us;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user