vhost: adapt library for selective datapath
[dpdk.git] / lib / librte_vhost / vhost.c
index 16b0f9a..b1afd69 100644 (file)
@@ -296,11 +296,17 @@ void
 vhost_destroy_device(int vid)
 {
        struct virtio_net *dev = get_device(vid);
+       struct rte_vdpa_device *vdpa_dev;
+       int did = -1;
 
        if (dev == NULL)
                return;
 
        if (dev->flags & VIRTIO_DEV_RUNNING) {
+               did = dev->vdpa_dev_id;
+               vdpa_dev = rte_vdpa_get_device(did);
+               if (vdpa_dev && vdpa_dev->ops->dev_close)
+                       vdpa_dev->ops->dev_close(dev->vid);
                dev->flags &= ~VIRTIO_DEV_RUNNING;
                dev->notify_ops->destroy_device(vid);
        }