dependency develop package
CentOS
yum install -y make gcc gcc-c++ make \
autoconf automake libtool cmake \
python python-six libpcap-devel \
libcap-devel libcap-ng-devel openssl-devel \
pciutils numactl-devel kernel-devel
Debian 9.x
apt-get install -y make gcc g++ make \
autoconf automake libtool cmake \
python-pip libpcap-dev \
libcap-dev libcap-ng-dev libssl-dev \
pciutils libnuma-dev linux-headers-$( uname -r)
configure and compile DPDK
make config T=x86_64-native-linuxapp-gcc
make -j$( nproc)
make DESTDIR=/Application/dpdk prefix=/ install
modprobe uio_pci_generic
modprobe uio
insmod /Application/dpdk/lib/modules/$( uname -r) /extra/dpdk/igb_uio.ko
insmod /Application/dpdk/lib/modules/$( uname -r) /extra/dpdk/rte_kni.ko
build openvswitch with DPDK
./configure --prefix=/Application/ovs --with-dpdk=/Application/dpdk
make -j$( nproc)
ovsdb-tool create /Application/ovs//etc/openvswitch/conf.db /Application/ovs//share/openvswitch/vswitch.ovsschema
ovsdb-server --remote=punix:/Application/ovs//var/run/openvswitch/db.sock --remote=db:Open_vSwitch,Open_vSwitch,manager_options --pidfile --detach --log-file
ovs-vsctl --no-wait init
ovs-vsctl --no-wait set Open_vSwitch . other_config:dpdk-init=true
echo 2048 > /sys/devices/system/node/node0/hugepages/hugepages-2048kB/nr_hugepages
cat /proc/meminfo | grep ^Huge
mkdir /mnt/huge
mount -t hugetlbfs nodev /mnt/huge/
ovs-vswitchd unix:/Application/ovs/var/run/openvswitch/db.sock --pidfile --detach --log-file
ovs-appctl -t ovsdb-server exit
ovs-appctl -t ovs-vswitchd exit
Physical NIC
ovs-vsctl add-br br0 -- set bridge br0 datapath_type=netdev
ovs-vsctl add-port br0 eth1 -- set Interface eth1 type=dpdk options:dpdk-devargs=0000:02:04.0
ovs-vsctl add-port br0 eth2 -- set Interface eth2 type=dpdk options:dpdk-devargs=0000:02:05.0
ip addr flush dev eth1
ip addr flush dev eth2
vhostuser
ovs-vsctl add-br br0 -- set bridge br0 datapath_type=netdev
ovs-vsctl add-port br0 vhostuser0 -- set Interface vhostuser0 type=dpdkvhostuser
ovs-vsctl add-port br0 vhostuser1 -- set Interface vhostuser1 type=dpdkvhostuser
RTE_SDK=/Application/dpdk RTE_TARGET=x86_64-native-linuxapp-gcc make LDLIBS=" -ldpdk -lm -lpthread -ldl"
qemu-system-x86_64 -m 512M -enable-kvm \
-nographic \
-kernel ./bzImage -initrd ./initramfs \
-append " console=ttyS0 quiet" \
-object memory-backend-file,id=mem,size=512M,mem-path=/dev/hugepages,share=on \
-numa node,memdev=mem -mem-prealloc \
-chardev socket,id=char1,path=/Application/ovs/var/run/openvswitch/vhostuser0 \
-netdev type=vhost-user,id=mynet1,chardev=char1,vhostforce \
-device virtio-net-pci,netdev=mynet1,mac=12:34:56:78:9a:01
qemu-system-x86_64 -m 512M -enable-kvm \
-nographic \
-kernel ./bzImage -initrd ./initramfs \
-append " console=ttyS0 quiet" \
-object memory-backend-file,id=mem,size=512M,mem-path=/dev/hugepages,share=on \
-numa node,memdev=mem -mem-prealloc \
-chardev socket,id=char1,path=/Application/ovs/var/run/openvswitch/vhostuser1 \
-netdev type=vhost-user,id=mynet1,chardev=char1,vhostforce \
-device virtio-net-pci,netdev=mynet1,mac=12:34:56:78:9a:02