Skip to content

Commit 0b350b4

Browse files
Shruti Parabkuba-moo
authored andcommitted
bnxt_en: Add mem_valid bit to struct bnxt_ctx_mem_type
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>
1 parent ff00bcc commit 0b350b4

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
@@ -8684,6 +8684,8 @@ static int bnxt_setup_ctxm_pg_tbls(struct bnxt *bp,
86848684
rc = bnxt_alloc_ctx_pg_tbls(bp, &ctx_pg[i], mem_size, pg_lvl,
86858685
ctxm->init_value ? ctxm : NULL);
86868686
}
8687+
if (!rc)
8688+
ctxm->mem_valid = 1;
86878689
return rc;
86888690
}
86898691

@@ -8754,6 +8756,8 @@ static int bnxt_backing_store_cfg_v2(struct bnxt *bp, u32 ena)
87548756
for (type = 0 ; type < BNXT_CTX_V2_MAX; type++) {
87558757
ctxm = &ctx->ctx_arr[type];
87568758

8759+
if (!ctxm->mem_valid)
8760+
continue;
87578761
rc = bnxt_hwrm_func_backing_store_cfg_v2(bp, ctxm, ctxm->last);
87588762
if (rc)
87598763
return rc;
@@ -8783,6 +8787,7 @@ void bnxt_free_ctx_mem(struct bnxt *bp)
87838787

87848788
kfree(ctx_pg);
87858789
ctxm->pg_info = NULL;
8790+
ctxm->mem_valid = 0;
87868791
}
87878792

87888793
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
@@ -1889,6 +1889,7 @@ struct bnxt_ctx_mem_type {
18891889
u32 max_entries;
18901890
u32 min_entries;
18911891
u8 last:1;
1892+
u8 mem_valid:1;
18921893
u8 split_entry_cnt;
18931894
#define BNXT_MAX_SPLIT_ENTRY 4
18941895
union {

0 commit comments

Comments
 (0)