genode/repos/os/run/nic_uplink.run
Martin Stein c23491ef3c nic_uplink: connect a Nic to an Uplink session
* Adds a new component server/nic_uplink that forwards packets unmodified
  between one Uplink session at one side and potentially multiple Nic sessions
  at the other side.
* Adds a new run script nic_uplink.run that does a basic test with multiple
  Nic clients on this component and adds it to the autopilot list.
* Adds a new depot recipe src/nic_uplink for this component.
* Adds a new depot recipe pkg/pc_nic for deploying the pc_nic_driver together
  with a nic_uplink server. This allows for raw access to the network connected
  to the Nic of the system in contrast to the commonly used routed and NAT'd
  access via NIC router. That said, it enables the use of network protocols
  not yet supported by the NIC router at the cost of less protection.

Ref #4966
2023-08-21 08:12:00 +02:00

142 lines
4.0 KiB
Plaintext
Executable File

#
# there are no nic driver packages for rpi3 and imx53 tz
#
if {[have_board rpi3] || [have_board imx53_qsb_tz]} {
puts "Run script is not supported on this platform."
exit 0
}
#
# lx & riscv would require extra setup on the test machine which is not desired
#
if {[get_cmd_switch --autopilot] && ([have_spec linux] ||
[have_board virt_qemu_riscv])} {
puts "Autopilot mode is not supported on this platform."
exit 0
}
proc test_timeout { } {
if {[have_spec sel4] && [have_board pc]} { return 60 }
return 30
}
proc dst_ip { } {
if {[expr ![have_include power_on/qemu]]} {
return "10.0.0.2"
} else {
return "10.0.2.2"
}
}
build { server/nic_uplink app/ping }
create_boot_directory
import_from_depot [depot_user]/src/[base_src] \
[depot_user]/pkg/[drivers_nic_pkg] \
[depot_user]/src/init
append config {
<config>
<parent-provides>
<service name="ROM"/>
<service name="IRQ"/>
<service name="IO_PORT"/>
<service name="IO_MEM"/>
<service name="PD"/>
<service name="RM"/>
<service name="CPU"/>
<service name="LOG"/>
</parent-provides>
<start name="timer" caps="100">
<resource name="RAM" quantum="1M"/>
<provides><service name="Timer"/></provides>
<route>
<service name="PD"> <parent/> </service>
<service name="ROM"> <parent/> </service>
<service name="LOG"> <parent/> </service>
<service name="CPU"> <parent/> </service>
<service name="IO_PORT"> <parent/> </service>
<service name="IO_MEM"> <parent/> </service>
<service name="IRQ"> <parent/> </service>
</route>
</start>
<start name="drivers" caps="1200" managing_system="yes">
<resource name="RAM" quantum="32M"/>
<binary name="init"/>
<route>
<service name="ROM" label="config"> <parent label="drivers.config"/> </service>
<service name="Uplink"> <child name="nic_uplink"/> </service>
<service name="Timer"> <child name="timer"/> </service>
<service name="RM"> <parent/> </service>
<service name="PD"> <parent/> </service>
<service name="ROM"> <parent/> </service>
<service name="LOG"> <parent/> </service>
<service name="CPU"> <parent/> </service>
<service name="IO_PORT"> <parent/> </service>
<service name="IO_MEM"> <parent/> </service>
<service name="IRQ"> <parent/> </service>
</route>
</start>
<start name="nic_uplink" caps="100">
<resource name="RAM" quantum="1M"/>
<provides>
<service name="Uplink"/>
<service name="Nic"/>
</provides>
<config verbose="yes"/>
<route>
<service name="Timer"> <child name="timer"/> </service>
<service name="PD"> <parent/> </service>
<service name="ROM"> <parent/> </service>
<service name="LOG"> <parent/> </service>
<service name="CPU"> <parent/> </service>
</route>
</start>
<start name="ping_1" caps="100">
<binary name="ping"/>
<resource name="RAM" quantum="8M"/>
<config dst_ip="} [dst_ip] {" period_sec="1" count="3"/>
<route>
<service name="Nic"> <child name="nic_uplink"/> </service>
<service name="Timer"> <child name="timer"/> </service>
<service name="PD"> <parent/> </service>
<service name="ROM"> <parent/> </service>
<service name="LOG"> <parent/> </service>
<service name="CPU"> <parent/> </service>
</route>
</start>
<start name="ping_2" caps="100">
<binary name="ping"/>
<resource name="RAM" quantum="8M"/>
<config dst_ip="} [dst_ip] {" period_sec="1" count="3"/>
<route>
<service name="Nic"> <child name="nic_uplink"/> </service>
<service name="Timer"> <child name="timer"/> </service>
<service name="PD"> <parent/> </service>
<service name="ROM"> <parent/> </service>
<service name="LOG"> <parent/> </service>
<service name="CPU"> <parent/> </service>
</route>
</start>
</config>
}
install_config $config
build_boot_image [build_artifacts]
append qemu_args " -nographic "
append_qemu_nic_args
run_genode_until "child \"ping_.\" exited with exit value 0.*child \"ping_.\" exited with exit value 0.*\n" [test_timeout]