DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/i40e: remove PF interrupt handler
@ 2018-07-26  5:14 Beilei Xing
  2018-07-27  1:36 ` [dpdk-dev] [PATCH v2] net/i40e: remove PF interrupt handler for multi-driver Beilei Xing
  0 siblings, 1 reply; 6+ messages in thread
From: Beilei Xing @ 2018-07-26  5:14 UTC (permalink / raw)
  To: qi.z.zhang; +Cc: dev, dhanya.r.pillai

Internal Rx interrupt/LSC/adminq share the same source,
that will casue lots of CPU cycles wasted during receiving
packets. So remove the PF interrupt handler just like i40e
VF.

Signed-off-by: Beilei Xing <beilei.xing@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c | 64 +++++++++++-------------------------------
 1 file changed, 17 insertions(+), 47 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index a340540..618b8d4 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -289,7 +289,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(void *param);
+static void i40e_dev_alarm_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);
@@ -1189,11 +1189,12 @@ i40e_aq_debug_write_global_register(struct i40e_hw *hw,
 	return i40e_aq_debug_write_register(hw, reg_addr, reg_val, cmd_details);
 }
 
+#define I40E_ALARM_INTERVAL 50000 /* us */
+
 static int
 eth_i40e_dev_init(struct rte_eth_dev *dev, void *init_params __rte_unused)
 {
 	struct rte_pci_device *pci_dev;
-	struct rte_intr_handle *intr_handle;
 	struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
 	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	struct i40e_vsi *vsi;
@@ -1218,7 +1219,6 @@ eth_i40e_dev_init(struct rte_eth_dev *dev, void *init_params __rte_unused)
 	}
 	i40e_set_default_ptype_table(dev);
 	pci_dev = RTE_ETH_DEV_TO_PCI(dev);
-	intr_handle = &pci_dev->intr_handle;
 
 	rte_eth_copy_pci_info(dev, pci_dev);
 
@@ -1450,16 +1450,12 @@ eth_i40e_dev_init(struct rte_eth_dev *dev, void *init_params __rte_unused)
 	/* initialize pf host driver to setup SRIOV resource if applicable */
 	i40e_pf_host_init(dev);
 
-	/* register callback func to eal lib */
-	rte_intr_callback_register(intr_handle,
-				   i40e_dev_interrupt_handler, dev);
-
 	/* configure and enable device interrupt */
 	i40e_pf_config_irq0(hw, TRUE);
 	i40e_pf_enable_irq0(hw);
 
-	/* enable uio intr after callback register */
-	rte_intr_enable(intr_handle);
+	rte_eal_alarm_set(I40E_ALARM_INTERVAL,
+			  i40e_dev_alarm_handler, dev);
 
 	/* By default disable flexible payload in global configuration */
 	if (!pf->support_multi_driver)
@@ -1604,14 +1600,11 @@ static int
 eth_i40e_dev_uninit(struct rte_eth_dev *dev)
 {
 	struct i40e_pf *pf;
-	struct rte_pci_device *pci_dev;
-	struct rte_intr_handle *intr_handle;
 	struct i40e_hw *hw;
 	struct i40e_filter_control_settings settings;
 	struct rte_flow *p_flow;
 	int ret;
 	uint8_t aq_fail = 0;
-	int retries = 0;
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -1620,8 +1613,6 @@ eth_i40e_dev_uninit(struct rte_eth_dev *dev)
 
 	pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
 	hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-	pci_dev = RTE_ETH_DEV_TO_PCI(dev);
-	intr_handle = &pci_dev->intr_handle;
 
 	ret = rte_eth_switch_domain_free(pf->switch_domain_id);
 	if (ret)
@@ -1654,23 +1645,7 @@ eth_i40e_dev_uninit(struct rte_eth_dev *dev)
 	rte_free(dev->data->mac_addrs);
 	dev->data->mac_addrs = NULL;
 
-	/* disable uio intr before callback unregister */
-	rte_intr_disable(intr_handle);
-
-	/* unregister callback func to eal lib */
-	do {
-		ret = rte_intr_callback_unregister(intr_handle,
-				i40e_dev_interrupt_handler, dev);
-		if (ret >= 0) {
-			break;
-		} else if (ret != -EAGAIN) {
-			PMD_INIT_LOG(ERR,
-				 "intr callback unregister failed: %d",
-				 ret);
-			return ret;
-		}
-		i40e_msec_delay(500);
-	} while (retries++ < 5);
+	rte_eal_alarm_cancel(i40e_dev_alarm_handler, dev);
 
 	i40e_rm_ethtype_filter_list(pf);
 	i40e_rm_tunnel_filter_list(pf);
@@ -2161,7 +2136,8 @@ i40e_dev_start(struct rte_eth_dev *dev)
 		return -EINVAL;
 	}
 
-	rte_intr_disable(intr_handle);
+	if (dev->data->dev_conf.intr_conf.rxq != 0)
+		rte_intr_disable(intr_handle);
 
 	if ((rte_intr_cap_multiple(intr_handle) ||
 	     !RTE_ETH_DEV_SRIOV(dev).active) &&
@@ -2259,9 +2235,8 @@ i40e_dev_start(struct rte_eth_dev *dev)
 	}
 
 	if (!rte_intr_allow_others(intr_handle)) {
-		rte_intr_callback_unregister(intr_handle,
-					     i40e_dev_interrupt_handler,
-					     (void *)dev);
+		rte_eal_alarm_cancel(i40e_dev_alarm_handler, dev);
+
 		/* configure and enable device interrupt */
 		i40e_pf_config_irq0(hw, FALSE);
 		i40e_pf_enable_irq0(hw);
@@ -2281,8 +2256,8 @@ i40e_dev_start(struct rte_eth_dev *dev)
 		i40e_dev_link_update(dev, 0);
 	}
 
-	/* enable uio intr after callback register */
-	rte_intr_enable(intr_handle);
+	if (dev->data->dev_conf.intr_conf.rxq != 0)
+		rte_intr_enable(intr_handle);
 
 	i40e_filter_restore(pf);
 
@@ -2334,12 +2309,6 @@ i40e_dev_stop(struct rte_eth_dev *dev)
 	/* Set link down */
 	i40e_dev_set_link_down(dev);
 
-	if (!rte_intr_allow_others(intr_handle))
-		/* resume to the default handler */
-		rte_intr_callback_register(intr_handle,
-					   i40e_dev_interrupt_handler,
-					   (void *)dev);
-
 	/* Clean datapath event and queue/vec mapping */
 	rte_intr_efd_disable(intr_handle);
 	if (intr_handle->intr_vec) {
@@ -2392,7 +2361,8 @@ i40e_dev_close(struct rte_eth_dev *dev)
 
 	/* Disable interrupt */
 	i40e_pf_disable_irq0(hw);
-	rte_intr_disable(intr_handle);
+	if (dev->data->dev_conf.intr_conf.rxq != 0)
+		rte_intr_disable(intr_handle);
 
 	i40e_fdir_teardown(pf);
 
@@ -6488,7 +6458,7 @@ i40e_dev_handle_aq_msg(struct rte_eth_dev *dev)
  *  void
  */
 static void
-i40e_dev_interrupt_handler(void *param)
+i40e_dev_alarm_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);
@@ -6532,7 +6502,8 @@ i40e_dev_interrupt_handler(void *param)
 done:
 	/* Enable interrupt */
 	i40e_pf_enable_irq0(hw);
-	rte_intr_enable(dev->intr_handle);
+	rte_eal_alarm_set(I40E_ALARM_INTERVAL,
+			  i40e_dev_alarm_handler, dev);
 }
 
 int
@@ -11419,7 +11390,6 @@ i40e_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id)
 			       I40E_PFINT_DYN_CTLN_ITR_INDX_MASK);
 
 	I40E_WRITE_FLUSH(hw);
-	rte_intr_enable(&pci_dev->intr_handle);
 
 	return 0;
 }
-- 
2.5.5

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

* [dpdk-dev] [PATCH v2] net/i40e: remove PF interrupt handler for multi-driver
  2018-07-26  5:14 [dpdk-dev] [PATCH] net/i40e: remove PF interrupt handler Beilei Xing
@ 2018-07-27  1:36 ` Beilei Xing
  2018-09-11  3:35   ` [dpdk-dev] [PATCH v3] net/i40e: add alarm handler Beilei Xing
  0 siblings, 1 reply; 6+ messages in thread
From: Beilei Xing @ 2018-07-27  1:36 UTC (permalink / raw)
  To: qi.z.zhang; +Cc: dev, dhanya.r.pillai

When multi-dirver is enabled, internal Rx interrupt/LSC/adminq
share the same source, that will cause lots of CPU cycles wasted
during receiving packets. So remove the PF interrupt handler
only when multi-driver is enabled.

Signed-off-by: Beilei Xing <beilei.xing@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c | 130 +++++++++++++++++++++++++++++++----------
 1 file changed, 99 insertions(+), 31 deletions(-)

v2 changes:
 - Remove PF interrupt handler only when multi-driver is enabled.

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index a340540..6c50c9f 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -290,6 +290,7 @@ static void i40e_stat_update_48(struct i40e_hw *hw,
 			       uint64_t *stat);
 static void i40e_pf_config_irq0(struct i40e_hw *hw, bool no_queue);
 static void i40e_dev_interrupt_handler(void *param);
+static void i40e_dev_alarm_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);
@@ -1189,6 +1190,8 @@ i40e_aq_debug_write_global_register(struct i40e_hw *hw,
 	return i40e_aq_debug_write_register(hw, reg_addr, reg_val, cmd_details);
 }
 
+#define I40E_ALARM_INTERVAL 50000 /* us */
+
 static int
 eth_i40e_dev_init(struct rte_eth_dev *dev, void *init_params __rte_unused)
 {
@@ -1450,16 +1453,20 @@ eth_i40e_dev_init(struct rte_eth_dev *dev, void *init_params __rte_unused)
 	/* initialize pf host driver to setup SRIOV resource if applicable */
 	i40e_pf_host_init(dev);
 
-	/* register callback func to eal lib */
-	rte_intr_callback_register(intr_handle,
-				   i40e_dev_interrupt_handler, dev);
-
 	/* configure and enable device interrupt */
 	i40e_pf_config_irq0(hw, TRUE);
 	i40e_pf_enable_irq0(hw);
 
-	/* enable uio intr after callback register */
-	rte_intr_enable(intr_handle);
+	if (!pf->support_multi_driver) {
+		/* register callback func to eal lib */
+		rte_intr_callback_register(intr_handle,
+					   i40e_dev_interrupt_handler, dev);
+		/* enable uio intr after callback register */
+		rte_intr_enable(intr_handle);
+	} else {
+		rte_eal_alarm_set(I40E_ALARM_INTERVAL,
+				  i40e_dev_alarm_handler, dev);
+	}
 
 	/* By default disable flexible payload in global configuration */
 	if (!pf->support_multi_driver)
@@ -1654,23 +1661,27 @@ eth_i40e_dev_uninit(struct rte_eth_dev *dev)
 	rte_free(dev->data->mac_addrs);
 	dev->data->mac_addrs = NULL;
 
-	/* disable uio intr before callback unregister */
-	rte_intr_disable(intr_handle);
-
-	/* unregister callback func to eal lib */
-	do {
-		ret = rte_intr_callback_unregister(intr_handle,
-				i40e_dev_interrupt_handler, dev);
-		if (ret >= 0) {
-			break;
-		} else if (ret != -EAGAIN) {
-			PMD_INIT_LOG(ERR,
-				 "intr callback unregister failed: %d",
-				 ret);
-			return ret;
-		}
-		i40e_msec_delay(500);
-	} while (retries++ < 5);
+	if (!pf->support_multi_driver) {
+		/* disable uio intr before callback unregister */
+		rte_intr_disable(intr_handle);
+
+		/* unregister callback func to eal lib */
+		do {
+			ret = rte_intr_callback_unregister(intr_handle,
+					   i40e_dev_interrupt_handler, dev);
+			if (ret >= 0) {
+				break;
+			} else if (ret != -EAGAIN) {
+				PMD_INIT_LOG(ERR,
+					     "intr callback unregister failed: %d",
+					     ret);
+				return ret;
+			}
+			i40e_msec_delay(500);
+		} while (retries++ < 5);
+	} else {
+		rte_eal_alarm_cancel(i40e_dev_alarm_handler, dev);
+	}
 
 	i40e_rm_ethtype_filter_list(pf);
 	i40e_rm_tunnel_filter_list(pf);
@@ -2161,7 +2172,8 @@ i40e_dev_start(struct rte_eth_dev *dev)
 		return -EINVAL;
 	}
 
-	rte_intr_disable(intr_handle);
+	if (!pf->support_multi_driver || dev->data->dev_conf.intr_conf.rxq != 0)
+		rte_intr_disable(intr_handle);
 
 	if ((rte_intr_cap_multiple(intr_handle) ||
 	     !RTE_ETH_DEV_SRIOV(dev).active) &&
@@ -2259,9 +2271,12 @@ i40e_dev_start(struct rte_eth_dev *dev)
 	}
 
 	if (!rte_intr_allow_others(intr_handle)) {
-		rte_intr_callback_unregister(intr_handle,
-					     i40e_dev_interrupt_handler,
-					     (void *)dev);
+		if (!pf->support_multi_driver)
+			rte_intr_callback_unregister(intr_handle,
+						     i40e_dev_interrupt_handler,
+						     (void *)dev);
+		else
+			rte_eal_alarm_cancel(i40e_dev_alarm_handler, dev);
 		/* configure and enable device interrupt */
 		i40e_pf_config_irq0(hw, FALSE);
 		i40e_pf_enable_irq0(hw);
@@ -2282,7 +2297,8 @@ i40e_dev_start(struct rte_eth_dev *dev)
 	}
 
 	/* enable uio intr after callback register */
-	rte_intr_enable(intr_handle);
+	if (!pf->support_multi_driver || dev->data->dev_conf.intr_conf.rxq != 0)
+		rte_intr_enable(intr_handle);
 
 	i40e_filter_restore(pf);
 
@@ -2334,7 +2350,7 @@ i40e_dev_stop(struct rte_eth_dev *dev)
 	/* Set link down */
 	i40e_dev_set_link_down(dev);
 
-	if (!rte_intr_allow_others(intr_handle))
+	if (!pf->support_multi_driver && !rte_intr_allow_others(intr_handle))
 		/* resume to the default handler */
 		rte_intr_callback_register(intr_handle,
 					   i40e_dev_interrupt_handler,
@@ -2392,7 +2408,8 @@ i40e_dev_close(struct rte_eth_dev *dev)
 
 	/* Disable interrupt */
 	i40e_pf_disable_irq0(hw);
-	rte_intr_disable(intr_handle);
+	if (!pf->support_multi_driver || dev->data->dev_conf.intr_conf.rxq != 0)
+		rte_intr_disable(intr_handle);
 
 	i40e_fdir_teardown(pf);
 
@@ -6535,6 +6552,55 @@ i40e_dev_interrupt_handler(void *param)
 	rte_intr_enable(dev->intr_handle);
 }
 
+static void
+i40e_dev_alarm_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);
+	uint32_t icr0;
+
+	/* Disable interrupt */
+	i40e_pf_disable_irq0(hw);
+
+	/* read out interrupt causes */
+	icr0 = I40E_READ_REG(hw, I40E_PFINT_ICR0);
+
+	/* No interrupt event indicated */
+	if (!(icr0 & I40E_PFINT_ICR0_INTEVENT_MASK)) {
+		PMD_DRV_LOG(INFO, "No interrupt event");
+		goto done;
+	}
+	if (icr0 & I40E_PFINT_ICR0_ECC_ERR_MASK)
+		PMD_DRV_LOG(ERR, "ICR0: unrecoverable ECC error");
+	if (icr0 & I40E_PFINT_ICR0_MAL_DETECT_MASK)
+		PMD_DRV_LOG(ERR, "ICR0: malicious programming detected");
+	if (icr0 & I40E_PFINT_ICR0_GRST_MASK)
+		PMD_DRV_LOG(INFO, "ICR0: global reset requested");
+	if (icr0 & I40E_PFINT_ICR0_PCI_EXCEPTION_MASK)
+		PMD_DRV_LOG(INFO, "ICR0: PCI exception activated");
+	if (icr0 & I40E_PFINT_ICR0_STORM_DETECT_MASK)
+		PMD_DRV_LOG(INFO, "ICR0: a change in the storm control state");
+	if (icr0 & I40E_PFINT_ICR0_HMC_ERR_MASK)
+		PMD_DRV_LOG(ERR, "ICR0: HMC error");
+	if (icr0 & I40E_PFINT_ICR0_PE_CRITERR_MASK)
+		PMD_DRV_LOG(ERR, "ICR0: protocol engine critical error");
+
+	if (icr0 & I40E_PFINT_ICR0_VFLR_MASK) {
+		PMD_DRV_LOG(INFO, "ICR0: VF reset detected");
+		i40e_dev_handle_vfr_event(dev);
+	}
+	if (icr0 & I40E_PFINT_ICR0_ADMINQ_MASK) {
+		PMD_DRV_LOG(INFO, "ICR0: adminq event");
+		i40e_dev_handle_aq_msg(dev);
+	}
+
+done:
+	/* Enable interrupt */
+	i40e_pf_enable_irq0(hw);
+	rte_eal_alarm_set(I40E_ALARM_INTERVAL,
+			  i40e_dev_alarm_handler, dev);
+}
+
 int
 i40e_add_macvlan_filters(struct i40e_vsi *vsi,
 			 struct i40e_macvlan_filter *filter,
@@ -11402,6 +11468,7 @@ i40e_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id)
 	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
 	struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
 	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
 	uint16_t msix_intr;
 
 	msix_intr = intr_handle->intr_vec[queue_id];
@@ -11419,7 +11486,8 @@ i40e_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id)
 			       I40E_PFINT_DYN_CTLN_ITR_INDX_MASK);
 
 	I40E_WRITE_FLUSH(hw);
-	rte_intr_enable(&pci_dev->intr_handle);
+	if (!pf->support_multi_driver)
+		rte_intr_enable(&pci_dev->intr_handle);
 
 	return 0;
 }
-- 
2.5.5

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

* [dpdk-dev] [PATCH v3] net/i40e: add alarm handler
  2018-07-27  1:36 ` [dpdk-dev] [PATCH v2] net/i40e: remove PF interrupt handler for multi-driver Beilei Xing
