DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] common/octeontx2: retry intr callback unregister
@ 2020-06-11  7:26 Nithin Dabilpuram
  2020-06-26 15:16 ` Jerin Jacob
  0 siblings, 1 reply; 3+ messages in thread
From: Nithin Dabilpuram @ 2020-06-11  7:26 UTC (permalink / raw)
  To: Jerin Jacob, Nithin Dabilpuram; +Cc: dev

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


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

end of thread, other threads:[~2020-07-08 11:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-11  7:26 [dpdk-dev] [PATCH] common/octeontx2: retry intr callback unregister Nithin Dabilpuram
2020-06-26 15:16 ` Jerin Jacob
2020-07-08 11:38   ` Jerin Jacob

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).