vhostuser配置

160阅读 0评论2020-11-18 可怜的猪头
分类:LINUX

https://wiki.qemu.org/Documentation/vhost-user-ovs-dpdk
https://blog.csdn.net/boilerplate/article/details/107740404
https://docs.openvswitch.org/en/latest/howto/dpdk/

ovs-vsctl --no-wait set Open_vSwitch . other_config:dpdk-init=true /usr/local/bin/ovs-vsctl add-port br1 port0 – set Interface port0 type=dpdk option:dpdk-devargs=0000:08:00.0 ovs-vsctl add-br ovsbr0 -- set bridge ovsbr0 datapath_type=netdev
ovs-vsctl add-port ovsbr0 vhost-user1 -- set Interface vhost-user1 type=dpdkvhostuser
ovs-vsctl add-port ovsbr0 vhost-user2 -- set Interface vhost-user2 type=dpdkvhostuser
cd /bin/x86_64-softmmu/
qemu-system-x86_64 -enable-kvm -m 1024 -smp 2 \
    -chardev socket,id=char0,path=/var/run/openvswitch/vhost-user \
    -netdev type=vhost-user,id=mynet1,chardev=char0,vhostforce \
    -device virtio-net-pci,netdev=mynet1,mac=52:54:00:02:d9:0 \
    -object memory-backend-file,id=mem,size=1024M,mem-path=/dev/hugepages,share=on \
    -numa node,memdev=mem -mem-prealloc \
    -net user,hostfwd=tcp::1002-:22 -net nic \
    /path/to/img

[root@localhost /]# ovs-vsctl show
fee1b353-7c1d-4549-890d-82c6965ea3a3
    Bridge "vswitch0"
        Controller "tcp:127.0.0.1:6633"
            is_connected: true
        fail_mode: secure
        Port "dpdkvhostuserclient1"
            Interface "dpdkvhostuserclient1"
                type: dpdkvhostuserclient
                options: {vhost-sever-path="/config/sysconf/vhost1"}
        Port "dpdk0"
            Interface "dpdk0"
                type: dpdk
                options: {dpdk-devargs="0000:00:05.0"}
        Port "vswitch0"
            Interface "vswitch0"
                type: internal
[root@localhost /]#

# Add userspace bridge
$ ovs-vsctl add-br br0 -- set bridge br0 datapath_type=netdev

# Add two dpdk ports
$ ovs-vsctl add-port br0 phy0 -- set Interface phy0 type=dpdk \
      options:dpdk-devargs=0000:01:00.0 ofport_request=1

$ ovs-vsctl add-port br0 phy1 -- set Interface phy1 type=dpdk
      options:dpdk-devargs=0000:01:00.1 ofport_request=2

# Add two dpdkvhostuser ports
$ ovs-vsctl add-port br0 dpdkvhostuser0 \
    -- set Interface dpdkvhostuser0 type=dpdkvhostuser ofport_request=3
$ ovs-vsctl add-port br0 dpdkvhostuser1 \
    -- set Interface dpdkvhostuser1 type=dpdkvhostuser ofport_request=4

# Clear current flows
$ ovs-ofctl del-flows br0

# Add flows
$ ovs-ofctl add-flow br0 in_port=1,action=output:3
$ ovs-ofctl add-flow br0 in_port=3,action=output:1
$ ovs-ofctl add-flow br0 in_port=4,action=output:2
$ ovs-ofctl add-flow br0 in_port=2,action=output:4

 # Dump flows
$ ovs-ofctl dump-flows br0







上一篇:记一次Linux系统卡顿的排查过程
下一篇:ldconfig