Hi all,
Problem description:
My name is Karthik and am a student of Technical University Munich. I am current working with setting up snabb switch inside a QEMU/KVM Virtual Machine. After setting up the QEMU/KVM virtual machine, the virtio-net interfaces are able to send and receive packets. But once i set up snabb switch inside the VM and run "snabb/src/apps/virtio_net/virtio_net.lua" i am not able to send or receive any packets.
Testbed setup:
The test bed i used consist of two servers connected to each other using two 10Gbps Ethernet interfaces. I am running snabb switch in one of the server and i am running snabb packetblaster on another server.
![](https://lh3.googleusercontent.com/-lcd0KRNAhH4/WAcj3t151II/AAAAAAAAA1w/1MLPzbTLYX8gfE98N2zVAXS5D7cUmLq2QCLcB/s1600/testbed_setup.png)
Steps:
1. I ran snabbnfv on Server 2 Host system with the following command,
>> sudo ./src/snabb snabbnfv traffic -k 10 -D 0 0000:02:00.0 ./port1.cfg /root/vhost-user/vm1.socket
port1.cfg looks like this
-------------------
return {
{ mac_address = "52:54:00:10:10:10",
port_id = "id1",
},
}
------------------
2. Next i started the qemu-vm using the following command,
>>sudo /usr/local/bin/qemu-system-x86_64 -curses -name palanga-vm1 -drive if=virtio,file=/root/vm/grml-3.16-xen/initrd.img -M pc -smp 2 --enable-kvm -cpu host -m 8192 -numa node,memdev=mem -object memory-backend-file,id=mem,size=8192M,mem-path=/mnt/huge,share=on -chardev socket,id=char0,path=/root/vhost-user/vm1.socket,server -netdev type=vhost-user,id=net0,chardev=char0 -device virtio-net-pci,netdev=net0,mac=52:54:00:10:10:10 -netdev type=tap,id=net2,ifname=ethvm,vhost=on -netdev bridge,id=hostnet0,br=br-mgmt -device rtl8139,netdev=net2,mac=52:54:00:00:07:02
The virtual machine was started successfully, and i got the following message on console running snabbnfv,
>>
Get features 0x18428001
VIRTIO_F_ANY_LAYOUT VIRTIO_NET_F_MQ VIRTIO_NET_F_CTRL_VQ VIRTIO_NET_F_MRG_RXBUF VIRTIO_RING_F_INDIRECT_DESC VIRTIO_NET_F_CSUM
>>
Once the VM is started, i can see some packets been sent from VM virtio interface to snabbnfv process,
>>
0 sent on id1_NIC.tx -> id1_Virtio.rx (loss rate: 0%)
49 sent on id1_Virtio.tx -> id1_NIC.rx (loss rate: 0%)
load: time: 1.00s fps: 0 fpGbps: 0.000 fpb: 0 bpp: - sleep: 100 us
load: time: 1.00s fps: 0 fpGbps: 0.000 fpb: 0 bpp: - sleep: 100 us
>>
3. Next i ran snabb packetblaster synth program on server 1 with the following command,
>>./snabb packetblaster synth -d 52:54:00:10:10:10 -S 64 1 0000:02:00.0
I could see bust of packet been sent on snabbnfv link to VM's virtio interface,
>>>
link report:
199,529 sent on id1_NIC.tx -> id1_Virtio.rx (loss rate: 12%)
49 sent on id1_Virtio.tx -> id1_NIC.rx (loss rate: 0%
<<<
also, i did a ifconfig <vm -interface> on the VM
>>>
eth-vm-test1 Link encap:Ethernet HWaddr 52:54:00:10:10:10
inet addr:10.0.10.100 Bcast:10.0.10.255 Mask:255.255.255.0
inet6 addr: fe80::5054:ff:fe10:1010/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:186315 errors:0 dropped:186320 overruns:0 frame:12455
TX packets:48 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:13157888 (12.5 MiB) TX bytes:7215 (7.0 KiB)
<<<<
The packets are received by the VM interface.
4. Next i repeated step 1-2 and now i installed snabb switch inside the VM and ran the self test method of virtio_net.lua giving the PCI address of the VM interface,
>>SNABB_TEST_VIRTIO_PCIDEV="0000:00:03.0" ./src/snabb snsh -t apps.virtio_net.virtio_net
I modified the selftest method so that virtio_net.lua runs for 30 seconds.
Next, i repeated step 3, Now i found that smaller number of packets are been sent from snabbnfv process to VM virtio.rx and those packets are not visible in the vm. Also the packets sent by the self test method of virtio_net are not visible in the snabbnfv process running on host.
Output of selftest method of virtio_net.lua running inside VM
>>
link report:
0 sent on VirtioNet.tx -> sink.input (loss rate: 0%)
5 sent on source.output -> VirtioNet.rx (loss rate: 0%)
<<
Output of snabbnfv running on host,
>>
link report:
1,023 sent on id1_NIC.tx -> id1_Virtio.rx (loss rate: 85%)
0 sent on id1_Virtio.tx -> id1_NIC.rx (loss rate: 0%)
load: time: 1.00s fps: 0 fpGbps: 0.000 fpb: 0 bpp: - sleep: 100 us
load: time: 1.00s fps: 0 fpGbps: 0.000 fpb: 0 bpp: - sleep: 100 us
<<
Server kernel versions:
Host kernel version: 3.16.0-1-grml-amd64
Guest kernal version : 3.16.0-1-grml-amd64
QEMU Version : QEMU emulator version 2.1.0, Copyright (c) 2003-2008 Fabrice Bellard
I think i am missing a piece here and i am not able to figure it out. I cannot understand why the Guest running snabbswitch virtio_net.lua does not receive any packets. Please let me know if i am setting up snabb switch inside QEMU/KVM VM in a right way.
Any help or suggestions will be really helpful in my work.
Thanks and Regards,
-Karthik