On Fri, Apr 29, 2016 at 01:18:33AM +0000, Jianfeng Tan wrote: > +static int > +kick_one_vq(struct virtio_user_hw *hw, struct virtqueue *vq, > + unsigned queue_sel)
Firstly, "dev" is a more common word than "hw" here. So, name the struct to "virtio_user_device", and name the var to "dev". And you are still mixing virtio driver and virtio device emulation here. Say, struct virtqueue should not be used here: it belongs to driver. Instead, you should define your own. It could be fair simple that is enough for current usage: struct virtqueue { uint32_t num; uint64_t desc_addr; uint64_t avail_addr; uint64_t used_addr; }; That could let us not depend on any structures (or just few if not possible) from virtio PMD driver. --yliu > +{ > + int callfd, kickfd; > + struct vhost_vring_file file; > + struct vhost_vring_state state; > + struct vhost_vring_addr addr = { > + .index = queue_sel, > + .desc_user_addr = (uint64_t)(uintptr_t)vq->vq_ring.desc, > + .avail_user_addr = (uint64_t)(uintptr_t)vq->vq_ring.avail, > + .used_user_addr = (uint64_t)(uintptr_t)vq->vq_ring.used, > + .log_guest_addr = 0, > + .flags = 0, /* disable log */ > + };