Skip to content

Commit 2b8503d

Browse files
Shruti Parabgregkh
authored andcommitted
bnxt_en: Add mem_valid bit to struct bnxt_ctx_mem_type
[ Upstream commit 0b350b4 ] Add a new bit to struct bnxt_ctx_mem_type to indicate that host memory has been successfully allocated for this context memory type. In the next patches, we'll be adding some additional context memory types for FW debugging/logging. If memory cannot be allocated for any of these new types, we will not abort and the cleared mem_valid bit will indicate to skip configuring the memory type. Reviewed-by: Hongguang Gao <hongguang.gao@broadcom.com> Signed-off-by: Shruti Parab <shruti.parab@broadcom.com> Signed-of-by: Michael Chan <michael.chan@broadcom.com> Link: https://patch.msgid.link/20241115151438.550106-3-michael.chan@broadcom.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Stable-dep-of: 5204943 ("bnxt_en: Fix warning in bnxt_dl_reload_down()") Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 2c8ca35 commit 2b8503d

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

drivers/net/ethernet/broadcom/bnxt/bnxt.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8791,6 +8791,8 @@ static int bnxt_setup_ctxm_pg_tbls(struct bnxt *bp,
87918791
rc = bnxt_alloc_ctx_pg_tbls(bp, &ctx_pg[i], mem_size, pg_lvl,
87928792
ctxm->init_value ? ctxm : NULL);
87938793
}
8794+
if (!rc)
8795+
ctxm->mem_valid = 1;
87948796
return rc;
87958797
}
87968798

@@ -8861,6 +8863,8 @@ static int bnxt_backing_store_cfg_v2(struct bnxt *bp, u32 ena)
88618863
for (type = 0 ; type < BNXT_CTX_V2_MAX; type++) {
88628864
ctxm = &ctx->ctx_arr[type];
88638865

8866+
if (!ctxm->mem_valid)
8867+
continue;
88648868
rc = bnxt_hwrm_func_backing_store_cfg_v2(bp, ctxm, ctxm->last);
88658869
if (rc)
88668870
return rc;
@@ -8890,6 +8894,7 @@ void bnxt_free_ctx_mem(struct bnxt *bp)
88908894

88918895
kfree(ctx_pg);
88928896
ctxm->pg_info = NULL;
8897+
ctxm->mem_valid = 0;
88938898
}
88948899

88958900
ctx->flags &= ~BNXT_CTX_FLAG_INITED;

drivers/net/ethernet/broadcom/bnxt/bnxt.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1892,6 +1892,7 @@ struct bnxt_ctx_mem_type {
18921892
u32 max_entries;
18931893
u32 min_entries;
18941894
u8 last:1;
1895+
u8 mem_valid:1;
18951896
u8 split_entry_cnt;
18961897
#define BNXT_MAX_SPLIT_ENTRY 4
18971898
union {

0 commit comments

Comments
 (0)