From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 8DE67F92F for ; Thu, 12 Jan 2017 07:01:09 +0100 (CET) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga105.fm.intel.com with ESMTP; 11 Jan 2017 22:01:08 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,348,1477983600"; d="scan'208";a="29354737" Received: from yliu-dev.sh.intel.com ([10.239.67.162]) by orsmga002.jf.intel.com with ESMTP; 11 Jan 2017 22:01:07 -0800 From: Yuanhan Liu To: dev@dpdk.org Cc: Yuanhan Liu Date: Thu, 12 Jan 2017 14:03:19 +0800 Message-Id: <1484201000-31071-1-git-send-email-yuanhan.liu@linux.intel.com> X-Mailer: git-send-email 1.9.0 Subject: [dpdk-dev] [PATCH 1/2] net/virtio: access interrupt handler directly X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Jan 2017 06:01:09 -0000 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 --- drivers/net/virtio/virtio_ethdev.c | 9 ++++----- drivers/net/virtio/virtio_pci.h | 6 ------ 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index 495de11..edef2a2 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -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); diff --git a/drivers/net/virtio/virtio_pci.h b/drivers/net/virtio/virtio_pci.h index 38a71a4..511a1c8 100644 --- a/drivers/net/virtio/virtio_pci.h +++ b/drivers/net/virtio/virtio_pci.h @@ -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; -- 1.9.0