[dpdk-dev] [PATCH] vhost: make destroy callback on VHOST_USER_RESET_OWNER

Rich Lane rich.lane at bigswitch.com
Tue Nov 10 03:15:13 CET 2015


QEMU sends this message first when shutting down. There was previously no way
for the dataplane to know that the virtio_net instance had become unusable and
it would segfault when trying to do RX/TX.

Signed-off-by: Rich Lane <rlane at bigswitch.com>
---
 lib/librte_vhost/virtio-net.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/librte_vhost/virtio-net.c b/lib/librte_vhost/virtio-net.c
index 14278de..39a6a5e 100644
--- a/lib/librte_vhost/virtio-net.c
+++ b/lib/librte_vhost/virtio-net.c
@@ -436,6 +436,9 @@ reset_owner(struct vhost_device_ctx ctx)
 	if (dev == NULL)
 		return -1;
 
+	if (dev->flags & VIRTIO_DEV_RUNNING)
+		notify_ops->destroy_device(dev);
+
 	device_fh = dev->device_fh;
 	cleanup_device(dev);
 	init_device(dev);
-- 
1.9.1



More information about the dev mailing list