All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/2] clean up interrupt handle
@ 2017-03-31  2:09 Qi Zhang
  2017-03-31  2:09 ` [PATCH v3 1/2] eal: " Qi Zhang
                   ` (3 more replies)
  0 siblings, 4 replies; 15+ messages in thread
From: Qi Zhang @ 2017-03-31  2:09 UTC (permalink / raw)
  To: thomas.monjalon; +Cc: dev, Qi Zhang

It seems its not necessary to register an intr_handle for interrupt callback 
function. "void* cb_arg" shows enough when be used to pass the object that 
contain the information be required to handle the interrupt event( A typical
way which is implemented by almost all driver is by passing a rte_ethdev 
instance). The patch change the prototype of rte_intr_callback_fn by removing
the uncessary intr_handle paramter.

v3:
- update bnx2x driver which is missed in v1,v2

v2:
- seperate patch 1 in v1 into 2 patches.
- correct some commit log.

Qi Zhang (2):
  eal: clean up interrupt handle
  app/test: update test code

 app/test/test_interrupts.c                     | 23 +++++++--------
 drivers/net/bnxt/bnxt_irq.c                    |  3 +-
 drivers/net/e1000/em_ethdev.c                  |  8 ++----
 drivers/net/e1000/igb_ethdev.c                 | 15 ++++------
 drivers/net/enic/enic_main.c                   |  3 +-
 drivers/net/fm10k/fm10k_ethdev.c               | 12 +++-----
 drivers/net/i40e/i40e_ethdev.c                 |  8 ++----
 drivers/net/i40e/i40e_ethdev_vf.c              |  5 ++--
 drivers/net/ixgbe/ixgbe_ethdev.c               | 14 ++++-----
 drivers/net/nfp/nfp_net.c                      |  6 ++--
 drivers/net/qede/qede_ethdev.c                 |  4 +--
 drivers/net/sfc/sfc_intr.c                     | 10 ++++---
 drivers/net/virtio/virtio_ethdev.c             |  5 ++--
 lib/librte_eal/common/include/rte_interrupts.h |  3 +-
 lib/librte_eal/linuxapp/eal/eal_alarm.c        |  5 ++--
 lib/librte_eal/linuxapp/eal/eal_interrupts.c   | 39 ++++----------------------
 16 files changed, 57 insertions(+), 106 deletions(-)

-- 
2.9.3

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH v3 1/2] eal: clean up interrupt handle
  2017-03-31  2:09 [PATCH v3 0/2] clean up interrupt handle Qi Zhang
@ 2017-03-31  2:09 ` Qi Zhang
  2017-03-31  2:09 ` [PATCH v3 2/2] app/test: update test code Qi Zhang
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 15+ messages in thread
From: Qi Zhang @ 2017-03-31  2:09 UTC (permalink / raw)
  To: thomas.monjalon; +Cc: dev, Qi Zhang

The patch change the prototype of callback function
(rte_intr_callback_fn) by removing the unnecessary parameter.

v3:
- update bnx2x driver which is missed in v1,v2.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/net/bnx2x/bnx2x_ethdev.c               |  5 +++--
 drivers/net/bnxt/bnxt_irq.c                    |  3 +--
 drivers/net/e1000/em_ethdev.c                  |  8 +++-----
 drivers/net/e1000/igb_ethdev.c                 | 15 ++++++---------
 drivers/net/enic/enic_main.c                   |  3 +--
 drivers/net/fm10k/fm10k_ethdev.c               | 12 ++++--------
 drivers/net/i40e/i40e_ethdev.c                 |  8 +++-----
 drivers/net/i40e/i40e_ethdev_vf.c              |  5 ++---
 drivers/net/ixgbe/ixgbe_ethdev.c               | 14 +++++---------
 drivers/net/nfp/nfp_net.c                      |  6 ++----
 drivers/net/qede/qede_ethdev.c                 |  4 ++--
 drivers/net/sfc/sfc_intr.c                     | 10 ++++++----
 drivers/net/virtio/virtio_ethdev.c             |  5 ++---
 lib/librte_eal/common/include/rte_interrupts.h |  3 +--
 lib/librte_eal/linuxapp/eal/eal_alarm.c        |  5 ++---
 lib/librte_eal/linuxapp/eal/eal_interrupts.c   |  3 +--
 16 files changed, 44 insertions(+), 65 deletions(-)

diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c
index a0b0dfa..0e8b4d9 100644
--- a/drivers/net/bnx2x/bnx2x_ethdev.c
+++ b/drivers/net/bnx2x/bnx2x_ethdev.c
@@ -119,12 +119,13 @@ bnx2x_interrupt_action(struct rte_eth_dev *dev)
 }
 
 static __rte_unused void
-bnx2x_interrupt_handler(struct rte_intr_handle *handle, void *param)
+bnx2x_interrupt_handler(void *param)
 {
 	struct rte_eth_dev *dev = (struct rte_eth_dev *)param;
+	struct bnx2x_softc *sc = dev->data->dev_private;
 
 	bnx2x_interrupt_action(dev);
-	rte_intr_enable(handle);
+	rte_intr_enable(&sc->pci_dev->intr_handle);
 }
 
 /*
diff --git a/drivers/net/bnxt/bnxt_irq.c b/drivers/net/bnxt/bnxt_irq.c
index e93585a..20e17ff 100644
--- a/drivers/net/bnxt/bnxt_irq.c
+++ b/drivers/net/bnxt/bnxt_irq.c
@@ -45,8 +45,7 @@
  * Interrupts
  */
 
