blob: 28dc68dd5f0d10655a3485405b9787882af75c49 [file] [log] [blame]
Damjan Marion572825d2017-05-15 12:32:15 +02001From 3a1470e031ff33ac99da33b41dae0e9082d4da78 Mon Sep 17 00:00:00 2001
2From: Damjan Marion <damarion@cisco.com>
3Date: Mon, 15 May 2017 12:27:37 +0200
4Subject: [PATCH] Revert "net/virtio: remove redundant MSI-X detection"
5
6This reverts commit ee1843bd89076c59e50cadbef5c935613f543765.
7---
8 drivers/net/virtio/virtio_pci.c | 27 +++++++++++++++++++++++++++
9 1 file changed, 27 insertions(+)
10
11diff --git a/drivers/net/virtio/virtio_pci.c b/drivers/net/virtio/virtio_pci.c
12index b7b3d6157..127f25791 100644
13--- a/drivers/net/virtio/virtio_pci.c
14+++ b/drivers/net/virtio/virtio_pci.c
15@@ -274,6 +274,32 @@ legacy_notify_queue(struct virtio_hw *hw, struct virtqueue *vq)
16 VIRTIO_PCI_QUEUE_NOTIFY);
17 }
18
19+#ifdef RTE_EXEC_ENV_LINUXAPP
20+static int
21+legacy_virtio_has_msix(const struct rte_pci_addr *loc)
22+{
23+ DIR *d;
24+ char dirname[PATH_MAX];
25+
26+ snprintf(dirname, sizeof(dirname),
27+ "%s/" PCI_PRI_FMT "/msi_irqs", pci_get_sysfs_path(),
28+ loc->domain, loc->bus, loc->devid, loc->function);
29+
30+ d = opendir(dirname);
31+ if (d)
32+ closedir(d);
33+
34+ return d != NULL;
35+}
36+#else
37+static int
38+legacy_virtio_has_msix(const struct rte_pci_addr *loc __rte_unused)
39+{
40+ /* nic_uio does not enable interrupts, return 0 (false). */
41+ return 0;
42+}
43+#endif
44+
45 const struct virtio_pci_ops legacy_ops = {
46 .read_dev_cfg = legacy_read_dev_config,
47 .write_dev_cfg = legacy_write_dev_config,
48@@ -694,6 +720,7 @@ vtpci_init(struct rte_pci_device *dev, struct virtio_hw *hw)
49 }
50
51 virtio_hw_internal[hw->port_id].vtpci_ops = &legacy_ops;
52+ hw->use_msix = legacy_virtio_has_msix(&dev->addr);
53 hw->modern = 0;
54
55 return 0;
56--
572.11.0
58