]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
bnxt_en: Add mem_valid bit to struct bnxt_ctx_mem_type
authorShruti Parab <shruti.parab@broadcom.com>
Fri, 15 Nov 2024 15:14:28 +0000 (07:14 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 13 Nov 2025 20:34:38 +0000 (15:34 -0500)
[ Upstream commit 0b350b4927e69d66629099dbb32cad8d2d56a26d ]

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: 5204943a4c6e ("bnxt_en: Fix warning in bnxt_dl_reload_down()")
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/broadcom/bnxt/bnxt.c
drivers/net/ethernet/broadcom/bnxt/bnxt.h

index 30d8e8b34dfb9779c2978315850ec8741f7d4b0e..abf8984ac5e2095abc48ac4b14b722e415864ff7 100644 (file)
@@ -8791,6 +8791,8 @@ static int bnxt_setup_ctxm_pg_tbls(struct bnxt *bp,
                rc = bnxt_alloc_ctx_pg_tbls(bp, &ctx_pg[i], mem_size, pg_lvl,
                                            ctxm->init_value ? ctxm : NULL);
        }
+       if (!rc)
+               ctxm->mem_valid = 1;
        return rc;
 }
 
@@ -8861,6 +8863,8 @@ static int bnxt_backing_store_cfg_v2(struct bnxt *bp, u32 ena)
        for (type = 0 ; type < BNXT_CTX_V2_MAX; type++) {
                ctxm = &ctx->ctx_arr[type];
 
+               if (!ctxm->mem_valid)
+                       continue;
                rc = bnxt_hwrm_func_backing_store_cfg_v2(bp, ctxm, ctxm->last);
                if (rc)
                        return rc;
@@ -8890,6 +8894,7 @@ void bnxt_free_ctx_mem(struct bnxt *bp)
 
                kfree(ctx_pg);
                ctxm->pg_info = NULL;
+               ctxm->mem_valid = 0;
        }
 
        ctx->flags &= ~BNXT_CTX_FLAG_INITED;
index cb934f175a3e40a1851fd9f82073183e151dc074..d4e63bf5996663a3892eff478d31dbb97c951d2b 100644 (file)
@@ -1892,6 +1892,7 @@ struct bnxt_ctx_mem_type {
        u32     max_entries;
        u32     min_entries;
        u8      last:1;
+       u8      mem_valid:1;
        u8      split_entry_cnt;
 #define BNXT_MAX_SPLIT_ENTRY   4
        union {