From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from wes1-so1.wedos.net (wes1-so1.wedos.net [46.28.106.15]) by dpdk.org (Postfix) with ESMTP id E9FE38D96 for ; Mon, 18 Jan 2016 17:05:13 +0100 (CET) Received: from pcviktorin.fit.vutbr.cz (pcviktorin.fit.vutbr.cz [147.229.13.147]) by wes1-so1.wedos.net (Postfix) with ESMTPSA id 3pkdHY54Yzz5T9; Mon, 18 Jan 2016 17:05:13 +0100 (CET) From: Jan Viktorin To: dev@dpdk.org Date: Mon, 18 Jan 2016 17:03:06 +0100 Message-Id: <1453132987-20564-6-git-send-email-viktorin@rehivetech.com> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1453132987-20564-1-git-send-email-viktorin@rehivetech.com> References: <1453132987-20564-1-git-send-email-viktorin@rehivetech.com> Cc: Jan Viktorin Subject: [dpdk-dev] [RFC 5/6] eal: move intr_handle from rte_pci_device to rte_device X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jan 2016 16:05:14 -0000 Suggested-by: David Marchand Signed-off-by: Jan Viktorin --- drivers/net/e1000/em_ethdev.c | 14 ++++++------- drivers/net/e1000/igb_ethdev.c | 24 +++++++++++----------- drivers/net/enic/enic_main.c | 4 ++-- drivers/net/fm10k/fm10k_ethdev.c | 16 +++++++-------- drivers/net/i40e/i40e_ethdev.c | 32 +++++++++++++++--------------- drivers/net/i40e/i40e_ethdev_vf.c | 16 +++++++-------- drivers/net/ixgbe/ixgbe_ethdev.c | 28 +++++++++++++------------- drivers/net/virtio/virtio_ethdev.c | 16 +++++++-------- lib/librte_eal/bsdapp/eal/eal_pci.c | 14 ++++++------- lib/librte_eal/common/eal_common_pci_uio.c | 18 ++++++++--------- lib/librte_eal/common/include/rte_dev.h | 1 + lib/librte_eal/common/include/rte_pci.h | 1 - lib/librte_eal/linuxapp/eal/eal_pci.c | 4 ++-- lib/librte_eal/linuxapp/eal/eal_pci_uio.c | 28 +++++++++++++------------- lib/librte_eal/linuxapp/eal/eal_pci_vfio.c | 14 ++++++------- lib/librte_ether/rte_ethdev.c | 4 ++-- 16 files changed, 117 insertions(+), 117 deletions(-) diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c index 66e8993..87ed780 100644 --- a/drivers/net/e1000/em_ethdev.c +++ b/drivers/net/e1000/em_ethdev.c @@ -296,7 +296,7 @@ eth_em_dev_init(struct rte_eth_dev *eth_dev) eth_dev->data->port_id, pci_dev->id.vendor_id, pci_dev->id.device_id); - rte_intr_callback_register(&(pci_dev->intr_handle), + rte_intr_callback_register(&(pci_dev->dev.intr_handle), eth_em_interrupt_handler, (void *)eth_dev); return (0); @@ -327,8 +327,8 @@ eth_em_dev_uninit(struct rte_eth_dev *eth_dev) eth_dev->data->mac_addrs = NULL; /* disable uio intr before callback unregister */ - rte_intr_disable(&(pci_dev->intr_handle)); - rte_intr_callback_unregister(&(pci_dev->intr_handle), + rte_intr_disable(&(pci_dev->dev.intr_handle)); + rte_intr_callback_unregister(&(pci_dev->dev.intr_handle), eth_em_interrupt_handler, (void *)eth_dev); return 0; @@ -506,7 +506,7 @@ eth_em_start(struct rte_eth_dev *dev) E1000_DEV_PRIVATE(dev->data->dev_private); struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private); - struct rte_intr_handle *intr_handle = &dev->pci_dev->intr_handle; + struct rte_intr_handle *intr_handle = &dev->pci_dev->dev.intr_handle; int ret, mask; uint32_t intr_vector = 0; @@ -683,7 +683,7 @@ eth_em_stop(struct rte_eth_dev *dev) { struct rte_eth_link link; struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private); - struct rte_intr_handle *intr_handle = &dev->pci_dev->intr_handle; + struct rte_intr_handle *intr_handle = &dev->pci_dev->dev.intr_handle; em_rxq_intr_disable(hw); em_lsc_intr_disable(hw); @@ -945,7 +945,7 @@ eth_em_rx_queue_intr_enable(struct rte_eth_dev *dev, __rte_unused uint16_t queue struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private); em_rxq_intr_enable(hw); - rte_intr_enable(&dev->pci_dev->intr_handle); + rte_intr_enable(&dev->pci_dev->dev.intr_handle); return 0; } @@ -1482,7 +1482,7 @@ eth_em_interrupt_action(struct rte_eth_dev *dev) return -1; intr->flags &= ~E1000_FLAG_NEED_LINK_UPDATE; - rte_intr_enable(&(dev->pci_dev->intr_handle)); + rte_intr_enable(&(dev->pci_dev->dev.intr_handle)); /* set get_link_status to check register later */ hw->mac.get_link_status = 1; diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c index d1bbcda..860bd5c 100644 --- a/drivers/net/e1000/igb_ethdev.c +++ b/drivers/net/e1000/igb_ethdev.c @@ -769,12 +769,12 @@ eth_igb_dev_init(struct rte_eth_dev *eth_dev) eth_dev->data->port_id, pci_dev->id.vendor_id, pci_dev->id.device_id); - rte_intr_callback_register(&pci_dev->intr_handle, + rte_intr_callback_register(&pci_dev->dev.intr_handle, eth_igb_interrupt_handler, (void *)eth_dev); /* enable uio/vfio intr/eventfd mapping */ - rte_intr_enable(&pci_dev->intr_handle); + rte_intr_enable(&pci_dev->dev.intr_handle); /* enable support intr */ igb_intr_enable(eth_dev); @@ -827,8 +827,8 @@ eth_igb_dev_uninit(struct rte_eth_dev *eth_dev) igb_pf_host_uninit(eth_dev); /* disable uio intr before callback unregister */ - rte_intr_disable(&(pci_dev->intr_handle)); - rte_intr_callback_unregister(&(pci_dev->intr_handle), + rte_intr_disable(&(pci_dev->dev.intr_handle)); + rte_intr_callback_unregister(&(pci_dev->dev.intr_handle), eth_igb_interrupt_handler, (void *)eth_dev); return 0; @@ -1115,7 +1115,7 @@ eth_igb_start(struct rte_eth_dev *dev) E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private); struct e1000_adapter *adapter = E1000_DEV_PRIVATE(dev->data->dev_private); - struct rte_intr_handle *intr_handle = &dev->pci_dev->intr_handle; + struct rte_intr_handle *intr_handle = &dev->pci_dev->dev.intr_handle; int ret, mask; uint32_t intr_vector = 0; uint32_t ctrl_ext; @@ -1315,7 +1315,7 @@ eth_igb_stop(struct rte_eth_dev *dev) struct e1000_flex_filter *p_flex; struct e1000_5tuple_filter *p_5tuple, *p_5tuple_next; struct e1000_2tuple_filter *p_2tuple, *p_2tuple_next; - struct rte_intr_handle *intr_handle = &dev->pci_dev->intr_handle; + struct rte_intr_handle *intr_handle = &dev->pci_dev->dev.intr_handle; igb_intr_disable(hw); @@ -1413,9 +1413,9 @@ eth_igb_close(struct rte_eth_dev *dev) igb_dev_free_queues(dev); pci_dev = dev->pci_dev; - if (pci_dev->intr_handle.intr_vec) { - rte_free(pci_dev->intr_handle.intr_vec); - pci_dev->intr_handle.intr_vec = NULL; + if (pci_dev->dev.intr_handle.intr_vec) { + rte_free(pci_dev->dev.intr_handle.intr_vec); + pci_dev->dev.intr_handle.intr_vec = NULL; } memset(&link, 0, sizeof(link)); @@ -2431,7 +2431,7 @@ eth_igb_interrupt_action(struct rte_eth_dev *dev) } igb_intr_enable(dev); - rte_intr_enable(&(dev->pci_dev->intr_handle)); + rte_intr_enable(&(dev->pci_dev->dev.intr_handle)); if (intr->flags & E1000_FLAG_NEED_LINK_UPDATE) { intr->flags &= ~E1000_FLAG_NEED_LINK_UPDATE; @@ -4727,7 +4727,7 @@ eth_igb_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id) E1000_WRITE_REG(hw, E1000_EIMS, regval | mask); E1000_WRITE_FLUSH(hw); - rte_intr_enable(&dev->pci_dev->intr_handle); + rte_intr_enable(&dev->pci_dev->dev.intr_handle); return 0; } @@ -4792,7 +4792,7 @@ eth_igb_configure_msix_intr(struct rte_eth_dev *dev) uint32_t base = E1000_MISC_VEC_ID; uint32_t misc_shift = 0; - struct rte_intr_handle *intr_handle = &dev->pci_dev->intr_handle; + struct rte_intr_handle *intr_handle = &dev->pci_dev->dev.intr_handle; /* won't configure msix register if no mapping is done * between intr vector and event fd diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c index 07a9810..5a1c2ce 100644 --- a/drivers/net/enic/enic_main.c +++ b/drivers/net/enic/enic_main.c @@ -606,10 +606,10 @@ int enic_enable(struct enic *enic) vnic_dev_enable_wait(enic->vdev); /* Register and enable error interrupt */ - rte_intr_callback_register(&(enic->pdev->intr_handle), + rte_intr_callback_register(&(enic->pdev->dev.intr_handle), enic_intr_handler, (void *)enic->rte_dev); - rte_intr_enable(&(enic->pdev->intr_handle)); + rte_intr_enable(&(enic->pdev->dev.intr_handle)); vnic_intr_unmask(&enic->intr); return 0; diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c index e4aed94..7f88d25 100644 --- a/drivers/net/fm10k/fm10k_ethdev.c +++ b/drivers/net/fm10k/fm10k_ethdev.c @@ -2322,7 +2322,7 @@ fm10k_dev_interrupt_handler_pf( FM10K_WRITE_REG(hw, FM10K_ITR(0), FM10K_ITR_AUTOMASK | FM10K_ITR_MASK_CLEAR); /* Re-enable interrupt from host side */ - rte_intr_enable(&(dev->pci_dev->intr_handle)); + rte_intr_enable(&(dev->pci_dev->dev.intr_handle)); } /** @@ -2356,7 +2356,7 @@ fm10k_dev_interrupt_handler_vf( FM10K_WRITE_REG(hw, FM10K_VFITR(0), FM10K_ITR_AUTOMASK | FM10K_ITR_MASK_CLEAR); /* Re-enable interrupt from host side */ - rte_intr_enable(&(dev->pci_dev->intr_handle)); + rte_intr_enable(&(dev->pci_dev->dev.intr_handle)); } /* Mailbox message handler in VF */ @@ -2624,20 +2624,20 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev) /*PF/VF has different interrupt handling mechanism */ if (hw->mac.type == fm10k_mac_pf) { /* register callback func to eal lib */ - rte_intr_callback_register(&(dev->pci_dev->intr_handle), + rte_intr_callback_register(&(dev->pci_dev->dev.intr_handle), fm10k_dev_interrupt_handler_pf, (void *)dev); /* enable MISC interrupt */ fm10k_dev_enable_intr_pf(dev); } else { /* VF */ - rte_intr_callback_register(&(dev->pci_dev->intr_handle), + rte_intr_callback_register(&(dev->pci_dev->dev.intr_handle), fm10k_dev_interrupt_handler_vf, (void *)dev); fm10k_dev_enable_intr_vf(dev); } /* Enable uio intr after callback registered */ - rte_intr_enable(&(dev->pci_dev->intr_handle)); + rte_intr_enable(&(dev->pci_dev->dev.intr_handle)); hw->mac.ops.update_int_moderator(hw); @@ -2707,7 +2707,7 @@ eth_fm10k_dev_uninit(struct rte_eth_dev *dev) dev->tx_pkt_burst = NULL; /* disable uio/vfio intr */ - rte_intr_disable(&(dev->pci_dev->intr_handle)); + rte_intr_disable(&(dev->pci_dev->dev.intr_handle)); /*PF/VF has different interrupt handling mechanism */ if (hw->mac.type == fm10k_mac_pf) { @@ -2715,13 +2715,13 @@ eth_fm10k_dev_uninit(struct rte_eth_dev *dev) fm10k_dev_disable_intr_pf(dev); /* unregister callback func to eal lib */ - rte_intr_callback_unregister(&(dev->pci_dev->intr_handle), + rte_intr_callback_unregister(&(dev->pci_dev->dev.intr_handle), fm10k_dev_interrupt_handler_pf, (void *)dev); } else { /* disable interrupt */ fm10k_dev_disable_intr_vf(dev); - rte_intr_callback_unregister(&(dev->pci_dev->intr_handle), + rte_intr_callback_unregister(&(dev->pci_dev->dev.intr_handle), fm10k_dev_interrupt_handler_vf, (void *)dev); } diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index bf6220d..2d6a7d5 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -903,7 +903,7 @@ eth_i40e_dev_init(struct rte_eth_dev *dev) i40e_pf_host_init(dev); /* register callback func to eal lib */ - rte_intr_callback_register(&(pci_dev->intr_handle), + rte_intr_callback_register(&(pci_dev->dev.intr_handle), i40e_dev_interrupt_handler, (void *)dev); /* configure and enable device interrupt */ @@ -911,7 +911,7 @@ eth_i40e_dev_init(struct rte_eth_dev *dev) i40e_pf_enable_irq0(hw); /* enable uio intr after callback register */ - rte_intr_enable(&(pci_dev->intr_handle)); + rte_intr_enable(&(pci_dev->dev.intr_handle)); /* * Add an ethertype filter to drop all flow control frames transmitted * from VSIs. By doing so, we stop VF from sending out PAUSE or PFC @@ -1004,10 +1004,10 @@ eth_i40e_dev_uninit(struct rte_eth_dev *dev) dev->data->mac_addrs = NULL; /* disable uio intr before callback unregister */ - rte_intr_disable(&(pci_dev->intr_handle)); + rte_intr_disable(&(pci_dev->dev.intr_handle)); /* register callback func to eal lib */ - rte_intr_callback_unregister(&(pci_dev->intr_handle), + rte_intr_callback_unregister(&(pci_dev->dev.intr_handle), i40e_dev_interrupt_handler, (void *)dev); return 0; @@ -1094,7 +1094,7 @@ void i40e_vsi_queues_unbind_intr(struct i40e_vsi *vsi) { struct rte_eth_dev *dev = vsi->adapter->eth_dev; - struct rte_intr_handle *intr_handle = &dev->pci_dev->intr_handle; + struct rte_intr_handle *intr_handle = &dev->pci_dev->dev.intr_handle; struct i40e_hw *hw = I40E_VSI_TO_HW(vsi); uint16_t msix_vect = vsi->msix_intr; uint16_t i; @@ -1207,7 +1207,7 @@ void i40e_vsi_queues_bind_intr(struct i40e_vsi *vsi) { struct rte_eth_dev *dev = vsi->adapter->eth_dev; - struct rte_intr_handle *intr_handle = &dev->pci_dev->intr_handle; + struct rte_intr_handle *intr_handle = &dev->pci_dev->dev.intr_handle; struct i40e_hw *hw = I40E_VSI_TO_HW(vsi); uint16_t msix_vect = vsi->msix_intr; uint16_t nb_msix = RTE_MIN(vsi->nb_msix, intr_handle->nb_efd); @@ -1278,7 +1278,7 @@ static void i40e_vsi_enable_queues_intr(struct i40e_vsi *vsi) { struct rte_eth_dev *dev = vsi->adapter->eth_dev; - struct rte_intr_handle *intr_handle = &dev->pci_dev->intr_handle; + struct rte_intr_handle *intr_handle = &dev->pci_dev->dev.intr_handle; struct i40e_hw *hw = I40E_VSI_TO_HW(vsi); uint16_t interval = i40e_calc_itr_interval(\ RTE_LIBRTE_I40E_ITR_INTERVAL); @@ -1309,7 +1309,7 @@ static void i40e_vsi_disable_queues_intr(struct i40e_vsi *vsi) { struct rte_eth_dev *dev = vsi->adapter->eth_dev; - struct rte_intr_handle *intr_handle = &dev->pci_dev->intr_handle; + struct rte_intr_handle *intr_handle = &dev->pci_dev->dev.intr_handle; struct i40e_hw *hw = I40E_VSI_TO_HW(vsi); uint16_t msix_intr, i; @@ -1389,7 +1389,7 @@ i40e_dev_start(struct rte_eth_dev *dev) struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private); struct i40e_vsi *main_vsi = pf->main_vsi; int ret, i; - struct rte_intr_handle *intr_handle = &dev->pci_dev->intr_handle; + struct rte_intr_handle *intr_handle = &dev->pci_dev->dev.intr_handle; uint32_t intr_vector = 0; hw->adapter_stopped = 0; @@ -1507,7 +1507,7 @@ i40e_dev_stop(struct rte_eth_dev *dev) struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private); struct i40e_vsi *main_vsi = pf->main_vsi; struct i40e_mirror_rule *p_mirror; - struct rte_intr_handle *intr_handle = &dev->pci_dev->intr_handle; + struct rte_intr_handle *intr_handle = &dev->pci_dev->dev.intr_handle; int i; /* Disable all queues */ @@ -1569,7 +1569,7 @@ i40e_dev_close(struct rte_eth_dev *dev) /* Disable interrupt */ i40e_pf_disable_irq0(hw); - rte_intr_disable(&(dev->pci_dev->intr_handle)); + rte_intr_disable(&(dev->pci_dev->dev.intr_handle)); /* shutdown and destroy the HMC */ i40e_shutdown_lan_hmc(hw); @@ -4920,7 +4920,7 @@ i40e_dev_interrupt_delayed_handler(void *param) _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC); i40e_pf_enable_irq0(hw); - rte_intr_enable(&(dev->pci_dev->intr_handle)); + rte_intr_enable(&(dev->pci_dev->dev.intr_handle)); } /** @@ -5007,7 +5007,7 @@ i40e_dev_interrupt_handler(__rte_unused struct rte_intr_handle *handle, done: /* Enable interrupt */ i40e_pf_enable_irq0(hw); - rte_intr_enable(&(dev->pci_dev->intr_handle)); + rte_intr_enable(&(dev->pci_dev->dev.intr_handle)); } static int @@ -8483,7 +8483,7 @@ i40e_dev_get_dcb_info(struct rte_eth_dev *dev, static int i40e_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id) { - struct rte_intr_handle *intr_handle = &dev->pci_dev->intr_handle; + struct rte_intr_handle *intr_handle = &dev->pci_dev->dev.intr_handle; struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private); uint16_t interval = i40e_calc_itr_interval(RTE_LIBRTE_I40E_ITR_INTERVAL); @@ -8508,7 +8508,7 @@ i40e_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id) I40E_PFINT_DYN_CTLN_INTERVAL_SHIFT)); I40E_WRITE_FLUSH(hw); - rte_intr_enable(&dev->pci_dev->intr_handle); + rte_intr_enable(&dev->pci_dev->dev.intr_handle); return 0; } @@ -8516,7 +8516,7 @@ i40e_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id) static int i40e_dev_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id) { - struct rte_intr_handle *intr_handle = &dev->pci_dev->intr_handle; + struct rte_intr_handle *intr_handle = &dev->pci_dev->dev.intr_handle; struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private); uint16_t msix_intr; diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c index 14d2a50..f9ed908 100644 --- a/drivers/net/i40e/i40e_ethdev_vf.c +++ b/drivers/net/i40e/i40e_ethdev_vf.c @@ -748,7 +748,7 @@ i40evf_config_irq_map(struct rte_eth_dev *dev) uint8_t cmd_buffer[sizeof(struct i40e_virtchnl_irq_map_info) + \ sizeof(struct i40e_virtchnl_vector_map)]; struct i40e_virtchnl_irq_map_info *map_info; - struct rte_intr_handle *intr_handle = &dev->pci_dev->intr_handle; + struct rte_intr_handle *intr_handle = &dev->pci_dev->dev.intr_handle; uint32_t vector_id; int i, err; @@ -1693,7 +1693,7 @@ i40evf_enable_queues_intr(struct rte_eth_dev *dev) { struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private); struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private); - struct rte_intr_handle *intr_handle = &dev->pci_dev->intr_handle; + struct rte_intr_handle *intr_handle = &dev->pci_dev->dev.intr_handle; if (!rte_intr_allow_others(intr_handle)) { I40E_WRITE_REG(hw, @@ -1724,7 +1724,7 @@ i40evf_disable_queues_intr(struct rte_eth_dev *dev) { struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private); struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private); - struct rte_intr_handle *intr_handle = &dev->pci_dev->intr_handle; + struct rte_intr_handle *intr_handle = &dev->pci_dev->dev.intr_handle; if (!rte_intr_allow_others(intr_handle)) { I40E_WRITE_REG(hw, I40E_VFINT_DYN_CTL01, 0); @@ -1746,7 +1746,7 @@ i40evf_disable_queues_intr(struct rte_eth_dev *dev) static int i40evf_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id) { - struct rte_intr_handle *intr_handle = &dev->pci_dev->intr_handle; + struct rte_intr_handle *intr_handle = &dev->pci_dev->dev.intr_handle; struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private); uint16_t interval = i40e_calc_itr_interval(RTE_LIBRTE_I40E_ITR_INTERVAL); @@ -1772,7 +1772,7 @@ i40evf_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id) I40EVF_WRITE_FLUSH(hw); - rte_intr_enable(&dev->pci_dev->intr_handle); + rte_intr_enable(&dev->pci_dev->dev.intr_handle); return 0; } @@ -1780,7 +1780,7 @@ i40evf_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id) static int i40evf_dev_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id) { - struct rte_intr_handle *intr_handle = &dev->pci_dev->intr_handle; + struct rte_intr_handle *intr_handle = &dev->pci_dev->dev.intr_handle; struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private); uint16_t msix_intr; @@ -1803,7 +1803,7 @@ i40evf_dev_start(struct rte_eth_dev *dev) { struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private); struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private); - struct rte_intr_handle *intr_handle = &dev->pci_dev->intr_handle; + struct rte_intr_handle *intr_handle = &dev->pci_dev->dev.intr_handle; struct ether_addr mac_addr; uint32_t intr_vector = 0; @@ -1879,7 +1879,7 @@ static void i40evf_dev_stop(struct rte_eth_dev *dev) { struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private); - struct rte_intr_handle *intr_handle = &dev->pci_dev->intr_handle; + struct rte_intr_handle *intr_handle = &dev->pci_dev->dev.intr_handle; struct ether_addr mac_addr; PMD_INIT_FUNC_TRACE(); diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 4c4c6df..cc760f3 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -1151,12 +1151,12 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev) eth_dev->data->port_id, pci_dev->id.vendor_id, pci_dev->id.device_id); - rte_intr_callback_register(&pci_dev->intr_handle, + rte_intr_callback_register(&pci_dev->dev.intr_handle, ixgbe_dev_interrupt_handler, (void *)eth_dev); /* enable uio/vfio intr/eventfd mapping */ - rte_intr_enable(&pci_dev->intr_handle); + rte_intr_enable(&pci_dev->dev.intr_handle); /* enable support intr */ ixgbe_enable_intr(eth_dev); @@ -1194,8 +1194,8 @@ eth_ixgbe_dev_uninit(struct rte_eth_dev *eth_dev) ixgbe_swfw_lock_reset(hw); /* disable uio intr before callback unregister */ - rte_intr_disable(&(pci_dev->intr_handle)); - rte_intr_callback_unregister(&(pci_dev->intr_handle), + rte_intr_disable(&(pci_dev->dev.intr_handle)); + rte_intr_callback_unregister(&(pci_dev->dev.intr_handle), ixgbe_dev_interrupt_handler, (void *)eth_dev); /* uninitialize PF if max_vfs not zero */ @@ -1972,7 +1972,7 @@ ixgbe_dev_start(struct rte_eth_dev *dev) IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); struct ixgbe_vf_info *vfinfo = *IXGBE_DEV_PRIVATE_TO_P_VFDATA(dev->data->dev_private); - struct rte_intr_handle *intr_handle = &dev->pci_dev->intr_handle; + struct rte_intr_handle *intr_handle = &dev->pci_dev->dev.intr_handle; uint32_t intr_vector = 0; int err, link_up = 0, negotiate = 0; uint32_t speed = 0; @@ -2184,7 +2184,7 @@ ixgbe_dev_stop(struct rte_eth_dev *dev) struct ixgbe_filter_info *filter_info = IXGBE_DEV_PRIVATE_TO_FILTER_INFO(dev->data->dev_private); struct ixgbe_5tuple_filter *p_5tuple, *p_5tuple_next; - struct rte_intr_handle *intr_handle = &dev->pci_dev->intr_handle; + struct rte_intr_handle *intr_handle = &dev->pci_dev->dev.intr_handle; int vf; PMD_INIT_FUNC_TRACE(); @@ -3173,7 +3173,7 @@ ixgbe_dev_interrupt_action(struct rte_eth_dev *dev) } else { PMD_DRV_LOG(DEBUG, "enable intr immediately"); ixgbe_enable_intr(dev); - rte_intr_enable(&(dev->pci_dev->intr_handle)); + rte_intr_enable(&(dev->pci_dev->dev.intr_handle)); } @@ -3217,7 +3217,7 @@ ixgbe_dev_interrupt_delayed_handler(void *param) PMD_DRV_LOG(DEBUG, "enable intr in delayed handler S[%08x]", eicr); ixgbe_enable_intr(dev); - rte_intr_enable(&(dev->pci_dev->intr_handle)); + rte_intr_enable(&(dev->pci_dev->dev.intr_handle)); } /** @@ -3817,7 +3817,7 @@ ixgbevf_dev_start(struct rte_eth_dev *dev) struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); uint32_t intr_vector = 0; - struct rte_intr_handle *intr_handle = &dev->pci_dev->intr_handle; + struct rte_intr_handle *intr_handle = &dev->pci_dev->dev.intr_handle; int err, mask = 0; @@ -3880,7 +3880,7 @@ static void ixgbevf_dev_stop(struct rte_eth_dev *dev) { struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); - struct rte_intr_handle *intr_handle = &dev->pci_dev->intr_handle; + struct rte_intr_handle *intr_handle = &dev->pci_dev->dev.intr_handle; PMD_INIT_FUNC_TRACE(); @@ -4453,7 +4453,7 @@ ixgbevf_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id) RTE_SET_USED(queue_id); IXGBE_WRITE_REG(hw, IXGBE_VTEIMS, mask); - rte_intr_enable(&dev->pci_dev->intr_handle); + rte_intr_enable(&dev->pci_dev->dev.intr_handle); return 0; } @@ -4495,7 +4495,7 @@ ixgbe_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id) mask &= (1 << (queue_id - 32)); IXGBE_WRITE_REG(hw, IXGBE_EIMS_EX(1), mask); } - rte_intr_enable(&dev->pci_dev->intr_handle); + rte_intr_enable(&dev->pci_dev->dev.intr_handle); return 0; } @@ -4599,7 +4599,7 @@ ixgbe_set_ivar_map(struct ixgbe_hw *hw, int8_t direction, static void ixgbevf_configure_msix(struct rte_eth_dev *dev) { - struct rte_intr_handle *intr_handle = &dev->pci_dev->intr_handle; + struct rte_intr_handle *intr_handle = &dev->pci_dev->dev.intr_handle; struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); uint32_t q_idx; @@ -4632,7 +4632,7 @@ ixgbevf_configure_msix(struct rte_eth_dev *dev) static void ixgbe_configure_msix(struct rte_eth_dev *dev) { - struct rte_intr_handle *intr_handle = &dev->pci_dev->intr_handle; + struct rte_intr_handle *intr_handle = &dev->pci_dev->dev.intr_handle; struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); uint32_t queue_id, base = IXGBE_MISC_VEC_ID; diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index d928339..1ee9f85 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -1114,14 +1114,14 @@ static int virtio_resource_init_by_uio(struct rte_pci_device *pci_dev) /* save fd */ memset(dirname, 0, sizeof(dirname)); snprintf(dirname, sizeof(dirname), "/dev/uio%u", uio_num); - pci_dev->intr_handle.fd = open(dirname, O_RDWR); - if (pci_dev->intr_handle.fd < 0) { + pci_dev->dev.intr_handle.fd = open(dirname, O_RDWR); + if (pci_dev->dev.intr_handle.fd < 0) { PMD_INIT_LOG(ERR, "Cannot open %s: %s\n", dirname, strerror(errno)); return -1; } - pci_dev->intr_handle.type = RTE_INTR_HANDLE_UIO; + pci_dev->dev.intr_handle.type = RTE_INTR_HANDLE_UIO; pci_dev->driver->drv_flags |= RTE_PCI_DRV_INTR_LSC; return 0; @@ -1233,7 +1233,7 @@ virtio_interrupt_handler(__rte_unused struct rte_intr_handle *handle, isr = vtpci_isr(hw); PMD_DRV_LOG(INFO, "interrupt status = %#x", isr); - if (rte_intr_enable(&dev->pci_dev->intr_handle) < 0) + if (rte_intr_enable(&dev->pci_dev->dev.intr_handle) < 0) PMD_DRV_LOG(ERR, "interrupt enable failed"); if (isr & VIRTIO_PCI_ISR_CONFIG) { @@ -1389,7 +1389,7 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev) /* Setup interrupt callback */ if (pci_dev->driver->drv_flags & RTE_PCI_DRV_INTR_LSC) - rte_intr_callback_register(&pci_dev->intr_handle, + rte_intr_callback_register(&pci_dev->dev.intr_handle, virtio_interrupt_handler, eth_dev); virtio_dev_cq_start(eth_dev); @@ -1425,7 +1425,7 @@ eth_virtio_dev_uninit(struct rte_eth_dev *eth_dev) /* reset interrupt callback */ if (pci_dev->driver->drv_flags & RTE_PCI_DRV_INTR_LSC) - rte_intr_callback_unregister(&pci_dev->intr_handle, + rte_intr_callback_unregister(&pci_dev->dev.intr_handle, virtio_interrupt_handler, eth_dev); @@ -1515,7 +1515,7 @@ virtio_dev_start(struct rte_eth_dev *dev) return -ENOTSUP; } - if (rte_intr_enable(&dev->pci_dev->intr_handle) < 0) { + if (rte_intr_enable(&dev->pci_dev->dev.intr_handle) < 0) { PMD_DRV_LOG(ERR, "interrupt enable failed"); return -EIO; } @@ -1616,7 +1616,7 @@ virtio_dev_stop(struct rte_eth_dev *dev) PMD_INIT_LOG(DEBUG, "stop"); if (dev->data->dev_conf.intr_conf.lsc) - rte_intr_disable(&dev->pci_dev->intr_handle); + rte_intr_disable(&dev->pci_dev->dev.intr_handle); memset(&link, 0, sizeof(link)); virtio_dev_atomic_write_link_status(dev, &link); diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c b/lib/librte_eal/bsdapp/eal/eal_pci.c index 07fd6c8..762ddfd 100644 --- a/lib/librte_eal/bsdapp/eal/eal_pci.c +++ b/lib/librte_eal/bsdapp/eal/eal_pci.c @@ -136,10 +136,10 @@ pci_uio_free_resource(struct rte_pci_device *dev, { rte_free(uio_res); - if (dev->intr_handle.fd) { - close(dev->intr_handle.fd); - dev->intr_handle.fd = -1; - dev->intr_handle.type = RTE_INTR_HANDLE_UNKNOWN; + if (dev->dev.intr_handle.fd) { + close(dev->dev.intr_handle.fd); + dev->dev.intr_handle.fd = -1; + dev->dev.intr_handle.type = RTE_INTR_HANDLE_UNKNOWN; } } @@ -162,13 +162,13 @@ pci_uio_alloc_resource(struct rte_pci_device *dev, } /* save fd if in primary process */ - dev->intr_handle.fd = open(devname, O_RDWR); - if (dev->intr_handle.fd < 0) { + dev->dev.intr_handle.fd = open(devname, O_RDWR); + if (dev->dev.intr_handle.fd < 0) { RTE_LOG(ERR, EAL, "Cannot open %s: %s\n", devname, strerror(errno)); goto error; } - dev->intr_handle.type = RTE_INTR_HANDLE_UIO; + dev->dev.intr_handle.type = RTE_INTR_HANDLE_UIO; /* allocate the mapping details for secondary processes*/ *uio_res = rte_zmalloc("UIO_RES", sizeof(**uio_res), 0); diff --git a/lib/librte_eal/common/eal_common_pci_uio.c b/lib/librte_eal/common/eal_common_pci_uio.c index f062e81..5adc396 100644 --- a/lib/librte_eal/common/eal_common_pci_uio.c +++ b/lib/librte_eal/common/eal_common_pci_uio.c @@ -105,9 +105,9 @@ pci_uio_map_resource(struct rte_pci_device *dev) struct mapped_pci_res_list *uio_res_list = RTE_TAILQ_CAST(rte_uio_tailq.head, mapped_pci_res_list); - dev->intr_handle.fd = -1; - dev->intr_handle.uio_cfg_fd = -1; - dev->intr_handle.type = RTE_INTR_HANDLE_UNKNOWN; + dev->dev.intr_handle.fd = -1; + dev->dev.intr_handle.uio_cfg_fd = -1; + dev->dev.intr_handle.type = RTE_INTR_HANDLE_UNKNOWN; /* secondary processes - use already recorded details */ if (rte_eal_process_type() != RTE_PROC_PRIMARY) @@ -211,12 +211,12 @@ pci_uio_unmap_resource(struct rte_pci_device *dev) rte_free(uio_res); /* close fd if in primary process */ - close(dev->intr_handle.fd); - if (dev->intr_handle.uio_cfg_fd >= 0) { - close(dev->intr_handle.uio_cfg_fd); - dev->intr_handle.uio_cfg_fd = -1; + close(dev->dev.intr_handle.fd); + if (dev->dev.intr_handle.uio_cfg_fd >= 0) { + close(dev->dev.intr_handle.uio_cfg_fd); + dev->dev.intr_handle.uio_cfg_fd = -1; } - dev->intr_handle.fd = -1; - dev->intr_handle.type = RTE_INTR_HANDLE_UNKNOWN; + dev->dev.intr_handle.fd = -1; + dev->dev.intr_handle.type = RTE_INTR_HANDLE_UNKNOWN; } diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h index 593ceb3..a481988 100644 --- a/lib/librte_eal/common/include/rte_dev.h +++ b/lib/librte_eal/common/include/rte_dev.h @@ -161,6 +161,7 @@ struct rte_devargs; struct rte_bus_device { const char *name; struct rte_devargs *devargs; + struct rte_intr_handle intr_handle; int numa_node; }; diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h index 5566e3d..e2c3073 100644 --- a/lib/librte_eal/common/include/rte_pci.h +++ b/lib/librte_eal/common/include/rte_pci.h @@ -161,7 +161,6 @@ struct rte_pci_device { struct rte_pci_addr addr; /**< PCI location. */ struct rte_pci_id id; /**< PCI ID. */ struct rte_pci_resource mem_resource[PCI_MAX_RESOURCE]; /**< PCI Memory Resource */ - struct rte_intr_handle intr_handle; /**< Interrupt handle */ struct rte_pci_driver *driver; /**< Associated driver */ uint16_t max_vfs; /**< sriov enable if not zero */ enum rte_kernel_driver kdrv; /**< Kernel driver passthrough */ diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c index c87dd37..11e175e 100644 --- a/lib/librte_eal/linuxapp/eal/eal_pci.c +++ b/lib/librte_eal/linuxapp/eal/eal_pci.c @@ -575,7 +575,7 @@ pci_config_space_set(struct rte_pci_device *dev) int rte_eal_pci_read_config(const struct rte_pci_device *device, void *buf, size_t len, off_t offset) { - const struct rte_intr_handle *intr_handle = &device->intr_handle; + const struct rte_intr_handle *intr_handle = &device->dev.intr_handle; switch (intr_handle->type) { case RTE_INTR_HANDLE_UIO: @@ -600,7 +600,7 @@ int rte_eal_pci_read_config(const struct rte_pci_device *device, int rte_eal_pci_write_config(const struct rte_pci_device *device, const void *buf, size_t len, off_t offset) { - const struct rte_intr_handle *intr_handle = &device->intr_handle; + const struct rte_intr_handle *intr_handle = &device->dev.intr_handle; switch (intr_handle->type) { case RTE_INTR_HANDLE_UIO: diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_uio.c b/lib/librte_eal/linuxapp/eal/eal_pci_uio.c index ac50e13..840b5ba 100644 --- a/lib/librte_eal/linuxapp/eal/eal_pci_uio.c +++ b/lib/librte_eal/linuxapp/eal/eal_pci_uio.c @@ -221,14 +221,14 @@ pci_uio_free_resource(struct rte_pci_device *dev, { rte_free(uio_res); - if (dev->intr_handle.uio_cfg_fd >= 0) { - close(dev->intr_handle.uio_cfg_fd); - dev->intr_handle.uio_cfg_fd = -1; + if (dev->dev.intr_handle.uio_cfg_fd >= 0) { + close(dev->dev.intr_handle.uio_cfg_fd); + dev->dev.intr_handle.uio_cfg_fd = -1; } - if (dev->intr_handle.fd) { - close(dev->intr_handle.fd); - dev->intr_handle.fd = -1; - dev->intr_handle.type = RTE_INTR_HANDLE_UNKNOWN; + if (dev->dev.intr_handle.fd) { + close(dev->dev.intr_handle.fd); + dev->dev.intr_handle.fd = -1; + dev->dev.intr_handle.type = RTE_INTR_HANDLE_UNKNOWN; } } @@ -254,8 +254,8 @@ pci_uio_alloc_resource(struct rte_pci_device *dev, snprintf(devname, sizeof(devname), "/dev/uio%u", uio_num); /* save fd if in primary process */ - dev->intr_handle.fd = open(devname, O_RDWR); - if (dev->intr_handle.fd < 0) { + dev->dev.intr_handle.fd = open(devname, O_RDWR); + if (dev->dev.intr_handle.fd < 0) { RTE_LOG(ERR, EAL, "Cannot open %s: %s\n", devname, strerror(errno)); goto error; @@ -263,20 +263,20 @@ pci_uio_alloc_resource(struct rte_pci_device *dev, snprintf(cfgname, sizeof(cfgname), "/sys/class/uio/uio%u/device/config", uio_num); - dev->intr_handle.uio_cfg_fd = open(cfgname, O_RDWR); - if (dev->intr_handle.uio_cfg_fd < 0) { + dev->dev.intr_handle.uio_cfg_fd = open(cfgname, O_RDWR); + if (dev->dev.intr_handle.uio_cfg_fd < 0) { RTE_LOG(ERR, EAL, "Cannot open %s: %s\n", cfgname, strerror(errno)); goto error; } if (dev->kdrv == RTE_KDRV_IGB_UIO) - dev->intr_handle.type = RTE_INTR_HANDLE_UIO; + dev->dev.intr_handle.type = RTE_INTR_HANDLE_UIO; else { - dev->intr_handle.type = RTE_INTR_HANDLE_UIO_INTX; + dev->dev.intr_handle.type = RTE_INTR_HANDLE_UIO_INTX; /* set bus master that is not done by uio_pci_generic */ - if (pci_uio_set_bus_master(dev->intr_handle.uio_cfg_fd)) { + if (pci_uio_set_bus_master(dev->dev.intr_handle.uio_cfg_fd)) { RTE_LOG(ERR, EAL, "Cannot set up bus mastering!\n"); goto error; } diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c index 74f91ba..30addc6 100644 --- a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c +++ b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c @@ -317,21 +317,21 @@ pci_vfio_setup_interrupts(struct rte_pci_device *dev, int vfio_dev_fd) return -1; } - dev->intr_handle.fd = fd; - dev->intr_handle.vfio_dev_fd = vfio_dev_fd; + dev->dev.intr_handle.fd = fd; + dev->dev.intr_handle.vfio_dev_fd = vfio_dev_fd; switch (i) { case VFIO_PCI_MSIX_IRQ_INDEX: internal_config.vfio_intr_mode = RTE_INTR_MODE_MSIX; - dev->intr_handle.type = RTE_INTR_HANDLE_VFIO_MSIX; + dev->dev.intr_handle.type = RTE_INTR_HANDLE_VFIO_MSIX; break; case VFIO_PCI_MSI_IRQ_INDEX: internal_config.vfio_intr_mode = RTE_INTR_MODE_MSI; - dev->intr_handle.type = RTE_INTR_HANDLE_VFIO_MSI; + dev->dev.intr_handle.type = RTE_INTR_HANDLE_VFIO_MSI; break; case VFIO_PCI_INTX_IRQ_INDEX: internal_config.vfio_intr_mode = RTE_INTR_MODE_LEGACY; - dev->intr_handle.type = RTE_INTR_HANDLE_VFIO_LEGACY; + dev->dev.intr_handle.type = RTE_INTR_HANDLE_VFIO_LEGACY; break; default: RTE_LOG(ERR, EAL, " unknown interrupt type!\n"); @@ -574,8 +574,8 @@ pci_vfio_map_resource(struct rte_pci_device *dev) uint32_t msix_table_offset = 0; uint32_t msix_table_size = 0; - dev->intr_handle.fd = -1; - dev->intr_handle.type = RTE_INTR_HANDLE_UNKNOWN; + dev->dev.intr_handle.fd = -1; + dev->dev.intr_handle.type = RTE_INTR_HANDLE_UNKNOWN; /* store PCI address string */ snprintf(pci_addr, sizeof(pci_addr), PCI_PRI_FMT, diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index 908997a..b93fba8 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -2571,7 +2571,7 @@ rte_eth_dev_rx_intr_ctl(uint8_t port_id, int epfd, int op, void *data) } dev = &rte_eth_devices[port_id]; - intr_handle = &dev->pci_dev->intr_handle; + intr_handle = &dev->pci_dev->dev.intr_handle; if (!intr_handle->intr_vec) { RTE_PMD_DEBUG_TRACE("RX Intr vector unset\n"); return -EPERM; @@ -2634,7 +2634,7 @@ rte_eth_dev_rx_intr_ctl_q(uint8_t port_id, uint16_t queue_id, return -EINVAL; } - intr_handle = &dev->pci_dev->intr_handle; + intr_handle = &dev->pci_dev->dev.intr_handle; if (!intr_handle->intr_vec) { RTE_PMD_DEBUG_TRACE("RX Intr vector unset\n"); return -EPERM; -- 2.7.0