@ 2018-09-11  3:35   ` Beilei Xing
  2018-09-11 13:04     ` Zhang, Qi Z
  2018-09-17 11:07     ` Ferruh Yigit
  0 siblings, 2 replies; 6+ messages in thread
From: Beilei Xing @ 2018-09-11  3:35 UTC (permalink / raw)
  To: qi.z.zhang; +Cc: dev

This patch adds alarm handler, and then i40e
PF will use alarm handler instead of interrupt
handler when device is started and Rx interrupt
mode is disabled. This way will save CPU cycles
during receiving packets.

Signed-off-by: Beilei Xing <beilei.xing@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c | 67 ++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 65 insertions(+), 2 deletions(-)

v3 changes:
 - Replace interrupt handler with alarm handler when device is started.
v2 changes:
 - Remove PF interrupt handler only when multi-driver is enabled.

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 85a6a86..31b5a49 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -292,6 +292,7 @@ static void i40e_stat_update_48(struct i40e_hw *hw,
 			       uint64_t *stat);
 static void i40e_pf_config_irq0(struct i40e_hw *hw, bool no_queue);
 static void i40e_dev_interrupt_handler(void *param);
+static void i40e_dev_alarm_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);
@@ -1201,6 +1202,8 @@ i40e_aq_debug_write_global_register(struct i40e_hw *hw,
 	return i40e_aq_debug_write_register(hw, reg_addr, reg_val, cmd_details);
 }
 
+#define I40E_ALARM_INTERVAL 50000 /* us */
+
 static int
 eth_i40e_dev_init(struct rte_eth_dev *dev, void *init_params __rte_unused)
 {
@@ -2293,8 +2296,13 @@ i40e_dev_start(struct rte_eth_dev *dev)
 		i40e_dev_link_update(dev, 0);
 	}
 
-	/* enable uio intr after callback register */
-	rte_intr_enable(intr_handle);
+	if (dev->data->dev_conf.intr_conf.rxq == 0) {
+		rte_eal_alarm_set(I40E_ALARM_INTERVAL,
+				  i40e_dev_alarm_handler, dev);
+	} else {
+		/* enable uio intr after callback register */
+		rte_intr_enable(intr_handle);
+	}
 
 	i40e_filter_restore(pf);
 
@@ -2324,6 +2332,12 @@ i40e_dev_stop(struct rte_eth_dev *dev)
 
 	if (hw->adapter_stopped == 1)
 		return;
+
+	if (dev->data->dev_conf.intr_conf.rxq == 0) {
+		rte_eal_alarm_cancel(i40e_dev_alarm_handler, dev);
+		rte_intr_enable(intr_handle);
+	}
+
 	/* Disable all queues */
 	i40e_dev_switch_queues(pf, FALSE);
 
@@ -6552,6 +6566,55 @@ i40e_dev_interrupt_handler(void *param)
 	rte_intr_enable(dev->intr_handle);
 }
 
+static void
+i40e_dev_alarm_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);
+	uint32_t icr0;
+
+	/* Disable interrupt */
+	i40e_pf_disable_irq0(hw);
+
+	/* read out interrupt causes */
+	icr0 = I40E_READ_REG(hw, I40E_PFINT_ICR0);
+
+	/* No interrupt event indicated */
+	if (!(icr0 & I40E_PFINT_ICR0_INTEVENT_MASK)) {
+		PMD_DRV_LOG(INFO, "No interrupt event");
+		goto done;
+	}
+	if (icr0 & I40E_PFINT_ICR0_ECC_ERR_MASK)
+		PMD_DRV_LOG(ERR, "ICR0: unrecoverable ECC error");
+	if (icr0 & I40E_PFINT_ICR0_MAL_DETECT_MASK)
+		PMD_DRV_LOG(ERR, "ICR0: malicious programming detected");
+	if (icr0 & I40E_PFINT_ICR0_GRST_MASK)
+		PMD_DRV_LOG(INFO, "ICR0: global reset requested");
+	if (icr0 & I40E_PFINT_ICR0_PCI_EXCEPTION_MASK)
+		PMD_DRV_LOG(INFO, "ICR0: PCI exception activated");
+	if (icr0 & I40E_PFINT_ICR0_STORM_DETECT_MASK)
+		PMD_DRV_LOG(INFO, "ICR0: a change in the storm control state");
+	if (icr0 & I40E_PFINT_ICR0_HMC_ERR_MASK)
+		PMD_DRV_LOG(ERR, "ICR0: HMC error");
+	if (icr0 & I40E_PFINT_ICR0_PE_CRITERR_MASK)
+		PMD_DRV_LOG(ERR, "ICR0: protocol engine critical error");
+
+	if (icr0 & I40E_PFINT_ICR0_VFLR_MASK) {
+		PMD_DRV_LOG(INFO, "ICR0: VF reset detected");
+		i40e_dev_handle_vfr_event(dev);
+	}
+	if (icr0 & I40E_PFINT_ICR0_ADMINQ_MASK) {
+		PMD_DRV_LOG(INFO, "ICR0: adminq event");
+		i40e_dev_handle_aq_msg(dev);
+	}
+
+done:
+	/* Enable interrupt */
+	i40e_pf_enable_irq0(hw);
+	rte_eal_alarm_set(I40E_ALARM_INTERVAL,
+			  i40e_dev_alarm_handler, dev);
+}
+
 int
 i40e_add_macvlan_filters(struct i40e_vsi *vsi,
 			 struct i40e_macvlan_filter *filter,
-- 
2.5.5

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

* Re: [dpdk-dev] [PATCH v3] net/i40e: add alarm handler
  2018-09-11  3:35   ` [dpdk-dev] [PATCH v3] net/i40e: add alarm handler Beilei Xing
