From: sashiko-bot@kernel.org
To: "Siva Reddy Kallam" <siva.kallam@broadcom.com>
Cc: linux-rdma@vger.kernel.org
Subject: Re: [RDMA v2 10/13] RDMA/bng_re: Add Stats verbs
Date: Sat, 05 Dec 2026 16:10:11 +0000 [thread overview]
Message-ID: <sashiko-outbox-251734@kernel.org> (raw)
In-Reply-To: <20261204155249.1002019-11-siva.kallam@broadcom.com>
Thank you for your contribution! Sashiko AI review found 4 potential
issues to consider:
- [Medium] RDMA/bng_re: bng_re_ib_get_hw_stats() ignores firmware query
errors
- [Medium] RDMA/bng_re: bng_sp_query_srq() leaks DMA sbuf on unposted
timeouts
- [Low] RDMA/bng_re: commit message omits RCFW msg->posted and sbuf
timeout changes
- [Low] RDMA/bng_re: bng_re_alloc_hw_port_stats() exposes unsupported
ext counters
--
commit db6ba711153b68d8a6509d08bb7e50da99843672
Author: Usman Ansari <usman.ansari@broadcom.com>
> RDMA/bng_re: Add Stats verbs
>
> This patch adds below verbs.
> - bng_re_alloc_hw_port_stats
> - bng_re_ib_get_hw_stats
>
> Signed-off-by: Usman Ansari <usman.ansari@broadcom.com>
> Signed-off-by: Siva Reddy Kallam <siva.kallam@broadcom.com>
[Severity: Low]
Should the commit message also describe the shared RCFW and side-buffer
changes?
In addition to the stats verbs, this patch adds posted tracking to struct
bng_re_cmdqmsg and bng_re_rcfw_send_message(), adds oos_prev and
init_oos_stats to struct bng_re_rcfw, and introduces bng_re_free_sbuf() to
keep DMA side buffers allocated when a posted command times out.
[ ... ]
> diff --git a/drivers/infiniband/hw/bng_re/bng_hw_counters.c b/drivers/infiniband/hw/bng_re/bng_hw_counters.c
> new file mode 100644
> index 0000000000000..be32c59cc59eb
> --- /dev/null
> +++ b/drivers/infiniband/hw/bng_re/bng_hw_counters.c
[ ... ]
> +struct rdma_hw_stats *bng_re_alloc_hw_port_stats(struct ib_device *ibdev, u32 port_num)
> +{
> + int num_counters = 0;
> +
> + num_counters = BNG_RE_NUM_EXT_COUNTERS;
> +
> + return rdma_alloc_hw_stats_struct(bng_re_stat_descs, num_counters,
> + RDMA_HW_STATS_DEFAULT_LIFESPAN);
> +}
[Severity: Low]
Does bng_re_alloc_hw_port_stats() expose unsupported extended counters on
firmware without CREQ_QUERY_FUNC_RESP_SB_EXT_STATS?
bng_re_ib_get_hw_stats() only queries extended stats when
bng_ext_stats_supported() is true, but bng_re_alloc_hw_port_stats()
unconditionally allocates BNG_RE_NUM_EXT_COUNTERS, leaving 20 extended
counters permanently at 0 in sysfs and netlink when unsupported. In
enum bng_re_hw_enum_stats, BNG_RE_REQ_CQE_ERROR, BNG_RE_RESP_CQE_ERROR,
and BNG_RE_RESP_REMOTE_ACCESS_ERRS are also placed after the extended
counters; moving them before the extended range would let
bng_re_alloc_hw_port_stats() and bng_re_ib_get_hw_stats() expose only the
supported prefix.
[ ... ]
> + err_s = &rdev->stats.rstat.errs;
> + if (test_bit(BNG_RE_FLAG_ISSUE_ROCE_STATS, &rdev->flags)) {
> + rc = bng_re_get_roce_stats(&rdev->rcfw, err_s);
> + if (rc)
> + goto done;
> + bng_re_copy_err_stats(rdev, stats, err_s);
> + if (bng_ext_stats_supported(rdev->chip_ctx, rdev->dev_attr->dev_cap_flags)) {
> + rc = bng_re_get_ext_stat(rdev, stats);
> + if (rc)
> + goto done;
> + }
> + }
> +
> +done:
> + return BNG_RE_NUM_EXT_COUNTERS;
> +}
[Severity: Medium]
Should bng_re_ib_get_hw_stats() return rc on failure instead of
BNG_RE_NUM_EXT_COUNTERS?
When bng_re_get_roce_stats() or bng_re_get_ext_stat() fails, jumping to
done discards rc and reports all counters as updated. RDMA core
(update_hw_stats() and stat_get_doit_default_counter()) requires a
negative return value to detect failure; returning BNG_RE_NUM_EXT_COUNTERS
advances stats->timestamp and serves stale, zeroed, or torn snapshots
(such as fresh error counters paired with stale extended counters).
In addition, BNG_RE_FLAG_ISSUE_ROCE_STATS is never cleared on persistent
firmware -EIO rejections, which do not set FIRMWARE_STALL_DETECTED, so
every subsequent stats read retries the failing command, allocates and
frees a coherent DMA buffer, and logs dev_err().
[ ... ]
> diff --git a/drivers/infiniband/hw/bng_re/bng_sp.c b/drivers/infiniband/hw/bng_re/bng_sp.c
> index 40fe509db724c..f2b3c0234b90b 100644
> --- a/drivers/infiniband/hw/bng_re/bng_sp.c
> +++ b/drivers/infiniband/hw/bng_re/bng_sp.c
> @@ -915,3 +915,162 @@ int bng_sp_destroy_srq(struct bng_re_res *res, struct bng_sp_srq *srq)
>
> return 0;
> }
> +
> +/*
> + * Free a response side buffer after a query.
> + *
> + * Firmware DMAs the response straight into the side buffer. If a posted
> + * command times out, the driver only abandons it, firmware may still
> + * write the response later. Freeing the buffer then would let firmware
> + * write into memory that has been reused, so leave this small buffer
> + * allocated in that case.
> + *
> + * A timeout reported before the command was posted, such as after a
> + * firmware stall was already detected, never exposed the buffer to
> + * firmware, so it is freed as usual to avoid leaking one on every call.
> + */
> +static void bng_re_free_sbuf(struct bng_re_rcfw *rcfw, struct bng_re_rcfw_sbuf *sbuf,
> + struct bng_re_cmdqmsg *msg, int rc)
> +{
> + if (rc == -ETIMEDOUT && msg->posted)
> + return;
> +
> + dma_free_coherent(&rcfw->pdev->dev, sbuf->size, sbuf->sb, sbuf->dma_addr);
> +}
[Severity: Medium]
Should bng_sp_query_srq() in this same file also be updated to use
bng_re_free_sbuf()?
bng_sp_query_srq() allocates a DMA side buffer with the same pattern, but
still skips freeing it on every -ETIMEDOUT:
drivers/infiniband/hw/bng_re/bng_sp.c:bng_sp_query_srq() {
...
if (rc != -ETIMEDOUT)
dma_free_coherent(&rcfw->pdev->dev, sbuf.size,
sbuf.sb, sbuf.dma_addr);
}
Once FIRMWARE_STALL_DETECTED is set or pci_channel_offline() is true,
__send_message_basic_sanity() makes bng_re_rcfw_send_message() return
-ETIMEDOUT immediately before posting, so every subsequent query_srq call
(such as via IB_USER_VERBS_CMD_QUERY_SRQ) leaks a coherent DMA buffer.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261204155249.1002019-1-siva.kallam@broadcom.com?part=10
next prev parent reply other threads:[~2026-12-05 16:10 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 15:47 [RDMA v2 00/13] Add BNG_RE control path verbs Siva Reddy Kallam
2026-12-04 15:47 ` [RDMA v2 01/13] bnge: Keep the RoCE MSI-X minimum for the MPC vector Siva Reddy Kallam
2026-12-04 15:47 ` [RDMA v2 02/13] RDMA/bng_re: Add MPC, XID management, doorbell infrastructure Siva Reddy Kallam
2026-12-05 16:10 ` sashiko-bot
2026-12-04 15:47 ` [RDMA v2 03/13] RDMA/bng_re: Add support verbs Siva Reddy Kallam
2026-12-05 16:10 ` sashiko-bot
2026-12-04 15:47 ` [RDMA v2 04/13] RDMA/bng_re: Add ucontext/mmap verbs Siva Reddy Kallam
2026-12-05 16:10 ` sashiko-bot
2026-12-04 15:47 ` [RDMA v2 05/13] RDMA/bng_re: Add GID verbs Siva Reddy Kallam
2026-12-05 16:10 ` sashiko-bot
2026-12-04 15:47 ` [RDMA v2 06/13] RDMA/bng_re: Add PD verbs Siva Reddy Kallam
2026-12-05 16:10 ` sashiko-bot
2026-12-04 15:47 ` [RDMA v2 07/13] RDMA/bng_re: Add MR verbs Siva Reddy Kallam
2026-12-05 16:10 ` sashiko-bot
2026-12-04 15:48 ` [RDMA v2 08/13] RDMA/bng_re: Add CQ verbs Siva Reddy Kallam
2026-12-05 16:10 ` sashiko-bot
2026-12-04 15:48 ` [RDMA v2 09/13] RDMA/bng_re: Add SRQ verbs Siva Reddy Kallam
2026-12-05 16:10 ` sashiko-bot
2026-12-04 15:48 ` [RDMA v2 10/13] RDMA/bng_re: Add Stats verbs Siva Reddy Kallam
2026-12-05 16:10 ` sashiko-bot [this message]
2026-12-04 15:48 ` [RDMA v2 11/13] RDMA/bng_re: Add AH verbs Siva Reddy Kallam
2026-12-05 16:10 ` sashiko-bot
2026-12-04 15:48 ` [RDMA v2 12/13] RDMA/bng_re: Add QP verbs Siva Reddy Kallam
2026-12-05 16:10 ` sashiko-bot
2026-12-04 15:48 ` [RDMA v2 13/13] RDMA/bng_re: Register with ib-core Siva Reddy Kallam
2026-12-05 16:10 ` sashiko-bot
2026-12-05 16:10 ` [RDMA v2 00/13] Add BNG_RE control path verbs sashiko-bot
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-251734@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=siva.kallam@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.