]> git.droids-corp.org - dpdk.git/blobdiff - lib/librte_vhost/vhost.c
vhost: adapt library for selective datapath
[dpdk.git] / lib / librte_vhost / vhost.c
index 16b0f9a6ff38f17e12adcd3c1b564269a97a88cc..b1afd693a50fd8ae42e0f53eb45ee2123b68b340 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);
        }