git: aca2e5fae3d9 - main - if_bnxt: size MRAV from the AV split entry for backing store V2
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 02 Nov 2026 07:56:44 UTC
The branch main has been updated by ssaxena:
URL: https://cgit.FreeBSD.org/src/commit/?id=aca2e5fae3d9c3350b47ee3e7d00937a73dba9a9
commit aca2e5fae3d9c3350b47ee3e7d00937a73dba9a9
Author: Sumit Saxena <sumit.saxena@broadcom.com>
AuthorDate: 2026-10-22 10:48:42 +0000
Commit: Sumit Saxena <ssaxena@FreeBSD.org>
CommitDate: 2026-11-02 07:55:42 +0000
if_bnxt: size MRAV from the AV split entry for backing store V2
On RoCE-capable Thor2, attach fails with
HWRM_FUNC_BACKING_STORE_CFG_V2 returning INVALID_PARAMS, as MRAV is
sized the pre-V2 way and the firmware's AV split value is sent as is.
Size MRAV from the AV split entry, and move the legacy entry-count
packing into bnxt_hwrm_func_backing_store_cfg().
Fixes: d5ce906da7c5 ("bnxt_en: Add backing store V2 support")
Reviewed by: gallatin
Sponsored by: Broadcom Inc
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D60976
---
sys/dev/bnxt/bnxt_en/bnxt.h | 2 ++
sys/dev/bnxt/bnxt_en/bnxt_hwrm.c | 12 +++++++++++-
sys/dev/bnxt/bnxt_en/if_bnxt.c | 24 ++++++++++++------------
3 files changed, 25 insertions(+), 13 deletions(-)
diff --git a/sys/dev/bnxt/bnxt_en/bnxt.h b/sys/dev/bnxt/bnxt_en/bnxt.h
index 07108cec9f98..5c37fb4b2857 100644
--- a/sys/dev/bnxt/bnxt_en/bnxt.h
+++ b/sys/dev/bnxt/bnxt_en/bnxt.h
@@ -964,6 +964,8 @@ struct bnxt_ctx_mem_type {
struct bnxt_ctx_pg_info *pg_info;
};
+#define BNXT_CTX_MRAV_AV_SPLIT_ENTRY 0
+
#define BNXT_CTX_QP HWRM_FUNC_BACKING_STORE_CFG_V2_INPUT_TYPE_QP
#define BNXT_CTX_SRQ HWRM_FUNC_BACKING_STORE_CFG_V2_INPUT_TYPE_SRQ
#define BNXT_CTX_CQ HWRM_FUNC_BACKING_STORE_CFG_V2_INPUT_TYPE_CQ
diff --git a/sys/dev/bnxt/bnxt_en/bnxt_hwrm.c b/sys/dev/bnxt/bnxt_en/bnxt_hwrm.c
index cbafba396827..54e06f3a7972 100644
--- a/sys/dev/bnxt/bnxt_en/bnxt_hwrm.c
+++ b/sys/dev/bnxt/bnxt_en/bnxt_hwrm.c
@@ -696,12 +696,22 @@ int bnxt_hwrm_func_backing_store_cfg(struct bnxt_softc *softc, uint32_t enables)
&req.cq_page_dir);
}
if (enables & HWRM_FUNC_BACKING_STORE_CFG_INPUT_ENABLES_MRAV) {
+ u32 units;
+
ctxm = &ctx->ctx_arr[BNXT_CTX_MRAV];
ctx_pg = ctxm->pg_info;
req.mrav_num_entries = htole32(ctx_pg->entries);
- if (ctxm->mrav_num_entries_units)
+ units = ctxm->mrav_num_entries_units;
+ if (units) {
+ u32 num_mr, num_ah = ctxm->mrav_av_entries;
+
+ num_mr = ctx_pg->entries - num_ah;
+ req.mrav_num_entries =
+ htole32(((num_mr / units) << 16) |
+ (num_ah / units));
flags |=
HWRM_FUNC_BACKING_STORE_CFG_INPUT_FLAGS_MRAV_RESERVATION_SPLIT;
+ }
req.mrav_entry_size = htole16(ctxm->entry_size);
bnxt_hwrm_set_pg_attr(&ctx_pg->ring_mem,
&req.mrav_pg_size_mrav_lvl,
diff --git a/sys/dev/bnxt/bnxt_en/if_bnxt.c b/sys/dev/bnxt/bnxt_en/if_bnxt.c
index 630301604e3e..4f380b7b956e 100644
--- a/sys/dev/bnxt/bnxt_en/if_bnxt.c
+++ b/sys/dev/bnxt/bnxt_en/if_bnxt.c
@@ -1480,7 +1480,6 @@ bnxt_backing_store_cfg_v2(struct bnxt_softc *softc, u32 ena)
static int bnxt_alloc_ctx_mem(struct bnxt_softc *softc)
{
- struct bnxt_ctx_pg_info *ctx_pg;
struct bnxt_ctx_mem_type *ctxm;
struct bnxt_ctx_mem_info *ctx;
u32 l2_qps, qp1_qps, max_qps;
@@ -1558,21 +1557,22 @@ static int bnxt_alloc_ctx_mem(struct bnxt_softc *softc)
goto skip_rdma;
ctxm = &ctx->ctx_arr[BNXT_CTX_MRAV];
- ctx_pg = ctxm->pg_info;
- /* 128K extra is needed to accomodate static AH context
- * allocation by f/w.
- */
- num_mr = min_t(u32, ctxm->max_entries / 2, 1024 * 256);
- num_ah = min_t(u32, num_mr, 1024 * 128);
+ if (BNXT_SW_RES_LMT(softc) &&
+ ctxm->split_entry_cnt == BNXT_CTX_MRAV_AV_SPLIT_ENTRY + 1) {
+ num_ah = ctxm->mrav_av_entries;
+ num_mr = ctxm->max_entries - num_ah;
+ } else {
+ /* 128K extra for static AH contexts allocated by f/w. */
+ num_mr = min_t(u32, ctxm->max_entries / 2, 1024 * 256);
+ num_ah = min_t(u32, num_mr, 1024 * 128);
+ ctxm->split_entry_cnt = BNXT_CTX_MRAV_AV_SPLIT_ENTRY + 1;
+ if (!ctxm->mrav_av_entries || ctxm->mrav_av_entries > num_ah)
+ ctxm->mrav_av_entries = num_ah;
+ }
rc = bnxt_setup_ctxm_pg_tbls(softc, ctxm, num_mr + num_ah, 2);
if (rc)
return rc;
- ctx_pg->entries = num_mr + num_ah;
ena = HWRM_FUNC_BACKING_STORE_CFG_INPUT_ENABLES_MRAV;
- if (ctxm->mrav_num_entries_units)
- ctx_pg->entries =
- ((num_mr / ctxm->mrav_num_entries_units) << 16) |
- (num_ah / ctxm->mrav_num_entries_units);
ctxm = &ctx->ctx_arr[BNXT_CTX_TIM];
rc = bnxt_setup_ctxm_pg_tbls(softc, ctxm, l2_qps + qp1_qps + extra_qps, 1);