Add vhost-backend and VhostBackendType

Use vhost_set_backend_type to initialise a proper vhost_ops structure.
In vhost_net_init and vhost_net_start_one call conditionally TAP related
initialisation depending on the vhost backend type.

Signed-off-by: Antonios Motakis <a.motakis@virtualopensystems.com>
Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
Nikolay Nikolaev 2014-05-27 15:05:49 +03:00 committed by Michael S. Tsirkin
parent 24d1eb33eb
commit 1a1bfac9ee
9 changed files with 135 additions and 34 deletions

View file

@ -808,11 +808,15 @@ static void vhost_virtqueue_cleanup(struct vhost_virtqueue *vq)
}
int vhost_dev_init(struct vhost_dev *hdev, void *opaque,
bool force)
VhostBackendType backend_type, bool force)
{
uint64_t features;
int i, r;
if (vhost_set_backend_type(hdev, backend_type) < 0) {
return -1;
}
if (hdev->vhost_ops->vhost_backend_init(hdev, opaque) < 0) {
return -errno;
}