@ 2018-09-11 13:04     ` Zhang, Qi Z
  2018-09-17 11:07     ` Ferruh Yigit
  1 sibling, 0 replies; 6+ messages in thread
From: Zhang, Qi Z @ 2018-09-11 13:04 UTC (permalink / raw)
  To: Xing, Beilei; +Cc: dev

> -----Original Message-----
> From: Xing, Beilei
> Sent: Tuesday, September 11, 2018 11:36 AM
> To: Zhang, Qi Z <qi.z.zhang@intel.com>
> Cc: dev@dpdk.org
> Subject: [PATCH v3] net/i40e: add alarm handler
> 
> This patch adds alarm handler, and then i40e PF will use alarm handler instead
> of interrupt handler when device is started and Rx interrupt mode is disabled.
> This way will save CPU cycles during receiving packets.
> 
> Signed-off-by: Beilei Xing <beilei.xing@intel.com>

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

Applied to dpdk-next-net-intel.

Thanks
Qi

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

* Re: [dpdk-dev] [PATCH v3] net/i40e: add alarm handler
  2018-09-11  3:35   ` [dpdk-dev] [PATCH v3] net/i40e: add alarm handler Beilei Xing
  2018-09-11 13:04     ` Zhang, Qi Z
@ 2018-09-17 11:07     ` Ferruh Yigit
  2018-09-18  2:52       ` Xing, Beilei
  1 sibling, 1 reply; 6+ messages in thread
