DPDK patches and discussions
 help / color / mirror / Atom feed
From: Nithin Dabilpuram <ndabilpuram@marvell.com>
To: Jerin Jacob <jerinj@marvell.com>,
	Nithin Dabilpuram <ndabilpuram@marvell.com>
Cc: <dev@dpdk.org>
Subject: [dpdk-dev] [PATCH] common/octeontx2: retry intr callback unregister
Date: Thu, 11 Jun 2020 12:56:04 +0530	[thread overview]
Message-ID: <20200611072605.472-1-ndabilpuram@marvell.com> (raw)

Interrupt callback unregister can fail with -EAGAIN
when interrupt handler is active in interrupt thread.
Hence retry before reporting a failure or proceeding further.

Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
---
 drivers/common/octeontx2/otx2_irq.c | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/drivers/common/octeontx2/otx2_irq.c b/drivers/common/octeontx2/otx2_irq.c
index fa3206a..c0137ff 100644
--- a/drivers/common/octeontx2/otx2_irq.c
+++ b/drivers/common/octeontx2/otx2_irq.c
@@ -193,6 +193,8 @@ otx2_unregister_irq(struct rte_intr_handle *intr_handle,
 		    rte_intr_callback_fn cb, void *data, unsigned int vec)
 {
 	struct rte_intr_handle tmp_handle;
+	uint8_t retries = 5; /* 5 ms */
+	int rc;
 
 	if (vec > intr_handle->max_intr) {
 		otx2_err("Error unregistering MSI-X interrupts vec:%d > %d",
@@ -205,8 +207,21 @@ otx2_unregister_irq(struct rte_intr_handle *intr_handle,
 	if (tmp_handle.fd == -1)
 		return;
 
-	/* Un-register callback func from eal lib */
-	rte_intr_callback_unregister(&tmp_handle, cb, data);
+	do {
+		/* Un-register callback func from eal lib */
+		rc = rte_intr_callback_unregister(&tmp_handle, cb, data);
+		/* Retry only if -EAGAIN */
+		if (rc != -EAGAIN)
+			break;
+		rte_delay_ms(1);
+		retries--;
+	} while (retries);
+
+	if (rc < 0) {
+		otx2_err("Error unregistering MSI-X intr vec %d cb, rc=%d",
+			 vec, rc);
+		return;
+	}
 
 	otx2_base_dbg("Disable vector:0x%x for vfio (efds: %d, max:%d)",
 			vec, intr_handle->nb_efd, intr_handle->max_intr);
-- 
2.8.4


             reply	other threads:[~2020-06-11  7:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-11  7:26 Nithin Dabilpuram [this message]
2020-06-26 15:16 ` Jerin Jacob
2020-07-08 11:38   ` Jerin Jacob

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=20200611072605.472-1-ndabilpuram@marvell.com \
    --to=ndabilpuram@marvell.com \
    --cc=dev@dpdk.org \
    --cc=jerinj@marvell.com \
    /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).