On Wed, Oct 6, 2010 at 12:34 PM, devi thapa <devi.thapa@xxxxxxxxx> wrote: > I am actually going only through net.c and in this module they > haven't specified anywhere, where this value is coming from. In order to understand net.c it will be necessary to read other code too. Make sure you have an environment that makes it easy to jump to function and variable definitions and switch between source files. For example, use ctags, cscope, or even Eclipse to navigate the kernel source tree. > So, you mean that kernel vhost code is connected to QEMU userspace code. QEMU userspace makes use of the vhost interface. If you get stuck understanding the kernel side, you can jump to the relevant place in QEMU and see what userspace is doing. This will be useful especially for the part of the code that sets up a vhost-net device. > I request to guide me in following the code. In order to understand the code, you need to put in the effort to dig through the source for yourself. The strategy I follow is to read the code (you've already started with the kernel vhost-net code). Much of it will be unclear on the first pass. Now switch to QEMU and read the vhost code there. Patterns will become clearer but there will still be unanswered questions. Go back to the kernel and study it again with the insight you've gained from the userspace side. Iterate a few times. That's how I understand new systems. Some other ideas to try if you get stuck: 1. Check the virtio specification for details on vring and the virtio-net device: http://ozlabs.org/~rusty/virtio-spec/virtio-spec-0.8.9.pdf 2. Use strace to see how QEMU uses the vhost file descriptor. 3. Look at related code like the virtio-net guest driver, the tap driver, KVM's ioeventfd and irqfd. Good luck! Stefan _______________________________________________ Virtualization mailing list Virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx https://lists.linux-foundation.org/mailman/listinfo/virtualization