[dpdk-users] Usage of example vhost (vhost-switch)

Derek jwsu1986 at gmail.com
Wed Sep 18 06:09:12 CEST 2019


Hi,

I try to run the vhost example in DPDK.

The steps I did are:

(1) The guest vm created by QEMU using the shell script
#!/bin/bash

USER_SOCK="/tmp/sock0"
MPATH="/dev/hugepages"
MEMSZ=2048
IMG=/home/derek/ubuntu-guest.img

qemu-system-x86_64 \
-boot c \
-machine accel=kvm -cpu host \
-m ${MEMSZ} -object
memory-backend-file,id=hugemem,size=${MEMSZ}M,mem-path=/dev/hugepages,share=on
\
-mem-prealloc -smp 2 -numa node,memdev=hugemem \
-chardev socket,id=char1,path=/tmp/sock0,server \
-netdev type=vhost-user,id=hostnet1,chardev=char1  \
-device virtio-net-pci,netdev=hostnet1,id=net1,mac=52:54:00:00:00:14 \
-drive format=raw,file=${IMG} -vnc :4,password -monitor stdio

(2) run the vhost-switch on the host
#> ./build/vhost-switch -l 0-3 -n 4--2 uge-dir /dev/hugepages --socket-mem
1024 --log-level 8 -w 00000:73:00.1 -- --socket-file /tmp/sock0 --client -p
0x1 --stats 20

(3) The guest vm is started successfully. Then, in the guest vm i did
#> ./x86_64-native-gcc/app/testpmd -l 0-1 -- -i
> start tx_first

I can see the TX packets on the host's vhost-switch  stats and got the
message
VHOST_DATA: (0) mac 52:54:00:00:00:14 and vlan 1000 registered

Device statistics =================================
Statistics for device 0
-----------------------
TX total:              32
TX dropped:            0
TX successful:         32
RX total:              0
RX dropped:            0
RX successful:         0
===================================================


My question is that how can I inject packets to the MAC address and VLAN ID
1000.
I've tried to setup a pktgen on another host whose physical NIC is directly
connected to the physical NIC port of the host. Then, set pktgen's dst mac
to 52:54:00:00:00:14 and vlan id to 1000. But the "Device statistics" is
not changed.

Any idea for this problem? Very thanks.


More information about the users mailing list