ansyun / dpdk-ans

ANS(Accelerated Network Stack) on DPDK, DPDK native TCP/IP stack.
https://ansyun.com
BSD 3-Clause "New" or "Revised" License
1.15k stars 322 forks source link

how to use virtio-user with backend vhost-user by ovs+dpdk #112

Open zmz opened 4 years ago

zmz commented 4 years ago

1. ovs+dpdk create vhost-user port

root@dpdk-ans-test:~/work/dpdk-ans/ans# ovs-vsctl show
ebe25286-a74f-402a-9661-5e062da59e74
    Bridge "br0"
        Port "vhost-user1"
            Interface "vhost-user1"
                type: dpdkvhostuser
        Port "tap-user0"
            Interface "tap-user0"
                type: tap
        Port "br0"
            Interface "br0"
                type: internal

2. start ans

root@dpdk-ans-test:~/work/dpdk-ans/ans# ./build/ans -l 1-2 -n 1 --vdev 'virtio_user0,path=/usr/local/var/run/openvswitch/vhost-user1,queues=2' --file-prefix=host --no-pci -- -p 0x3 --config="(0,0,1),(0,1,2)"
EAL: Detected 8 lcore(s)
EAL: Detected 1 NUMA nodes
EAL: Multi-process socket /var/run/dpdk/host/mp_socket
EAL: No free hugepages reported in hugepages-1048576kB
EAL: Probing VFIO support...
EAL: WARNING: cpu flags constant_tsc=yes nonstop_tsc=no -> using unreliable clock cycles !

Start to Init port 
         port 0:  
         port name net_virtio_user:  
         max_rx_queues 2: max_tx_queues:2 
         rx_offload_capa 0x1d: tx_offload_capa:0x8001 
         Creating queues: rx queue number=2 tx queue number=2... 
         MAC Address:B2:70:F8:61:C6:8F 
         Deault-- tx pthresh:0, tx hthresh:0, tx wthresh:0, tx offloads:0x0 
         lcore id:1, tx queue id:0, socket id:0 
         Conf-- tx pthresh:0, tx hthresh:0, tx wthresh:0, tx offloads:0x0 
         Deault-- tx pthresh:0, tx hthresh:0, tx wthresh:0, tx offloads:0x0 
         lcore id:2, tx queue id:1, socket id:0 
         Conf-- tx pthresh:0, tx hthresh:0, tx wthresh:0, tx offloads:0x0 

update_memory_region(): Too many memory regions
Allocated mbuf pool on socket 0, mbuf number: 65536 

Initializing rx queues on lcore 1 ... 
Default-- rx pthresh:0, rx hthresh:0, rx wthresh:0, rx offloads:0x0  
Conf-- rx pthresh:0, rx hthresh:0, rx wthresh:0, rx offloads:0xd  
port id:0, rx queue id: 0, socket id:0 

Initializing rx queues on lcore 2 ... 
Default-- rx pthresh:0, rx hthresh:0, rx wthresh:0, rx offloads:0x0  
Conf-- rx pthresh:0, rx hthresh:0, rx wthresh:0, rx offloads:0xd  
port id:0, rx queue id: 1, socket id:0 

 rx core: 2, worker core: 0, sockets number:1, lcore number:2 
start to init ans 
USER8: LCORE[1] lcore number 2 
update_memory_region(): Too many memory regions
update_memory_region(): Too many memory regions
update_memory_region(): Too many memory regions
USER1: rte_ip_frag_table_create: allocated of 25165952 bytes at socket 0
update_memory_region(): Too many memory regions
update_memory_region(): Too many memory regions
update_memory_region(): Too many memory regions
update_memory_region(): Too many memory regions
update_memory_region(): Too many memory regions
update_memory_region(): Too many memory regions
update_memory_region(): Too many memory regions
update_memory_region(): Too many memory regions
update_memory_region(): Too many memory regions
update_memory_region(): Too many memory regions
update_memory_region(): Too many memory regions
update_memory_region(): Too many memory regions
update_memory_region(): Too many memory regions
update_memory_region(): Too many memory regions
update_memory_region(): Too many memory regions
update_memory_region(): Too many memory regions
update_memory_region(): Too many memory regions
update_memory_region(): Too many memory regions
update_memory_region(): Too many memory regions
update_memory_region(): Too many memory regions
update_memory_region(): Too many memory regions
update_memory_region(): Too many memory regions
update_memory_region(): Too many memory regions
update_memory_region(): Too many memory regions
update_memory_region(): Too many memory regions
update_memory_region(): Too many memory regions
update_memory_region(): Too many memory regions
update_memory_region(): Too many memory regions
update_memory_region(): Too many memory regions
update_memory_region(): Too many memory regions
update_memory_region(): Too many memory regions
add virtio0 device, kni id 0 
USER8: LCORE[1] Interface virtio0 if_capabilities: 0x8001 
add IP a000002 on device virtio0 
show all IPs: 

 virtio0: mtu 1500 
        link/ether b2:70:f8:61:c6:8f
        inet addr: 10.0.0.2/24

add static route 

ANS IP routing table
 10.0.0.0/24 via dev virtio0 src 10.0.0.2 
 10.10.0.0/24 via 10.0.0.5 dev virtio0 

virtio_dev_promiscuous_disable(): Failed to disable promisc
virtio_dev_allmulticast_disable(): Failed to disable allmulticast

Checking link status done
Port 0 Link Up - speed 10000 Mbps - full-duplex
USER8: main loop on lcore 2
USER8:  -- lcoreid=2 portid=0 rxqueueid=1
hz: 2394448955 
USER8: main loop on lcore 1
USER8:  -- lcoreid=1 portid=0 rxqueueid=0
hz: 2394448955 

3. using cli to config ans, but error

root@dpdk-ans-test:~/work/dpdk-ans/cli/build# ./anscli --file-prefix=host                                                                               
EAL: failed to send to (/var/run/dpdk/host/mp_socket) due to Connection refused
EAL: Fail to send request /var/run/dpdk/host/mp_socket:bus_vdev_mp
vdev_scan(): Failed to request vdev from primary

4. can not ping

root@dpdk-ans-test:~# ip a
7: tap-user0: <BROADCAST,MULTICAST,PROMISC,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 1000
    link/ether ce:8f:23:93:d0:a5 brd ff:ff:ff:ff:ff:ff
    inet 10.0.0.25/24 scope global tap-user0
       valid_lft forever preferred_lft forever
    inet6 fe80::cc8f:23ff:fe93:d0a5/64 scope link 
       valid_lft forever preferred_lft forever
root@dpdk-ans-test:~# ping 10.0.0.2
PING 10.0.0.2 (10.0.0.2) 56(84) bytes of data.