From: Simon Horman <horms@kernel.org>
To: Siva Reddy Kallam <siva.kallam@broadcom.com>
Cc: leonro@nvidia.com, jgg@nvidia.com, linux-rdma@vger.kernel.org,
netdev@vger.kernel.org, vikas.gupta@broadcom.com,
selvin.xavier@broadcom.com, anand.subramanian@broadcom.com,
Usman Ansari <usman.ansari@broadcom.com>
Subject: Re: [PATCH 6/8] RDMA/bng_re: Enable Firmware channel and query device attributes
Date: Fri, 12 Sep 2025 09:42:34 +0100 [thread overview]
Message-ID: <20250912084234.GT30363@horms.kernel.org> (raw)
In-Reply-To: <20250829123042.44459-7-siva.kallam@broadcom.com>
On Fri, Aug 29, 2025 at 12:30:40PM +0000, Siva Reddy Kallam wrote:
> Enable Firmware channel and query device attributes
>
> Signed-off-by: Siva Reddy Kallam <siva.kallam@broadcom.com>
> Reviewed-by: Usman Ansari <usman.ansari@broadcom.com>
...
> diff --git a/drivers/infiniband/hw/bng_re/bng_sp.c b/drivers/infiniband/hw/bng_re/bng_sp.c
...
> +int bng_re_get_dev_attr(struct bng_re_rcfw *rcfw)
> +{
> + struct bng_re_dev_attr *attr = rcfw->res->dattr;
> + struct creq_query_func_resp resp = {};
> + struct bng_re_cmdqmsg msg = {};
> + struct creq_query_func_resp_sb *sb;
> + struct bng_re_rcfw_sbuf sbuf;
> + struct bng_re_chip_ctx *cctx;
> + struct cmdq_query_func req = {};
> + u8 *tqm_alloc;
> + int i, rc;
> + u32 temp;
> +
> + cctx = rcfw->res->cctx;
Similar to my comment on an earlier patch in this series,
cctx appears to be initialised but otherwise unused in this function.
> + bng_re_rcfw_cmd_prep((struct cmdq_base *)&req,
> + CMDQ_BASE_OPCODE_QUERY_FUNC,
> + sizeof(req));
> +
> + sbuf.size = ALIGN(sizeof(*sb), BNG_FW_CMDQE_UNITS);
> + sbuf.sb = dma_alloc_coherent(&rcfw->pdev->dev, sbuf.size,
> + &sbuf.dma_addr, GFP_KERNEL);
> + if (!sbuf.sb)
> + return -ENOMEM;
> + sb = sbuf.sb;
> + req.resp_size = sbuf.size / BNG_FW_CMDQE_UNITS;
> + bng_re_fill_cmdqmsg(&msg, &req, &resp, &sbuf, sizeof(req),
> + sizeof(resp), 0);
> + rc = bng_re_rcfw_send_message(rcfw, &msg);
> + if (rc)
> + goto bail;
> + /* Extract the context from the side buffer */
> + attr->max_qp = le32_to_cpu(sb->max_qp);
> + /* max_qp value reported by FW doesn't include the QP1 */
> + attr->max_qp += 1;
> + attr->max_qp_rd_atom =
> + sb->max_qp_rd_atom > BNG_RE_MAX_OUT_RD_ATOM ?
> + BNG_RE_MAX_OUT_RD_ATOM : sb->max_qp_rd_atom;
> + attr->max_qp_init_rd_atom =
> + sb->max_qp_init_rd_atom > BNG_RE_MAX_OUT_RD_ATOM ?
> + BNG_RE_MAX_OUT_RD_ATOM : sb->max_qp_init_rd_atom;
> + attr->max_qp_wqes = le16_to_cpu(sb->max_qp_wr) - 1;
> +
> + /* Adjust for max_qp_wqes for variable wqe */
> + attr->max_qp_wqes = min_t(u32, attr->max_qp_wqes, BNG_VAR_MAX_WQE - 1);
> +
> + attr->max_qp_sges = min_t(u32, sb->max_sge_var_wqe, BNG_VAR_MAX_SGE);
> + attr->max_cq = le32_to_cpu(sb->max_cq);
> + attr->max_cq_wqes = le32_to_cpu(sb->max_cqe);
> + attr->max_cq_sges = attr->max_qp_sges;
> + attr->max_mr = le32_to_cpu(sb->max_mr);
> + attr->max_mw = le32_to_cpu(sb->max_mw);
> +
> + attr->max_mr_size = le64_to_cpu(sb->max_mr_size);
> + attr->max_pd = 64 * 1024;
> + attr->max_raw_ethy_qp = le32_to_cpu(sb->max_raw_eth_qp);
> + attr->max_ah = le32_to_cpu(sb->max_ah);
> +
> + attr->max_srq = le16_to_cpu(sb->max_srq);
> + attr->max_srq_wqes = le32_to_cpu(sb->max_srq_wr) - 1;
> + attr->max_srq_sges = sb->max_srq_sge;
> + attr->max_pkey = 1;
> + attr->max_inline_data = le32_to_cpu(sb->max_inline_data);
> + /*
> + * Read the max gid supported by HW.
> + * For each entry in HW GID in HW table, we consume 2
> + * GID entries in the kernel GID table. So max_gid reported
> + * to stack can be up to twice the value reported by the HW, up to 256 gids.
> + */
> + attr->max_sgid = le32_to_cpu(sb->max_gid);
> + attr->max_sgid = min_t(u32, BNG_RE_NUM_GIDS_SUPPORTED, 2 * attr->max_sgid);
> + attr->dev_cap_flags = le16_to_cpu(sb->dev_cap_flags);
> + attr->dev_cap_flags2 = le16_to_cpu(sb->dev_cap_ext_flags_2);
> +
> + if (_is_max_srq_ext_supported(attr->dev_cap_flags2))
> + attr->max_srq += le16_to_cpu(sb->max_srq_ext);
> +
> + bng_re_query_version(rcfw, attr->fw_ver);
> + for (i = 0; i < BNG_MAX_TQM_ALLOC_REQ / 4; i++) {
> + temp = le32_to_cpu(sb->tqm_alloc_reqs[i]);
> + tqm_alloc = (u8 *)&temp;
> + attr->tqm_alloc_reqs[i * 4] = *tqm_alloc;
> + attr->tqm_alloc_reqs[i * 4 + 1] = *(++tqm_alloc);
> + attr->tqm_alloc_reqs[i * 4 + 2] = *(++tqm_alloc);
> + attr->tqm_alloc_reqs[i * 4 + 3] = *(++tqm_alloc);
> + }
> +
> + attr->max_dpi = le32_to_cpu(sb->max_dpi);
> + attr->is_atomic = bng_re_is_atomic_cap(rcfw);
> +bail:
> + dma_free_coherent(&rcfw->pdev->dev, sbuf.size,
> + sbuf.sb, sbuf.dma_addr);
> + return rc;
> +}
...
next prev parent reply other threads:[~2025-09-12 8:42 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-29 12:30 [PATCH 0/8] Introducing Broadcom BNG_RE RoCE Driver Siva Reddy Kallam
2025-08-29 12:30 ` [PATCH 1/8] bng_en: Add RoCE aux device support Siva Reddy Kallam
2025-09-01 19:10 ` Jakub Kicinski
2025-08-29 12:30 ` [PATCH 2/8] RDMA/bng_re: Add Auxiliary interface Siva Reddy Kallam
2025-09-16 12:34 ` Simon Horman
2025-09-17 9:17 ` Siva Reddy Kallam
2025-08-29 12:30 ` [PATCH 3/8] RDMA/bng_re: Register and get the resources from bnge driver Siva Reddy Kallam
2025-08-29 12:30 ` [PATCH 4/8] RDMA/bng_re: Allocate required memory resources for Firmware channel Siva Reddy Kallam
2025-08-29 12:30 ` [PATCH 5/8] RDMA/bng_re: Add infrastructure for enabling " Siva Reddy Kallam
2025-09-12 8:39 ` Simon Horman
2025-09-15 8:44 ` Siva Reddy Kallam
2025-09-15 9:00 ` Leon Romanovsky
2025-09-15 10:09 ` Siva Reddy Kallam
2025-08-29 12:30 ` [PATCH 6/8] RDMA/bng_re: Enable Firmware channel and query device attributes Siva Reddy Kallam
2025-09-12 8:42 ` Simon Horman [this message]
2025-09-15 8:46 ` Siva Reddy Kallam
2025-08-29 12:30 ` [PATCH 7/8] RDMA/bng_re: Add basic debugfs infrastructure Siva Reddy Kallam
2025-08-29 12:30 ` [PATCH 8/8] RDMA/bng_re: Initialize the Firmware and Hardware Siva Reddy Kallam
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=20250912084234.GT30363@horms.kernel.org \
--to=horms@kernel.org \
--cc=anand.subramanian@broadcom.com \
--cc=jgg@nvidia.com \
--cc=leonro@nvidia.com \
--cc=linux-rdma@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=selvin.xavier@broadcom.com \
--cc=siva.kallam@broadcom.com \
--cc=usman.ansari@broadcom.com \
--cc=vikas.gupta@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;
as well as URLs for NNTP newsgroup(s).