patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH] net/iavf: replace event interrupt by alarm
@ 2021-07-14  0:23 Jingjing Wu
  2021-07-14  2:17 ` Xing, Beilei
  0 siblings, 1 reply; 2+ messages in thread
From: Jingjing Wu @ 2021-07-14  0:23 UTC (permalink / raw)
  To: beilei.xing; +Cc: stable, jingjing.wu

To support environment without MSI/MSIX interrupt support,
and reduce the performance impact when internal rx interrupt
and adminq interrupt share the same source, the patch removes
the interrupt handler, replace it with a low frequency interrupt
polling daemon which is implemented by registering a alarm
callback periodly.

Fixes: 22b123a36d07 ("net/avf: initialize PMD")

Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
---
 drivers/net/iavf/iavf_ethdev.c | 29 +++++++++++++----------------
 1 file changed, 13 insertions(+), 16 deletions(-)

diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
index 649061d2ba..4671add0bb 100644
--- a/drivers/net/iavf/iavf_ethdev.c
+++ b/drivers/net/iavf/iavf_ethdev.c
@@ -18,6 +18,7 @@
 #include <rte_pci.h>
 #include <rte_atomic.h>
 #include <rte_eal.h>
+#include <rte_alarm.h>
 #include <rte_ether.h>
 #include <rte_ethdev_driver.h>
 #include <rte_ethdev_pci.h>
@@ -33,6 +34,8 @@
 /* devargs */
 #define IAVF_PROTO_XTR_ARG         "proto_xtr"
 
+#define IAVF_ALARM_INTERVAL       50000 /* us */
+
 static const char * const iavf_valid_args[] = {
 	IAVF_PROTO_XTR_ARG,
 	NULL
@@ -729,6 +732,9 @@ iavf_dev_stop(struct rte_eth_dev *dev)
 
 	PMD_INIT_FUNC_TRACE();
 
+	if (dev->data->dev_conf.intr_conf.rxq != 0)
+		rte_intr_disable(intr_handle);
+
 	if (adapter->stopped == 1)
 		return 0;
 
@@ -1902,7 +1908,7 @@ iavf_disable_irq0(struct iavf_hw *hw)
 }
 
 static void
-iavf_dev_interrupt_handler(void *param)
+iavf_dev_alarm_handler(void *param)
 {
 	struct rte_eth_dev *dev = (struct rte_eth_dev *)param;
 	struct iavf_hw *hw = IAVF_DEV_PRIVATE_TO_HW(dev->data->dev_private);
@@ -1912,6 +1918,8 @@ iavf_dev_interrupt_handler(void *param)
 	iavf_handle_virtchnl_msg(dev);
 
 	iavf_enable_irq0(hw);
+
+	rte_eal_alarm_set(IAVF_ALARM_INTERVAL, iavf_dev_alarm_handler, dev);
 }
 
 static int
@@ -2012,14 +2020,8 @@ iavf_dev_init(struct rte_eth_dev *eth_dev)
 	rte_ether_addr_copy((struct rte_ether_addr *)hw->mac.addr,
 			&eth_dev->data->mac_addrs[0]);
 
-	/* register callback func to eal lib */
-	rte_intr_callback_register(&pci_dev->intr_handle,
-				   iavf_dev_interrupt_handler,
-				   (void *)eth_dev);
-
-	/* enable uio intr after callback register */
-	rte_intr_enable(&pci_dev->intr_handle);
-
+	rte_eal_alarm_set(IAVF_ALARM_INTERVAL,
+			  iavf_dev_alarm_handler, eth_dev);
 	/* configure and enable device interrupt */
 	iavf_enable_irq0(hw);
 
@@ -2036,8 +2038,6 @@ static int
 iavf_dev_close(struct rte_eth_dev *dev)
 {
 	struct iavf_hw *hw = IAVF_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
-	struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
 	struct iavf_adapter *adapter =
 		IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
 	struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
@@ -2060,14 +2060,11 @@ iavf_dev_close(struct rte_eth_dev *dev)
 		iavf_config_promisc(adapter, false, false);
 
 	iavf_shutdown_adminq(hw);
-	/* disable uio intr before callback unregister */
-	rte_intr_disable(intr_handle);
 
-	/* unregister callback func from eal lib */
-	rte_intr_callback_unregister(intr_handle,
-				     iavf_dev_interrupt_handler, dev);
 	iavf_disable_irq0(hw);
 
+	rte_eal_alarm_cancel(iavf_dev_alarm_handler, dev);
+
 	if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_RSS_PF) {
 		if (vf->rss_lut) {
 			rte_free(vf->rss_lut);
-- 
2.21.1


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

* Re: [dpdk-stable] [PATCH] net/iavf: replace event interrupt by alarm
  2021-07-14  0:23 [dpdk-stable] [PATCH] net/iavf: replace event interrupt by alarm Jingjing Wu
@ 2021-07-14  2:17 ` Xing, Beilei
  0 siblings, 0 replies; 2+ messages in thread
From: Xing, Beilei @ 2021-07-14  2:17 UTC (permalink / raw)
  To: Wu, Jingjing; +Cc: stable

Please hold on. Need more verification.

BR,
Beilei

