vdpa/mlx5: support device cleanup callback
[dpdk.git] / drivers / vdpa / ifc / ifcvf_vdpa.c
index 365da2a..9f05595 100644 (file)
@@ -17,7 +17,7 @@
 #include <rte_bus_pci.h>
 #include <rte_vhost.h>
 #include <rte_vdpa.h>
-#include <rte_vdpa_dev.h>
+#include <vdpa_driver.h>
 #include <rte_vfio.h>
 #include <rte_spinlock.h>
 #include <rte_log.h>
@@ -162,7 +162,7 @@ ifcvf_vfio_setup(struct ifcvf_internal *internal)
        if (rte_pci_map_device(dev))
                goto err;
 
-       internal->vfio_dev_fd = dev->intr_handle.vfio_dev_fd;
+       internal->vfio_dev_fd = rte_intr_dev_fd_get(dev->intr_handle);
 
        for (i = 0; i < RTE_MIN(PCI_MAX_RESOURCE, IFCVF_PCI_MAX_RESOURCE);
                        i++) {
@@ -226,8 +226,7 @@ ifcvf_dma_map(struct ifcvf_internal *internal, bool do_map)
        }
 
 exit:
-       if (mem)
-               free(mem);
+       free(mem);
        return ret;
 }
 
@@ -253,8 +252,7 @@ hva_to_gpa(int vid, uint64_t hva)
        }
 
 exit:
-       if (mem)
-               free(mem);
+       free(mem);
        return gpa;
 }
 
@@ -365,7 +363,8 @@ vdpa_enable_vfio_intr(struct ifcvf_internal *internal, bool m_rx)
        irq_set->index = VFIO_PCI_MSIX_IRQ_INDEX;
        irq_set->start = 0;
        fd_ptr = (int *)&irq_set->data;
-       fd_ptr[RTE_INTR_VEC_ZERO_OFFSET] = internal->pdev->intr_handle.fd;
+       fd_ptr[RTE_INTR_VEC_ZERO_OFFSET] =
+               rte_intr_fd_get(internal->pdev->intr_handle);
 
        for (i = 0; i < nr_vring; i++)
                internal->intr_fd[i] = -1;
@@ -660,8 +659,7 @@ m_ifcvf_start(struct ifcvf_internal *internal)
 
 error:
        for (i = 0; i < nr_vring; i++)
-               if (internal->m_vring[i].desc)
-                       rte_free(internal->m_vring[i].desc);
+               rte_free(internal->m_vring[i].desc);
 
        return -1;
 }