Re: [PATCH net-next 04/11] bnxt_en: Improve bnxt_hwrm_func_backing_store_cfg_v2()
From: Paolo Abeni <pabeni@redhat.com>
Date: 2025-09-16 11:19:06
From: Paolo Abeni <pabeni@redhat.com>
Date: 2025-09-16 11:19:06
On 9/15/25 5:04 AM, Michael Chan wrote:
Optimize the loop inside this function that sends the FW message to configure backing store memory for each instance of a memory type. It uses 2 loop counters i and j, but both counters advance at the same time so we can eliminate one of them.
The above statement does not look correct.
@@ -9128,20 +9128,20 @@ static int bnxt_hwrm_func_backing_store_cfg_v2(struct bnxt *bp, req->subtype_valid_cnt = ctxm->split_entry_cnt; for (i = 0, p = &req->split_entry_0; i < ctxm->split_entry_cnt; i++) p[i] = cpu_to_le32(ctxm->split[i]); - for (i = 0, j = 0; j < n && !rc; i++) { + for (i = 0; i < n && !rc; i++) { struct bnxt_ctx_pg_info *ctx_pg; if (!(instance_bmap & (1 << i))) continue; req->instance = cpu_to_le16(i); - ctx_pg = &ctxm->pg_info[j++]; + ctx_pg = &ctxm->pg_info[i];
`j` is incremented only for bit set in `instance_bmap`, AFAICS this does not introduces functional changes only if `instance_bmap` has all the bit set. /P