net/virtio-user: fix device type check
[dpdk.git] / drivers / net / virtio / virtio_ethdev.c
index e79748e..73e5da8 100644 (file)
@@ -1348,7 +1348,7 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features)
        if (virtio_negotiate_features(hw, req_features) < 0)
                return -1;
 
-       if (eth_dev->device) {
+       if (!hw->virtio_user_dev) {
                pci_dev = RTE_DEV_TO_PCI(eth_dev->device);
                rte_eth_copy_pci_info(eth_dev, pci_dev);
        }
@@ -1742,9 +1742,6 @@ virtio_dev_start(struct rte_eth_dev *dev)
                }
        }
 
-       /* Initialize Link state */
-       virtio_dev_link_update(dev, 0);
-
        /*Notify the backend
         *Otherwise the tap backend might already stop its queue due to fullness.
         *vhost backend will have no chance to be waked up
@@ -1773,8 +1770,12 @@ virtio_dev_start(struct rte_eth_dev *dev)
                txvq = dev->data->tx_queues[i];
                VIRTQUEUE_DUMP(txvq->vq);
        }
+
        hw->started = 1;
 
+       /* Initialize Link state */
+       virtio_dev_link_update(dev, 0);
+
        return 0;
 }