net/virtio: remove useless driver name copy
[dpdk.git] / drivers / net / virtio / virtio_ethdev.c
index adfc69d..5c8afb5 100644 (file)
@@ -602,7 +602,6 @@ virtio_dev_close(struct rte_eth_dev *dev)
        if (dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC)
                vtpci_irq_config(hw, VIRTIO_MSI_NO_VECTOR);
        vtpci_reset(hw);
-       hw->started = 0;
        virtio_dev_free_mbufs(dev);
        virtio_free_queues(hw);
 }
@@ -1277,6 +1276,7 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features)
        ret = virtio_alloc_queues(eth_dev);
        if (ret < 0)
                return ret;
+       vtpci_reinit_complete(hw);
 
        if (pci_dev)
                PMD_INIT_LOG(DEBUG, "port %d vendorID=0x%x deviceID=0x%x",
@@ -1344,17 +1344,14 @@ static int
 eth_virtio_dev_uninit(struct rte_eth_dev *eth_dev)
 {
        struct rte_pci_device *pci_dev;
-       struct virtio_hw *hw = eth_dev->data->dev_private;
 
        PMD_INIT_FUNC_TRACE();
 
        if (rte_eal_process_type() == RTE_PROC_SECONDARY)
                return -EPERM;
 
-       if (hw->started == 1) {
-               virtio_dev_stop(eth_dev);
-               virtio_dev_close(eth_dev);
-       }
+       virtio_dev_stop(eth_dev);
+       virtio_dev_close(eth_dev);
        pci_dev = eth_dev->pci_dev;
 
        eth_dev->dev_ops = NULL;
@@ -1473,9 +1470,9 @@ static int
 virtio_dev_start(struct rte_eth_dev *dev)
 {
        uint16_t nb_queues, i;
-       struct virtio_hw *hw = dev->data->dev_private;
        struct virtnet_rx *rxvq;
        struct virtnet_tx *txvq __rte_unused;
+       struct virtio_hw *hw = dev->data->dev_private;
 
        /* check if lsc interrupt feature is enabled */
        if (dev->data->dev_conf.intr_conf.lsc) {
@@ -1493,27 +1490,19 @@ virtio_dev_start(struct rte_eth_dev *dev)
        /* Initialize Link state */
        virtio_dev_link_update(dev, 0);
 
-       /* On restart after stop do not touch queues */
-       if (hw->started)
-               return 0;
-
-       vtpci_reinit_complete(hw);
-
-       hw->started = 1;
-
        /*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
         */
-       nb_queues = dev->data->nb_rx_queues;
-       if (nb_queues > 1) {
+       nb_queues = RTE_MAX(dev->data->nb_rx_queues, dev->data->nb_tx_queues);
+       if (hw->max_queue_pairs > 1) {
                if (virtio_set_multiple_queues(dev, nb_queues) != 0)
                        return -EINVAL;
        }
 
        PMD_INIT_LOG(DEBUG, "nb_queues=%d", nb_queues);
 
-       for (i = 0; i < nb_queues; i++) {
+       for (i = 0; i < dev->data->nb_rx_queues; i++) {
                rxvq = dev->data->rx_queues[i];
                virtqueue_notify(rxvq->vq);
        }
@@ -1635,10 +1624,6 @@ virtio_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
        uint64_t tso_mask;
        struct virtio_hw *hw = dev->data->dev_private;
 
-       if (dev->pci_dev)
-               dev_info->driver_name = dev->driver->pci_drv.driver.name;
-       else
-               dev_info->driver_name = "virtio_user PMD";
        dev_info->max_rx_queues =
                RTE_MIN(hw->max_queue_pairs, VIRTIO_MAX_RX_QUEUES);
        dev_info->max_tx_queues =
@@ -1680,3 +1665,4 @@ __rte_unused uint8_t is_rx)
 
 RTE_PMD_EXPORT_NAME(net_virtio, __COUNTER__);
 RTE_PMD_REGISTER_PCI_TABLE(net_virtio, pci_id_virtio_map);
+RTE_PMD_REGISTER_KMOD_DEP(net_virtio, "* igb_uio | uio_pci_generic | vfio");