JustKernel
Ray Of Hope
QEMU Networking Vhost-user & Transport Infiniband – series 2 – code flow.
hw/virtio/vhost.c
static const vhostops user_ops
{
.backend_type = VHOST_BACKEND_TYPE_USER
.vhost_call = vhost_user_call
.vhost_status = vhost_user_status
}
static const vhostops user_ops
{
.backend_type = VHOST_BACKEND_TYPE_kernel
.vhost_call = vhost_kerne_call
.vhost_status = 0
}
vhost_set_backend_type()
{
select whether to use vhost-kernel or vhost-user
}
vhost_user_call()
{
vhost_dev_init()
{
1) set the backend type
2. init the backend //vhost_backend_init = vhost_user_init for vhost-user backend . Create a socket and connect to the server. VM/ QEMU acts as a client sendign the packet and other usemode app (app1) that receives the packet i server.
3. calls the vhost-user for control communication so as to setup the mapping of guest vring memory with third party usermode app. for eg VHOST_SET_OWNER, VHOST_SET_MEM_TABLE, VHOST_SET_VRING_ADDR.//vhost_call() —> vhost_user_call() in vhost_backend.c
}
hw/net/vhost-net.c
vhost_net_start_one() //called by hw/net/virtio-net.c virtio_net_vhost_status.
{
for each virtq
{
enable the notifiers (kick etc)
vhost_dev_start() //defined in vhost.c and issues vhost_Call(VHOST_SET_MEM_TABLE), vhost_virtq_start() for each vq,
qemu_set_fd_handler//this is where the qemu set the fd handler for listening for read and writing to the packet/virt queue.
vhost_call(VHOST_NET_SET_BACKEND)
set_guest_notifier; //defined in hw/virtio/virtio-pci.c to enable event listeners for irqs from guest.
}
Tags: infiniband, qemu, rdma, vhost-user, virtio-net
Leave a Reply