-static void bnxt_int_handler(struct rte_intr_handle *handle __rte_unused,
-			     void *param)
+static void bnxt_int_handler(void *param)
 {
 	struct rte_eth_dev *eth_dev = (struct rte_eth_dev *)param;
 	struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index 4066ef9..fff0874 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -85,8 +85,7 @@ static int eth_em_rxq_interrupt_setup(struct rte_eth_dev *dev);
 static int eth_em_interrupt_get_status(struct rte_eth_dev *dev);
 static int eth_em_interrupt_action(struct rte_eth_dev *dev,
 				   struct rte_intr_handle *handle);
-static void eth_em_interrupt_handler(struct rte_intr_handle *handle,
-							void *param);
+static void eth_em_interrupt_handler(void *param);
 
 static int em_hw_init(struct e1000_hw *hw);
 static int em_hardware_init(struct e1000_hw *hw);
@@ -1646,13 +1645,12 @@ eth_em_interrupt_action(struct rte_eth_dev *dev,
  *  void
  */
 static void
-eth_em_interrupt_handler(struct rte_intr_handle *handle,
-			 void *param)
+eth_em_interrupt_handler(void *param)
 {
 	struct rte_eth_dev *dev = (struct rte_eth_dev *)param;
 
 	eth_em_interrupt_get_status(dev);
-	eth_em_interrupt_action(dev, handle);
+	eth_em_interrupt_action(dev, dev->intr_handle);
 	_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 }
 
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index a112b38..4cc7945 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -136,8 +136,7 @@ static int eth_igb_rxq_interrupt_setup(struct rte_eth_dev *dev);
 static int eth_igb_interrupt_get_status(struct rte_eth_dev *dev);
 static int eth_igb_interrupt_action(struct rte_eth_dev *dev,
 				    struct rte_intr_handle *handle);
-static void eth_igb_interrupt_handler(struct rte_intr_handle *handle,
-							void *param);
+static void eth_igb_interrupt_handler(void *param);
 static int  igb_hardware_init(struct e1000_hw *hw);
 static void igb_hw_control_acquire(struct e1000_hw *hw);
 static void igb_hw_control_release(struct e1000_hw *hw);
@@ -283,8 +282,7 @@ static void eth_igb_assign_msix_vector(struct e1000_hw *hw, int8_t direction,
 static void eth_igb_write_ivar(struct e1000_hw *hw, uint8_t msix_vector,
 			       uint8_t index, uint8_t offset);
 static void eth_igb_configure_msix_intr(struct rte_eth_dev *dev);
-static void eth_igbvf_interrupt_handler(struct rte_intr_handle *handle,
-					void *param);
+static void eth_igbvf_interrupt_handler(void *param);
 static void igbvf_mbx_process(struct rte_eth_dev *dev);
 
 /*
@@ -2781,12 +2779,12 @@ eth_igb_interrupt_action(struct rte_eth_dev *dev,
  *  void
  */
 static void
-eth_igb_interrupt_handler(struct rte_intr_handle *handle, void *param)
+eth_igb_interrupt_handler(void *param)
 {
 	struct rte_eth_dev *dev = (struct rte_eth_dev *)param;
 
 	eth_igb_interrupt_get_status(dev);
-	eth_igb_interrupt_action(dev, handle);
+	eth_igb_interrupt_action(dev, dev->intr_handle);
 }
 
 static int
@@ -2843,13 +2841,12 @@ eth_igbvf_interrupt_action(struct rte_eth_dev *dev, struct rte_intr_handle *intr
 }
 
 static void
-eth_igbvf_interrupt_handler(struct rte_intr_handle *handle,
-			    void *param)
+eth_igbvf_interrupt_handler(void *param)
 {
 	struct rte_eth_dev *dev = (struct rte_eth_dev *)param;
 
 	eth_igbvf_interrupt_get_status(dev);
-	eth_igbvf_interrupt_action(dev, handle);
+	eth_igbvf_interrupt_action(dev, dev->intr_handle);
 }
 
 static int
diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c
index 570b7b6..5f2188b 100644
--- a/drivers/net/enic/enic_main.c
+++ b/drivers/net/enic/enic_main.c
@@ -423,8 +423,7 @@ int enic_link_update(struct enic *enic)
 }
 
 static void
-enic_intr_handler(__rte_unused struct rte_intr_handle *handle,
-	void *arg)
+enic_intr_handler(void *arg)
 {
 	struct rte_eth_dev *dev = (struct rte_eth_dev *)arg;
 	struct enic *enic = pmd_priv(dev);
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index c4fe746..e37bd8f 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -2541,9 +2541,7 @@ fm10k_dev_handle_fault(struct fm10k_hw *hw, uint32_t eicr)
  *  void
  */
 static void
-fm10k_dev_interrupt_handler_pf(
-			struct rte_intr_handle *handle,
-			void *param)
+fm10k_dev_interrupt_handler_pf(void *param)
 {
 	struct rte_eth_dev *dev = (struct rte_eth_dev *)param;
 	struct fm10k_hw *hw = FM10K_DEV_PRIVATE_TO_HW(dev->data->dev_private);
@@ -2593,7 +2591,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(handle);
+	rte_intr_enable(dev->intr_handle);
 }
 
 /**
@@ -2608,9 +2606,7 @@ fm10k_dev_interrupt_handler_pf(
  *  void
  */
 static void
-fm10k_dev_interrupt_handler_vf(
-			struct rte_intr_handle *handle,
-			void *param)
+fm10k_dev_interrupt_handler_vf(void *param)
 {
 	struct rte_eth_dev *dev = (struct rte_eth_dev *)param;
 	struct fm10k_hw *hw = FM10K_DEV_PRIVATE_TO_HW(dev->data->dev_private);
@@ -2627,7 +2623,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(handle);
+	rte_intr_enable(dev->intr_handle);
 }
 
 /* Mailbox message handler in VF */
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 303027b..ddd423c 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -318,8 +318,7 @@ static void i40e_stat_update_48(struct i40e_hw *hw,
 			       uint64_t *offset,
 			       uint64_t *stat);
 static void i40e_pf_config_irq0(struct i40e_hw *hw, bool no_queue);
-static void i40e_dev_interrupt_handler(struct rte_intr_handle *handle,
-				       void *param);
+static void i40e_dev_interrupt_handler(void *param);
 static int i40e_res_pool_init(struct i40e_res_pool_info *pool,
 				uint32_t base, uint32_t num);
 static void i40e_res_pool_destroy(struct i40e_res_pool_info *pool);
@@ -5770,8 +5769,7 @@ i40e_dev_handle_aq_msg(struct rte_eth_dev *dev)
  *  void
  */
 static void
-i40e_dev_interrupt_handler(struct rte_intr_handle *intr_handle,
-			   void *param)
+i40e_dev_interrupt_handler(void *param)
 {
 	struct rte_eth_dev *dev = (struct rte_eth_dev *)param;
 	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
@@ -5817,7 +5815,7 @@ i40e_dev_interrupt_handler(struct rte_intr_handle *intr_handle,
 done:
 	/* Enable interrupt */
 	i40e_pf_enable_irq0(hw);
-	rte_intr_enable(intr_handle);
+	rte_intr_enable(dev->intr_handle);
 }
 
 static int
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 55fd344..517b48b 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1420,8 +1420,7 @@ i40evf_handle_aq_msg(struct rte_eth_dev *dev)
  *  void
  */
 static void
-i40evf_dev_interrupt_handler(struct rte_intr_handle *intr_handle,
-			     void *param)
+i40evf_dev_interrupt_handler(void *param)
 {
 	struct rte_eth_dev *dev = (struct rte_eth_dev *)param;
 	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
@@ -1450,7 +1449,7 @@ i40evf_dev_interrupt_handler(struct rte_intr_handle *intr_handle,
 
 done:
 	i40evf_enable_irq0(hw);
-	rte_intr_enable(intr_handle);
+	rte_intr_enable(dev->intr_handle);
 }
 
 static int
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 7169007..b979476 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -244,8 +244,7 @@ static int ixgbe_dev_rxq_interrupt_setup(struct rte_eth_dev *dev);
 static int ixgbe_dev_interrupt_get_status(struct rte_eth_dev *dev);
 static int ixgbe_dev_interrupt_action(struct rte_eth_dev *dev,
 				      struct rte_intr_handle *handle);
-static void ixgbe_dev_interrupt_handler(struct rte_intr_handle *handle,
-		void *param);
+static void ixgbe_dev_interrupt_handler(void *param);
 static void ixgbe_dev_interrupt_delayed_handler(void *param);
 static void ixgbe_add_rar(struct rte_eth_dev *dev, struct ether_addr *mac_addr,
 		uint32_t index, uint32_t pool);
@@ -366,8 +365,7 @@ static int ixgbe_timesync_read_time(struct rte_eth_dev *dev,
 				   struct timespec *timestamp);
 static int ixgbe_timesync_write_time(struct rte_eth_dev *dev,
 				   const struct timespec *timestamp);
-static void ixgbevf_dev_interrupt_handler(struct rte_intr_handle *handle,
-					  void *param);
+static void ixgbevf_dev_interrupt_handler(void *param);
 
 static int ixgbe_dev_l2_tunnel_eth_type_conf
 	(struct rte_eth_dev *dev, struct rte_eth_l2_tunnel_conf *l2_tunnel);
@@ -3913,13 +3911,12 @@ ixgbe_dev_interrupt_delayed_handler(void *param)
  *  void
  */
 static void
-ixgbe_dev_interrupt_handler(struct rte_intr_handle *handle,
-			    void *param)
+ixgbe_dev_interrupt_handler(void *param)
 {
 	struct rte_eth_dev *dev = (struct rte_eth_dev *)param;
 
 	ixgbe_dev_interrupt_get_status(dev);
-	ixgbe_dev_interrupt_action(dev, handle);
+	ixgbe_dev_interrupt_action(dev, dev->intr_handle);
 }
 
 static int
@@ -8159,8 +8156,7 @@ ixgbevf_dev_interrupt_action(struct rte_eth_dev *dev)
 }
 
 static void
-ixgbevf_dev_interrupt_handler(__rte_unused struct rte_intr_handle *handle,
-			      void *param)
+ixgbevf_dev_interrupt_handler(void *param)
 {
 	struct rte_eth_dev *dev = (struct rte_eth_dev *)param;
 
diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
index d79f262..dbd9844 100644
--- a/drivers/net/nfp/nfp_net.c
+++ b/drivers/net/nfp/nfp_net.c
@@ -63,8 +63,7 @@
 /* Prototypes */
 static void nfp_net_close(struct rte_eth_dev *dev);
 static int nfp_net_configure(struct rte_eth_dev *dev);
-static void nfp_net_dev_interrupt_handler(struct rte_intr_handle *handle,
-					  void *param);
+static void nfp_net_dev_interrupt_handler(void *param);
 static void nfp_net_dev_interrupt_delayed_handler(void *param);
 static int nfp_net_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu);
 static void nfp_net_infos_get(struct rte_eth_dev *dev,
@@ -1308,8 +1307,7 @@ nfp_net_irq_unmask(struct rte_eth_dev *dev)
 }
 
 static void
-nfp_net_dev_interrupt_handler(__rte_unused struct rte_intr_handle *handle,
-			      void *param)
+nfp_net_dev_interrupt_handler(void *param)
 {
 	int64_t timeout;
 	struct rte_eth_link link;
diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index 0494dbd..ce10924 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -279,14 +279,14 @@ static void qede_interrupt_action(struct ecore_hwfn *p_hwfn)
 }
 
 static void
-qede_interrupt_handler(struct rte_intr_handle *handle, void *param)
+qede_interrupt_handler(void *param)
 {
 	struct rte_eth_dev *eth_dev = (struct rte_eth_dev *)param;
 	struct qede_dev *qdev = eth_dev->data->dev_private;
 	struct ecore_dev *edev = &qdev->edev;
 
 	qede_interrupt_action(ECORE_LEADING_HWFN(edev));
-	if (rte_intr_enable(handle))
+	if (rte_intr_enable(eth_dev->intr_handle))
 		DP_ERR(edev, "rte_intr_enable failed\n");
 }
 
diff --git a/drivers/net/sfc/sfc_intr.c b/drivers/net/sfc/sfc_intr.c
index d06980e..fa7cc3d 100644
--- a/drivers/net/sfc/sfc_intr.c
+++ b/drivers/net/sfc/sfc_intr.c
@@ -68,13 +68,14 @@ sfc_intr_handle_mgmt_evq(struct sfc_adapter *sa)
 }
 
 static void
-sfc_intr_line_handler(struct rte_intr_handle *intr_handle, void *cb_arg)
+sfc_intr_line_handler(void *cb_arg)
 {
 	struct sfc_adapter *sa = (struct sfc_adapter *)cb_arg;
 	efx_nic_t *enp = sa->nic;
 	boolean_t fatal;
 	uint32_t qmask;
 	unsigned int lsc_seq = sa->port.lsc_seq;
+	struct rte_pci_device *pci_dev = SFC_DEV_TO_PCI(sa->eth_dev);
 
 	sfc_log_init(sa, "entry");
 
@@ -97,7 +98,7 @@ sfc_intr_line_handler(struct rte_intr_handle *intr_handle, void *cb_arg)
 	if (qmask & (1 << sa->mgmt_evq_index))
 		sfc_intr_handle_mgmt_evq(sa);
 
-	if (rte_intr_enable(intr_handle) != 0)
+	if (rte_intr_enable(&pci_dev->intr_handle) != 0)
 		sfc_err(sa, "cannot reenable interrupts");
 
 	sfc_log_init(sa, "done");
@@ -113,12 +114,13 @@ sfc_intr_line_handler(struct rte_intr_handle *intr_handle, void *cb_arg)
 }
 
 static void
-sfc_intr_message_handler(struct rte_intr_handle *intr_handle, void *cb_arg)
+sfc_intr_message_handler(void *cb_arg)
 {
 	struct sfc_adapter *sa = (struct sfc_adapter *)cb_arg;
 	efx_nic_t *enp = sa->nic;
 	boolean_t fatal;
 	unsigned int lsc_seq = sa->port.lsc_seq;
+	struct rte_pci_device *pci_dev = SFC_DEV_TO_PCI(sa->eth_dev);
 
 	sfc_log_init(sa, "entry");
 
@@ -139,7 +141,7 @@ sfc_intr_message_handler(struct rte_intr_handle *intr_handle, void *cb_arg)
 
 	sfc_intr_handle_mgmt_evq(sa);
 
-	if (rte_intr_enable(intr_handle) != 0)
+	if (rte_intr_enable(&pci_dev->intr_handle) != 0)
 		sfc_err(sa, "cannot reenable interrupts");
 
 	sfc_log_init(sa, "done");
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 4dc03b9..9033e7b 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1191,8 +1191,7 @@ virtio_negotiate_features(struct virtio_hw *hw, uint64_t req_features)
  * if link state changed.
  */
 static void
-virtio_interrupt_handler(struct rte_intr_handle *handle,
-			 void *param)
+virtio_interrupt_handler(void *param)
 {
 	struct rte_eth_dev *dev = param;
 	struct virtio_hw *hw = dev->data->dev_private;
@@ -1202,7 +1201,7 @@ virtio_interrupt_handler(struct rte_intr_handle *handle,
 	isr = vtpci_isr(hw);
 	PMD_DRV_LOG(INFO, "interrupt status = %#x", isr);
 
-	if (rte_intr_enable(handle) < 0)
+	if (rte_intr_enable(dev->intr_handle) < 0)
 		PMD_DRV_LOG(ERR, "interrupt enable failed");
 
 	if (isr & VIRTIO_PCI_ISR_CONFIG) {
diff --git a/lib/librte_eal/common/include/rte_interrupts.h b/lib/librte_eal/common/include/rte_interrupts.h
index 6cade01..5d06ed7 100644
--- a/lib/librte_eal/common/include/rte_interrupts.h
+++ b/lib/librte_eal/common/include/rte_interrupts.h
@@ -51,8 +51,7 @@ extern "C" {
 struct rte_intr_handle;
 
 /** Function to be registered for the specific interrupt */
-typedef void (*rte_intr_callback_fn)(struct rte_intr_handle *intr_handle,
-							void *cb_arg);
+typedef void (*rte_intr_callback_fn)(void *cb_arg);
 
 #include <exec-env/rte_interrupts.h>
 
diff --git a/lib/librte_eal/linuxapp/eal/eal_alarm.c b/lib/librte_eal/linuxapp/eal/eal_alarm.c
index 8b042ab..fbae461 100644
--- a/lib/librte_eal/linuxapp/eal/eal_alarm.c
+++ b/lib/librte_eal/linuxapp/eal/eal_alarm.c
@@ -83,7 +83,7 @@ static rte_spinlock_t alarm_list_lk = RTE_SPINLOCK_INITIALIZER;
 
 static struct rte_intr_handle intr_handle = {.fd = -1 };
 static int handler_registered = 0;
-static void eal_alarm_callback(struct rte_intr_handle *hdl, void *arg);
+static void eal_alarm_callback(void *arg);
 
 int
 rte_eal_alarm_init(void)
@@ -102,8 +102,7 @@ rte_eal_alarm_init(void)
 }
 
 static void
-eal_alarm_callback(struct rte_intr_handle *hdl __rte_unused,
-		void *arg __rte_unused)
+eal_alarm_callback(void *arg __rte_unused)
 {
 	struct timespec now;
 	struct alarm_entry *ap;
diff --git a/lib/librte_eal/linuxapp/eal/eal_interrupts.c b/lib/librte_eal/linuxapp/eal/eal_interrupts.c
index b50dad8..19372fd 100644
--- a/lib/librte_eal/linuxapp/eal/eal_interrupts.c
+++ b/lib/librte_eal/linuxapp/eal/eal_interrupts.c
@@ -729,8 +729,7 @@ eal_intr_process_interrupts(struct epoll_event *events, int nfds)
 				rte_spinlock_unlock(&intr_lock);
 
 				/* call the actual callback */
-				active_cb.cb_fn(&src->intr_handle,
-					active_cb.cb_arg);
+				active_cb.cb_fn(active_cb.cb_arg);
 
 				/*get the lock back. */
 				rte_spinlock_lock(&intr_lock);
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH v3 2/2] app/test: update test code
  2017-03-31  2:09 [PATCH v3 0/2] clean up interrupt handle Qi Zhang
  2017-03-31  2:09 ` [PATCH v3 1/2] eal: " Qi Zhang
@ 2017-03-31  2:09 ` Qi Zhang
  2017-04-04 10:12 ` [PATCH v3 0/2] clean up interrupt handle Thomas Monjalon
  2017-04-04 21:21 ` [PATCH v4 " Qi Zhang
  3 siblings, 0 replies; 15+ messages in thread
From: Qi Zhang @ 2017-03-31  2:09 UTC (permalink / raw)
  To: thomas.monjalon; +Cc: dev, Qi Zhang

Update the test code to algin with callback function change.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 app/test/test_interrupts.c | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/app/test/test_interrupts.c b/app/test/test_interrupts.c
index 371101f..5377292 100644
--- a/app/test/test_interrupts.c
+++ b/app/test/test_interrupts.c
@@ -199,8 +199,9 @@ test_interrupt_handle_compare(struct rte_intr_handle *intr_handle_l,
  * Callback for the test interrupt.
  */
 static void
-test_interrupt_callback(struct rte_intr_handle *intr_handle, void *arg)
+test_interrupt_callback(void *arg)
 {
+	struct rte_intr_handle *intr_handle = (struct rte_intr_handle *)arg;
 	if (test_intr_type >= TEST_INTERRUPT_HANDLE_MAX) {
 		printf("invalid interrupt type\n");
 		flag = -1;
@@ -230,9 +231,9 @@ test_interrupt_callback(struct rte_intr_handle *intr_handle, void *arg)
  * Callback for the test interrupt.
  */
 static void
-test_interrupt_callback_1(struct rte_intr_handle *intr_handle,
-	__attribute__((unused)) void *arg)
+test_interrupt_callback_1(void *arg)
 {
+	struct rte_intr_handle *intr_handle = (struct rte_intr_handle *)arg;
 	if (test_interrupt_handle_sanity_check(intr_handle) < 0) {
 		printf("null or invalid intr_handle for %s\n", __func__);
 		flag = -1;
@@ -364,7 +365,7 @@ test_interrupt_full_path_check(enum test_interrupt_handle_type intr_type)
 	test_intr_handle = intr_handles[intr_type];
 	test_intr_type = intr_type;
 	if (rte_intr_callback_register(&test_intr_handle,
-			test_interrupt_callback, NULL) < 0) {
+			test_interrupt_callback, &test_intr_handle) < 0) {
 		printf("fail to register callback\n");
 		return -1;
 	}
@@ -378,7 +379,7 @@ test_interrupt_full_path_check(enum test_interrupt_handle_type intr_type)
 
 	rte_delay_ms(TEST_INTERRUPT_CHECK_INTERVAL);
 	if (rte_intr_callback_unregister(&test_intr_handle,
-			test_interrupt_callback, NULL) < 0)
+			test_interrupt_callback, &test_intr_handle) < 0)
 		return -1;
 
 	if (flag == 0) {
@@ -441,7 +442,7 @@ test_interrupt(void)
 	/* check if it will fail to register cb with invalid intr_handle */
 	test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_INVALID];
 	if (rte_intr_callback_register(&test_intr_handle,
-			test_interrupt_callback, NULL) == 0) {
+			test_interrupt_callback, &test_intr_handle) == 0) {
 		printf("unexpectedly register successfully with invalid "
 			"intr_handle\n");
 		goto out;
@@ -449,7 +450,7 @@ test_interrupt(void)
 
 	/* check if it will fail to register without callback */
 	test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_VALID];
-	if (rte_intr_callback_register(&test_intr_handle, NULL, NULL) == 0) {
+	if (rte_intr_callback_register(&test_intr_handle, NULL, &test_intr_handle) == 0) {
 		printf("unexpectedly register successfully with "
 			"null callback\n");
 		goto out;
@@ -466,7 +467,7 @@ test_interrupt(void)
 	/* check if it will fail to unregister cb with invalid intr_handle */
 	test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_INVALID];
 	if (rte_intr_callback_unregister(&test_intr_handle,
-			test_interrupt_callback, NULL) > 0) {
+			test_interrupt_callback, &test_intr_handle) > 0) {
 		printf("unexpectedly unregister successfully with "
 			"invalid intr_handle\n");
 		goto out;
@@ -475,12 +476,12 @@ test_interrupt(void)
 	/* check if it is ok to register the same intr_handle twice */
 	test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_VALID];
 	if (rte_intr_callback_register(&test_intr_handle,
-			test_interrupt_callback, NULL) < 0) {
+			test_interrupt_callback, &test_intr_handle) < 0) {
 		printf("it fails to register test_interrupt_callback\n");
 		goto out;
 	}
 	if (rte_intr_callback_register(&test_intr_handle,
-			test_interrupt_callback_1, NULL) < 0) {
+			test_interrupt_callback_1, &test_intr_handle) < 0) {
 		printf("it fails to register test_interrupt_callback_1\n");
 		goto out;
 	}
@@ -492,7 +493,7 @@ test_interrupt(void)
 		goto out;
 	}
 	if (rte_intr_callback_unregister(&test_intr_handle,
-			test_interrupt_callback, NULL) <= 0) {
+			test_interrupt_callback, &test_intr_handle) <= 0) {
 		printf("it fails to unregister test_interrupt_callback\n");
 		goto out;
 	}
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH v3 0/2] clean up interrupt handle
  2017-03-31  2:09 [PATCH v3 0/2] clean up interrupt handle Qi Zhang
  2017-03-31  2:09 ` [PATCH v3 1/2] eal: " Qi Zhang
  2017-03-31  2:09 ` [PATCH v3 2/2] app/test: update test code Qi Zhang
@ 2017-04-04 10:12 ` Thomas Monjalon
  2017-04-04 12:41   ` Zhang, Qi Z
  2017-04-04 21:21 ` [PATCH v4 " Qi Zhang
  3 siblings, 1 reply; 15+ messages in thread
From: Thomas Monjalon @ 2017-04-04 10:12 UTC (permalink / raw)
  To: Qi Zhang; +Cc: dev

Hi,

2017-03-30 22:09, Qi Zhang:
> It seems its not necessary to register an intr_handle for interrupt callback 
> function. "void* cb_arg" shows enough when be used to pass the object that 
> contain the information be required to handle the interrupt event( A typical
> way which is implemented by almost all driver is by passing a rte_ethdev 
> instance). The patch change the prototype of rte_intr_callback_fn by removing
> the uncessary intr_handle paramter.
> 
> v3:
> - update bnx2x driver which is missed in v1,v2
> 
> v2:
> - seperate patch 1 in v1 into 2 patches.
> - correct some commit log.
> 
> Qi Zhang (2):
>   eal: clean up interrupt handle
>   app/test: update test code

Several comments:

* You forgot to use --in-reply-to, so it is not convenient to check the history.

* Please keep the the prior acked-by in your patches if there are.

* There is another miss in this patch:

drivers/net/mlx5/mlx5_ethdev.c:1259:10:
fatal error: incompatible pointer types passing
'void (struct rte_intr_handle *, void *)'
to parameter of type 'rte_intr_callback_fn'
(aka 'void (*)(void *)') [-Wincompatible-pointer-types]
    mlx5_dev_interrupt_handler,

* The second patch is clearly not up to date as the file
app/test/test_interrupts.c has moved.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v3 0/2] clean up interrupt handle
  2017-04-04 10:12 ` [PATCH v3 0/2] clean up interrupt handle Thomas Monjalon
@ 2017-04-04 12:41   ` Zhang, Qi Z
  0 siblings, 0 replies; 15+ messages in thread
From: Zhang, Qi Z @ 2017-04-04 12:41 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev



> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
> Sent: Tuesday, April 4, 2017 6:13 PM
> To: Zhang, Qi Z <qi.z.zhang@intel.com>
> Cc: dev@dpdk.org
> Subject: Re: [PATCH v3 0/2] clean up interrupt handle
> 
> Hi,
> 
> 2017-03-30 22:09, Qi Zhang:
> > It seems its not necessary to register an intr_handle for interrupt
> > callback function. "void* cb_arg" shows enough when be used to pass
> > the object that contain the information be required to handle the
> > interrupt event( A typical way which is implemented by almost all
> > driver is by passing a rte_ethdev instance). The patch change the
> > prototype of rte_intr_callback_fn by removing the uncessary intr_handle
> paramter.
> >
> > v3:
> > - update bnx2x driver which is missed in v1,v2
> >
> > v2:
> > - seperate patch 1 in v1 into 2 patches.
> > - correct some commit log.
> >
> > Qi Zhang (2):
> >   eal: clean up interrupt handle
> >   app/test: update test code
> 
> Several comments:
> 
> * You forgot to use --in-reply-to, so it is not convenient to check the history.
Will follow, thanks for your reminder.
> 
> * Please keep the the prior acked-by in your patches if there are.
Will add that back
> 
> * There is another miss in this patch:
> 
> drivers/net/mlx5/mlx5_ethdev.c:1259:10:
> fatal error: incompatible pointer types passing 'void (struct rte_intr_handle *,
> void *)'
> to parameter of type 'rte_intr_callback_fn'
> (aka 'void (*)(void *)') [-Wincompatible-pointer-types]
>     mlx5_dev_interrupt_handler,

After I turn on mlx5 driver and downloaded the missing mlx libraries, I saw this issue.
Will update.

> 
> * The second patch is clearly not up to date as the file
> app/test/test_interrupts.c has moved.

Will sync to latest code.

Thanks
Qi

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v4 2/2] eal: clean up interrupt handle
  2017-04-04 21:21   ` [PATCH v4 2/2] eal: clean up interrupt handle Qi Zhang
@ 2017-04-04 13:54     ` Shahaf Shuler
  2017-04-04 14:23       ` Zhang, Qi Z
  0 siblings, 1 reply; 15+ messages in thread
From: Shahaf Shuler @ 2017-04-04 13:54 UTC (permalink / raw)
  To: Qi Zhang, thomas.monjalon; +Cc: dev

Wednesday, April 5, 2017 12:21 AM, Qi Zhang:
> The patch change the prototype of callback function
> (rte_intr_callback_fn) by removing the unnecessary parameter.
> 
> Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
> ---
> 
> v4:
> 
> - Update mlx5 driver which is missed in v1, v2, v3.

Thanks for the update of mlx5.
The compilation is still failing for mlx4. the implementation there is much similar to mlx5.

> 
> v3:
> 
> - Update bnx2x driver which is missed in v1,v2
> 
> v2:
> 
> - Seperate patch 1 of v1 into 2 patches.(part 2)
> 
>  drivers/net/bnx2x/bnx2x_ethdev.c               |  5 +++--
>  drivers/net/bnxt/bnxt_irq.c                    |  3 +--
>  drivers/net/e1000/em_ethdev.c                  |  8 +++-----
>  drivers/net/e1000/igb_ethdev.c                 | 15 ++++++---------
>  drivers/net/enic/enic_main.c                   |  3 +--
>  drivers/net/fm10k/fm10k_ethdev.c               | 12 ++++--------
>  drivers/net/i40e/i40e_ethdev.c                 |  8 +++-----
>  drivers/net/i40e/i40e_ethdev_vf.c              |  5 ++---
>  drivers/net/ixgbe/ixgbe_ethdev.c               | 14 +++++---------
>  drivers/net/mlx5/mlx5.h                        |  2 +-
>  drivers/net/mlx5/mlx5_ethdev.c                 |  3 +--
>  drivers/net/nfp/nfp_net.c                      |  6 ++----
>  drivers/net/qede/qede_ethdev.c                 |  4 ++--
>  drivers/net/sfc/sfc_intr.c                     | 10 ++++++----
>  drivers/net/virtio/virtio_ethdev.c             |  5 ++---
>  lib/librte_eal/common/include/rte_interrupts.h |  3 +--
>  lib/librte_eal/linuxapp/eal/eal_alarm.c        |  5 ++---
>  lib/librte_eal/linuxapp/eal/eal_interrupts.c   |  3 +--
>  18 files changed, 46 insertions(+), 68 deletions(-)

[...]

> @@ -119,12 +119,13 @@ bnx2x_interrupt_action(struct rte_eth_dev *dev)

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v4 2/2] eal: clean up interrupt handle
  2017-04-04 13:54     ` Shahaf Shuler
@ 2017-04-04 14:23       ` Zhang, Qi Z
  0 siblings, 0 replies; 15+ messages in thread
From: Zhang, Qi Z @ 2017-04-04 14:23 UTC (permalink / raw)
  To: Shahaf Shuler, thomas.monjalon; +Cc: dev



> -----Original Message-----
> From: Shahaf Shuler [mailto:shahafs@mellanox.com]
> Sent: Tuesday, April 4, 2017 9:54 PM
> To: Zhang, Qi Z <qi.z.zhang@intel.com>; thomas.monjalon@6wind.com
> Cc: dev@dpdk.org
> Subject: RE: [dpdk-dev] [PATCH v4 2/2] eal: clean up interrupt handle
> 
> Wednesday, April 5, 2017 12:21 AM, Qi Zhang:
> > The patch change the prototype of callback function
> > (rte_intr_callback_fn) by removing the unnecessary parameter.
> >
> > Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
> > ---
> >
> > v4:
> >
> > - Update mlx5 driver which is missed in v1, v2, v3.
> 
> Thanks for the update of mlx5.
> The compilation is still failing for mlx4. the implementation there is much
> similar to mlx5.

OK, should not rely on compile option , now scan the code, this should be the last missing one:)
Thanks.
> 
> >
> > v3:
> >
> > - Update bnx2x driver which is missed in v1,v2
> >
> > v2:
> >
> > - Seperate patch 1 of v1 into 2 patches.(part 2)
> >
> >  drivers/net/bnx2x/bnx2x_ethdev.c               |  5 +++--
> >  drivers/net/bnxt/bnxt_irq.c                    |  3 +--
> >  drivers/net/e1000/em_ethdev.c                  |  8 +++-----
> >  drivers/net/e1000/igb_ethdev.c                 | 15 ++++++---------
> >  drivers/net/enic/enic_main.c                   |  3 +--
> >  drivers/net/fm10k/fm10k_ethdev.c               | 12 ++++--------
> >  drivers/net/i40e/i40e_ethdev.c                 |  8 +++-----
> >  drivers/net/i40e/i40e_ethdev_vf.c              |  5 ++---
> >  drivers/net/ixgbe/ixgbe_ethdev.c               | 14 +++++---------
> >  drivers/net/mlx5/mlx5.h                        |  2 +-
> >  drivers/net/mlx5/mlx5_ethdev.c                 |  3 +--
> >  drivers/net/nfp/nfp_net.c                      |  6 ++----
> >  drivers/net/qede/qede_ethdev.c                 |  4 ++--
> >  drivers/net/sfc/sfc_intr.c                     | 10 ++++++----
> >  drivers/net/virtio/virtio_ethdev.c             |  5 ++---
> >  lib/librte_eal/common/include/rte_interrupts.h |  3 +--
> >  lib/librte_eal/linuxapp/eal/eal_alarm.c        |  5 ++---
> >  lib/librte_eal/linuxapp/eal/eal_interrupts.c   |  3 +--
> >  18 files changed, 46 insertions(+), 68 deletions(-)
> 
> [...]
> 
> > @@ -119,12 +119,13 @@ bnx2x_interrupt_action(struct rte_eth_dev
> *dev)

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v5 0/2] clean up interrupt handle
  2017-04-04 22:27   ` [PATCH v5 0/2] " Qi Zhang
@ 2017-04-04 14:50     ` Thomas Monjalon
  2017-04-04 14:58       ` Zhang, Qi Z
  2017-04-04 22:27     ` [PATCH v5 1/2] vfio: keep interrupt source read only Qi Zhang
  2017-04-04 22:27     ` [PATCH v5 2/2] eal: clean up interrupt handle Qi Zhang
  2 siblings, 1 reply; 15+ messages in thread
From: Thomas Monjalon @ 2017-04-04 14:50 UTC (permalink / raw)
  To: Qi Zhang; +Cc: dev

2017-04-05 06:27, Qi Zhang:
> It seems its not necessary to register an intr_handle for interrupt callback
> function. "void* cb_arg" shows enough when be used to pass the object that
> contain the information be required to handle the interrupt event( A typical
> way which is implemented by almost all driver is by passing a rte_ethdev
> instance).
> The patch change the prototype of rte_intr_callback_fn by removing
> the uncessary intr_handle paramter.
> 
> v5:
> 
> - Update mlx4 driver which is missed in previous version.
> 
> v4:
> 
> - Update mlx5 driver which is missed in v1, v2, v3.
> - Add back patch 1 of v2 to make this complete though it already be applied.
> - Remove patch 3 which is not necessary with latest master.

Why have you removed patch 3?

There is this error now:

test/test/test_interrupts.c:217:4: fatal error:
incompatible pointer types passing 'void (struct rte_intr_handle *, void *)'
to parameter of type 'rte_intr_callback_fn' (aka 'void (*)(void *)')
[-Wincompatible-pointer-types]
                        test_interrupt_callback, arg) >= 0) {

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v5 0/2] clean up interrupt handle
  2017-04-04 14:50     ` Thomas Monjalon
@ 2017-04-04 14:58       ` Zhang, Qi Z
  0 siblings, 0 replies; 15+ messages in thread
From: Zhang, Qi Z @ 2017-04-04 14:58 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev



> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
> Sent: Tuesday, April 4, 2017 10:50 PM
> To: Zhang, Qi Z <qi.z.zhang@intel.com>
> Cc: dev@dpdk.org
> Subject: Re: [PATCH v5 0/2] clean up interrupt handle
> 
> 2017-04-05 06:27, Qi Zhang:
> > It seems its not necessary to register an intr_handle for interrupt
> > callback function. "void* cb_arg" shows enough when be used to pass
> > the object that contain the information be required to handle the
> > interrupt event( A typical way which is implemented by almost all
> > driver is by passing a rte_ethdev instance).
> > The patch change the prototype of rte_intr_callback_fn by removing the
> > uncessary intr_handle paramter.
> >
> > v5:
> >
> > - Update mlx4 driver which is missed in previous version.
> >
> > v4:
> >
> > - Update mlx5 driver which is missed in v1, v2, v3.
> > - Add back patch 1 of v2 to make this complete though it already be
> applied.
> > - Remove patch 3 which is not necessary with latest master.
> 
> Why have you removed patch 3?
> 
> There is this error now:
> 
> test/test/test_interrupts.c:217:4: fatal error:
> incompatible pointer types passing 'void (struct rte_intr_handle *, void *)'
> to parameter of type 'rte_intr_callback_fn' (aka 'void (*)(void *)')
> [-Wincompatible-pointer-types]
>                         test_interrupt_callback, arg) >= 0) {
> 
Sorry, did not noticed the recent change "mk: do not build tests by default",
I thought the related test code has been removed.
Will Fix.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH v4 0/2] clean up interrupt handle
  2017-03-31  2:09 [PATCH v3 0/2] clean up interrupt handle Qi Zhang
                   ` (2 preceding siblings ...)
  2017-04-04 10:12 ` [PATCH v3 0/2] clean up interrupt handle Thomas Monjalon
@ 2017-04-04 21:21 ` Qi Zhang
  2017-04-04 21:21   ` [PATCH v4 1/2] vfio: keep interrupt source read only Qi Zhang
                     ` (2 more replies)
  3 siblings, 3 replies; 15+ messages in thread
From: Qi Zhang @ 2017-04-04 21:21 UTC (permalink / raw)
  To: thomas.monjalon; +Cc: dev, Qi Zhang

It seems its not necessary to register an intr_handle for interrupt callback
function. "void* cb_arg" shows enough when be used to pass the object that
contain the information be required to handle the interrupt event( A typical
way which is implemented by almost all driver is by passing a rte_ethdev
instance). 
The patch change the prototype of rte_intr_callback_fn by removing
the uncessary intr_handle paramter. 

v4:

- Update mlx5 driver which is missed in v1, v2, v3.
- Add back patch 1 of v2 to make this complete though it already be applied.
- Remove patch 3 which is not necessary with latest master.

v3:
- Update bnx2x driver which is missed in v1,v2

v2:
- Seperate patch 1 in v1 into 2 patches.
- Correct some commit log.

Qi Zhang (2):
  vfio: keep interrupt source read only
  eal: clean up interrupt handle

 drivers/net/bnx2x/bnx2x_ethdev.c               |  5 ++--
 drivers/net/bnxt/bnxt_irq.c                    |  3 +-
 drivers/net/e1000/em_ethdev.c                  |  8 ++----
 drivers/net/e1000/igb_ethdev.c                 | 15 ++++------
 drivers/net/enic/enic_main.c                   |  3 +-
 drivers/net/fm10k/fm10k_ethdev.c               | 12 +++-----
 drivers/net/i40e/i40e_ethdev.c                 |  8 ++----
 drivers/net/i40e/i40e_ethdev_vf.c              |  5 ++--
 drivers/net/ixgbe/ixgbe_ethdev.c               | 14 ++++-----
 drivers/net/mlx5/mlx5.h                        |  2 +-
 drivers/net/mlx5/mlx5_ethdev.c                 |  3 +-
 drivers/net/nfp/nfp_net.c                      |  6 ++--
 drivers/net/qede/qede_ethdev.c                 |  4 +--
 drivers/net/sfc/sfc_intr.c                     | 10 ++++---
 drivers/net/virtio/virtio_ethdev.c             |  5 ++--
 lib/librte_eal/common/include/rte_interrupts.h |  3 +-
 lib/librte_eal/linuxapp/eal/eal_alarm.c        |  5 ++--
 lib/librte_eal/linuxapp/eal/eal_interrupts.c   | 39 ++++----------------------
 18 files changed, 50 insertions(+), 100 deletions(-)

-- 
2.7.4

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH v4 1/2] vfio: keep interrupt source read only
  2017-04-04 21:21 ` [PATCH v4 " Qi Zhang
@ 2017-04-04 21:21   ` Qi Zhang
  2017-04-04 21:21   ` [PATCH v4 2/2] eal: clean up interrupt handle Qi Zhang
  2017-04-04 22:27   ` [PATCH v5 0/2] " Qi Zhang
  2 siblings, 0 replies; 15+ messages in thread
