From nobody Thu Apr 2 22:08:40 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 AF07335F8D1; Fri, 13 Feb 2026 11:00:52 +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=1770980452; cv=none; b=GrJfdly1WKm0mhhHs8bpNk7bsdCepYBOxqgSFh3vWMzf3vah54pVYfIXfdMiU9rTBknwrxk7ketbRyCz8Kha5EhhaCcRRIl7tOMRnB4jddArl3zEtaivtWfyyhHQf0exVzPY+5DxOqPWWJuqP+c/KCINQaqBjpCg3Ra/8K730ZQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770980452; c=relaxed/simple; bh=50qG2y5fbQy5Qu3vQ5GMSNOhKd9VjZpb7hrkivZKUF0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=pL36tesiLriiu98TO6+WopIjgGMCPEIP9Cm0wOivPlrTwjRGXNchdLqciV4UuzaetBnl94LDFS+0/EIR3MbKB5qBE8kf8688xAGvapBtuz/Yjsf27EtOsUyM2OdkbcdiJRZ0a5naPlWxlBEiA0HSzdBFCKwcDgZSqvYL05xpe1k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=iNQ8039N; 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="iNQ8039N" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF500C116C6; Fri, 13 Feb 2026 11:00:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1770980452; bh=50qG2y5fbQy5Qu3vQ5GMSNOhKd9VjZpb7hrkivZKUF0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iNQ8039NrIVSCwVGb42NPQhWrtdZI6BEGf3kdgt10LNUfPlVvdrvC9aFbqux2814v Q6Hx/eGuJUbiciVHJJTVC0PE7/HnQEptVYgGRlZRozvPdNglmd7EU3vi1uVioqsWXY u72yd/ptaS/utW9GMMHForver2HIdD7Azzx7eq5emHS1mR9Q3UoTNoYOIzIVkIqm75 Ub3aELkOYY+EGfjiEjW523Dk6j8Q0Lc3Qid95/I3HGiy+lTPr2bZvnhvbfqyf/JLaT uSk6JOLCyjIb3MnMZqo5CN0l3CcESnxh4cHPVMYgXLyWxlKAEdIdf2A8SvKh6ASM6T cRCoNHtzUtMqg== 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 29/50] RDMA/rxe: Split user and kernel CQ creation paths Date: Fri, 13 Feb 2026 12:58:05 +0200 Message-ID: <20260213-refactor-umem-v1-29-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 Separate the CQ creation logic into distinct kernel and user flows. Signed-off-by: Leon Romanovsky --- drivers/infiniband/sw/rxe/rxe_verbs.c | 81 ++++++++++++++++++++-----------= ---- 1 file changed, 47 insertions(+), 34 deletions(-) diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.c b/drivers/infiniband/sw/= rxe/rxe_verbs.c index 38d8c408320f..1e651bdd8622 100644 --- a/drivers/infiniband/sw/rxe/rxe_verbs.c +++ b/drivers/infiniband/sw/rxe/rxe_verbs.c @@ -1072,58 +1072,70 @@ static int rxe_post_recv(struct ib_qp *ibqp, const = struct ib_recv_wr *wr, } =20 /* cq */ -static int rxe_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr = *attr, - struct uverbs_attr_bundle *attrs) +static int rxe_create_user_cq(struct ib_cq *ibcq, const struct ib_cq_init_= attr *attr, + struct uverbs_attr_bundle *attrs) { struct ib_udata *udata =3D &attrs->driver_udata; struct ib_device *dev =3D ibcq->device; struct rxe_dev *rxe =3D to_rdev(dev); struct rxe_cq *cq =3D to_rcq(ibcq); - struct rxe_create_cq_resp __user *uresp =3D NULL; - int err, cleanup_err; + struct rxe_create_cq_resp __user *uresp; + int err; =20 - if (udata) { - if (udata->outlen < sizeof(*uresp)) { - err =3D -EINVAL; - rxe_dbg_dev(rxe, "malformed udata, err =3D %d\n", err); - goto err_out; - } - uresp =3D udata->outbuf; - } + if (udata->outlen < sizeof(*uresp)) + return -EINVAL; =20 - if (attr->flags) { - err =3D -EOPNOTSUPP; - rxe_dbg_dev(rxe, "bad attr->flags, err =3D %d\n", err); - goto err_out; - } + uresp =3D udata->outbuf; =20 - err =3D rxe_cq_chk_attr(rxe, NULL, attr->cqe, attr->comp_vector); - if (err) { - rxe_dbg_dev(rxe, "bad init attributes, err =3D %d\n", err); - goto err_out; - } + if (attr->flags || ibcq->umem) + return -EOPNOTSUPP; + + if (attr->cqe > rxe->attr.max_cqe) + return -EINVAL; =20 err =3D rxe_add_to_pool(&rxe->cq_pool, cq); - if (err) { - rxe_dbg_dev(rxe, "unable to create cq, err =3D %d\n", err); - goto err_out; - } + if (err) + return err; =20 err =3D rxe_cq_from_init(rxe, cq, attr->cqe, attr->comp_vector, udata, uresp); - if (err) { - rxe_dbg_cq(cq, "create cq failed, err =3D %d\n", err); + if (err) goto err_cleanup; - } =20 return 0; =20 err_cleanup: - cleanup_err =3D rxe_cleanup(cq); - if (cleanup_err) - rxe_err_cq(cq, "cleanup failed, err =3D %d\n", cleanup_err); -err_out: - rxe_err_dev(rxe, "returned err =3D %d\n", err); + rxe_cleanup(cq); + return err; +} + +static int rxe_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr = *attr, + struct uverbs_attr_bundle *attrs) +{ + struct ib_device *dev =3D ibcq->device; + struct rxe_dev *rxe =3D to_rdev(dev); + struct rxe_cq *cq =3D to_rcq(ibcq); + int err; + + if (attr->flags) + return -EOPNOTSUPP; + + if (attr->cqe > rxe->attr.max_cqe) + return -EINVAL; + + err =3D rxe_add_to_pool(&rxe->cq_pool, cq); + if (err) + return err; + + err =3D rxe_cq_from_init(rxe, cq, attr->cqe, attr->comp_vector, NULL, + NULL); + if (err) + goto err_cleanup; + + return 0; + +err_cleanup: + rxe_cleanup(cq); return err; } =20 @@ -1478,6 +1490,7 @@ static const struct ib_device_ops rxe_dev_ops =3D { .attach_mcast =3D rxe_attach_mcast, .create_ah =3D rxe_create_ah, .create_cq =3D rxe_create_cq, + .create_user_cq =3D rxe_create_user_cq, .create_qp =3D rxe_create_qp, .create_srq =3D rxe_create_srq, .create_user_ah =3D rxe_create_ah, --=20 2.52.0