From nobody Thu Apr 2 22:08:39 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 4DB7235A938; Fri, 13 Feb 2026 11:01:00 +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=1770980460; cv=none; b=ucbXDgj9G0Z3Mb4wyyFroO+YXC0CmLFBlEh0RIuMNhwfxoqNL6mdXDWg8qnY1LpZ8g1TECaKg23Mnc586ni2lj+sxQ0GmnTxA/YibuVl5SXE9rDUIzcrTdXojF+dC+UPkD6EBU0tAtSEueOHIgRPozbmii9hutvnu0OdiRZi8mw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770980460; c=relaxed/simple; bh=TXN66+61USoueF/YJO1qmTespgeOREpM5eWqChYgcOM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=WuxjklvmUJ6a1Ipj4lSkoHF5KCd2GsmrGOeBHseBA7gxdVzkLsHiDC01M6FGiRA4xZVjkEsAN58vfcb7knFJNDReCBacPvDcrALMm695akyzV4gpC3qW6maASfD4PB+IMC4QhQWUpZWcCZXrnWcPmHmDSLJfoTCYIao4xy5w3EE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=uRNBf6WU; 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="uRNBf6WU" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8B152C116C6; Fri, 13 Feb 2026 11:00:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1770980460; bh=TXN66+61USoueF/YJO1qmTespgeOREpM5eWqChYgcOM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uRNBf6WULIHJ9gua3TQfmU5Qf9S6KLJq2/4trstsDBUtXYD3gCkMb0iHAFzWF9XLH 7bSh+ozvuVcSj5Sum5daGYPH1oyVEGTwkX/fpTZKOFqRFOeYBTSxTWHpXyGwH68/Ke jZIEyQ44KSK/4bLFxCtlb45tG/ot0Qt5Nv398NohopTM97sbD0VrllEztC/Ytb/x/x QV2jbBGNZTLb5ql2NfvWFicoeVRATeSKBLi2RhbXJhkHpumLwDrSF9Ok3Mw8COTVex 0BFkgAH4tqg/cEgGsy2WARRAO8A5PdRd5FI3WUMJ1+0bn4t5LlipwGjVYi3JATY0/G pr3cRMxpLMLJg== 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 34/50] RDMA/irdma: Remove resize support for kernel CQs Date: Fri, 13 Feb 2026 12:58:10 +0200 Message-ID: <20260213-refactor-umem-v1-34-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 The CQ resize operation is a uverbs-only interface and is not required for kernel-created CQs. Drop this unused functionality. Signed-off-by: Leon Romanovsky --- drivers/infiniband/hw/irdma/verbs.c | 88 +++++++++------------------------= ---- 1 file changed, 21 insertions(+), 67 deletions(-) diff --git a/drivers/infiniband/hw/irdma/verbs.c b/drivers/infiniband/hw/ir= dma/verbs.c index f727d1922a84..d5442aebf1ac 100644 --- a/drivers/infiniband/hw/irdma/verbs.c +++ b/drivers/infiniband/hw/irdma/verbs.c @@ -2015,6 +2015,9 @@ static int irdma_destroy_cq(struct ib_cq *ib_cq, stru= ct ib_udata *udata) static int irdma_resize_cq(struct ib_cq *ibcq, int entries, struct ib_udata *udata) { + struct irdma_resize_cq_req req =3D {}; + struct irdma_ucontext *ucontext =3D rdma_udata_to_drv_context( + udata, struct irdma_ucontext, ibucontext); #define IRDMA_RESIZE_CQ_MIN_REQ_LEN offsetofend(struct irdma_resize_cq_req= , user_cq_buffer) struct irdma_cq *iwcq =3D to_iwcq(ibcq); struct irdma_sc_dev *dev =3D iwcq->sc_cq.dev; @@ -2029,7 +2032,6 @@ static int irdma_resize_cq(struct ib_cq *ibcq, int en= tries, struct irdma_pci_f *rf; struct irdma_cq_buf *cq_buf =3D NULL; unsigned long flags; - u8 cqe_size; int ret; =20 iwdev =3D to_iwdev(ibcq->device); @@ -2039,81 +2041,39 @@ static int irdma_resize_cq(struct ib_cq *ibcq, int = entries, IRDMA_FEATURE_CQ_RESIZE)) return -EOPNOTSUPP; =20 - if (udata && udata->inlen < IRDMA_RESIZE_CQ_MIN_REQ_LEN) + if (udata->inlen < IRDMA_RESIZE_CQ_MIN_REQ_LEN) return -EINVAL; =20 if (entries > rf->max_cqe) return -EINVAL; =20 - if (!iwcq->user_mode) { - entries +=3D 2; - - if (!iwcq->sc_cq.cq_uk.avoid_mem_cflct && - dev->hw_attrs.uk_attrs.hw_rev >=3D IRDMA_GEN_2) - entries *=3D 2; - - if (entries & 1) - entries +=3D 1; /* cq size must be an even number */ - - cqe_size =3D iwcq->sc_cq.cq_uk.avoid_mem_cflct ? 64 : 32; - if (entries * cqe_size =3D=3D IRDMA_HW_PAGE_SIZE) - entries +=3D 2; - } - info.cq_size =3D max(entries, 4); =20 if (info.cq_size =3D=3D iwcq->sc_cq.cq_uk.cq_size - 1) return 0; =20 - if (udata) { - struct irdma_resize_cq_req req =3D {}; - struct irdma_ucontext *ucontext =3D - rdma_udata_to_drv_context(udata, struct irdma_ucontext, - ibucontext); - - /* CQ resize not supported with legacy GEN_1 libi40iw */ - if (ucontext->legacy_mode) - return -EOPNOTSUPP; + /* CQ resize not supported with legacy GEN_1 libi40iw */ + if (ucontext->legacy_mode) + return -EOPNOTSUPP; =20 - if (ib_copy_from_udata(&req, udata, - min(sizeof(req), udata->inlen))) - return -EINVAL; + if (ib_copy_from_udata(&req, udata, min(sizeof(req), udata->inlen))) + return -EINVAL; =20 - spin_lock_irqsave(&ucontext->cq_reg_mem_list_lock, flags); - iwpbl_buf =3D irdma_get_pbl((unsigned long)req.user_cq_buffer, - &ucontext->cq_reg_mem_list); - spin_unlock_irqrestore(&ucontext->cq_reg_mem_list_lock, flags); + spin_lock_irqsave(&ucontext->cq_reg_mem_list_lock, flags); + iwpbl_buf =3D irdma_get_pbl((unsigned long)req.user_cq_buffer, + &ucontext->cq_reg_mem_list); + spin_unlock_irqrestore(&ucontext->cq_reg_mem_list_lock, flags); =20 - if (!iwpbl_buf) - return -ENOMEM; + if (!iwpbl_buf) + return -ENOMEM; =20 - cqmr_buf =3D &iwpbl_buf->cq_mr; - if (iwpbl_buf->pbl_allocated) { - info.virtual_map =3D true; - info.pbl_chunk_size =3D 1; - info.first_pm_pbl_idx =3D cqmr_buf->cq_pbl.idx; - } else { - info.cq_pa =3D cqmr_buf->cq_pbl.addr; - } + cqmr_buf =3D &iwpbl_buf->cq_mr; + if (iwpbl_buf->pbl_allocated) { + info.virtual_map =3D true; + info.pbl_chunk_size =3D 1; + info.first_pm_pbl_idx =3D cqmr_buf->cq_pbl.idx; } else { - /* Kmode CQ resize */ - int rsize; - - rsize =3D info.cq_size * sizeof(struct irdma_cqe); - kmem_buf.size =3D ALIGN(round_up(rsize, 256), 256); - kmem_buf.va =3D dma_alloc_coherent(dev->hw->device, - kmem_buf.size, &kmem_buf.pa, - GFP_KERNEL); - if (!kmem_buf.va) - return -ENOMEM; - - info.cq_base =3D kmem_buf.va; - info.cq_pa =3D kmem_buf.pa; - cq_buf =3D kzalloc(sizeof(*cq_buf), GFP_KERNEL); - if (!cq_buf) { - ret =3D -ENOMEM; - goto error; - } + info.cq_pa =3D cqmr_buf->cq_pbl.addr; } =20 cqp_request =3D irdma_alloc_and_get_cqp_request(&rf->cqp, true); @@ -2154,13 +2114,7 @@ static int irdma_resize_cq(struct ib_cq *ibcq, int e= ntries, =20 return 0; error: - if (!udata) { - dma_free_coherent(dev->hw->device, kmem_buf.size, kmem_buf.va, - kmem_buf.pa); - kmem_buf.va =3D NULL; - } kfree(cq_buf); - return ret; } =20 --=20 2.52.0