[dpdk-dev,1/2] net/virtio: access interrupt handler directly
Checks
Commit Message
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 <yuanhan.liu@linux.intel.com>
---
drivers/net/virtio/virtio_ethdev.c | 9 ++++-----
drivers/net/virtio/virtio_pci.h | 6 ------
2 files changed, 4 insertions(+), 11 deletions(-)
Comments
On Thu, Jan 12, 2017 at 02:03:19PM +0800, Yuanhan Liu wrote:
> 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 <yuanhan.liu@linux.intel.com>
> ---
Both applied to dpdk-next-virtio.
--yliu
@@ -1397,7 +1397,7 @@ static int virtio_dev_xstats_get_names(struct rte_eth_dev *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;
@@ -1425,7 +1425,7 @@ static int virtio_dev_xstats_get_names(struct rte_eth_dev *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)
@@ -1544,7 +1544,7 @@ static int virtio_dev_xstats_get_names(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;
}
@@ -1636,13 +1636,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);
@@ -333,12 +333,6 @@ int vtpci_init(struct rte_pci_device *, 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;