DPDK patches and discussions
 help / color / mirror / Atom feed
From: wangyunjian <wangyunjian@huawei.com>
To: <dev@dpdk.org>
Cc: <caihe@huawei.com>, Yunjian Wang <wangyunjian@huawei.com>
Subject: [dpdk-dev] [PATCH v3] net/i40e: fix intr callback unregister by adding retry
Date: Wed, 14 Mar 2018 20:02:02 +0800	[thread overview]
Message-ID: <1521028922-12664-1-git-send-email-wangyunjian@huawei.com> (raw)

From: Yunjian Wang <wangyunjian@huawei.com>

The nic's interrupt source has some active callbacks, when
the port hotplug. Add a retry to give more port's a chance
to uninit before returning an error.

Fixes: d42aaf30008b ("i40e: support port hotplug")

Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
---
v2:
* Fix return value check
---
v3:
* Fix comment suggested by Kirill Rybalchenko
---
 drivers/net/i40e/i40e_ethdev.c | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 508b417..6bb31f6 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -1533,6 +1533,7 @@ void i40e_flex_payload_reg_set_default(struct i40e_hw *hw)
 	struct rte_flow *p_flow;
 	int ret;
 	uint8_t aq_fail = 0;
+	int retries = 0;
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -1574,9 +1575,20 @@ void i40e_flex_payload_reg_set_default(struct i40e_hw *hw)
 	/* disable uio intr before callback unregister */
 	rte_intr_disable(intr_handle);
 
-	/* register callback func to eal lib */
-	rte_intr_callback_unregister(intr_handle,
-				     i40e_dev_interrupt_handler, dev);
+	/* 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(100);
+	} while (retries++ < 5);
 
 	i40e_rm_ethtype_filter_list(pf);
 	i40e_rm_tunnel_filter_list(pf);
-- 
1.8.3.1

             reply	other threads:[~2018-03-14 12:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-14 12:02 wangyunjian [this message]
2018-03-14 12:07 ` Rybalchenko, Kirill
2018-03-14 13:41   ` Zhang, Qi Z
2018-03-20  2:57     ` wangyunjian
2018-03-20  3:27       ` Zhang, Qi Z
2018-03-20  6:59         ` wangyunjian

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=1521028922-12664-1-git-send-email-wangyunjian@huawei.com \
    --to=wangyunjian@huawei.com \
    --cc=caihe@huawei.com \
    --cc=dev@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).