Skip to content

Commit 4ee9371

Browse files
neosys007kuba-moo
authored andcommitted
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: 6a4d077 ("bnxt_en: Add support for new backing store query firmware API") Signed-off-by: Pengpeng Hou <[email protected]> Reviewed-by: Michael Chan <[email protected]> Tested-by: Michael Chan <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent cedc1bf commit 4ee9371

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

  • drivers/net/ethernet/broadcom/bnxt

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8671,7 +8671,7 @@ static int bnxt_hwrm_func_backing_store_qcaps_v2(struct bnxt *bp)
86718671
struct hwrm_func_backing_store_qcaps_v2_output *resp;
86728672
struct hwrm_func_backing_store_qcaps_v2_input *req;
86738673
struct bnxt_ctx_mem_info *ctx = bp->ctx;
8674-
u16 type;
8674+
u16 type, next_type = 0;
86758675
int rc;
86768676

86778677
rc = hwrm_req_init(bp, req, HWRM_FUNC_BACKING_STORE_QCAPS_V2);
@@ -8687,7 +8687,7 @@ static int bnxt_hwrm_func_backing_store_qcaps_v2(struct bnxt *bp)
86878687

86888688
resp = hwrm_req_hold(bp, req);
86898689

8690-
for (type = 0; type < BNXT_CTX_V2_MAX; ) {
8690+
for (type = 0; type < BNXT_CTX_V2_MAX; type = next_type) {
86918691
struct bnxt_ctx_mem_type *ctxm = &ctx->ctx_arr[type];
86928692
u8 init_val, init_off, i;
86938693
u32 max_entries;
@@ -8700,7 +8700,7 @@ static int bnxt_hwrm_func_backing_store_qcaps_v2(struct bnxt *bp)
87008700
if (rc)
87018701
goto ctx_done;
87028702
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);
87048704
if (!(flags & BNXT_CTX_MEM_TYPE_VALID)) {
87058705
bnxt_free_one_ctx_mem(bp, ctxm, true);
87068706
continue;
@@ -8715,7 +8715,7 @@ static int bnxt_hwrm_func_backing_store_qcaps_v2(struct bnxt *bp)
87158715
else
87168716
continue;
87178717
}
8718-
ctxm->type = le16_to_cpu(resp->type);
8718+
ctxm->type = type;
87198719
ctxm->entry_size = entry_size;
87208720
ctxm->flags = flags;
87218721
ctxm->instance_bmap = le32_to_cpu(resp->instance_bit_map);

0 commit comments

Comments
 (0)