rte_virtio: implement virtio_user_stop_device

It was en empty function before.

Also, don't stop the device in
virtio_user_dev_uninit, the device
is stopped separately before
removing (unititializing) it.

Change-Id: Ib540ee4a55bd3f983b50f35a138c1690daba1d98
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/379156
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Dariusz Stojaczyk 2017-09-19 14:58:15 +02:00 committed by Jim Harris
parent 1faea41722
commit 00e59e3bba

View File

@ -99,6 +99,18 @@ virtio_user_kick_queue(struct virtio_user_dev *dev, uint32_t queue_sel)
return 0;
}
static int
virtio_user_stop_queue(struct virtio_user_dev *dev, uint32_t queue_sel)
{
struct vhost_vring_state state;
state.index = queue_sel;
state.num = 0;
dev->ops->send_request(dev, VHOST_USER_GET_VRING_BASE, &state);
return 0;
}
static int
virtio_user_queue_setup(struct virtio_user_dev *dev,
int (*fn)(struct virtio_user_dev *, uint32_t))
@ -138,7 +150,7 @@ virtio_user_start_device(struct virtio_user_dev *dev)
int virtio_user_stop_device(struct virtio_user_dev *dev)
{
return 0;
return virtio_user_queue_setup(dev, virtio_user_stop_queue);
}
int
@ -228,8 +240,6 @@ virtio_user_dev_uninit(struct virtio_user_dev *dev)
{
uint32_t i;
virtio_user_stop_device(dev);
close(dev->vhostfd);
if (dev->vhostfds) {