[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CACKFLim09whYXguLVgvUA8oXot051zK5MnLbujDMkTZsQqRc0A@mail.gmail.com>
Date: Tue, 16 Sep 2025 08:58:16 -0700
From: Michael Chan <michael.chan@...adcom.com>
To: Paolo Abeni <pabeni@...hat.com>
Cc: davem@...emloft.net, netdev@...r.kernel.org, edumazet@...gle.com,
kuba@...nel.org, andrew+netdev@...n.ch, pavan.chebbi@...adcom.com,
andrew.gospodarek@...adcom.com,
Kalesh AP <kalesh-anakkur.purayil@...adcom.com>,
Somnath Kotur <somnath.kotur@...adcom.com>
Subject: Re: [PATCH net-next 04/11] bnxt_en: Improve bnxt_hwrm_func_backing_store_cfg_v2()
On Tue, Sep 16, 2025 at 4:19 AM Paolo Abeni <pabeni@...hat.com> wrote:
>
> 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.
>
Yes, you are absolutely right. The original code will skip over zeros
in the instance_bmap without incrementing j. Let me rethink this
patch or drop this patch. Thanks for the review.
Powered by blists - more mailing lists