From patchwork Thu Jun 11 07:26:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nithin Dabilpuram X-Patchwork-Id: 71237 X-Patchwork-Delegate: jerinj@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 78EECA00C5; Thu, 11 Jun 2020 09:36:53 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9FD7B49E0; Thu, 11 Jun 2020 09:36:52 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id A70E22F42 for ; Thu, 11 Jun 2020 09:36:51 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 05B7VOUh019342 for ; Thu, 11 Jun 2020 00:36:50 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-type; s=pfpt0818; bh=8gwBSffnVxnpY6C4+uq09gJ66szm9Jt64LjHMDDZasM=; b=S6urQ2AXZXH+QCWXFBPGMlc4cpV2TqosaKNxfJ/d4XabKSZqCS1lvxoozSMZAy8KkZsM LOyQbgQb5d1EFm3Zu7PF1fJU1nRuHnsGlbW6N02uFFYi75nhx09V3/pgNwQCSBt8FcC3 gSllHhFHVK2d8joOlAzjbY4qDJTfNe/3cWj/NLEo0zS3vyJL+DsBsGrOLFCBRfRTqzvf cJ3Xb4t22xNNBu9XwulXBa3lI2OT9ZF5IDiV4Qoebe97PZfwCU4nzAePUTh/WTLzigeY O04qmTiB4eAlBRD20gn4icZUExXp9TIpj5jBEZLD2MM21N9Sp0HmGmScke9D/4s5rNcY KQ== Received: from sc-exch02.marvell.com ([199.233.58.182]) by mx0a-0016f401.pphosted.com with ESMTP id 31j77drr8x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Thu, 11 Jun 2020 00:36:50 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 11 Jun 2020 00:36:49 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 11 Jun 2020 00:36:49 -0700 Received: from hyd1588t430.marvell.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id 7D9E93F703F; Thu, 11 Jun 2020 00:36:48 -0700 (PDT) From: Nithin Dabilpuram To: Jerin Jacob , Nithin Dabilpuram CC: Date: Thu, 11 Jun 2020 12:56:04 +0530 Message-ID: <20200611072605.472-1-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.8.4 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.216, 18.0.687 definitions=2020-06-11_04:2020-06-10, 2020-06-11 signatures=0 Subject: [dpdk-dev] [PATCH] common/octeontx2: retry intr callback unregister X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "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 Acked-by: Jerin Jacob --- 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);