mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-11-07 04:36:52 -10:00
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: d5ce906da7 ("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
This commit is contained in:
1 parent
013f1779f6
commit
aca2e5fae3
3 files changed
+25
-13
No files matched your search
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user