From: Qi Zhang @ 2017-04-04 21:21 UTC (permalink / raw)
  To: thomas.monjalon; +Cc: dev, Qi Zhang

Remove the inappropriate modification on get_max_intr
field that keep the intr_source read only.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---

v4:

- Add back this patch to make patch set complete though it already be applied.

v2:
- Seperate patch 1 of v1 into 2 patches.(part 1)

 lib/librte_eal/linuxapp/eal/eal_interrupts.c | 36 ++++------------------------
 1 file changed, 4 insertions(+), 32 deletions(-)

diff --git a/lib/librte_eal/linuxapp/eal/eal_interrupts.c b/lib/librte_eal/linuxapp/eal/eal_interrupts.c
index 029a147..1716d68 100644
--- a/lib/librte_eal/linuxapp/eal/eal_interrupts.c
+++ b/lib/librte_eal/linuxapp/eal/eal_interrupts.c
@@ -278,29 +278,6 @@ vfio_disable_msi(const struct rte_intr_handle *intr_handle) {
 	return ret;
 }
 
-static int
-get_max_intr(const struct rte_intr_handle *intr_handle)
-{
-	struct rte_intr_source *src;
-
-	TAILQ_FOREACH(src, &intr_sources, next) {
-		if (src->intr_handle.fd != intr_handle->fd)
-			continue;
-
-		if (src->intr_handle.max_intr < intr_handle->max_intr)
-			src->intr_handle.max_intr = intr_handle->max_intr;
-		if (!src->intr_handle.max_intr)
-			src->intr_handle.max_intr = 1;
-		else if (src->intr_handle.max_intr > RTE_MAX_RXTX_INTR_VEC_ID)
-			src->intr_handle.max_intr
-				= RTE_MAX_RXTX_INTR_VEC_ID + 1;
-
-		return src->intr_handle.max_intr;
-	}
-
-	return -1;
-}
-
 /* enable MSI-X interrupts */
 static int
 vfio_enable_msix(const struct rte_intr_handle *intr_handle) {
@@ -313,15 +290,10 @@ vfio_enable_msix(const struct rte_intr_handle *intr_handle) {
 
 	irq_set = (struct vfio_irq_set *) irq_set_buf;
 	irq_set->argsz = len;
-
-	ret = get_max_intr(intr_handle);
-	if (ret < 0) {
-		RTE_LOG(ERR, EAL, "Invalid number of MSI-X irqs for fd %d\n",
-			intr_handle->fd);
-		return -1;
-	}
-
-	irq_set->count = ret;
+	/* 0 < irq_set->count < RTE_MAX_RXTX_INTR_VEC_ID + 1 */
+	irq_set->count = intr_handle->max_intr ?
+		(intr_handle->max_intr > RTE_MAX_RXTX_INTR_VEC_ID + 1 ?
+		RTE_MAX_RXTX_INTR_VEC_ID + 1 : intr_handle->max_intr) : 1;
 	irq_set->flags = VFIO_IRQ_SET_DATA_EVENTFD | VFIO_IRQ_SET_ACTION_TRIGGER;
 	irq_set->index = VFIO_PCI_MSIX_IRQ_INDEX;
 	irq_set->start = 0;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH v4 2/2] eal: clean up interrupt handle
  2017-04-04 21:21 ` [PATCH v4 " Qi Zhang
  2017-04-04 21:21   ` [PATCH v4 1/2] vfio: keep interrupt source read only Qi Zhang
@ 2017-04-04 21:21   ` Qi Zhang
  2017-04-04 13:54     ` Shahaf Shuler
  2017-04-04 22:27   ` [PATCH v5 0/2] " Qi Zhang
  2 siblings, 1 reply; 15+ messages in thread
From: Qi Zhang @ 2017-04-04 21:21 UTC (permalink / raw)
  To: thomas.monjalon; +Cc: dev, Qi Zhang

The patch change the prototype of callback function
(rte_intr_callback_fn) by removing the unnecessary parameter.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---

v4:

- Update mlx5 driver which is missed in v1, v2, v3.

v3:

- Update bnx2x driver which is missed in v1,v2

v2:

- Seperate patch 1 of v1 into 2 patches.(part 2)

 drivers/net/bnx2x/bnx2x_ethdev.c               |  5 +++--
 drivers/net/bnxt/bnxt_irq.c                    |  3 +--
 drivers/net/e1000/em_ethdev.c                  |  8 +++-----
 drivers/net/e1000/igb_ethdev.c                 | 15 ++++++---------
 drivers/net/enic/enic_main.c                   |  3 +--
 drivers/net/fm10k/fm10k_ethdev.c               | 12 ++++--------
 drivers/net/i40e/i40e_ethdev.c                 |  8 +++-----
 drivers/net/i40e/i40e_ethdev_vf.c              |  5 ++---
 drivers/net/ixgbe/ixgbe_ethdev.c               | 14 +++++---------
 drivers/net/mlx5/mlx5.h                        |  2 +-
 drivers/net/mlx5/mlx5_ethdev.c                 |  3 +--
 drivers/net/nfp/nfp_net.c                      |  6 ++----
 drivers/net/qede/qede_ethdev.c                 |  4 ++--
 drivers/net/sfc/sfc_intr.c                     | 10 ++++++----
 drivers/net/virtio/virtio_ethdev.c             |  5 ++---
 lib/librte_eal/common/include/rte_interrupts.h |  3 +--
 lib/librte_eal/linuxapp/eal/eal_alarm.c        |  5 ++---
 lib/librte_eal/linuxapp/eal/eal_interrupts.c   |  3 +--
 18 files changed, 46 insertions(+), 68 deletions(-)

diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c
index a0b0dfa..0e8b4d9 100644
--- a/drivers/net/bnx2x/bnx2x_ethdev.c
+++ b/drivers/net/bnx2x/bnx2x_ethdev.c
@@ -119,12 +119,13 @@ bnx2x_interrupt_action(struct rte_eth_dev *dev)
 }
 
 static __rte_unused void
-bnx2x_interrupt_handler(struct rte_intr_handle *handle, void *param)
+bnx2x_interrupt_handler(void *param)
 {
 	struct rte_eth_dev *dev = (struct rte_eth_dev *)param;
+	struct bnx2x_softc *sc = dev->data->dev_private;
 
 	bnx2x_interrupt_action(dev);
-	rte_intr_enable(handle);
+	rte_intr_enable(&sc->pci_dev->intr_handle);
 }
 
 /*
diff --git a/drivers/net/bnxt/bnxt_irq.c b/drivers/net/bnxt/bnxt_irq.c
index e93585a..20e17ff 100644
--- a/drivers/net/bnxt/bnxt_irq.c
+++ b/drivers/net/bnxt/bnxt_irq.c
@@ -45,8 +45,7 @@
  * Interrupts
  */
 
-static void bnxt_int_handler(struct rte_intr_handle *handle __rte_unused,
-			     void *param)
+static void bnxt_int_handler(void *param)
 {
 	struct rte_eth_dev *eth_dev = (struct rte_eth_dev *)param;
 	struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index 4f34c14..169060c 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -85,8 +85,7 @@ static int eth_em_rxq_interrupt_setup(struct rte_eth_dev *dev);
 static int eth_em_interrupt_get_status(struct rte_eth_dev *dev);
 static int eth_em_interrupt_action(struct rte_eth_dev *dev,
 				   struct rte_intr_handle *handle);
-static void eth_em_interrupt_handler(struct rte_intr_handle *handle,
-							void *param);
+static void eth_em_interrupt_handler(void *param);
 
 static int em_hw_init(struct e1000_hw *hw);
 static int em_hardware_init(struct e1000_hw *hw);
@@ -1648,13 +1647,12 @@ eth_em_interrupt_action(struct rte_eth_dev *dev,
  *  void
  */
 static void
-eth_em_interrupt_handler(struct rte_intr_handle *handle,
-			 void *param)
+eth_em_interrupt_handler(void *param)
 {
 	struct rte_eth_dev *dev = (struct rte_eth_dev *)param;
 
 	eth_em_interrupt_get_status(dev);
-	eth_em_interrupt_action(dev, handle);
+	eth_em_interrupt_action(dev, dev->intr_handle);
 	_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 }
 
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index a73cd7a..cc2c244 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -136,8 +136,7 @@ static int eth_igb_rxq_interrupt_setup(struct rte_eth_dev *dev);
 static int eth_igb_interrupt_get_status(struct rte_eth_dev *dev);
 static int eth_igb_interrupt_action(struct rte_eth_dev *dev,
 				    struct rte_intr_handle *handle);
-static void eth_igb_interrupt_handler(struct rte_intr_handle *handle,
-							void *param);
+static void eth_igb_interrupt_handler(void *param);
 static int  igb_hardware_init(struct e1000_hw *hw);
 static void igb_hw_control_acquire(struct e1000_hw *hw);
 static void igb_hw_control_release(struct e1000_hw *hw);
@@ -283,8 +282,7 @@ static void eth_igb_assign_msix_vector(struct e1000_hw *hw, int8_t direction,
 static void eth_igb_write_ivar(struct e1000_hw *hw, uint8_t msix_vector,
 			       uint8_t index, uint8_t offset);
 static void eth_igb_configure_msix_intr(struct rte_eth_dev *dev);
-static void eth_igbvf_interrupt_handler(struct rte_intr_handle *handle,
-					void *param);
+static void eth_igbvf_interrupt_handler(void *param);
 static void igbvf_mbx_process(struct rte_eth_dev *dev);
 
 /*
@@ -2784,12 +2782,12 @@ eth_igb_interrupt_action(struct rte_eth_dev *dev,
  *  void
  */
 static void
-eth_igb_interrupt_handler(struct rte_intr_handle *handle, void *param)
+eth_igb_interrupt_handler(void *param)
 {
 	struct rte_eth_dev *dev = (struct rte_eth_dev *)param;
 
 	eth_igb_interrupt_get_status(dev);
-	eth_igb_interrupt_action(dev, handle);
+	eth_igb_interrupt_action(dev, dev->intr_handle);
 }
 
 static int
@@ -2846,13 +2844,12 @@ eth_igbvf_interrupt_action(struct rte_eth_dev *dev, struct rte_intr_handle *intr
 }
 
 static void
-eth_igbvf_interrupt_handler(struct rte_intr_handle *handle,
-			    void *param)
+eth_igbvf_interrupt_handler(void *param)
 {
 	struct rte_eth_dev *dev = (struct rte_eth_dev *)param;
 
 	eth_igbvf_interrupt_get_status(dev);
-	eth_igbvf_interrupt_action(dev, handle);
+	eth_igbvf_interrupt_action(dev, dev->intr_handle);
 }
 
 static int
diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c
index 570b7b6..5f2188b 100644
--- a/drivers/net/enic/enic_main.c
+++ b/drivers/net/enic/enic_main.c
@@ -423,8 +423,7 @@ int enic_link_update(struct enic *enic)
 }
 
 static void
-enic_intr_handler(__rte_unused struct rte_intr_handle *handle,
-	void *arg)
+enic_intr_handler(void *arg)
 {
 	struct rte_eth_dev *dev = (struct rte_eth_dev *)arg;
 	struct enic *enic = pmd_priv(dev);
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index c4fe746..e37bd8f 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -2541,9 +2541,7 @@ fm10k_dev_handle_fault(struct fm10k_hw *hw, uint32_t eicr)
  *  void
  */
 static void
-fm10k_dev_interrupt_handler_pf(
-			struct rte_intr_handle *handle,
-			void *param)
+fm10k_dev_interrupt_handler_pf(void *param)
 {
 	struct rte_eth_dev *dev = (struct rte_eth_dev *)param;
 	struct fm10k_hw *hw = FM10K_DEV_PRIVATE_TO_HW(dev->data->dev_private);
@@ -2593,7 +2591,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(handle);
+	rte_intr_enable(dev->intr_handle);
 }
 
 /**
@@ -2608,9 +2606,7 @@ fm10k_dev_interrupt_handler_pf(
  *  void
  */
 static void
-fm10k_dev_interrupt_handler_vf(
-			struct rte_intr_handle *handle,
-			void *param)
+fm10k_dev_interrupt_handler_vf(void *param)
 {
 	struct rte_eth_dev *dev = (struct rte_eth_dev *)param;
 	struct fm10k_hw *hw = FM10K_DEV_PRIVATE_TO_HW(dev->data->dev_private);
@@ -2627,7 +2623,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(handle);
+	rte_intr_enable(dev->intr_handle);
 }
 
 /* Mailbox message handler in VF */
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 8b5fd54..8daffc5 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -318,8 +318,7 @@ static void i40e_stat_update_48(struct i40e_hw *hw,
 			       uint64_t *offset,
 			       uint64_t *stat);
 static void i40e_pf_config_irq0(struct i40e_hw *hw, bool no_queue);
-static void i40e_dev_interrupt_handler(struct rte_intr_handle *handle,
-				       void *param);
+static void i40e_dev_interrupt_handler(void *param);
 static int i40e_res_pool_init(struct i40e_res_pool_info *pool,
 				uint32_t base, uint32_t num);
 static void i40e_res_pool_destroy(struct i40e_res_pool_info *pool);
@@ -5772,8 +5771,7 @@ i40e_dev_handle_aq_msg(struct rte_eth_dev *dev)
  *  void
  */
 static void
-i40e_dev_interrupt_handler(struct rte_intr_handle *intr_handle,
-			   void *param)
+i40e_dev_interrupt_handler(void *param)
 {
 	struct rte_eth_dev *dev = (struct rte_eth_dev *)param;
 	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
@@ -5819,7 +5817,7 @@ i40e_dev_interrupt_handler(struct rte_intr_handle *intr_handle,
 done:
 	/* Enable interrupt */
 	i40e_pf_enable_irq0(hw);
-	rte_intr_enable(intr_handle);
+	rte_intr_enable(dev->intr_handle);
 }
 
 static int
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index d3659c9..7e48fea 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1422,8 +1422,7 @@ i40evf_handle_aq_msg(struct rte_eth_dev *dev)
  *  void
  */
 static void
-i40evf_dev_interrupt_handler(struct rte_intr_handle *intr_handle,
-			     void *param)
+i40evf_dev_interrupt_handler(void *param)
 {
 	struct rte_eth_dev *dev = (struct rte_eth_dev *)param;
 	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
@@ -1452,7 +1451,7 @@ i40evf_dev_interrupt_handler(struct rte_intr_handle *intr_handle,
 
 done:
 	i40evf_enable_irq0(hw);
-	rte_intr_enable(intr_handle);
+	rte_intr_enable(dev->intr_handle);
 }
 
 static int
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 34bd681..1bcaae8 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -244,8 +244,7 @@ static int ixgbe_dev_rxq_interrupt_setup(struct rte_eth_dev *dev);
 static int ixgbe_dev_interrupt_get_status(struct rte_eth_dev *dev);
 static int ixgbe_dev_interrupt_action(struct rte_eth_dev *dev,
 				      struct rte_intr_handle *handle);
-static void ixgbe_dev_interrupt_handler(struct rte_intr_handle *handle,
-		void *param);
+static void ixgbe_dev_interrupt_handler(void *param);
 static void ixgbe_dev_interrupt_delayed_handler(void *param);
 static void ixgbe_add_rar(struct rte_eth_dev *dev, struct ether_addr *mac_addr,
 		uint32_t index, uint32_t pool);
@@ -366,8 +365,7 @@ static int ixgbe_timesync_read_time(struct rte_eth_dev *dev,
 				   struct timespec *timestamp);
 static int ixgbe_timesync_write_time(struct rte_eth_dev *dev,
 				   const struct timespec *timestamp);
-static void ixgbevf_dev_interrupt_handler(struct rte_intr_handle *handle,
-					  void *param);
+static void ixgbevf_dev_interrupt_handler(void *param);
 
 static int ixgbe_dev_l2_tunnel_eth_type_conf
 	(struct rte_eth_dev *dev, struct rte_eth_l2_tunnel_conf *l2_tunnel);
@@ -3917,13 +3915,12 @@ ixgbe_dev_interrupt_delayed_handler(void *param)
  *  void
  */
 static void
-ixgbe_dev_interrupt_handler(struct rte_intr_handle *handle,
-			    void *param)
+ixgbe_dev_interrupt_handler(void *param)
 {
 	struct rte_eth_dev *dev = (struct rte_eth_dev *)param;
 
 	ixgbe_dev_interrupt_get_status(dev);
-	ixgbe_dev_interrupt_action(dev, handle);
+	ixgbe_dev_interrupt_action(dev, dev->intr_handle);
 }
 
 static int
@@ -8163,8 +8160,7 @@ ixgbevf_dev_interrupt_action(struct rte_eth_dev *dev)
 }
 
 static void
-ixgbevf_dev_interrupt_handler(__rte_unused struct rte_intr_handle *handle,
-			      void *param)
+ixgbevf_dev_interrupt_handler(void *param)
 {
 	struct rte_eth_dev *dev = (struct rte_eth_dev *)param;
 
diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h
index 879da5e..23a9a4e 100644
--- a/drivers/net/mlx5/mlx5.h
+++ b/drivers/net/mlx5/mlx5.h
@@ -210,7 +210,7 @@ int mlx5_dev_set_flow_ctrl(struct rte_eth_dev *, struct rte_eth_fc_conf *);
 int mlx5_ibv_device_to_pci_addr(const struct ibv_device *,
 				struct rte_pci_addr *);
 void mlx5_dev_link_status_handler(void *);
-void mlx5_dev_interrupt_handler(struct rte_intr_handle *, void *);
+void mlx5_dev_interrupt_handler(void *);
 void priv_dev_interrupt_handler_uninstall(struct priv *, struct rte_eth_dev *);
 void priv_dev_interrupt_handler_install(struct priv *, struct rte_eth_dev *);
 int mlx5_set_link_down(struct rte_eth_dev *dev);
diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c
index 2145965..44fba8c 100644
--- a/drivers/net/mlx5/mlx5_ethdev.c
+++ b/drivers/net/mlx5/mlx5_ethdev.c
@@ -1228,13 +1228,12 @@ mlx5_dev_link_status_handler(void *arg)
  *   Callback argument.
  */
 void
-mlx5_dev_interrupt_handler(struct rte_intr_handle *intr_handle, void *cb_arg)
+mlx5_dev_interrupt_handler(void *cb_arg)
 {
 	struct rte_eth_dev *dev = cb_arg;
 	struct priv *priv = dev->data->dev_private;
 	int ret;
 
-	(void)intr_handle;
 	priv_lock(priv);
 	ret = priv_dev_link_status_handler(priv, dev);
 	priv_unlock(priv);
diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
index f8ed976..326043c 100644
--- a/drivers/net/nfp/nfp_net.c
+++ b/drivers/net/nfp/nfp_net.c
@@ -63,8 +63,7 @@
 /* Prototypes */
 static void nfp_net_close(struct rte_eth_dev *dev);
 static int nfp_net_configure(struct rte_eth_dev *dev);
-static void nfp_net_dev_interrupt_handler(struct rte_intr_handle *handle,
-					  void *param);
+static void nfp_net_dev_interrupt_handler(void *param);
 static void nfp_net_dev_interrupt_delayed_handler(void *param);
 static int nfp_net_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu);
 static void nfp_net_infos_get(struct rte_eth_dev *dev,
@@ -1303,8 +1302,7 @@ nfp_net_irq_unmask(struct rte_eth_dev *dev)
 }
 
 static void
-nfp_net_dev_interrupt_handler(__rte_unused struct rte_intr_handle *handle,
-			      void *param)
+nfp_net_dev_interrupt_handler(void *param)
 {
 	int64_t timeout;
 	struct rte_eth_link link;
diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index 0494dbd..ce10924 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -279,14 +279,14 @@ static void qede_interrupt_action(struct ecore_hwfn *p_hwfn)
 }
 
 static void
-qede_interrupt_handler(struct rte_intr_handle *handle, void *param)
+qede_interrupt_handler(void *param)
 {
 	struct rte_eth_dev *eth_dev = (struct rte_eth_dev *)param;
 	struct qede_dev *qdev = eth_dev->data->dev_private;
 	struct ecore_dev *edev = &qdev->edev;
 
 	qede_interrupt_action(ECORE_LEADING_HWFN(edev));
-	if (rte_intr_enable(handle))
+	if (rte_intr_enable(eth_dev->intr_handle))
 		DP_ERR(edev, "rte_intr_enable failed\n");
 }
 
diff --git a/drivers/net/sfc/sfc_intr.c b/drivers/net/sfc/sfc_intr.c
index d06980e..fa7cc3d 100644
--- a/drivers/net/sfc/sfc_intr.c
+++ b/drivers/net/sfc/sfc_intr.c
@@ -68,13 +68,14 @@ sfc_intr_handle_mgmt_evq(struct sfc_adapter *sa)
 }
 
 static void
-sfc_intr_line_handler(struct rte_intr_handle *intr_handle, void *cb_arg)
+sfc_intr_line_handler(void *cb_arg)
 {
 	struct sfc_adapter *sa = (struct sfc_adapter *)cb_arg;
 	efx_nic_t *enp = sa->nic;
 	boolean_t fatal;
 	uint32_t qmask;
 	unsigned int lsc_seq = sa->port.lsc_seq;
+	struct rte_pci_device *pci_dev = SFC_DEV_TO_PCI(sa->eth_dev);
 
 	sfc_log_init(sa, "entry");
 
@@ -97,7 +98,7 @@ sfc_intr_line_handler(struct rte_intr_handle *intr_handle, void *cb_arg)
 	if (qmask & (1 << sa->mgmt_evq_index))
 		sfc_intr_handle_mgmt_evq(sa);
 
-	if (rte_intr_enable(intr_handle) != 0)
+	if (rte_intr_enable(&pci_dev->intr_handle) != 0)
 		sfc_err(sa, "cannot reenable interrupts");
 
 	sfc_log_init(sa, "done");
@@ -113,12 +114,13 @@ sfc_intr_line_handler(struct rte_intr_handle *intr_handle, void *cb_arg)
 }
 
 static void
-sfc_intr_message_handler(struct rte_intr_handle *intr_handle, void *cb_arg)
+sfc_intr_message_handler(void *cb_arg)
 {
 	struct sfc_adapter *sa = (struct sfc_adapter *)cb_arg;
 	efx_nic_t *enp = sa->nic;
 	boolean_t fatal;
 	unsigned int lsc_seq = sa->port.lsc_seq;
+	struct rte_pci_device *pci_dev = SFC_DEV_TO_PCI(sa->eth_dev);
 
 	sfc_log_init(sa, "entry");
 
@@ -139,7 +141,7 @@ sfc_intr_message_handler(struct rte_intr_handle *intr_handle, void *cb_arg)
 
 	sfc_intr_handle_mgmt_evq(sa);
 
-	if (rte_intr_enable(intr_handle) != 0)
+	if (rte_intr_enable(&pci_dev->intr_handle) != 0)
 		sfc_err(sa, "cannot reenable interrupts");
 
 	sfc_log_init(sa, "done");
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 4dc03b9..9033e7b 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1191,8 +1191,7 @@ virtio_negotiate_features(struct virtio_hw *hw, uint64_t req_features)
  * if link state changed.
  */
 static void
-virtio_interrupt_handler(struct rte_intr_handle *handle,
-			 void *param)
+virtio_interrupt_handler(void *param)
 {
 	struct rte_eth_dev *dev = param;
 	struct virtio_hw *hw = dev->data->dev_private;
@@ -1202,7 +1201,7 @@ virtio_interrupt_handler(struct rte_intr_handle *handle,
 	isr = vtpci_isr(hw);
 	PMD_DRV_LOG(INFO, "interrupt status = %#x", isr);
 
-	if (rte_intr_enable(handle) < 0)
+	if (rte_intr_enable(dev->intr_handle) < 0)
 		PMD_DRV_LOG(ERR, "interrupt enable failed");
 
 	if (isr & VIRTIO_PCI_ISR_CONFIG) {
diff --git a/lib/librte_eal/common/include/rte_interrupts.h b/lib/librte_eal/common/include/rte_interrupts.h
index 6cade01..5d06ed7 100644
--- a/lib/librte_eal/common/include/rte_interrupts.h
+++ b/lib/librte_eal/common/include/rte_interrupts.h
@@ -51,8 +51,7 @@ extern "C" {
 struct rte_intr_handle;
 
 /** Function to be registered for the specific interrupt */
-typedef void (*rte_intr_callback_fn)(struct rte_intr_handle *intr_handle,
-							void *cb_arg);
+typedef void (*rte_intr_callback_fn)(void *cb_arg);
 
 #include <exec-env/rte_interrupts.h>
 
diff --git a/lib/librte_eal/linuxapp/eal/eal_alarm.c b/lib/librte_eal/linuxapp/eal/eal_alarm.c
index 8b042ab..fbae461 100644
--- a/lib/librte_eal/linuxapp/eal/eal_alarm.c
+++ b/lib/librte_eal/linuxapp/eal/eal_alarm.c
@@ -83,7 +83,7 @@ static rte_spinlock_t alarm_list_lk = RTE_SPINLOCK_INITIALIZER;
 
 static struct rte_intr_handle intr_handle = {.fd = -1 };
 static int handler_registered = 0;
-static void eal_alarm_callback(struct rte_intr_handle *hdl, void *arg);
+static void eal_alarm_callback(void *arg);
 
 int
 rte_eal_alarm_init(void)
@@ -102,8 +102,7 @@ rte_eal_alarm_init(void)
 }
 
 static void
-eal_alarm_callback(struct rte_intr_handle *hdl __rte_unused,
-		void *arg __rte_unused)
+eal_alarm_callback(void *arg __rte_unused)
 {
 	struct timespec now;
 	struct alarm_entry *ap;
diff --git a/lib/librte_eal/linuxapp/eal/eal_interrupts.c b/lib/librte_eal/linuxapp/eal/eal_interrupts.c
index 1716d68..f175aca 100644
--- a/lib/librte_eal/linuxapp/eal/eal_interrupts.c
+++ b/lib/librte_eal/linuxapp/eal/eal_interrupts.c
@@ -729,8 +729,7 @@ eal_intr_process_interrupts(struct epoll_event *events, int nfds)
 				rte_spinlock_unlock(&intr_lock);
 
 				/* call the actual callback */
-				active_cb.cb_fn(&src->intr_handle,
-					active_cb.cb_arg);
+				active_cb.cb_fn(active_cb.cb_arg);
 
 				/*get the lock back. */
 				rte_spinlock_lock(&intr_lock);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH v5 0/2] clean up interrupt handle
  2017-04-04 21:21 ` [PATCH v4 " Qi Zhang
  2017-04-04 21:21   ` [PATCH v4 1/2] vfio: keep interrupt source read only Qi Zhang
  2017-04-04 21:21   ` [PATCH v4 2/2] eal: clean up interrupt handle Qi Zhang
@ 2017-04-04 22:27   ` Qi Zhang
  2017-04-04 14:50     ` Thomas Monjalon
                       ` (2 more replies)
  2 siblings, 3 replies; 15+ messages in thread
From: Qi Zhang @ 2017-04-04 22:27 UTC (permalink / raw)
  To: thomas.monjalon; +Cc: dev, Qi Zhang

It seems its not necessary to register an intr_handle for interrupt callback
function. "void* cb_arg" shows enough when be used to pass the object that
contain the information be required to handle the interrupt event( A typical
way which is implemented by almost all driver is by passing a rte_ethdev
instance).
The patch change the prototype of rte_intr_callback_fn by removing
the uncessary intr_handle paramter.

v5:

- Update mlx4 driver which is missed in previous version.

v4:

- Update mlx5 driver which is missed in v1, v2, v3.
- Add back patch 1 of v2 to make this complete though it already be applied.
- Remove patch 3 which is not necessary with latest master.

v3:
- Update bnx2x driver which is missed in v1,v2

v2:
- Seperate patch 1 in v1 into 2 patches.
- Correct some commit log.



Qi Zhang (2):
  vfio: keep interrupt source read only
  eal: clean up interrupt handle

 drivers/net/bnx2x/bnx2x_ethdev.c               |  5 ++--
 drivers/net/bnxt/bnxt_irq.c                    |  3 +-
 drivers/net/e1000/em_ethdev.c                  |  8 ++----
 drivers/net/e1000/igb_ethdev.c                 | 15 ++++------
 drivers/net/enic/enic_main.c                   |  3 +-
 drivers/net/fm10k/fm10k_ethdev.c               | 12 +++-----
 drivers/net/i40e/i40e_ethdev.c                 |  8 ++----
 drivers/net/i40e/i40e_ethdev_vf.c              |  5 ++--
 drivers/net/ixgbe/ixgbe_ethdev.c               | 14 ++++-----
 drivers/net/mlx4/mlx4.c                        |  5 ++--
 drivers/net/mlx5/mlx5.h                        |  2 +-
 drivers/net/mlx5/mlx5_ethdev.c                 |  3 +-
 drivers/net/nfp/nfp_net.c                      |  6 ++--
 drivers/net/qede/qede_ethdev.c                 |  4 +--
 drivers/net/sfc/sfc_intr.c                     | 10 ++++---
 drivers/net/virtio/virtio_ethdev.c             |  5 ++--
 lib/librte_eal/common/include/rte_interrupts.h |  3 +-
 lib/librte_eal/linuxapp/eal/eal_alarm.c        |  5 ++--
 lib/librte_eal/linuxapp/eal/eal_interrupts.c   | 39 ++++----------------------
 19 files changed, 52 insertions(+), 103 deletions(-)

-- 
2.9.3

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH v5 1/2] vfio: keep interrupt source read only
  2017-04-04 22:27   ` [PATCH v5 0/2] " Qi Zhang
  2017-04-04 14:50     ` Thomas Monjalon
@ 2017-04-04 22:27     ` Qi Zhang
  2017-04-04 22:27     ` [PATCH v5 2/2] eal: clean up interrupt handle Qi Zhang
  2 siblings, 0 replies; 15+ messages in thread
From: Qi Zhang @ 2017-04-04 22:27 UTC (permalink / raw)
  To: thomas.monjalon; +Cc: dev, Qi Zhang

Remove the inappropriate modification on get_max_intr
field that keep the intr_source read only.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---

v4:

- Add back this patch to make patch set complete though it already be applied.

v2:

- Seperate patch 1 of v1 into 2 patches.(part 1)

 lib/librte_eal/linuxapp/eal/eal_interrupts.c | 36 ++++------------------------
 1 file changed, 4 insertions(+), 32 deletions(-)

diff --git a/lib/librte_eal/linuxapp/eal/eal_interrupts.c b/lib/librte_eal/linuxapp/eal/eal_interrupts.c
index 029a147..1716d68 100644
--- a/lib/librte_eal/linuxapp/eal/eal_interrupts.c
+++ b/lib/librte_eal/linuxapp/eal/eal_interrupts.c
@@ -278,29 +278,6 @@ vfio_disable_msi(const struct rte_intr_handle *intr_handle) {
 	return ret;
 }
 
-static int
-get_max_intr(const struct rte_intr_handle *intr_handle)
-{
-	struct rte_intr_source *src;
-
-	TAILQ_FOREACH(src, &intr_sources, next) {
-		if (src->intr_handle.fd != intr_handle->fd)
-			continue;
-
-		if (src->intr_handle.max_intr < intr_handle->max_intr)
-			src->intr_handle.max_intr = intr_handle->max_intr;
-		if (!src->intr_handle.max_intr)
-			src->intr_handle.max_intr = 1;
-		else if (src->intr_handle.max_intr > RTE_MAX_RXTX_INTR_VEC_ID)
-			src->intr_handle.max_intr
-				= RTE_MAX_RXTX_INTR_VEC_ID + 1;
-
-		return src->intr_handle.max_intr;
-	}
-
-	return -1;
-}
-
 /* enable MSI-X interrupts */
 static int
 vfio_enable_msix(const struct rte_intr_handle *intr_handle) {
@@ -313,15 +290,10 @@ vfio_enable_msix(const struct rte_intr_handle *intr_handle) {
 
 	irq_set = (struct vfio_irq_set *) irq_set_buf;
 	irq_set->argsz = len;
-
-	ret = get_max_intr(intr_handle);
-	if (ret < 0) {
-		RTE_LOG(ERR, EAL, "Invalid number of MSI-X irqs for fd %d\n",
-			intr_handle->fd);
-		return -1;
-	}
-
-	irq_set->count = ret;
+	/* 0 < irq_set->count < RTE_MAX_RXTX_INTR_VEC_ID + 1 */
+	irq_set->count = intr_handle->max_intr ?
+		(intr_handle->max_intr > RTE_MAX_RXTX_INTR_VEC_ID + 1 ?
+		RTE_MAX_RXTX_INTR_VEC_ID + 1 : intr_handle->max_intr) : 1;
 	irq_set->flags = VFIO_IRQ_SET_DATA_EVENTFD | VFIO_IRQ_SET_ACTION_TRIGGER;
 	irq_set->index = VFIO_PCI_MSIX_IRQ_INDEX;
 	irq_set->start = 0;
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH v5 2/2] eal: clean up interrupt handle
  2017-04-04 22:27   ` [PATCH v5 0/2] " Qi Zhang
  2017-04-04 14:50     ` Thomas Monjalon
  2017-04-04 22:27     ` [PATCH v5 1/2] vfio: keep interrupt source read only Qi Zhang
@ 2017-04-04 22:27     ` Qi Zhang
  2 siblings, 0 replies; 15+ messages in thread
From: Qi Zhang @ 2017-04-04 22:27 UTC (permalink / raw)
  To: thomas.monjalon; +Cc: dev, Qi Zhang

The patch change the prototype of callback function
(rte_intr_callback_fn) by removing the unnecessary parameter.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---

v5:

- Update mlx4 driver which is missed in previous version.

v4:

- Update mlx5 driver which is missed in v1, v2, v3.

v3:

- Update bnx2x driver which is missed in v1,v2

v2:

- Seperate patch 1 of v1 into 2 patches.(part 2)

 drivers/net/bnx2x/bnx2x_ethdev.c               |  5 +++--
 drivers/net/bnxt/bnxt_irq.c                    |  3 +--
 drivers/net/e1000/em_ethdev.c                  |  8 +++-----
 drivers/net/e1000/igb_ethdev.c                 | 15 ++++++---------
 drivers/net/enic/enic_main.c                   |  3 +--
 drivers/net/fm10k/fm10k_ethdev.c               | 12 ++++--------
 drivers/net/i40e/i40e_ethdev.c                 |  8 +++-----
 drivers/net/i40e/i40e_ethdev_vf.c              |  5 ++---
 drivers/net/ixgbe/ixgbe_ethdev.c               | 14 +++++---------
 drivers/net/mlx4/mlx4.c                        |  5 ++---
 drivers/net/mlx5/mlx5.h                        |  2 +-
 drivers/net/mlx5/mlx5_ethdev.c                 |  3 +--
 drivers/net/nfp/nfp_net.c                      |  6 ++----
 drivers/net/qede/qede_ethdev.c                 |  4 ++--
 drivers/net/sfc/sfc_intr.c                     | 10 ++++++----
 drivers/net/virtio/virtio_ethdev.c             |  5 ++---
 lib/librte_eal/common/include/rte_interrupts.h |  3 +--
 lib/librte_eal/linuxapp/eal/eal_alarm.c        |  5 ++---
 lib/librte_eal/linuxapp/eal/eal_interrupts.c   |  3 +--
 19 files changed, 48 insertions(+), 71 deletions(-)

diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c
index a0b0dfa..0e8b4d9 100644
--- a/drivers/net/bnx2x/bnx2x_ethdev.c
+++ b/drivers/net/bnx2x/bnx2x_ethdev.c
@@ -119,12 +119,13 @@ bnx2x_interrupt_action(struct rte_eth_dev *dev)
 }
 
 static __rte_unused void
-bnx2x_interrupt_handler(struct rte_intr_handle *handle, void *param)
+bnx2x_interrupt_handler(void *param)
 {
 	struct rte_eth_dev *dev = (struct rte_eth_dev *)param;
+	struct bnx2x_softc *sc = dev->data->dev_private;
 
 	bnx2x_interrupt_action(dev);
-	rte_intr_enable(handle);
+	rte_intr_enable(&sc->pci_dev->intr_handle);
 }
 
 /*
diff --git a/drivers/net/bnxt/bnxt_irq.c b/drivers/net/bnxt/bnxt_irq.c
index e93585a..20e17ff 100644
--- a/drivers/net/bnxt/bnxt_irq.c
+++ b/drivers/net/bnxt/bnxt_irq.c
@@ -45,8 +45,7 @@
  * Interrupts
  */
 
-static void bnxt_int_handler(struct rte_intr_handle *handle __rte_unused,
-			     void *param)
+static void bnxt_int_handler(void *param)
 {
 	struct rte_eth_dev *eth_dev = (struct rte_eth_dev *)param;
 	struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index 4f34c14..169060c 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -85,8 +85,7 @@ static int eth_em_rxq_interrupt_setup(struct rte_eth_dev *dev);
 static int eth_em_interrupt_get_status(struct rte_eth_dev *dev);
 static int eth_em_interrupt_action(struct rte_eth_dev *dev,
 				   struct rte_intr_handle *handle);
-static void eth_em_interrupt_handler(struct rte_intr_handle *handle,
-							void *param);
+static void eth_em_interrupt_handler(void *param);
 
 static int em_hw_init(struct e1000_hw *hw);
 static int em_hardware_init(struct e1000_hw *hw);
@@ -1648,13 +1647,12 @@ eth_em_interrupt_action(struct rte_eth_dev *dev,
  *  void
  */
 static void
-eth_em_interrupt_handler(struct rte_intr_handle *handle,
-			 void *param)
+eth_em_interrupt_handler(void *param)
 {
 	struct rte_eth_dev *dev = (struct rte_eth_dev *)param;
 
 	eth_em_interrupt_get_status(dev);
-	eth_em_interrupt_action(dev, handle);
+	eth_em_interrupt_action(dev, dev->intr_handle);
 	_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 }
 
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index a73cd7a..cc2c244 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -136,8 +136,7 @@ static int eth_igb_rxq_interrupt_setup(struct rte_eth_dev *dev);
 static int eth_igb_interrupt_get_status(struct rte_eth_dev *dev);
 static int eth_igb_interrupt_action(struct rte_eth_dev *dev,
 				    struct rte_intr_handle *handle);
-static void eth_igb_interrupt_handler(struct rte_intr_handle *handle,
-							void *param);
+static void eth_igb_interrupt_handler(void *param);
 static int  igb_hardware_init(struct e1000_hw *hw);
 static void igb_hw_control_acquire(struct e1000_hw *hw);
 static void igb_hw_control_release(struct e1000_hw *hw);
@@ -283,8 +282,7 @@ static void eth_igb_assign_msix_vector(struct e1000_hw *hw, int8_t direction,
 static void eth_igb_write_ivar(struct e1000_hw *hw, uint8_t msix_vector,
 			       uint8_t index, uint8_t offset);
 static void eth_igb_configure_msix_intr(struct rte_eth_dev *dev);
-static void eth_igbvf_interrupt_handler(struct rte_intr_handle *handle,
-					void *param);
+static void eth_igbvf_interrupt_handler(void *param);
 static void igbvf_mbx_process(struct rte_eth_dev *dev);
 
 /*
@@ -2784,12 +2782,12 @@ eth_igb_interrupt_action(struct rte_eth_dev *dev,
  *  void
  */
 static void
-eth_igb_interrupt_handler(struct rte_intr_handle *handle, void *param)
+eth_igb_interrupt_handler(void *param)
 {
 	struct rte_eth_dev *dev = (struct rte_eth_dev *)param;
 
 	eth_igb_interrupt_get_status(dev);
-	eth_igb_interrupt_action(dev, handle);
+	eth_igb_interrupt_action(dev, dev->intr_handle);
 }
 
 static int
@@ -2846,13 +2844,12 @@ eth_igbvf_interrupt_action(struct rte_eth_dev *dev, struct rte_intr_handle *intr
 }
 
 static void
-eth_igbvf_interrupt_handler(struct rte_intr_handle *handle,
-			    void *param)
+eth_igbvf_interrupt_handler(void *param)
 {
 	struct rte_eth_dev *dev = (struct rte_eth_dev *)param;
 
 	eth_igbvf_interrupt_get_status(dev);
-	eth_igbvf_interrupt_action(dev, handle);
+	eth_igbvf_interrupt_action(dev, dev->intr_handle);
 }
 
 static int
diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c
index 570b7b6..5f2188b 100644
--- a/drivers/net/enic/enic_main.c
+++ b/drivers/net/enic/enic_main.c
@@ -423,8 +423,7 @@ int enic_link_update(struct enic *enic)
 }
 
 static void
-enic_intr_handler(__rte_unused struct rte_intr_handle *handle,
-	void *arg)
+enic_intr_handler(void *arg)
 {
 	struct rte_eth_dev *dev = (struct rte_eth_dev *)arg;
 	struct enic *enic = pmd_priv(dev);
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index c4fe746..e37bd8f 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -2541,9 +2541,7 @@ fm10k_dev_handle_fault(struct fm10k_hw *hw, uint32_t eicr)
  *  void
  */
 static void
-fm10k_dev_interrupt_handler_pf(
-			struct rte_intr_handle *handle,
-			void *param)
+fm10k_dev_interrupt_handler_pf(void *param)
 {
 	struct rte_eth_dev *dev = (struct rte_eth_dev *)param;
 	struct fm10k_hw *hw = FM10K_DEV_PRIVATE_TO_HW(dev->data->dev_private);
@@ -2593,7 +2591,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(handle);
+	rte_intr_enable(dev->intr_handle);
 }
 
 /**
@@ -2608,9 +2606,7 @@ fm10k_dev_interrupt_handler_pf(
  *  void
  */
 static void
-fm10k_dev_interrupt_handler_vf(
-			struct rte_intr_handle *handle,
-			void *param)
+fm10k_dev_interrupt_handler_vf(void *param)
 {
 	struct rte_eth_dev *dev = (struct rte_eth_dev *)param;
 	struct fm10k_hw *hw = FM10K_DEV_PRIVATE_TO_HW(dev->data->dev_private);
@@ -2627,7 +2623,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(handle);
+	rte_intr_enable(dev->intr_handle);
 }
 
 /* Mailbox message handler in VF */
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 8b5fd54..8daffc5 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -318,8 +318,7 @@ static void i40e_stat_update_48(struct i40e_hw *hw,
 			       uint64_t *offset,
 			       uint64_t *stat);
 static void i40e_pf_config_irq0(struct i40e_hw *hw, bool no_queue);
-static void i40e_dev_interrupt_handler(struct rte_intr_handle *handle,
-				       void *param);
+static void i40e_dev_interrupt_handler(void *param);
 static int i40e_res_pool_init(struct i40e_res_pool_info *pool,
 				uint32_t base, uint32_t num);
 static void i40e_res_pool_destroy(struct i40e_res_pool_info *pool);
@@ -5772,8 +5771,7 @@ i40e_dev_handle_aq_msg(struct rte_eth_dev *dev)
  *  void
  */
 static void
-i40e_dev_interrupt_handler(struct rte_intr_handle *intr_handle,
-			   void *param)
+i40e_dev_interrupt_handler(void *param)
 {
 	struct rte_eth_dev *dev = (struct rte_eth_dev *)param;
 	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
@@ -5819,7 +5817,7 @@ i40e_dev_interrupt_handler(struct rte_intr_handle *intr_handle,
 done:
 	/* Enable interrupt */
 	i40e_pf_enable_irq0(hw);
-	rte_intr_enable(intr_handle);
+	rte_intr_enable(dev->intr_handle);
 }
 
 static int
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index d3659c9..7e48fea 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1422,8 +1422,7 @@ i40evf_handle_aq_msg(struct rte_eth_dev *dev)
  *  void
  */
 static void
-i40evf_dev_interrupt_handler(struct rte_intr_handle *intr_handle,
-			     void *param)
+i40evf_dev_interrupt_handler(void *param)
 {
 	struct rte_eth_dev *dev = (struct rte_eth_dev *)param;
 	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
@@ -1452,7 +1451,7 @@ i40evf_dev_interrupt_handler(struct rte_intr_handle *intr_handle,
 
 done:
 	i40evf_enable_irq0(hw);
-	rte_intr_enable(intr_handle);
+	rte_intr_enable(dev->intr_handle);
 }
 
 static int
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 34bd681..1bcaae8 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -244,8 +244,7 @@ static int ixgbe_dev_rxq_interrupt_setup(struct rte_eth_dev *dev);
 static int ixgbe_dev_interrupt_get_status(struct rte_eth_dev *dev);
 static int ixgbe_dev_interrupt_action(struct rte_eth_dev *dev,
 				      struct rte_intr_handle *handle);
-static void ixgbe_dev_interrupt_handler(struct rte_intr_handle *handle,
-		void *param);
+static void ixgbe_dev_interrupt_handler(void *param);
 static void ixgbe_dev_interrupt_delayed_handler(void *param);
 static void ixgbe_add_rar(struct rte_eth_dev *dev, struct ether_addr *mac_addr,
 		uint32_t index, uint32_t pool);
@@ -366,8 +365,7 @@ static int ixgbe_timesync_read_time(struct rte_eth_dev *dev,
 				   struct timespec *timestamp);
 static int ixgbe_timesync_write_time(struct rte_eth_dev *dev,
 				   const struct timespec *timestamp);
-static void ixgbevf_dev_interrupt_handler(struct rte_intr_handle *handle,
-					  void *param);
+static void ixgbevf_dev_interrupt_handler(void *param);
 
 static int ixgbe_dev_l2_tunnel_eth_type_conf
 	(struct rte_eth_dev *dev, struct rte_eth_l2_tunnel_conf *l2_tunnel);
@@ -3917,13 +3915,12 @@ ixgbe_dev_interrupt_delayed_handler(void *param)
  *  void
  */
 static void
-ixgbe_dev_interrupt_handler(struct rte_intr_handle *handle,
-			    void *param)
+ixgbe_dev_interrupt_handler(void *param)
 {
 	struct rte_eth_dev *dev = (struct rte_eth_dev *)param;
 
 	ixgbe_dev_interrupt_get_status(dev);
-	ixgbe_dev_interrupt_action(dev, handle);
+	ixgbe_dev_interrupt_action(dev, dev->intr_handle);
 }
 
 static int
@@ -8163,8 +8160,7 @@ ixgbevf_dev_interrupt_action(struct rte_eth_dev *dev)
 }
 
 static void
-ixgbevf_dev_interrupt_handler(__rte_unused struct rte_intr_handle *handle,
-			      void *param)
+ixgbevf_dev_interrupt_handler(void *param)
 {
 	struct rte_eth_dev *dev = (struct rte_eth_dev *)param;
 
diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index 79efaaa..ceee0fd 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -5361,7 +5361,7 @@ mlx4_getenv_int(const char *name)
 static void
 mlx4_dev_link_status_handler(void *);
 static void
-mlx4_dev_interrupt_handler(struct rte_intr_handle *, void *);
+mlx4_dev_interrupt_handler(void *);
 
 /**
  * Link status handler.
@@ -5443,13 +5443,12 @@ mlx4_dev_link_status_handler(void *arg)
  *   Callback argument.
  */
 static void
-mlx4_dev_interrupt_handler(struct rte_intr_handle *intr_handle, void *cb_arg)
+mlx4_dev_interrupt_handler(void *cb_arg)
 {
 	struct rte_eth_dev *dev = cb_arg;
 	struct priv *priv = dev->data->dev_private;
 	int ret;
 
-	(void)intr_handle;
 	priv_lock(priv);
 	ret = priv_dev_link_status_handler(priv, dev);
 	priv_unlock(priv);
diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h
index 879da5e..23a9a4e 100644
--- a/drivers/net/mlx5/mlx5.h
+++ b/drivers/net/mlx5/mlx5.h
@@ -210,7 +210,7 @@ int mlx5_dev_set_flow_ctrl(struct rte_eth_dev *, struct rte_eth_fc_conf *);
 int mlx5_ibv_device_to_pci_addr(const struct ibv_device *,
 				struct rte_pci_addr *);
 void mlx5_dev_link_status_handler(void *);
-void mlx5_dev_interrupt_handler(struct rte_intr_handle *, void *);
+void mlx5_dev_interrupt_handler(void *);
 void priv_dev_interrupt_handler_uninstall(struct priv *, struct rte_eth_dev *);
 void priv_dev_interrupt_handler_install(struct priv *, struct rte_eth_dev *);
 int mlx5_set_link_down(struct rte_eth_dev *dev);
diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c
index 2145965..44fba8c 100644
--- a/drivers/net/mlx5/mlx5_ethdev.c
+++ b/drivers/net/mlx5/mlx5_ethdev.c
@@ -1228,13 +1228,12 @@ mlx5_dev_link_status_handler(void *arg)
  *   Callback argument.
  */
 void
-mlx5_dev_interrupt_handler(struct rte_intr_handle *intr_handle, void *cb_arg)
+mlx5_dev_interrupt_handler(void *cb_arg)
 {
 	struct rte_eth_dev *dev = cb_arg;
 	struct priv *priv = dev->data->dev_private;
 	int ret;
 
-	(void)intr_handle;
 	priv_lock(priv);
 	ret = priv_dev_link_status_handler(priv, dev);
 	priv_unlock(priv);
diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
index f8ed976..326043c 100644
--- a/drivers/net/nfp/nfp_net.c
+++ b/drivers/net/nfp/nfp_net.c
@@ -63,8 +63,7 @@
 /* Prototypes */
 static void nfp_net_close(struct rte_eth_dev *dev);
 static int nfp_net_configure(struct rte_eth_dev *dev);
-static void nfp_net_dev_interrupt_handler(struct rte_intr_handle *handle,
-					  void *param);
+static void nfp_net_dev_interrupt_handler(void *param);
 static void nfp_net_dev_interrupt_delayed_handler(void *param);
 static int nfp_net_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu);
 static void nfp_net_infos_get(struct rte_eth_dev *dev,
@@ -1303,8 +1302,7 @@ nfp_net_irq_unmask(struct rte_eth_dev *dev)
 }
 
 static void
-nfp_net_dev_interrupt_handler(__rte_unused struct rte_intr_handle *handle,
-			      void *param)
+nfp_net_dev_interrupt_handler(void *param)
 {
 	int64_t timeout;
 	struct rte_eth_link link;
diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index 0494dbd..ce10924 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -279,14 +279,14 @@ static void qede_interrupt_action(struct ecore_hwfn *p_hwfn)
 }
 
 static void
-qede_interrupt_handler(struct rte_intr_handle *handle, void *param)
+qede_interrupt_handler(void *param)
 {
 	struct rte_eth_dev *eth_dev = (struct rte_eth_dev *)param;
 	struct qede_dev *qdev = eth_dev->data->dev_private;
 	struct ecore_dev *edev = &qdev->edev;
 
 	qede_interrupt_action(ECORE_LEADING_HWFN(edev));
-	if (rte_intr_enable(handle))
+	if (rte_intr_enable(eth_dev->intr_handle))
 		DP_ERR(edev, "rte_intr_enable failed\n");
 }
 
diff --git a/drivers/net/sfc/sfc_intr.c b/drivers/net/sfc/sfc_intr.c
index d06980e..fa7cc3d 100644
--- a/drivers/net/sfc/sfc_intr.c
+++ b/drivers/net/sfc/sfc_intr.c
@@ -68,13 +68,14 @@ sfc_intr_handle_mgmt_evq(struct sfc_adapter *sa)
 }
 
 static void
-sfc_intr_line_handler(struct rte_intr_handle *intr_handle, void *cb_arg)
+sfc_intr_line_handler(void *cb_arg)
 {
 	struct sfc_adapter *sa = (struct sfc_adapter *)cb_arg;
 	efx_nic_t *enp = sa->nic;
 	boolean_t fatal;
 	uint32_t qmask;
 	unsigned int lsc_seq = sa->port.lsc_seq;
+	struct rte_pci_device *pci_dev = SFC_DEV_TO_PCI(sa->eth_dev);
 
 	sfc_log_init(sa, "entry");
 
@@ -97,7 +98,7 @@ sfc_intr_line_handler(struct rte_intr_handle *intr_handle, void *cb_arg)
 	if (qmask & (1 << sa->mgmt_evq_index))
 		sfc_intr_handle_mgmt_evq(sa);
 
-	if (rte_intr_enable(intr_handle) != 0)
+	if (rte_intr_enable(&pci_dev->intr_handle) != 0)
 		sfc_err(sa, "cannot reenable interrupts");
 
 	sfc_log_init(sa, "done");
@@ -113,12 +114,13 @@ sfc_intr_line_handler(struct rte_intr_handle *intr_handle, void *cb_arg)
 }
 
 static void
-sfc_intr_message_handler(struct rte_intr_handle *intr_handle, void *cb_arg)
+sfc_intr_message_handler(void *cb_arg)
 {
 	struct sfc_adapter *sa = (struct sfc_adapter *)cb_arg;
 	efx_nic_t *enp = sa->nic;
 	boolean_t fatal;
 	unsigned int lsc_seq = sa->port.lsc_seq;
+	struct rte_pci_device *pci_dev = SFC_DEV_TO_PCI(sa->eth_dev);
 
 	sfc_log_init(sa, "entry");
 
@@ -139,7 +141,7 @@ sfc_intr_message_handler(struct rte_intr_handle *intr_handle, void *cb_arg)
 
 	sfc_intr_handle_mgmt_evq(sa);
 
-	if (rte_intr_enable(intr_handle) != 0)
+	if (rte_intr_enable(&pci_dev->intr_handle) != 0)
 		sfc_err(sa, "cannot reenable interrupts");
 
 	sfc_log_init(sa, "done");
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 4dc03b9..9033e7b 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1191,8 +1191,7 @@ virtio_negotiate_features(struct virtio_hw *hw, uint64_t req_features)
  * if link state changed.
  */
 static void
-virtio_interrupt_handler(struct rte_intr_handle *handle,
-			 void *param)
+virtio_interrupt_handler(void *param)
 {
 	struct rte_eth_dev *dev = param;
 	struct virtio_hw *hw = dev->data->dev_private;
@@ -1202,7 +1201,7 @@ virtio_interrupt_handler(struct rte_intr_handle *handle,
 	isr = vtpci_isr(hw);
 	PMD_DRV_LOG(INFO, "interrupt status = %#x", isr);
 
-	if (rte_intr_enable(handle) < 0)
+	if (rte_intr_enable(dev->intr_handle) < 0)
 		PMD_DRV_LOG(ERR, "interrupt enable failed");
 
 	if (isr & VIRTIO_PCI_ISR_CONFIG) {
diff --git a/lib/librte_eal/common/include/rte_interrupts.h b/lib/librte_eal/common/include/rte_interrupts.h
index 6cade01..5d06ed7 100644
--- a/lib/librte_eal/common/include/rte_interrupts.h
+++ b/lib/librte_eal/common/include/rte_interrupts.h
@@ -51,8 +51,7 @@ extern "C" {
 struct rte_intr_handle;
 
 /** Function to be registered for the specific interrupt */
-typedef void (*rte_intr_callback_fn)(struct rte_intr_handle *intr_handle,
-							void *cb_arg);
+typedef void (*rte_intr_callback_fn)(void *cb_arg);
 
 #include <exec-env/rte_interrupts.h>
 
diff --git a/lib/librte_eal/linuxapp/eal/eal_alarm.c b/lib/librte_eal/linuxapp/eal/eal_alarm.c
index 8b042ab..fbae461 100644
--- a/lib/librte_eal/linuxapp/eal/eal_alarm.c
+++ b/lib/librte_eal/linuxapp/eal/eal_alarm.c
@@ -83,7 +83,7 @@ static rte_spinlock_t alarm_list_lk = RTE_SPINLOCK_INITIALIZER;
 
 static struct rte_intr_handle intr_handle = {.fd = -1 };
 static int handler_registered = 0;
-static void eal_alarm_callback(struct rte_intr_handle *hdl, void *arg);
+static void eal_alarm_callback(void *arg);
 
 int
 rte_eal_alarm_init(void)
@@ -102,8 +102,7 @@ rte_eal_alarm_init(void)
 }
 
 static void
-eal_alarm_callback(struct rte_intr_handle *hdl __rte_unused,
-		void *arg __rte_unused)
+eal_alarm_callback(void *arg __rte_unused)
 {
 	struct timespec now;
 	struct alarm_entry *ap;
diff --git a/lib/librte_eal/linuxapp/eal/eal_interrupts.c b/lib/librte_eal/linuxapp/eal/eal_interrupts.c
index 1716d68..f175aca 100644
--- a/lib/librte_eal/linuxapp/eal/eal_interrupts.c
+++ b/lib/librte_eal/linuxapp/eal/eal_interrupts.c
@@ -729,8 +729,7 @@ eal_intr_process_interrupts(struct epoll_event *events, int nfds)
 				rte_spinlock_unlock(&intr_lock);
 
 				/* call the actual callback */
-				active_cb.cb_fn(&src->intr_handle,
-					active_cb.cb_arg);
+				active_cb.cb_fn(active_cb.cb_arg);
 
 				/*get the lock back. */
 				rte_spinlock_lock(&intr_lock);
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2017-04-04 14:58 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-31  2:09 [PATCH v3 0/2] clean up interrupt handle Qi Zhang
2017-03-31  2:09 ` [PATCH v3 1/2] eal: " Qi Zhang
2017-03-31  2:09 ` [PATCH v3 2/2] app/test: update test code Qi Zhang
2017-04-04 10:12 ` [PATCH v3 0/2] clean up interrupt handle Thomas Monjalon
2017-04-04 12:41   ` Zhang, Qi Z
2017-04-04 21:21 ` [PATCH v4 " Qi Zhang
2017-04-04 21:21   ` [PATCH v4 1/2] vfio: keep interrupt source read only Qi Zhang
2017-04-04 21:21   ` [PATCH v4 2/2] eal: clean up interrupt handle Qi Zhang
2017-04-04 13:54     ` Shahaf Shuler
2017-04-04 14:23       ` Zhang, Qi Z
2017-04-04 22:27   ` [PATCH v5 0/2] " Qi Zhang
2017-04-04 14:50     ` Thomas Monjalon
2017-04-04 14:58       ` Zhang, Qi Z
2017-04-04 22:27     ` [PATCH v5 1/2] vfio: keep interrupt source read only Qi Zhang
2017-04-04 22:27     ` [PATCH v5 2/2] eal: clean up interrupt handle Qi Zhang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.