> -----Original Message-----
> From: Wu, Jingjing <jingjing.wu@intel.com>
> Sent: Wednesday, July 14, 2021 8:23 AM
> To: Xing, Beilei <beilei.xing@intel.com>
> Cc: stable@dpdk.org; Wu, Jingjing <jingjing.wu@intel.com>
> Subject: [PATCH] net/iavf: replace event interrupt by alarm
> 
> To support environment without MSI/MSIX interrupt support, and reduce
> the performance impact when internal rx interrupt and adminq interrupt
> share the same source, the patch removes the interrupt handler, replace it
> with a low frequency interrupt polling daemon which is implemented by
> registering a alarm callback periodly.
> 
> Fixes: 22b123a36d07 ("net/avf: initialize PMD")
> 
> Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
> ---
>  drivers/net/iavf/iavf_ethdev.c | 29 +++++++++++++----------------
>  1 file changed, 13 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
> index 649061d2ba..4671add0bb 100644
> --- a/drivers/net/iavf/iavf_ethdev.c
> +++ b/drivers/net/iavf/iavf_ethdev.c
> @@ -18,6 +18,7 @@
>  #include <rte_pci.h>
>  #include <rte_atomic.h>
>  #include <rte_eal.h>
> +#include <rte_alarm.h>
>  #include <rte_ether.h>
>  #include <rte_ethdev_driver.h>
>  #include <rte_ethdev_pci.h>
> @@ -33,6 +34,8 @@
>  /* devargs */
>  #define IAVF_PROTO_XTR_ARG         "proto_xtr"
> 
> +#define IAVF_ALARM_INTERVAL       50000 /* us */
> +
>  static const char * const iavf_valid_args[] = {
>  	IAVF_PROTO_XTR_ARG,
>  	NULL
> @@ -729,6 +732,9 @@ iavf_dev_stop(struct rte_eth_dev *dev)
> 
>  	PMD_INIT_FUNC_TRACE();
> 
> +	if (dev->data->dev_conf.intr_conf.rxq != 0)
> +		rte_intr_disable(intr_handle);
> +
>  	if (adapter->stopped == 1)
>  		return 0;
> 
> @@ -1902,7 +1908,7 @@ iavf_disable_irq0(struct iavf_hw *hw)  }
> 
>  static void
> -iavf_dev_interrupt_handler(void *param)
> +iavf_dev_alarm_handler(void *param)
>  {
>  	struct rte_eth_dev *dev = (struct rte_eth_dev *)param;
>  	struct iavf_hw *hw = IAVF_DEV_PRIVATE_TO_HW(dev->data-
> >dev_private);
> @@ -1912,6 +1918,8 @@ iavf_dev_interrupt_handler(void *param)
>  	iavf_handle_virtchnl_msg(dev);
> 
>  	iavf_enable_irq0(hw);
> +
> +	rte_eal_alarm_set(IAVF_ALARM_INTERVAL, iavf_dev_alarm_handler,
> dev);
>  }
> 
>  static int
> @@ -2012,14 +2020,8 @@ iavf_dev_init(struct rte_eth_dev *eth_dev)
>  	rte_ether_addr_copy((struct rte_ether_addr *)hw->mac.addr,
>  			&eth_dev->data->mac_addrs[0]);
> 
> -	/* register callback func to eal lib */
> -	rte_intr_callback_register(&pci_dev->intr_handle,
> -				   iavf_dev_interrupt_handler,
> -				   (void *)eth_dev);
> -
> -	/* enable uio intr after callback register */
> -	rte_intr_enable(&pci_dev->intr_handle);
> -
> +	rte_eal_alarm_set(IAVF_ALARM_INTERVAL,
> +			  iavf_dev_alarm_handler, eth_dev);
>  	/* configure and enable device interrupt */
>  	iavf_enable_irq0(hw);
> 
> @@ -2036,8 +2038,6 @@ static int
>  iavf_dev_close(struct rte_eth_dev *dev)  {
>  	struct iavf_hw *hw = IAVF_DEV_PRIVATE_TO_HW(dev->data-
> >dev_private);
> -	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
> -	struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
>  	struct iavf_adapter *adapter =
>  		IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
>  	struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(dev->data-
> >dev_private);
> @@ -2060,14 +2060,11 @@ iavf_dev_close(struct rte_eth_dev *dev)
>  		iavf_config_promisc(adapter, false, false);
> 
>  	iavf_shutdown_adminq(hw);
> -	/* disable uio intr before callback unregister */
> -	rte_intr_disable(intr_handle);
> 
> -	/* unregister callback func from eal lib */
> -	rte_intr_callback_unregister(intr_handle,
> -				     iavf_dev_interrupt_handler, dev);
>  	iavf_disable_irq0(hw);
> 
> +	rte_eal_alarm_cancel(iavf_dev_alarm_handler, dev);
> +
>  	if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_RSS_PF) {
>  		if (vf->rss_lut) {
>  			rte_free(vf->rss_lut);
> --
> 2.21.1


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

end of thread, other threads:[~2021-07-14  2:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-14  0:23 [dpdk-stable] [PATCH] net/iavf: replace event interrupt by alarm Jingjing Wu
2021-07-14  2:17 ` 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).