diff --git a/lib/vhost/rte_vhost_17_05/vhost_user.c b/lib/vhost/rte_vhost_17_05/vhost_user.c index 6cafb7500..f6bee6ebc 100644 --- a/lib/vhost/rte_vhost_17_05/vhost_user.c +++ b/lib/vhost/rte_vhost_17_05/vhost_user.c @@ -399,6 +399,12 @@ static int vhost_user_set_vring_base(struct virtio_net *dev, struct vhost_vring_state *state) { + /* Remove from the data plane. */ + if (dev->flags & VIRTIO_DEV_RUNNING) { + dev->flags &= ~VIRTIO_DEV_RUNNING; + dev->notify_ops->destroy_device(dev->vid); + } + dev->virtqueue[state->index]->last_used_idx = state->num; dev->virtqueue[state->index]->last_avail_idx = state->num; @@ -635,6 +641,12 @@ vhost_user_set_vring_call(struct virtio_net *dev, struct VhostUserMsg *pmsg) struct vhost_vring_file file; struct vhost_virtqueue *vq; + /* Remove from the data plane. */ + if (dev->flags & VIRTIO_DEV_RUNNING) { + dev->flags &= ~VIRTIO_DEV_RUNNING; + dev->notify_ops->destroy_device(dev->vid); + } + file.index = pmsg->payload.u64 & VHOST_USER_VRING_IDX_MASK; if (pmsg->payload.u64 & VHOST_USER_VRING_NOFD_MASK) file.fd = VIRTIO_INVALID_EVENTFD; @@ -656,6 +668,12 @@ vhost_user_set_vring_kick(struct virtio_net *dev, struct VhostUserMsg *pmsg) struct vhost_vring_file file; struct vhost_virtqueue *vq; + /* Remove from the data plane. */ + if (dev->flags & VIRTIO_DEV_RUNNING) { + dev->flags &= ~VIRTIO_DEV_RUNNING; + dev->notify_ops->destroy_device(dev->vid); + } + file.index = pmsg->payload.u64 & VHOST_USER_VRING_IDX_MASK; if (pmsg->payload.u64 & VHOST_USER_VRING_NOFD_MASK) file.fd = VIRTIO_INVALID_EVENTFD;