[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-discuss] Virtio interaction with the physical device

From: Gadre Nayan
Subject: [Qemu-discuss] Virtio interaction with the physical device
Date: Tue, 16 Aug 2016 10:08:09 +0530


I was trying to understand the flow of packets from the Guest OS to my
NIC card, while using the Virtio paravirtualized drivers. (Qemu is not
emulating the NIC)

THis is as far as I have understood:
THe guest OS starts with a virtio nic:
-net nic,model=virtio -net user -redir tcp:2222::22

A socket application sends data on an interface (which would have been
created by this nic (alloc_etherdev and net_device creation and some
such). This net_device would be created by the virtio-net.ko in the
Guest Kernel.

Where is the underlying hardware on the Host getting mapped with the
virtio-net in the guest.

The device ID table simply specifies VIRTIO_ID_NET, VIRTIO_DEV_ANY_ID

The virtio-net in Guest kernel allocated virt-queue using virtnet_alloc_queues
SO the driver puts the packet into the queue and call the xmit
function which will do
virtqueue_add_outbuf() (virtio-ring.ko) which calls virtqueue_add() --
It also calls virtqueue_kick() if num_added equals 2^16 -1.

virtqueue_kick calls notify function, where is the notify function defined ?


1. Where is the notify function defined, I only saw assignment.
2. Now once the other side ( the Host side ) is notified (need to see
exactly how ) who takes care of the packet on the HOST. How is this
packet received from a generic virtio framework mapped to a specific
Physical NIC. (The TX and RX registers of the physical hardware must
have been mapped to the virtio-net somehow to achieve this)

3. Suppose I have virtio-blk also enabled through:
-drive file=/home/gnayan/u1.img,if=virtio,format=raw

Then how are the two buffers in the virtio-ring differentiated if
belonging to block layer or network layer?

Kindly suggest.

Nayan Gadre

reply via email to

[Prev in Thread] Current Thread [Next in Thread]