patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Jingjing Wu <jingjing.wu@intel.com>
To: beilei.xing@intel.com
Cc: stable@dpdk.org, jingjing.wu@intel.com
Subject: [dpdk-stable] [PATCH] net/iavf: replace event interrupt by alarm
Date: Wed, 14 Jul 2021 08:23:19 +0800	[thread overview]
Message-ID: <20210714002319.22572-1-jingjing.wu@intel.com> (raw)

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


             reply	other threads:[~2021-07-13 16:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-14  0:23 Jingjing Wu [this message]
2021-07-14  2:17 ` Xing, Beilei

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210714002319.22572-1-jingjing.wu@intel.com \
    --to=jingjing.wu@intel.com \
    --cc=beilei.xing@intel.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).