net/virtio: fix multiple process support
[dpdk.git] / drivers / net / virtio / virtio_user_ethdev.c
index bfdc3d0..48a8c4f 100644 (file)
@@ -212,7 +212,7 @@ virtio_user_notify_queue(struct virtio_hw *hw, struct virtqueue *vq)
                            strerror(errno));
 }
 
-static const struct virtio_pci_ops virtio_user_ops = {
+const struct virtio_pci_ops virtio_user_ops = {
        .read_dev_cfg   = virtio_user_read_dev_config,
        .write_dev_cfg  = virtio_user_write_dev_config,
        .reset          = virtio_user_reset,
@@ -301,7 +301,8 @@ virtio_user_eth_dev_alloc(const char *name)
                return NULL;
        }
 
-       hw->vtpci_ops = &virtio_user_ops;
+       hw->port_id = data->port_id;
+       virtio_hw_internal[hw->port_id].vtpci_ops = &virtio_user_ops;
        hw->use_msix = 0;
        hw->modern   = 0;
        hw->use_simple_rxtx = 0;
@@ -310,7 +311,6 @@ virtio_user_eth_dev_alloc(const char *name)
        data->numa_node = SOCKET_ID_ANY;
        data->kdrv = RTE_KDRV_NONE;
        data->dev_flags = RTE_ETH_DEV_DETACHABLE;
-       eth_dev->pci_dev = NULL;
        eth_dev->driver = NULL;
        return eth_dev;
 }
@@ -479,6 +479,7 @@ static struct rte_vdev_driver virtio_user_driver = {
 };
 
 RTE_PMD_REGISTER_VDEV(net_virtio_user, virtio_user_driver);
+RTE_PMD_REGISTER_ALIAS(net_virtio_user, virtio_user);
 RTE_PMD_REGISTER_PARAM_STRING(net_virtio_user,
        "path=<path> "
        "mac=<mac addr> "