From: Ferruh Yigit @ 2018-09-17 11:07 UTC (permalink / raw)
  To: Beilei Xing, qi.z.zhang; +Cc: dev

On 9/11/2018 4:35 AM, Beilei Xing wrote:
> This patch adds alarm handler, and then i40e
> PF will use alarm handler instead of interrupt
> handler when device is started and Rx interrupt
> mode is disabled. This way will save CPU cycles
> during receiving packets.
> 
> Signed-off-by: Beilei Xing <beilei.xing@intel.com>

<...>

> +static void
> +i40e_dev_alarm_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);
> +	uint32_t icr0;
> +
> +	/* Disable interrupt */
> +	i40e_pf_disable_irq0(hw);
> +
> +	/* read out interrupt causes */
> +	icr0 = I40E_READ_REG(hw, I40E_PFINT_ICR0);
> +
> +	/* No interrupt event indicated */
> +	if (!(icr0 & I40E_PFINT_ICR0_INTEVENT_MASK)) {
> +		PMD_DRV_LOG(INFO, "No interrupt event");

Hi Beilei, Qi,

This prints an "info" level log each 50ms which makes console unusable.

This patch already merged in master repo.
So can you please send another patch to remove the log?

Thanks,
ferruh

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

* Re: [dpdk-dev] [PATCH v3] net/i40e: add alarm handler
  2018-09-17 11:07     ` Ferruh Yigit
@ 2018-09-18  2:52       ` Xing, Beilei
  0 siblings, 0 replies; 6+ messages in thread
From: Xing, Beilei @ 2018-09-18  2:52 UTC (permalink / raw)
  To: Yigit, Ferruh, Zhang, Qi Z; +Cc: dev


> -----Original Message-----
> From: Yigit, Ferruh
> Sent: Monday, September 17, 2018 7:08 PM
> To: Xing, Beilei <beilei.xing@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v3] net/i40e: add alarm handler
> 
> On 9/11/2018 4:35 AM, Beilei Xing wrote:
> > This patch adds alarm handler, and then i40e PF will use alarm handler
> > instead of interrupt handler when device is started and Rx interrupt
> > mode is disabled. This way will save CPU cycles during receiving
> > packets.
> >
> > Signed-off-by: Beilei Xing <beilei.xing@intel.com>
> 
> <...>
> 
> > +static void
> > +i40e_dev_alarm_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);
> > +	uint32_t icr0;
> > +
> > +	/* Disable interrupt */
> > +	i40e_pf_disable_irq0(hw);
> > +
> > +	/* read out interrupt causes */
> > +	icr0 = I40E_READ_REG(hw, I40E_PFINT_ICR0);
> > +
> > +	/* No interrupt event indicated */
> > +	if (!(icr0 & I40E_PFINT_ICR0_INTEVENT_MASK)) {
> > +		PMD_DRV_LOG(INFO, "No interrupt event");
> 
> Hi Beilei, Qi,
> 
> This prints an "info" level log each 50ms which makes console unusable.
> 
> This patch already merged in master repo.
> So can you please send another patch to remove the log?

OK. I will send another patch.

> 
> Thanks,
> ferruh

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

end of thread, other threads:[~2018-09-18  2:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-26  5:14 [dpdk-dev] [PATCH] net/i40e: remove PF interrupt handler Beilei Xing
2018-07-27  1:36 ` [dpdk-dev] [PATCH v2] net/i40e: remove PF interrupt handler for multi-driver Beilei Xing
2018-09-11  3:35   ` [dpdk-dev] [PATCH v3] net/i40e: add alarm handler Beilei Xing
2018-09-11 13:04     ` Zhang, Qi Z
2018-09-17 11:07     ` Ferruh Yigit
2018-09-18  2:52       ` Xing, Beilei

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).