Commit 4ee93710 authored by Pengpeng Hou's avatar Pengpeng Hou Committed by Jakub Kicinski
Browse files

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: 6a4d0774 ("bnxt_en: Add support for new backing store query firmware API")
Signed-off-by: default avatarPengpeng Hou <pengpeng@iscas.ac.cn>
Reviewed-by: default avatarMichael Chan <michael.chan@broadcom.com>
Tested-by: default avatarMichael Chan <michael.chan@broadcom.com>
Link: https://patch.msgid.link/20260328234357.43669-1-pengpeng@iscas.ac.cn


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent cedc1bf3
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -8671,7 +8671,7 @@ static int bnxt_hwrm_func_backing_store_qcaps_v2(struct bnxt *bp)
	struct hwrm_func_backing_store_qcaps_v2_output *resp;
	struct hwrm_func_backing_store_qcaps_v2_input *req;
	struct bnxt_ctx_mem_info *ctx = bp->ctx;
	u16 type;
	u16 type, next_type = 0;
	int rc;

	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)

	resp = hwrm_req_hold(bp, req);

	for (type = 0; type < BNXT_CTX_V2_MAX; ) {
	for (type = 0; type < BNXT_CTX_V2_MAX; type = next_type) {
		struct bnxt_ctx_mem_type *ctxm = &ctx->ctx_arr[type];
		u8 init_val, init_off, i;
		u32 max_entries;
@@ -8700,7 +8700,7 @@ static int bnxt_hwrm_func_backing_store_qcaps_v2(struct bnxt *bp)
		if (rc)
			goto ctx_done;
		flags = le32_to_cpu(resp->flags);
		type = le16_to_cpu(resp->next_valid_type);
		next_type = le16_to_cpu(resp->next_valid_type);
		if (!(flags & BNXT_CTX_MEM_TYPE_VALID)) {
			bnxt_free_one_ctx_mem(bp, ctxm, true);
			continue;
@@ -8715,7 +8715,7 @@ static int bnxt_hwrm_func_backing_store_qcaps_v2(struct bnxt *bp)
			else
				continue;
		}
		ctxm->type = le16_to_cpu(resp->type);
		ctxm->type = type;
		ctxm->entry_size = entry_size;
		ctxm->flags = flags;
		ctxm->instance_bmap = le32_to_cpu(resp->instance_bit_map);