From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45076) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xqlfc-0000oB-Ia for qemu-devel@nongnu.org; Tue, 18 Nov 2014 11:30:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XqlfW-0002ZS-O5 for qemu-devel@nongnu.org; Tue, 18 Nov 2014 11:30:24 -0500 Received: from mail-qg0-f43.google.com ([209.85.192.43]:41518) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XqlfW-0002Yx-KC for qemu-devel@nongnu.org; Tue, 18 Nov 2014 11:30:18 -0500 Received: by mail-qg0-f43.google.com with SMTP id q108so396364qgd.2 for ; Tue, 18 Nov 2014 08:30:17 -0800 (PST) MIME-Version: 1.0 From: Anshul Makkar Date: Tue, 18 Nov 2014 17:29:57 +0100 Message-ID: Content-Type: multipart/alternative; boundary=001a11c295724add6b0508249cfc Subject: [Qemu-devel] Sending packets up to VM using vhost-net User. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel --001a11c295724add6b0508249cfc Content-Type: text/plain; charset=UTF-8 Hi, I am developing an application that is using vhost-user backend for packet transfer. The architecture: 1) VM1 is using Vhost-user and executing on server1. ".qemu-system-x86_64 -m 1024 -mem-path /dev/hugepages,prealloc=on,share=on -drive file=/home/amakkar/test.img,if=none,id=drive-virtio-disk0,format=raw,cache=none,aio=native -device virtio-blk-pci,bus=pci.0,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=2 -vga std -vnc 0.0.0.0:3 -netdev type=vhost-user,id=net0,file=/home/amakkar/qemu.sock -device virtio-net-pci,netdev=net0" 2) App1 on server1: executing in user-mode connects with vhost-user backend over qemu.sock. As expected, initialization is done and guest addresses including addresses of descriptor ring , available ring and used ring and mapped to my userspace app and I can directly access them. I launch PACKETH on VM1 and transfer some packets using eth0 on VM1 (packet transfer uses virtio-net backend. ifconfig eth0 shows correct TX stats) In App1 I directly access the avail_ring buffer and consume the packet and then I do RDMA transfer to server 2 . 3) VM2 and App2 executing on server2 and again using VHost-User. App2: Vring initializations are successfully done and vring buffers are mapped. I get the buffer from App1 and now *I want to transfer this buffer (Raw packet) to VM2.* To transfer the buffer from App2 to VM2, I directly access the descriptor ring, place the buffer in it and update the available index and then issue the kick. code snippet for it: dest_buf = (void *)handler->map_handler(handler->context, desc[a_idx].addr); memcpy(dest_buf + hdr_len, buf, size); avail->ring[avail->idx % num] = a_idx; avail->idx++; fprintf(stdout, "put_vring, synching memory \n"); sync_shm(dest_buf, size); sync_shm((void *)&(avail), sizeof(struct vring_avail)); kick(&vhost_user->vring_table, rx_idx); But the buffer never reaches to VM2. (I do ifconfig eth0 in VM2 and RX stats are 0) Please can you share if my approach is correct in transferring the packet from App2 to VM. Can I directly place the buffer in descriptor ring and issue a kick to notify virtio-net that a packet is available or you can smell some implementation problem. Thanks Anshul Makkar --001a11c295724add6b0508249cfc Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi,

I am developing an application that i= s using vhost-user backend for packet transfer.

The architectu= re:

1) VM1 is using Vhost-user and executing on server1.
".qemu-system-x86_64 -m 1024 -mem-path /dev/hugepages,prealloc=3Don,= share=3Don -drive file=3D/home/amakkar/test.img,if=3Dnone,id=3Ddrive-virtio= -disk0,format=3Draw,cache=3Dnone,aio=3Dnative -device virtio-blk-pci,bus=3D= pci.0,drive=3Ddrive-virtio-disk0,id=3Dvirtio-disk0,bootindex=3D2 -vga std -= vnc 0.0.0.0:3 -netdev type=3Dvhost-user,id= =3Dnet0,file=3D/home/amakkar/qemu.sock -device virtio-net-pci,netdev=3Dnet0= "

2) App1 on server1: executing in user-mode connects with= vhost-user backend over qemu.sock. As expected, initialization is done and= guest addresses including addresses of descriptor ring , available ring an= d used ring and mapped to my userspace app and I can directly access them.<= br>
I launch PACKETH on VM1 and transfer some packets using eth0 on VM1 = (packet transfer uses virtio-net backend. ifconfig eth0 shows correct TX st= ats)

In App1 I directly access the avail_ring buffer and consume the= packet and then I do RDMA transfer to server 2 .

3) VM2 = and App2 executing on server2 and again using VHost-User.

App2: Vring initializations are successfully done and vring buffers are ma= pped. I get the buffer from App1 and now I want to transfer this buffer = (Raw packet) to VM2.

To transfer the buffer from App2= to VM2, I directly access the descriptor ring, place the buffer in it and = update the available index and then issue the kick.

code = snippet for it:

dest_buf =3D (void *)handler-&= gt;map_handler(handler->context, desc[a_idx].addr);
memcpy(dest_buf += hdr_len, buf, size);
avail->ring[avail->idx % num] =3D a_idx;
= avail->idx++;
fprintf(stdout, "put_vring, synching memory \n&quo= t;);
sync_shm(dest_buf, size);
sync_shm((void *)&(avail), sizeof(= struct vring_avail));

kick(&vhost_user->vring_table, rx_idx);=

But the buffer never reaches to VM2. (I do ifconfig eth0= in VM2 and RX stats are 0)

Please can you share if my ap= proach is correct in transferring the packet from App2 to VM. Can I directl= y place the buffer in descriptor ring and issue a kick to notify virtio-net= that a packet is available or you can smell some implementation problem.
Thanks
Anshul Makkar

--001a11c295724add6b0508249cfc--