Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save feiskyer/829ea1c3e0061edf0bcaa99602de1fa3 to your computer and use it in GitHub Desktop.
Save feiskyer/829ea1c3e0061edf0bcaa99602de1fa3 to your computer and use it in GitHub Desktop.
ovs-dpdk
env
dpdk: dpdk-stable-17.02.1
ovs: 6b1d46253362c0bad844cedf93e22e7bf94d55dc/2.7.0?
kernel: 4.11.5-200.fc25.x86_64
1, download and install dpd
$ wget http://dpdk.org/browse/dpdk-stable/snapshot/dpdk-stable-17.02.1.zip
$ unzip dpdk-stable-17.02.1.zip
$ cd dpdk-stable-17.02.1
$ export DPDK_DIR=`pwd`
$ set CONFIG_RTE_BUILD_SHARED_LIB=y in config/common_base
$ export DPDK_TARGET=x86_64-native-linuxapp-gcc
$ export DPDK_BUILD=$DPDK_DIR/$DPDK_TARGET
$ make install T=$DPDK_TARGET DESTDIR=install
$ export LD_LIBRARY_PATH=$DPDK_DIR/x86_64-native-linuxapp-gcc/lib or sudo cp $DPDK_TARGET/lib/* /lib64
2, install ov
$ ./configure --with-dpdk=$DPDK_BUILD
$ make && sudo make install
3, setup dpdk
Setup Hugepage for dpdk
$ echo 'vm.nr_hugepages=2048' > /etc/sysctl.d/hugepages.conf
$ sudo mount -t hugetlbfs none /dev/hugepages``
Setup DPDK devices
$ sudo modprobe uio_pci_generic
$ sudo insmod $DPDK_BUILD/kmod/igb_uio.ko
$ $DPDK_DIR/usertools/dpdk-devbind.py --status
Network devices using DPDK-compatible driver
============================================
Network devices using kernel driver
===================================
0000:00:19.0 'Ethernet Connection I217-LM' if=enp0s25 drv=e1000e unused=igb_uio,uio_pci_generic
0000:04:00.0 'Wireless 7260' if=wlp4s0 drv=iwlwifi unused=igb_uio,uio_pci_generic *Active*
$ $DPDK_DIR/usertools/dpdk-devbind.py --bind=igb_uio enp0s25
$ $DPDK_DIR/usertools/dpdk-devbind.py --status
Network devices using DPDK-compatible driver
============================================
0000:00:19.0 'Ethernet Connection I217-LM' drv=igb_uio unused=e1000e,uio_pci_generic
Network devices using kernel driver
===================================
0000:04:00.0 'Wireless 7260' if=wlp4s0 drv=iwlwifi unused=igb_uio,uio_pci_generic *Active*
4, setup ovs
$ export PATH=$PATH:/path/openvswitch/utilities/
$ export DB_SOCK=/usr/local/var/run/openvswitch/db.sock
$ sudo ovsdb-server --remote=punix:/usr/local/var/run/openvswitch/db.sock
$ ovs-vsctl --no-wait set Open_vSwitch . other_config:dpdk-init=true
$ ovs-ctl --no-ovsdb-server --db-sock="$DB_SOCK" start
5, add dpdk port and dpdkvhostuser port
$ ovs-vsctl add-br br0 -- set bridge br0 datapath_type=netdev
$ ovs-vsctl add-port br0 dpdk0 -- set Interface dpdk0 type=dpdk options:dpdk-devargs=0000:00:19.0
$ ovs-vsctl add-port br0 vhost-user1 -- set Interface vhost-user1 type=dpdkvhostuser
$ ovs-vsctl add-port br0 vhost-user2 -- set Interface vhost-user2 type=dpdkvhostuser
6, start qemu and test network performance
$ qemu-system-x86_64 -m 1024 -smp 2 -cpu host -hda /var/lib/libvirt/images/Alpine-3.6.1.qcow2 -boot c -enable-kvm -no-reboot -nographic -net none
-chardev socket,id=char1,path=/usr/local/var/run/openvswitch/vhost-user1 -netdev type=vhost-user,id=mynet1,chardev=char1,vhostforce
-device virtio-net-pci,mac=00:00:00:00:00:03,netdev=mynet1 -object memory-backend-file,id=mem,size=1024M,mem-path=/dev/hugepages,share=on
-numa node,memdev=mem -mem-prealloc -vnc 0.0.0.0:38
$ qemu-system-x86_64 -m 1024 -smp 2 -cpu host -hda /var/lib/libvirt/images/Alpine2-3.6.1.qcow2 -boot c -enable-kvm -no-reboot -nographic -net none
-chardev socket,id=char1,path=/usr/local/var/run/openvswitch/vhost-user2 -netdev type=vhost-user,id=mynet1,chardev=char1,vhostforce
-device virtio-net-pci,mac=00:00:00:00:00:03,netdev=mynet1 -object memory-backend-file,id=mem,size=1024M,mem-path=/dev/hugepages,share=on
-numa node,memdev=mem -mem-prealloc -vnc 0.0.0.0:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment