There is no point it detecting whether we can use MSIX every time the interrupt is enabled/disabled/masked.
Let's do it once for all at PCI device init time. Signed-off-by: Maxime Coquelin <maxime.coque...@redhat.com> --- drivers/net/virtio/virtio_ethdev.c | 15 --------------- drivers/net/virtio/virtio_pci.c | 5 ++++- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index 4032a89396..67f6be3fa8 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -1282,42 +1282,27 @@ virtio_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on) static int virtio_intr_unmask(struct rte_eth_dev *dev) { - struct virtio_hw *hw = dev->data->dev_private; - if (rte_intr_ack(dev->intr_handle) < 0) return -1; - if (hw->bus_type == VIRTIO_BUS_PCI_LEGACY || hw->bus_type == VIRTIO_BUS_PCI_MODERN) - hw->use_msix = vtpci_msix_detect(RTE_ETH_DEV_TO_PCI(dev)); - return 0; } static int virtio_intr_enable(struct rte_eth_dev *dev) { - struct virtio_hw *hw = dev->data->dev_private; - if (rte_intr_enable(dev->intr_handle) < 0) return -1; - if (hw->bus_type == VIRTIO_BUS_PCI_LEGACY || hw->bus_type == VIRTIO_BUS_PCI_MODERN) - hw->use_msix = vtpci_msix_detect(RTE_ETH_DEV_TO_PCI(dev)); - return 0; } static int virtio_intr_disable(struct rte_eth_dev *dev) { - struct virtio_hw *hw = dev->data->dev_private; - if (rte_intr_disable(dev->intr_handle) < 0) return -1; - if (hw->bus_type == VIRTIO_BUS_PCI_LEGACY || hw->bus_type == VIRTIO_BUS_PCI_MODERN) - hw->use_msix = vtpci_msix_detect(RTE_ETH_DEV_TO_PCI(dev)); - return 0; } diff --git a/drivers/net/virtio/virtio_pci.c b/drivers/net/virtio/virtio_pci.c index 1692268f30..8605254e53 100644 --- a/drivers/net/virtio/virtio_pci.c +++ b/drivers/net/virtio/virtio_pci.c @@ -698,7 +698,7 @@ 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->bus_type = VIRTIO_BUS_PCI_MODERN; - return 0; + goto msix_detect; } PMD_INIT_LOG(INFO, "trying with legacy virtio pci."); @@ -718,6 +718,9 @@ vtpci_init(struct rte_pci_device *dev, struct virtio_hw *hw) virtio_hw_internal[hw->port_id].vtpci_ops = &legacy_ops; hw->bus_type = VIRTIO_BUS_PCI_LEGACY; +msix_detect: + hw->use_msix = vtpci_msix_detect(dev); + return 0; } -- 2.29.2