]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
RDMA/bnxt_re: Update rq depth for app allocated QPs
authorSriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
Tue, 19 May 2026 15:00:34 +0000 (20:30 +0530)
committerJason Gunthorpe <jgg@nvidia.com>
Sun, 24 May 2026 15:32:20 +0000 (12:32 -0300)
For app allocated QPs, there's no need to add extra slots or
to round up the slot count. Use 'max_recv_wr' count provided
by the application as is.

Link: https://patch.msgid.link/r/20260519150041.7251-3-sriharsha.basavapatna@broadcom.com
Signed-off-by: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
Reviewed-by: Selvin Xavier <selvin.xavier@broadcom.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/hw/bnxt_re/ib_verbs.c

index d50ec97518426c9a1b423d20fc6b91913174153f..c3db53af3ff606e7ef9b69949ed895b114217d90 100644 (file)
@@ -1475,7 +1475,8 @@ fail:
 
 static int bnxt_re_init_rq_attr(struct bnxt_re_qp *qp,
                                struct ib_qp_init_attr *init_attr,
-                               struct bnxt_re_ucontext *uctx)
+                               struct bnxt_re_ucontext *uctx,
+                               bool fixed_que_attr)
 {
        struct bnxt_qplib_dev_attr *dev_attr;
        struct bnxt_qplib_qp *qplqp;
@@ -1500,12 +1501,16 @@ static int bnxt_re_init_rq_attr(struct bnxt_re_qp *qp,
                init_attr->cap.max_recv_sge = rq->max_sge;
                rq->wqe_size = bnxt_re_setup_rwqe_size(qplqp, rq->max_sge,
                                                       dev_attr->max_qp_sges);
-               /* Allocate 1 more than what's provided so posting max doesn't
-                * mean empty.
-                */
-               rq->max_wqe = bnxt_re_init_depth(init_attr->cap.max_recv_wr + 1,
-                                                dev_attr->max_qp_wqes + 1,
-                                                uctx);
+               if (!fixed_que_attr) {
+                       /* Allocate 1 more than what's provided so posting max doesn't
+                        * mean empty.
+                        */
+                       rq->max_wqe = bnxt_re_init_depth(init_attr->cap.max_recv_wr + 1,
+                                                        dev_attr->max_qp_wqes + 1,
+                                                        uctx);
+               } else {
+                       rq->max_wqe = init_attr->cap.max_recv_wr;
+               }
                rq->max_sw_wqe = rq->max_wqe;
                rq->q_full_delta = 0;
                rq->sg_info.pgsize = PAGE_SIZE;
@@ -1676,6 +1681,7 @@ static int bnxt_re_init_qp_attr(struct bnxt_re_qp *qp, struct bnxt_re_pd *pd,
 {
        struct bnxt_qplib_dev_attr *dev_attr;
        struct bnxt_qplib_qp *qplqp;
+       bool fixed_que_attr = false;
        struct bnxt_re_dev *rdev;
        struct bnxt_re_cq *cq;
        int rc = 0, qptype;
@@ -1724,7 +1730,7 @@ static int bnxt_re_init_qp_attr(struct bnxt_re_qp *qp, struct bnxt_re_pd *pd,
        }
 
        /* Setup RQ/SRQ */
-       rc = bnxt_re_init_rq_attr(qp, init_attr, uctx);
+       rc = bnxt_re_init_rq_attr(qp, init_attr, uctx, fixed_que_attr);
        if (rc)
                return rc;
        if (init_attr->qp_type == IB_QPT_GSI)