net/virtio: remove redundant MSI-X detection
[dpdk.git] / drivers / net / virtio / virtio_pci.c
index ecad46e..1df26a6 100644 (file)
@@ -279,47 +279,6 @@ legacy_notify_queue(struct virtio_hw *hw, struct virtqueue *vq)
                         VIRTIO_PCI_QUEUE_NOTIFY);
 }
 
-#ifdef RTE_EXEC_ENV_LINUXAPP
-static int
-legacy_virtio_has_msix(const struct rte_pci_addr *loc)
-{
-       DIR *d;
-       char dirname[PATH_MAX];
-
-       snprintf(dirname, sizeof(dirname),
-                    "%s/" PCI_PRI_FMT "/msi_irqs", pci_get_sysfs_path(),
-                    loc->domain, loc->bus, loc->devid, loc->function);
-
-       d = opendir(dirname);
-       if (d)
-               closedir(d);
-
-       return d != NULL;
-}
-#else
-static int
-legacy_virtio_has_msix(const struct rte_pci_addr *loc __rte_unused)
-{
-       /* nic_uio does not enable interrupts, return 0 (false). */
-       return 0;
-}
-#endif
-
-static int
-legacy_virtio_resource_init(struct rte_pci_device *pci_dev,
-                           struct virtio_hw *hw, uint32_t *dev_flags)
-{
-       if (rte_eal_pci_ioport_map(pci_dev, 0, VTPCI_IO(hw)) < 0)
-               return -1;
-
-       if (pci_dev->intr_handle.type != RTE_INTR_HANDLE_UNKNOWN)
-               *dev_flags |= RTE_ETH_DEV_INTR_LSC;
-       else
-               *dev_flags &= ~RTE_ETH_DEV_INTR_LSC;
-
-       return 0;
-}
-
 const struct virtio_pci_ops legacy_ops = {
        .read_dev_cfg   = legacy_read_dev_config,
        .write_dev_cfg  = legacy_write_dev_config,
@@ -712,8 +671,7 @@ next:
  * Return 0 on success.
  */
 int
-vtpci_init(struct rte_pci_device *dev, struct virtio_hw *hw,
-          uint32_t *dev_flags)
+vtpci_init(struct rte_pci_device *dev, struct virtio_hw *hw)
 {
        /*
         * Try if we can succeed reading virtio pci caps, which exists
@@ -724,12 +682,11 @@ vtpci_init(struct rte_pci_device *dev, struct virtio_hw *hw,
                PMD_INIT_LOG(INFO, "modern virtio pci detected.");
                virtio_hw_internal[hw->port_id].vtpci_ops = &modern_ops;
                hw->modern = 1;
-               *dev_flags |= RTE_ETH_DEV_INTR_LSC;
                return 0;
        }
 
        PMD_INIT_LOG(INFO, "trying with legacy virtio pci.");
-       if (legacy_virtio_resource_init(dev, hw, dev_flags) < 0) {
+       if (rte_eal_pci_ioport_map(dev, 0, VTPCI_IO(hw)) < 0) {
                if (dev->kdrv == RTE_KDRV_UNKNOWN &&
                    (!dev->device.devargs ||
                     dev->device.devargs->type !=
@@ -742,7 +699,6 @@ vtpci_init(struct rte_pci_device *dev, struct virtio_hw *hw,
        }
 
        virtio_hw_internal[hw->port_id].vtpci_ops = &legacy_ops;
-       hw->use_msix = legacy_virtio_has_msix(&dev->addr);
        hw->modern   = 0;
 
        return 0;