From 58601da0389035dbb0a109a516da214f9877c0fc Mon Sep 17 00:00:00 2001 From: Joerg Hofrichter Date: Wed, 13 May 2020 21:20:04 +0200 Subject: mpm: systemd: added systemd configuration files for network Added files which were previously maintained in meta-ettus repository but which are better placed alongside MPM itself: - eth0/int0/sfp0/sfp1.network: network configuration files - 70-sfp-net.rules: udev rule for automatically naming the network interfaces Signed-off-by: Joerg Hofrichter --- mpm/systemd/CMakeLists.txt | 28 ++++++++++++++++++++++++---- mpm/systemd/network/eth0.network | 11 +++++++++++ mpm/systemd/network/int0.network | 9 +++++++++ mpm/systemd/network/sfp0.network | 8 ++++++++ mpm/systemd/network/sfp1.network | 8 ++++++++ mpm/systemd/sysctl/usrp-hwd.conf | 2 ++ mpm/systemd/system/usrp-hwd.service.in | 14 ++++++++++++++ mpm/systemd/udev/70-sfp-net.rules | 3 +++ mpm/systemd/usrp-hwd.conf | 2 -- mpm/systemd/usrp-hwd.service.in | 14 -------------- 10 files changed, 79 insertions(+), 20 deletions(-) create mode 100644 mpm/systemd/network/eth0.network create mode 100644 mpm/systemd/network/int0.network create mode 100644 mpm/systemd/network/sfp0.network create mode 100644 mpm/systemd/network/sfp1.network create mode 100644 mpm/systemd/sysctl/usrp-hwd.conf create mode 100644 mpm/systemd/system/usrp-hwd.service.in create mode 100644 mpm/systemd/udev/70-sfp-net.rules delete mode 100644 mpm/systemd/usrp-hwd.conf delete mode 100644 mpm/systemd/usrp-hwd.service.in (limited to 'mpm/systemd') diff --git a/mpm/systemd/CMakeLists.txt b/mpm/systemd/CMakeLists.txt index da811c30f..b8f6e5901 100644 --- a/mpm/systemd/CMakeLists.txt +++ b/mpm/systemd/CMakeLists.txt @@ -13,17 +13,37 @@ message(STATUS "Systemd system unit directory ${SYSTEMD_SYSTEM_UNITDIR}") PKG_GET_VARIABLE(SYSTEMD_SYSCTLDIR systemd sysctldir) message(STATUS "Systemd sysctl directory ${SYSTEMD_SYSCTLDIR}") +PKG_GET_VARIABLE(UDEV_UDEVDIR udev udevdir) +message(STATUS "Udev directory ${UDEV_UDEVDIR}") + configure_file( - ${CMAKE_CURRENT_SOURCE_DIR}/usrp-hwd.service.in - ${CMAKE_CURRENT_BINARY_DIR}/usrp-hwd.service + ${CMAKE_CURRENT_SOURCE_DIR}/system/usrp-hwd.service.in + ${CMAKE_CURRENT_BINARY_DIR}/system/usrp-hwd.service ) +# service files install(FILES - ${CMAKE_CURRENT_BINARY_DIR}/usrp-hwd.service + ${CMAKE_CURRENT_BINARY_DIR}/system/usrp-hwd.service DESTINATION ${SYSTEMD_SYSTEM_UNITDIR} ) +# network configuration files +install(FILES + ${CMAKE_CURRENT_SOURCE_DIR}/network/eth0.network + ${CMAKE_CURRENT_SOURCE_DIR}/network/int0.network + ${CMAKE_CURRENT_SOURCE_DIR}/network/sfp0.network + ${CMAKE_CURRENT_SOURCE_DIR}/network/sfp1.network + DESTINATION ${SYSTEMD_SYSTEM_UNITDIR}/../network +) + +# sysctl configuration files install(FILES - ${CMAKE_CURRENT_SOURCE_DIR}/usrp-hwd.conf + ${CMAKE_CURRENT_SOURCE_DIR}/sysctl/usrp-hwd.conf DESTINATION ${SYSTEMD_SYSCTLDIR} ) + +# udev rules +install(FILES + ${CMAKE_CURRENT_SOURCE_DIR}/udev/70-sfp-net.rules + DESTINATION ${UDEV_UDEVDIR}/rules.d +) diff --git a/mpm/systemd/network/eth0.network b/mpm/systemd/network/eth0.network new file mode 100644 index 000000000..f0c285070 --- /dev/null +++ b/mpm/systemd/network/eth0.network @@ -0,0 +1,11 @@ +[Match] +Name=eth0 +KernelCommandLine=!nfsroot + +[Network] +DHCP=ipv4 +IPForward=ipv4 + +[DHCP] +UseHostname=true +ClientIdentifier=mac diff --git a/mpm/systemd/network/int0.network b/mpm/systemd/network/int0.network new file mode 100644 index 000000000..1b939a2f9 --- /dev/null +++ b/mpm/systemd/network/int0.network @@ -0,0 +1,9 @@ +[Match] +Name=int0 + +[Network] +Address=169.254.0.1/24 +IPForward=ipv4 + +[Link] +MTUBytes=8000 diff --git a/mpm/systemd/network/sfp0.network b/mpm/systemd/network/sfp0.network new file mode 100644 index 000000000..f38c4977a --- /dev/null +++ b/mpm/systemd/network/sfp0.network @@ -0,0 +1,8 @@ +[Match] +Name=sfp0 + +[Network] +Address=192.168.10.2/24 + +[Link] +MTUBytes=9000 diff --git a/mpm/systemd/network/sfp1.network b/mpm/systemd/network/sfp1.network new file mode 100644 index 000000000..5350c960a --- /dev/null +++ b/mpm/systemd/network/sfp1.network @@ -0,0 +1,8 @@ +[Match] +Name=sfp1 + +[Network] +Address=192.168.20.2/24 + +[Link] +MTUBytes=9000 diff --git a/mpm/systemd/sysctl/usrp-hwd.conf b/mpm/systemd/sysctl/usrp-hwd.conf new file mode 100644 index 000000000..cf4996afa --- /dev/null +++ b/mpm/systemd/sysctl/usrp-hwd.conf @@ -0,0 +1,2 @@ +net.core.wmem_max=2500000 +net.core.rmem_max=2500000 diff --git a/mpm/systemd/system/usrp-hwd.service.in b/mpm/systemd/system/usrp-hwd.service.in new file mode 100644 index 000000000..4da4a31dc --- /dev/null +++ b/mpm/systemd/system/usrp-hwd.service.in @@ -0,0 +1,14 @@ +[Unit] +Description=USRP Hardware Daemon (MPM) + +[Service] +ExecStart=@CMAKE_INSTALL_PREFIX@/bin/usrp_hwd.py +WatchdogSec=30 +Type=notify +Restart=on-failure +StartLimitInterval=2min +StartLimitBurst=4 +StartLimitAction=none + +[Install] +WantedBy=multi-user.target diff --git a/mpm/systemd/udev/70-sfp-net.rules b/mpm/systemd/udev/70-sfp-net.rules new file mode 100644 index 000000000..3015dfdef --- /dev/null +++ b/mpm/systemd/udev/70-sfp-net.rules @@ -0,0 +1,3 @@ +SUBSYSTEM=="net", KERNELS=="40000000.ethernet", NAME="sfp0" +SUBSYSTEM=="net", KERNELS=="40008000.ethernet", NAME="sfp1" +SUBSYSTEM=="net", KERNELS=="40020000.ethernet", NAME="int0" diff --git a/mpm/systemd/usrp-hwd.conf b/mpm/systemd/usrp-hwd.conf deleted file mode 100644 index cf4996afa..000000000 --- a/mpm/systemd/usrp-hwd.conf +++ /dev/null @@ -1,2 +0,0 @@ -net.core.wmem_max=2500000 -net.core.rmem_max=2500000 diff --git a/mpm/systemd/usrp-hwd.service.in b/mpm/systemd/usrp-hwd.service.in deleted file mode 100644 index 4da4a31dc..000000000 --- a/mpm/systemd/usrp-hwd.service.in +++ /dev/null @@ -1,14 +0,0 @@ -[Unit] -Description=USRP Hardware Daemon (MPM) - -[Service] -ExecStart=@CMAKE_INSTALL_PREFIX@/bin/usrp_hwd.py -WatchdogSec=30 -Type=notify -Restart=on-failure -StartLimitInterval=2min -StartLimitBurst=4 -StartLimitAction=none - -[Install] -WantedBy=multi-user.target -- cgit v1.2.3