public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH net v7] bnxt_en: set backing store type from query type
@ 2026-03-28 23:43 Pengpeng Hou
  2026-03-29  3:27 ` Michael Chan
  2026-03-31  1:10 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Pengpeng Hou @ 2026-03-28 23:43 UTC (permalink / raw)
  To: michael.chan
  Cc: pavan.chebbi, andrew+netdev, davem, edumazet, kuba, pabeni,
	netdev, linux-kernel, pengpeng

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>
---
v7:
- rename the patch to match the new fix
- advance type from next_valid_type in the for loop statement

Link: https://lore.kernel.org/r/20260328060824.8383-1-pengpeng@iscas.ac.cn

 drivers/net/ethernet/broadcom/bnxt/bnxt.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index 0751c0e4581a..7ed805713fbb 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -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);
-- 
2.50.1 (Apple Git-155)


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net v7] bnxt_en: set backing store type from query type
  2026-03-28 23:43 [PATCH net v7] bnxt_en: set backing store type from query type Pengpeng Hou
@ 2026-03-29  3:27 ` Michael Chan
  2026-03-31  1:10 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Chan @ 2026-03-29  3:27 UTC (permalink / raw)
  To: Pengpeng Hou
  Cc: pavan.chebbi, andrew+netdev, davem, edumazet, kuba, pabeni,
	netdev, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1135 bytes --]

On Sat, Mar 28, 2026 at 4:44 PM Pengpeng Hou <pengpeng@iscas.ac.cn> wrote:
>
> 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>
> ---
> v7:
> - rename the patch to match the new fix
> - advance type from next_valid_type in the for loop statement

Next time, please wait the full 24 hours before posting a new version.  Thanks.

Reviewed-by: Michael Chan <michael.chan@broadcom.com>
Tested-by: Michael Chan <michael.chan@broadcom.com>

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 5469 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net v7] bnxt_en: set backing store type from query type
  2026-03-28 23:43 [PATCH net v7] bnxt_en: set backing store type from query type Pengpeng Hou
  2026-03-29  3:27 ` Michael Chan
@ 2026-03-31  1:10 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-03-31  1:10 UTC (permalink / raw)
  To: Pengpeng Hou
  Cc: michael.chan, pavan.chebbi, andrew+netdev, davem, edumazet, kuba,
	pabeni, netdev, linux-kernel

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Sun, 29 Mar 2026 07:43:56 +0800 you wrote:
> 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.
> 
> [...]

Here is the summary with links:
  - [net,v7] bnxt_en: set backing store type from query type
    https://git.kernel.org/netdev/net/c/4ee937107d52

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-03-31  1:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-28 23:43 [PATCH net v7] bnxt_en: set backing store type from query type Pengpeng Hou
2026-03-29  3:27 ` Michael Chan
2026-03-31  1:10 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox