From: sashiko-bot@kernel.org
To: "Selvin Xavier" <selvin.xavier@broadcom.com>
Cc: linux-rdma@vger.kernel.org
Subject: Re: [PATCH for-next v2 4/4] RDMA/bnxt_re: Allow user library to request STATIC WQE mode per-QP
Date: Mon, 30 Nov 2026 09:51:16 +0000 [thread overview]
Message-ID: <sashiko-outbox-240813@kernel.org> (raw)
In-Reply-To: <20261130145344.322857-5-selvin.xavier@broadcom.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] RDMA/bnxt_re: wrong sq->max_wqe upper bound in
bnxt_re_init_sq_attr()
--
commit f833eaacd18642dcd75e27a7ef54dc8560c17fce
Author: Abhishek Mohapatra <abhishek.mohapatra@broadcom.com>
RDMA/bnxt_re: Allow user library to request STATIC WQE mode per-QP
This commit adds a wqe_mode field and BNXT_RE_QP_REQ_MASK_WQE_MODE flag to
struct bnxt_re_qp_req so userspace can explicitly request static WQE mode
per QP and size the SQ from sq_slots.
> diff --git a/drivers/infiniband/hw/bnxt_re/ib_verbs.c b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
> index 92d8995b58952..ac7db219bfc1f 100644
> --- a/drivers/infiniband/hw/bnxt_re/ib_verbs.c
> +++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
[ ... ]
> @@ -1598,17 +1611,24 @@ static int bnxt_re_init_sq_attr(struct bnxt_re_qp *qp,
> if (rc)
> return rc;
>
> - /* Allocate 128 + 1 more than what's provided */
> - if (qplqp->wqe_mode != BNXT_QPLIB_WQE_MODE_VARIABLE)
> - diff = BNXT_QPLIB_RESERVED_QP_WRS;
> - sq->max_wqe = bnxt_re_init_depth(
> - init_attr->cap.max_send_wr + diff + 1,
> - dev_attr->max_qp_wqes + diff + 1, uctx);
> - if (qplqp->wqe_mode == BNXT_QPLIB_WQE_MODE_VARIABLE)
> - sq->max_sw_wqe = bnxt_qplib_get_depth(sq, qplqp->wqe_mode, true);
> - else
> + if (uctx && fixed_que_attr) {
> + sq->max_wqe = ((u64)ureq->sq_slots * bnxt_qplib_get_stride()) /
> + sq->wqe_size;
> + /* Bound the depth by the device limit */
> + if (!sq->max_wqe || sq->max_wqe > dev_attr->max_qp_wqes + 1)
> + return -EINVAL;
> sq->max_sw_wqe = sq->max_wqe;
> -
> + } else {
> + /* Allocate 128 + 1 more than what's provided */
> + if (qplqp->wqe_mode != BNXT_QPLIB_WQE_MODE_VARIABLE)
> + diff = BNXT_QPLIB_RESERVED_QP_WRS;
> + sq->max_wqe = bnxt_re_init_depth(init_attr->cap.max_send_wr + diff + 1,
> + dev_attr->max_qp_wqes + diff + 1, uctx);
> + if (qplqp->wqe_mode == BNXT_QPLIB_WQE_MODE_VARIABLE)
> + sq->max_sw_wqe = bnxt_qplib_get_depth(sq, qplqp->wqe_mode, true);
> + else
> + sq->max_sw_wqe = sq->max_wqe;
> + }
> }
> if (!fixed_que_attr) {
> sq->q_full_delta = diff + 1;
> @@ -1618,6 +1638,12 @@ static int bnxt_re_init_sq_attr(struct bnxt_re_qp *qp,
> * unexpected Queue full condition
> */
> qplqp->sq.q_full_delta -= 1;
> + } else if (qplqp->wqe_mode == BNXT_QPLIB_WQE_MODE_STATIC &&
> + !bnxt_qplib_is_chip_gen_p5_p7(rdev->chip_ctx)) {
> + /* Legacy chips need 128 WQEs reserved for HW (8916) */
> + if (sq->max_wqe <= BNXT_QPLIB_RESERVED_QP_WRS)
> + return -EINVAL;
> + sq->q_full_delta = BNXT_QPLIB_RESERVED_QP_WRS;
> } else {
> sq->q_full_delta = 0;
> }
[Severity: Medium]
Does capping sq->max_wqe at dev_attr->max_qp_wqes + 1 reject valid static
WQE SQ sizes when fixed_que_attr is set?
In bnxt_qplib_get_dev_attr(), dev_attr->max_qp_wqes has already been
reduced for legacy chips or overwritten for variable-WQE chips:
drivers/infiniband/hw/bnxt_re/qplib_sp.c:bnxt_qplib_get_dev_attr() {
...
attr->max_qp_wqes = le16_to_cpu(sb->max_qp_wr) - 1;
if (!bnxt_qplib_is_chip_gen_p5_p7(rcfw->res->cctx)) {
/*
* 128 WQEs needs to be reserved for the HW (8916). Prevent
* reporting the max number on legacy devices
*/
attr->max_qp_wqes -= BNXT_QPLIB_RESERVED_QP_WRS + 1;
}
/* Adjust for max_qp_wqes for variable wqe */
if (cctx->modes.wqe_mode == BNXT_QPLIB_WQE_MODE_VARIABLE)
attr->max_qp_wqes = BNXT_VAR_MAX_WQE - 1;
...
}
On non-P5/P7 chips, fixed_que_attr static QPs still reserve
BNXT_QPLIB_RESERVED_QP_WRS (128) WQEs out of sq->max_wqe via
sq->q_full_delta, so checking sq->max_wqe against dev_attr->max_qp_wqes + 1
without adding BNXT_QPLIB_RESERVED_QP_WRS (unlike the else branch) rejects
QPs sized near the reported max_qp_wr limit with -EINVAL. On chips where
cctx->modes.wqe_mode is BNXT_QPLIB_WQE_MODE_VARIABLE, dev_attr->max_qp_wqes
is 4351, so the check caps static WQE SQs at 4352 WQEs (34816 slots) even
though bnxt_re_init_qp_attr() allows ureq->sq_slots up to
BNXT_RE_MAX_SQ_SLOTS (65536 slots, or 8192 static WQEs).
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261130145344.322857-1-selvin.xavier@broadcom.com?part=4
prev parent reply other threads:[~2026-11-30 9:51 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 14:53 [PATCH for-next v2 0/4] RDMA/bnxt_re: CQ and QP updates for app allocated queues Selvin Xavier
2026-11-30 9:51 ` sashiko-bot
2026-11-30 14:53 ` [PATCH for-next v2 1/4] RDMA/bnxt_re: Disable CQ overflow detection on P7 adapters based on FW support Selvin Xavier
2026-11-30 14:53 ` [PATCH for-next v2 2/4] RDMA/bnxt_re: Set CQ coalescing max buffers to 1 for CQs with depth 1 Selvin Xavier
2026-11-30 14:53 ` [PATCH for-next v2 3/4] RDMA/bnxt_re: Simplify PSN size and QP HWQ setup paths Selvin Xavier
2026-11-30 14:53 ` [PATCH for-next v2 4/4] RDMA/bnxt_re: Allow user library to request STATIC WQE mode per-QP Selvin Xavier
2026-11-30 9:51 ` sashiko-bot [this message]
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=sashiko-outbox-240813@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=selvin.xavier@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