From nobody Thu Apr 2 22:12:32 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 93B7E35DCE3; Fri, 13 Feb 2026 11:01:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770980513; cv=none; b=l94pLufKy7uIlNdnVOltGCzlP8RYXah9HHET1WpMIhXyYzr0enDJNC35ZTeK7WTgnJeLpcTLWgcABoVGVx/BtXbvKkXWp3P5vcLR3RltiG9A1vPMeRNvNYOHBunzf9qmLaLBa/c3gN0rFE708NmvR6fvTyHBdSV43Ybz3iniv/w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770980513; c=relaxed/simple; bh=1roDOuzFaVAi0uAanyZBBm5keeCeS16zySE/Gbe4n7M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=AKzq31n4BXXGgsUCV3wxYwa+MxStEydYjv5a1VTzAnvRhpMNYSsBStPmOmZ9TsIsiFoRJkWsDd1fTxWrMwr4ETXizBABKmKR/LFsCtm0d1BpFoCB20J6eqzBYeilNg8HyulryEZ5Z0k5K760pCqPiPhC1ZIm8UcEDqHzMxWPIJg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=nF7BXsVi; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="nF7BXsVi" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 97558C116C6; Fri, 13 Feb 2026 11:01:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1770980513; bh=1roDOuzFaVAi0uAanyZBBm5keeCeS16zySE/Gbe4n7M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nF7BXsVi9ZkQlLmjgJwjaAQ9hAKWIVnVuUu+Xg1CKWGVeQteyqV2VoCgXAusaEFEy 2142N5IxycG+Ywh57jwVYsNL/e6YRPcZd6tseyKDvHrduspXdNfxlazxglKR/DY2Uz w6rKub6ENw/Ka0v1/IjBSTP6Z4yoI4EJQJfA36IzodS4E6+d3QVL0jCuQwY1ZsYnqr 5TlHfZ7Acr0ovlXKOAlH3/m4capxkhuS8jVw/75f3g6QZuWOoSDIkFlCQrSaTdGGFi Twix9uVGpVMa/gf9O6KALMe1fOnax4KOw5YcTP7tM5zMVjiyl2z6yHd9t6mL9/AVbk SyP/yuWm+QNbw== From: Leon Romanovsky To: Jason Gunthorpe , Leon Romanovsky , Selvin Xavier , Kalesh AP , Potnuri Bharat Teja , Michael Margolin , Gal Pressman , Yossi Leybovich , Cheng Xu , Kai Shen , Chengchang Tang , Junxian Huang , Abhijit Gangurde , Allen Hubbe , Krzysztof Czurylo , Tatyana Nikolova , Long Li , Konstantin Taranov , Yishai Hadas , Michal Kalderon , Bryan Tan , Vishnu Dasa , Broadcom internal kernel review list , Christian Benvenuti , Nelson Escobar , Dennis Dalessandro , Bernard Metzler , Zhu Yanjun Cc: linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org, linux-hyperv@vger.kernel.org Subject: [PATCH rdma-next 44/50] RDMA/bnxt_re: Reduce CQ memory footprint Date: Fri, 13 Feb 2026 12:58:20 +0200 Message-ID: <20260213-refactor-umem-v1-44-f3be85847922@nvidia.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260213-refactor-umem-v1-0-f3be85847922@nvidia.com> References: <20260213-refactor-umem-v1-0-f3be85847922@nvidia.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" X-Mailer: b4 0.15-dev-47773 Content-Transfer-Encoding: quoted-printable From: Leon Romanovsky There is no need to store resize_cqe and resize_umem in CQ object. Let's remove them. Signed-off-by: Leon Romanovsky --- drivers/infiniband/hw/bnxt_re/ib_verbs.c | 37 +++++++++++-----------------= ---- drivers/infiniband/hw/bnxt_re/ib_verbs.h | 2 -- 2 files changed, 13 insertions(+), 26 deletions(-) diff --git a/drivers/infiniband/hw/bnxt_re/ib_verbs.c b/drivers/infiniband/= hw/bnxt_re/ib_verbs.c index d544a4fb1e96..9a8bdb52097f 100644 --- a/drivers/infiniband/hw/bnxt_re/ib_verbs.c +++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.c @@ -3320,6 +3320,8 @@ int bnxt_re_resize_cq(struct ib_cq *ibcq, unsigned in= t cqe, struct bnxt_re_resize_cq_req req; struct bnxt_re_dev *rdev; struct bnxt_re_cq *cq; + struct ib_umem *umem; + int rc, entries; =20 cq =3D container_of(ibcq, struct bnxt_re_cq, ib_cq); @@ -3336,26 +3338,18 @@ int bnxt_re_resize_cq(struct ib_cq *ibcq, unsigned = int cqe, entries =3D dev_attr->max_cq_wqes + 1; =20 /* uverbs consumer */ - if (ib_copy_from_udata(&req, udata, sizeof(req))) { - rc =3D -EFAULT; - goto fail; - } + if (ib_copy_from_udata(&req, udata, sizeof(req))) + return -EFAULT; =20 - cq->resize_umem =3D ib_umem_get(&rdev->ibdev, req.cq_va, - entries * sizeof(struct cq_base), - IB_ACCESS_LOCAL_WRITE); - if (IS_ERR(cq->resize_umem)) { - rc =3D PTR_ERR(cq->resize_umem); - ibdev_err(&rdev->ibdev, "%s: ib_umem_get failed! rc =3D %pe\n", - __func__, cq->resize_umem); - cq->resize_umem =3D NULL; - return rc; - } - cq->resize_cqe =3D entries; + umem =3D ib_umem_get(&rdev->ibdev, req.cq_va, + entries * sizeof(struct cq_base), + IB_ACCESS_LOCAL_WRITE); + if (IS_ERR(umem)) + return PTR_ERR(umem); memcpy(&sg_info, &cq->qplib_cq.sg_info, sizeof(sg_info)); orig_dpi =3D cq->qplib_cq.dpi; =20 - cq->qplib_cq.sg_info.umem =3D cq->resize_umem; + cq->qplib_cq.sg_info.umem =3D umem; cq->qplib_cq.sg_info.pgsize =3D PAGE_SIZE; cq->qplib_cq.sg_info.pgshft =3D PAGE_SHIFT; cq->qplib_cq.dpi =3D &uctx->dpi; @@ -3369,21 +3363,16 @@ int bnxt_re_resize_cq(struct ib_cq *ibcq, unsigned = int cqe, =20 bnxt_qplib_resize_cq_complete(&rdev->qplib_res, &cq->qplib_cq); =20 - cq->qplib_cq.max_wqe =3D cq->resize_cqe; + cq->qplib_cq.max_wqe =3D entries; ib_umem_release(cq->ib_cq.umem); - cq->ib_cq.umem =3D cq->resize_umem; - cq->resize_umem =3D NULL; - cq->resize_cqe =3D 0; - + cq->ib_cq.umem =3D umem; cq->ib_cq.cqe =3D entries; atomic_inc(&rdev->stats.res.resize_count); =20 return 0; =20 fail: - ib_umem_release(cq->resize_umem); - cq->resize_umem =3D NULL; - cq->resize_cqe =3D 0; + ib_umem_release(umem); memcpy(&cq->qplib_cq.sg_info, &sg_info, sizeof(sg_info)); cq->qplib_cq.dpi =3D orig_dpi; return rc; diff --git a/drivers/infiniband/hw/bnxt_re/ib_verbs.h b/drivers/infiniband/= hw/bnxt_re/ib_verbs.h index 7890d6ebad90..ee7ccaa2ed4c 100644 --- a/drivers/infiniband/hw/bnxt_re/ib_verbs.h +++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.h @@ -108,8 +108,6 @@ struct bnxt_re_cq { struct bnxt_qplib_cqe *cql; #define MAX_CQL_PER_POLL 1024 u32 max_cql; - struct ib_umem *resize_umem; - int resize_cqe; void *uctx_cq_page; struct hlist_node hash_entry; }; --=20 2.52.0