Skip to content

Commit

Permalink
Use systemd for binding dpdk port after reboot
Browse files Browse the repository at this point in the history
Remove rc.local config and use dpdkbind systemd to bind dpdk port after reboot
  • Loading branch information
sufuf3 committed Aug 1, 2018
1 parent 7e3ed2f commit 3702032
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
15 changes: 7 additions & 8 deletions developers/Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ sudo sysctl -w vm.nr_hugepages=1024
sudo cp /tmp/ovs-vswitchd.service /etc/systemd/system/ovs-vswitchd.service
sudo cp /tmp/ovsdb-server.service /etc/systemd/system/ovsdb-server.service
sudo cp /tmp/dpdkbind.service /etc/systemd/system/dpdkbind.service
# Name of network interface provisioned for DPDK to bind
export NET_IF_NAME=enp0s18
Expand Down Expand Up @@ -176,16 +177,13 @@ sudo ln -sf ${DPDK_DIR}/x86_64-native-linuxapp-gcc/kmod/igb_uio.ko /lib/modules/
sudo depmod -a
echo "uio" | sudo tee -a /etc/modules
echo "igb_uio" | sudo tee -a /etc/modules
# Setting rc.local config for binding dpdk port after reboot
sudo sed -i '/exit 0/d' /etc/rc.local
echo "ifconfig ${NET_IF_NAME} down" | sudo tee -a /etc/rc.local
echo "${DPDK_DIR}/usertools/dpdk-devbind.py --bind=igb_uio ${NET_IF_NAME}" | sudo tee -a /etc/rc.local
echo "exit 0" | sudo tee -a /etc/rc.local
# Bind secondary network adapter
# Note that this NIC setup does not persist across reboots
sudo ifconfig ${NET_IF_NAME} down
sudo ${DPDK_DIR}/usertools/dpdk-devbind.py --bind=igb_uio ${NET_IF_NAME}
# Note that this NIC setup will binding dpdk port after reboot
echo "ExecStart=/sbin/ifconfig ${NET_IF_NAME} down" | sudo tee -a /etc/systemd/system/dpdkbind.service
echo "ExecStart=${DPDK_DIR}/usertools/dpdk-devbind.py --bind=igb_uio ${NET_IF_NAME}" | sudo tee -a /etc/systemd/system/dpdkbind.service
sudo systemctl enable dpdkbind
sudo systemctl start dpdkbind
sudo ${DPDK_DIR}/usertools/dpdk-devbind.py --status
#### Install Open vSwitch with DPDK
Expand Down Expand Up @@ -234,6 +232,7 @@ SHELL
if dpdk_ovs_env == true
config.vm.provision "file", source: "systemctl/ovs-vswitchd.service", destination: "/tmp/ovs-vswitchd.service"
config.vm.provision "file", source: "systemctl/ovsdb-server.service", destination: "/tmp/ovsdb-server.service"
config.vm.provision "file", source: "systemctl/dpdkbind.service", destination: "/tmp/dpdkbind.service"
config.vm.provision "shell", privileged: false, inline: $ovs_dpdk
else
config.vm.provision "shell", privileged: false, inline: $apt_openvswitch
Expand Down
11 changes: 11 additions & 0 deletions developers/systemctl/dpdkbind.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[Unit]
Description=Binding dpdk port after reboot
After=network-pre.target multi-user.target
Before=network.target network.service

[Install]
WantedBy=multi-user.target

[Service]
Type=oneshot
RemainAfterExit=true

0 comments on commit 3702032

Please sign in to comment.