net/virtio: unmap PCI device in secondary process
[dpdk.git] / drivers / net / virtio / virtio_user_ethdev.c
index 90fcd6e..a7d7063 100644 (file)
@@ -398,7 +398,7 @@ virtio_user_backend_type(const char *path)
                if (errno == ENOENT)
                        return VIRTIO_USER_BACKEND_VHOST_USER;
 
-               PMD_INIT_LOG(ERR, "Stat fails: %s (%s)\n", path,
+               PMD_INIT_LOG(ERR, "Stat fails: %s (%s)", path,
                             strerror(errno));
                return VIRTIO_USER_BACKEND_UNKNOWN;
        }
@@ -657,9 +657,16 @@ virtio_user_pmd_probe(struct rte_vdev_device *vdev)
                goto end;
        }
 
+       /*
+        * Virtio-user requires using virtual addresses for the descriptors
+        * buffers, whatever other devices require
+        */
+       hw->use_va = true;
+
        /* previously called by pci probing for physical dev */
        if (eth_virtio_dev_init(eth_dev) < 0) {
                PMD_INIT_LOG(ERR, "eth_virtio_dev_init fails");
+               virtio_user_dev_uninit(dev);
                virtio_user_eth_dev_free(eth_dev);
                goto end;
        }
@@ -682,14 +689,10 @@ virtio_user_pmd_probe(struct rte_vdev_device *vdev)
        ret = 0;
 
 end:
-       if (kvlist)
-               rte_kvargs_free(kvlist);
-       if (path)
-               free(path);
-       if (mac_addr)
-               free(mac_addr);
-       if (ifname)
-               free(ifname);
+       rte_kvargs_free(kvlist);
+       free(path);
+       free(mac_addr);
+       free(ifname);
        return ret;
 }
 
@@ -769,7 +772,6 @@ static struct rte_vdev_driver virtio_user_driver = {
        .remove = virtio_user_pmd_remove,
        .dma_map = virtio_user_pmd_dma_map,
        .dma_unmap = virtio_user_pmd_dma_unmap,
-       .drv_flags = RTE_VDEV_DRV_NEED_IOVA_AS_VA,
 };
 
 RTE_PMD_REGISTER_VDEV(net_virtio_user, virtio_user_driver);