Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

bnxt_en: set backing store type from query type

bnxt_hwrm_func_backing_store_qcaps_v2() stores resp->type from the
firmware response in ctxm->type and later uses that value to index
fixed backing-store metadata arrays such as ctx_arr[] and
bnxt_bstore_to_trace[].

ctxm->type is fixed by the current backing-store query type and matches
the array index of ctx->ctx_arr. Set ctxm->type from the current loop
variable instead of depending on resp->type.

Also update the loop to advance type from next_valid_type in the for
statement, which keeps the control flow simpler for non-valid and
unchanged entries.

Fixes: 6a4d0774f02d ("bnxt_en: Add support for new backing store query firmware API")
Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
Reviewed-by: Michael Chan <michael.chan@broadcom.com>
Tested-by: Michael Chan <michael.chan@broadcom.com>
Link: https://patch.msgid.link/20260328234357.43669-1-pengpeng@iscas.ac.cn
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Pengpeng Hou and committed by
Jakub Kicinski
4ee93710 cedc1bf3

+4 -4
+4 -4
drivers/net/ethernet/broadcom/bnxt/bnxt.c
··· 8671 8671 struct hwrm_func_backing_store_qcaps_v2_output *resp; 8672 8672 struct hwrm_func_backing_store_qcaps_v2_input *req; 8673 8673 struct bnxt_ctx_mem_info *ctx = bp->ctx; 8674 - u16 type; 8674 + u16 type, next_type = 0; 8675 8675 int rc; 8676 8676 8677 8677 rc = hwrm_req_init(bp, req, HWRM_FUNC_BACKING_STORE_QCAPS_V2); ··· 8687 8687 8688 8688 resp = hwrm_req_hold(bp, req); 8689 8689 8690 - for (type = 0; type < BNXT_CTX_V2_MAX; ) { 8690 + for (type = 0; type < BNXT_CTX_V2_MAX; type = next_type) { 8691 8691 struct bnxt_ctx_mem_type *ctxm = &ctx->ctx_arr[type]; 8692 8692 u8 init_val, init_off, i; 8693 8693 u32 max_entries; ··· 8700 8700 if (rc) 8701 8701 goto ctx_done; 8702 8702 flags = le32_to_cpu(resp->flags); 8703 - type = le16_to_cpu(resp->next_valid_type); 8703 + next_type = le16_to_cpu(resp->next_valid_type); 8704 8704 if (!(flags & BNXT_CTX_MEM_TYPE_VALID)) { 8705 8705 bnxt_free_one_ctx_mem(bp, ctxm, true); 8706 8706 continue; ··· 8715 8715 else 8716 8716 continue; 8717 8717 } 8718 - ctxm->type = le16_to_cpu(resp->type); 8718 + ctxm->type = type; 8719 8719 ctxm->entry_size = entry_size; 8720 8720 ctxm->flags = flags; 8721 8721 ctxm->instance_bmap = le32_to_cpu(resp->instance_bit_map);