On 20/04/2020 11:32, Cindy Lu wrote: > Currently we have 2 types of vhost backends in QEMU: vhost kernel and > vhost-user. The above patch provides a generic device for vDPA purpose, > this vDPA device exposes to user space a non-vendor-specific configuration > interface for setting up a vhost HW accelerator, this patch set introduces > a third vhost backend called vhost-vdpa based on the vDPA interface. > > Vhost-vdpa usage: > > qemu-system-x86_64 -cpu host -enable-kvm \ > ...... > -netdev type=vhost-vdpa,vhostdev=/dev/vhost-vdpa-id,id=vhost-vdpa0 \ > -device virtio-net-pci,netdev=vhost-vdpa0,page-per-vq=on \ > > Author: Tiwei Bie
Use "git commit --author" to set that. > Signed-off-by: Cindy Lu <l...@redhat.com> > --- > hw/net/vhost_net.c | 43 ++++ > hw/net/virtio-net.c | 9 + > hw/virtio/Makefile.objs | 2 +- > hw/virtio/vhost-backend.c | 3 + > hw/virtio/vhost-vdpa.c | 379 ++++++++++++++++++++++++++++++ > hw/virtio/vhost.c | 5 + > include/hw/virtio/vhost-backend.h | 6 +- > include/hw/virtio/vhost-vdpa.h | 14 ++ > 8 files changed, 459 insertions(+), 2 deletions(-) > create mode 100644 hw/virtio/vhost-vdpa.c > create mode 100644 include/hw/virtio/vhost-vdpa.h > > diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c > index 4096d64aaf..0d13fda2fc 100644 > --- a/hw/net/vhost_net.c > +++ b/hw/net/vhost_net.c ... > @@ -434,6 +462,10 @@ VHostNetState *get_vhost_net(NetClientState *nc) > assert(vhost_net); > break; > #endif > + case NET_CLIENT_DRIVER_VHOST_VDPA: > + vhost_net = vhost_vdpa_get_vhost_net(nc); > + assert(vhost_net); > + break; This should be inside a "#ifdef". Thanks, Laurent