From nobody Mon Apr 6 19:48:51 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 E51943BBA0F; Wed, 18 Mar 2026 10:09:12 +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=1773828553; cv=none; b=sIp/CqQYgyDHwAH0lUoT+0xCw+AKHwA8JRLEYG4CngQYZa1czX8FYETeIRLuNNxuuQmfEHWN/KVI97EyHkUjyFcVjUbRAxwP6bMiB2T6ut7Z+24zHS/YY1IM90QTSq4QGKa11NIU23XsUgUfwfgRDgh6LPbcgKCOomazpVtDF/o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773828553; c=relaxed/simple; bh=ncxl0MunJglavLbnABmWimFxVQWUekOXGMOBEDMdKlc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Pl/B9Lpg0Y1mbzaNSPIPuD1NDF2DDvgYjVcKR9slmLaweWteqN5x8ql0lc8smcI04a3NDU53+6B3n0gdWnLjYYVue7AtQQGVA+ioH2TOJ42Iddc/36I2QcejIfUM2/icjQ42I4REKLR2TBQuCwAPD0SfP0JOxbhObW2GrSn6G0w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=N7KH/EtS; 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="N7KH/EtS" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8A4FFC19421; Wed, 18 Mar 2026 10:09:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773828552; bh=ncxl0MunJglavLbnABmWimFxVQWUekOXGMOBEDMdKlc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N7KH/EtSqIFKgEK/EKeWFc2oOYMlzMkCieBqL9HzpKQUXw+Mt79/El+rLHNM+43od uL+Kze+Y6b1/y0yw2MXdKCkvJdQOAeVK2TKMqL/AESZvM1sY+K/R3Alq8aXvK/qPqB IB9HFYVYpS8VaqT0kFJfiY02Z2OVuhhpU3Vl6K2ulklwmKZ6n0ktA13EzAkYm25pxN YtSgnC8KwysKpTOIg4ziQCVVXMS/oKSjV13vjHIcweWr0045YhXuoPbdV2vfTamSeK IkHV2GtedWP6Qw0Rf6e6MHEi3lfiJDtUR7NTf7Y7GzCxWadb7bNliSKAUqsOLIf66G rVs6l8yvV6ucw== From: Leon Romanovsky To: Selvin Xavier , Kalesh AP , Jason Gunthorpe , Leon Romanovsky Cc: linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH rdma-next 2/4] RDMA/bnxt_re: Remove unnecessary checks in kernel CQ creation path Date: Wed, 18 Mar 2026 12:08:51 +0200 Message-ID: <20260318-bnxt_re-cq-v1-2-381cb1b5e625@nvidia.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260318-bnxt_re-cq-v1-0-381cb1b5e625@nvidia.com> References: <20260318-bnxt_re-cq-v1-0-381cb1b5e625@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-18f8f Content-Transfer-Encoding: quoted-printable From: Leon Romanovsky bnxt_re_create_cq() is a kernel verb, which means udata will always be NULL and attr->cqe is valid. Remove the code handling this unreachable case. Signed-off-by: Leon Romanovsky Acked-by: Selvin Xavier --- drivers/infiniband/hw/bnxt_re/ib_verbs.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/drivers/infiniband/hw/bnxt_re/ib_verbs.c b/drivers/infiniband/= hw/bnxt_re/ib_verbs.c index 40ac546f113bc..cb53dfdf69bab 100644 --- a/drivers/infiniband/hw/bnxt_re/ib_verbs.c +++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.c @@ -3471,31 +3471,21 @@ int bnxt_re_create_cq(struct ib_cq *ibcq, const str= uct ib_cq_init_attr *attr, { struct bnxt_re_cq *cq =3D container_of(ibcq, struct bnxt_re_cq, ib_cq); struct bnxt_re_dev *rdev =3D to_bnxt_re_dev(ibcq->device, ibdev); - struct ib_udata *udata =3D &attrs->driver_udata; - struct bnxt_re_ucontext *uctx =3D - rdma_udata_to_drv_context(udata, struct bnxt_re_ucontext, ib_uctx); struct bnxt_qplib_dev_attr *dev_attr =3D rdev->dev_attr; - int cqe =3D attr->cqe; int rc; u32 active_cqs; =20 - if (udata) - return bnxt_re_create_user_cq(ibcq, attr, attrs); - if (attr->flags) return -EOPNOTSUPP; =20 /* Validate CQ fields */ - if (cqe < 1 || cqe > dev_attr->max_cq_wqes) { - ibdev_err(&rdev->ibdev, "Failed to create CQ -max exceeded"); + if (attr->cqe > dev_attr->max_cq_wqes) return -EINVAL; - } =20 cq->rdev =3D rdev; cq->qplib_cq.cq_handle =3D (u64)(unsigned long)(&cq->qplib_cq); =20 - cq->max_cql =3D bnxt_re_init_depth(attr->cqe + 1, - dev_attr->max_cq_wqes + 1, uctx); + cq->max_cql =3D attr->cqe + 1; cq->cql =3D kcalloc(cq->max_cql, sizeof(struct bnxt_qplib_cqe), GFP_KERNEL); if (!cq->cql) --=20 2.53.0