From: Yuanhan Liu Date: Thu, 12 Jan 2017 05:31:57 +0000 (+0800) Subject: net/virtio: access interrupt handler directly X-Git-Tag: spdx-start~5165 X-Git-Url: http://git.droids-corp.org/?p=dpdk.git;a=commitdiff_plain;h=61e3ee17568ab046243424cbec43526db932a2e3 net/virtio: access interrupt handler directly Since commit 0e1b45a284b4 ("ethdev: decouple interrupt handling from PCI device"), intr_handle is stored at eth_dev struct, that we could use it directly. Thus there is no need to get it from hw. Signed-off-by: Yuanhan Liu --- diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index 92908936e7..dfd7e9f2a2 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -1399,7 +1399,7 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev) /* Setup interrupt callback */ if (eth_dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC) - rte_intr_callback_register(vtpci_intr_handle(hw), + rte_intr_callback_register(eth_dev->intr_handle, virtio_interrupt_handler, eth_dev); return 0; @@ -1427,7 +1427,7 @@ eth_virtio_dev_uninit(struct rte_eth_dev *eth_dev) /* reset interrupt callback */ if (eth_dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC) - rte_intr_callback_unregister(vtpci_intr_handle(hw), + rte_intr_callback_unregister(eth_dev->intr_handle, virtio_interrupt_handler, eth_dev); if (hw->dev) @@ -1546,7 +1546,7 @@ virtio_dev_start(struct rte_eth_dev *dev) return -ENOTSUP; } - if (rte_intr_enable(vtpci_intr_handle(hw)) < 0) { + if (rte_intr_enable(dev->intr_handle) < 0) { PMD_DRV_LOG(ERR, "interrupt enable failed"); return -EIO; } @@ -1638,13 +1638,12 @@ static void virtio_dev_free_mbufs(struct rte_eth_dev *dev) static void virtio_dev_stop(struct rte_eth_dev *dev) { - struct virtio_hw *hw = dev->data->dev_private; struct rte_eth_link link; PMD_INIT_LOG(DEBUG, "stop"); if (dev->data->dev_conf.intr_conf.lsc) - rte_intr_disable(vtpci_intr_handle(hw)); + rte_intr_disable(dev->intr_handle); memset(&link, 0, sizeof(link)); virtio_dev_atomic_write_link_status(dev, &link); diff --git a/drivers/net/virtio/virtio_pci.h b/drivers/net/virtio/virtio_pci.h index 38a71a4e79..511a1c8794 100644 --- a/drivers/net/virtio/virtio_pci.h +++ b/drivers/net/virtio/virtio_pci.h @@ -333,12 +333,6 @@ uint8_t vtpci_isr(struct virtio_hw *); uint16_t vtpci_irq_config(struct virtio_hw *, uint16_t); -static inline struct rte_intr_handle * -vtpci_intr_handle(struct virtio_hw *hw) -{ - return hw->dev ? &hw->dev->intr_handle : NULL; -} - extern const struct virtio_pci_ops legacy_ops; extern const struct virtio_pci_ops modern_ops; extern const struct virtio_pci_ops virtio_user_ops;