From: Nithin Dabilpuram Date: Thu, 11 Jun 2020 07:26:04 +0000 (+0530) Subject: common/octeontx2: retry interrupt callback unregister X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=ff46ba738593306df86c7fed5988cd079df35a19;p=dpdk.git common/octeontx2: retry interrupt callback unregister 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 Acked-by: Jerin Jacob --- diff --git a/drivers/common/octeontx2/otx2_irq.c b/drivers/common/octeontx2/otx2_irq.c index fa3206af55..c0137ff36d 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);