Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: Selvin Xavier <selvin.xavier@broadcom.com>
To: leon@kernel.org, jgg@ziepe.ca
Cc: linux-rdma@vger.kernel.org, andrew.gospodarek@broadcom.com,
	kalesh-anakkur.purayil@broadcom.com,
	sriharsha.basavapatna@broadcom.com,
	Selvin Xavier <selvin.xavier@broadcom.com>
Subject: [PATCH 06/11] RDMA/bnxt_re: Avoid repeated requests to allocate WC pages
Date: Wed, 10 Jun 2026 03:08:50 -0700	[thread overview]
Message-ID: <20260610100855.64212-7-selvin.xavier@broadcom.com> (raw)
In-Reply-To: <20260610100855.64212-1-selvin.xavier@broadcom.com>

Applications can request for allocating multiple WC pages
for the same ucontext. As of now, supporting only 1 WC page
per ucontext. Adding a check to fail the repeated requests.

Fixes: eee6268421a2 ("RDMA/bnxt_re: Move the UAPI methods to a dedicated file")
Fixes: 360da60d6c6e ("RDMA/bnxt_re: Enable low latency push")
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Signed-off-by: Selvin Xavier <selvin.xavier@broadcom.com>
---
 drivers/infiniband/hw/bnxt_re/uapi.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/infiniband/hw/bnxt_re/uapi.c b/drivers/infiniband/hw/bnxt_re/uapi.c
index 0fceaf52bf4d..abd8f90ca0fb 100644
--- a/drivers/infiniband/hw/bnxt_re/uapi.c
+++ b/drivers/infiniband/hw/bnxt_re/uapi.c
@@ -99,6 +99,9 @@ static int UVERBS_HANDLER(BNXT_RE_METHOD_ALLOC_PAGE)(struct uverbs_attr_bundle *
 	switch (alloc_type) {
 	case BNXT_RE_ALLOC_WC_PAGE:
 		if (cctx->modes.db_push)  {
+			/* already allocated — one WC page per context */
+			if (uctx->wcdpi.dbr)
+				return -EEXIST;
 			if (bnxt_qplib_alloc_dpi(&rdev->qplib_res, &uctx->wcdpi,
 						 uctx, BNXT_QPLIB_DPI_TYPE_WC))
 				return -ENOMEM;
-- 
2.39.3


  parent reply	other threads:[~2026-06-10  4:46 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-10 10:08 [PATCH 00/11] RDMA/bnxt_re: Generic driver fixes Selvin Xavier
2026-06-10 10:08 ` [PATCH 01/11] RDMA/bnxt_re : Initialize dpi variable to zero Selvin Xavier
2026-06-10 10:08 ` [PATCH 02/11] RDMA/bnxt_re: Add ownership check while getting the CQ toggle page Selvin Xavier
2026-06-10 10:08 ` [PATCH 03/11] RDMA/bnxt_re: Add ownership check while getting the SRQ " Selvin Xavier
2026-06-10 10:08 ` [PATCH 04/11] RDMA/bnxt_re: Avoid displaying the kernel pointer Selvin Xavier
2026-06-10 10:08 ` [PATCH 05/11] RDMA/bnxt_re: Add a max slot check for SQ Selvin Xavier
2026-06-10 10:08 ` Selvin Xavier [this message]
2026-06-10  6:19   ` [PATCH 06/11] RDMA/bnxt_re: Avoid repeated requests to allocate WC pages Selvin Xavier
2026-06-10 10:08 ` [PATCH 07/11] RDMA/bnxt_re: Avoid any race while handling the hash list of CQ Selvin Xavier
2026-06-10 10:08 ` [PATCH 08/11] RDMA/bnxt_re: Avoid any race while handling the hash list of SRQ Selvin Xavier
2026-06-10 10:08 ` [PATCH 09/11] RDMA/bnxt_re: Fix the cleanup upon error during srq create Selvin Xavier
2026-06-10 10:08 ` [PATCH 10/11] RDMA/bnxt_re: Fix the cleanup upon error during CQ create Selvin Xavier
2026-06-10 10:08 ` [PATCH 11/11] RDMA/bnxt_re: Fail DBR related page allocation UAPIs if the feature is disabled Selvin Xavier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260610100855.64212-7-selvin.xavier@broadcom.com \
    --to=selvin.xavier@broadcom.com \
    --cc=andrew.gospodarek@broadcom.com \
    --cc=jgg@ziepe.ca \
    --cc=kalesh-anakkur.purayil@broadcom.com \
    --cc=leon@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=sriharsha.basavapatna@broadcom.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox