From nobody Fri Dec 19 07:50:24 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 96749C54EE9 for ; Tue, 13 Sep 2022 14:21:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232424AbiIMOVu (ORCPT ); Tue, 13 Sep 2022 10:21:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233543AbiIMOTS (ORCPT ); Tue, 13 Sep 2022 10:19:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD22965243; Tue, 13 Sep 2022 07:14:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9D0A8614C2; Tue, 13 Sep 2022 14:14:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9DE6AC433C1; Tue, 13 Sep 2022 14:14:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1663078441; bh=bTOIqGHcoGMJCze9crysSPTuC4OBpIBJRzrBeSjJLpQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PuZ5B5+tXK9VUpBe6n3G5qJr77qJbMCUwbRi0xc2W5PA98vzpH84nJuskmsgJiZAg CFIKHZHoBlGf1dSp7u/hmXa4nI4VF2Zp68ftd/ttOR9UnipuF+1glA/GmcG4aVq8x8 MaUi6bU9izU4n6CwL0UjfyNyRVPGXfFZ1xNzGa4k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sindhu-Devale , Shiraz Saleem , Leon Romanovsky , Sasha Levin Subject: [PATCH 5.19 141/192] RDMA/irdma: Return error on MR deregister CQP failure Date: Tue, 13 Sep 2022 16:04:07 +0200 Message-Id: <20220913140417.043917520@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220913140410.043243217@linuxfoundation.org> References: <20220913140410.043243217@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sindhu-Devale [ Upstream commit 6b227bd32db778eddc6f3b22cc72a28dda0f2272 ] The MR deregister CQP can fail if an MW is bound to it. Return an appropriate error for this case. Fixes: b48c24c2d710 ("RDMA/irdma: Implement device supported verb APIs") Signed-off-by: Sindhu-Devale Signed-off-by: Shiraz Saleem Link: https://lore.kernel.org/r/20220906223244.1119-3-shiraz.saleem@intel.c= om Signed-off-by: Leon Romanovsky Signed-off-by: Sasha Levin --- drivers/infiniband/hw/irdma/utils.c | 13 ++++++++----- drivers/infiniband/hw/irdma/verbs.c | 6 +++++- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers/infiniband/hw/irdma/utils.c b/drivers/infiniband/hw/ir= dma/utils.c index 7b15faadfef5c..f4d774451160d 100644 --- a/drivers/infiniband/hw/irdma/utils.c +++ b/drivers/infiniband/hw/irdma/utils.c @@ -590,11 +590,14 @@ static int irdma_wait_event(struct irdma_pci_f *rf, cqp_error =3D cqp_request->compl_info.error; if (cqp_error) { err_code =3D -EIO; - if (cqp_request->compl_info.maj_err_code =3D=3D 0xFFFF && - cqp_request->compl_info.min_err_code =3D=3D 0x8029) { - if (!rf->reset) { - rf->reset =3D true; - rf->gen_ops.request_reset(rf); + if (cqp_request->compl_info.maj_err_code =3D=3D 0xFFFF) { + if (cqp_request->compl_info.min_err_code =3D=3D 0x8002) + err_code =3D -EBUSY; + else if (cqp_request->compl_info.min_err_code =3D=3D 0x8029) { + if (!rf->reset) { + rf->reset =3D true; + rf->gen_ops.request_reset(rf); + } } } } diff --git a/drivers/infiniband/hw/irdma/verbs.c b/drivers/infiniband/hw/ir= dma/verbs.c index 4835702871677..e7120d7a5b4c6 100644 --- a/drivers/infiniband/hw/irdma/verbs.c +++ b/drivers/infiniband/hw/irdma/verbs.c @@ -3001,6 +3001,7 @@ static int irdma_dereg_mr(struct ib_mr *ib_mr, struct= ib_udata *udata) struct irdma_pble_alloc *palloc =3D &iwpbl->pble_alloc; struct irdma_cqp_request *cqp_request; struct cqp_cmds_info *cqp_info; + int status; =20 if (iwmr->type !=3D IRDMA_MEMREG_TYPE_MEM) { if (iwmr->region) { @@ -3031,8 +3032,11 @@ static int irdma_dereg_mr(struct ib_mr *ib_mr, struc= t ib_udata *udata) cqp_info->post_sq =3D 1; cqp_info->in.u.dealloc_stag.dev =3D &iwdev->rf->sc_dev; cqp_info->in.u.dealloc_stag.scratch =3D (uintptr_t)cqp_request; - irdma_handle_cqp_op(iwdev->rf, cqp_request); + status =3D irdma_handle_cqp_op(iwdev->rf, cqp_request); irdma_put_cqp_request(&iwdev->rf->cqp, cqp_request); + if (status) + return status; + irdma_free_stag(iwdev, iwmr->stag); done: if (iwpbl->pbl_allocated) --=20 2.35.1