Last active
September 11, 2015 02:59
-
-
Save s1061123/eda800c78f114844104f to your computer and use it in GitHub Desktop.
Lagopusをqemu/kvm with virtio-netで動かす (dpdk 1.7.1/lagopus 0.1.2) ref: http://qiita.com/s1061123/items/ffa3974e4635c06faa26
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pip install ryu | |
pip install six --upgrade |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user@packer-ubuntu-1404-server:~$ ./install-dpdk.sh | |
[sudo] password for user: | |
Network devices using DPDK-compatible driver | |
============================================ | |
0000:00:04.0 'Virtio network device' drv=igb_uio unused= | |
0000:00:05.0 'Virtio network device' drv=igb_uio unused= | |
Network devices using kernel driver | |
=================================== | |
0000:00:03.0 'Virtio network device' if= drv=virtio-pci unused=igb_uio | |
Other network devices | |
===================== | |
<none> | |
Set hugepagesize=256 of 2MB page | |
Creating /mnt/huge and mounting as hugetlbfs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GRUB_CMDLINE_LINUX="hugepages=256" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# This script is derived from handson training resources. | |
# http://lagopus.github.io/handson/handson.tar.xz | |
export RTE_SDK=${HOME}/dpdk-1.7.1 | |
export RTE_TARGET=x86_64-native-linuxapp-gcc | |
DPDK_NIC_PCIS="0000:00:04.0 0000:00:05.0" | |
HUGEPAGE_NOPAGES="256" | |
set_numa_pages() | |
{ | |
for d in /sys/devices/system/node/node? ; do | |
sudo sh -c "echo ${HUGEPAGE_NOPAGES} > $d/hugepages/hugepages-2048kB/nr_hugepages" | |
done | |
} | |
set_no_numa_pages() | |
{ | |
sudo sh -c "echo ${HUGEPAGE_NOPAGES} > /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages" | |
} | |
# install module | |
sudo modprobe uio | |
sudo insmod ${RTE_SDK}/${RTE_TARGET}/kmod/igb_uio.ko | |
sudo insmod ${RTE_SDK}/${RTE_TARGET}/kmod/rte_kni.ko | |
# unbind e1000 NICs from igb and bind igb_uio for DPDK | |
sudo ${RTE_SDK}/tools/dpdk_nic_bind.py --bind=igb_uio ${DPDK_NIC_PCIS} | |
sudo ${RTE_SDK}/tools/dpdk_nic_bind.py --status | |
# mount fugepagefs | |
echo "Set hugepagesize=${HUGEPAGE_NOPAGES} of 2MB page" | |
NCPUS=$(find /sys/devices/system/node/node? -maxdepth 0 -type d | wc -l) | |
if [ ${NCPUS} -gt 1 ] ; then | |
set_numa_pages | |
else | |
set_no_numa_pages | |
fi | |
echo "Creating /mnt/huge and mounting as hugetlbfs" | |
sudo mkdir -p /mnt/huge | |
grep -s '/mnt/huge' /proc/mounts > /dev/null | |
if [ $? -ne 0 ] ; then | |
sudo mount -t hugetlbfs nodev /mnt/huge | |
fi | |
unset RTE_SDK | |
unset RTE_TARGET |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface { | |
ethernet { | |
eth0; | |
eth1; | |
} | |
} | |
bridge-domains { | |
br0 { | |
port { | |
eth0; | |
eth1; | |
} | |
controller { | |
127.0.0.1; | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#(B-side) | |
qemu-system-x86_64 ...必要なオプション... | |
-device virtio-net-pci,netdev=net1,mac=52:54:21:12:34:56 \ | |
-netdev socket,id=net1,connect=127.0.0.1:5002 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment