Thread (14 messages) 14 messages, 2 authors, 2025-09-16
STALE274d REVIEWED: 2 (1M)
Revisions (11)
  1. v1 [diff vs current]
  2. v1 [diff vs current]
  3. v1 [diff vs current]
  4. v2 [diff vs current]
  5. v1 [diff vs current]
  6. v2 [diff vs current]
  7. v1 current
  8. v2 [diff vs current]
  9. v1 [diff vs current]
  10. v1 [diff vs current]
  11. v2 [diff vs current]

[PATCH net-next 04/11] bnxt_en: Improve bnxt_hwrm_func_backing_store_cfg_v2()

From: Michael Chan <michael.chan@broadcom.com>
Date: 2025-09-15 03:05:56
Subsystem: broadcom bnxt_en 50 gigabit ethernet driver, networking drivers, the rest · Maintainers: Michael Chan, Pavan Chebbi, Andrew Lunn, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds

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.

Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <redacted>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
---
 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 a74b50130cc0..38a2884f7c78 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -9098,7 +9098,7 @@ static int bnxt_hwrm_func_backing_store_cfg_v2(struct bnxt *bp,
 {
 	struct hwrm_func_backing_store_cfg_v2_input *req;
 	u32 instance_bmap = ctxm->instance_bmap;
-	int i, j, rc = 0, n = 1;
+	int i, rc = 0, n = 1;
 	__le32 *p;
 
 	if (!(ctxm->flags & BNXT_CTX_MEM_TYPE_VALID) || !ctxm->pg_info)
@@ -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];
 		if (!ctx_pg->entries)
 			continue;
 		req->num_entries = cpu_to_le32(ctx_pg->entries);
 		bnxt_hwrm_set_pg_attr(&ctx_pg->ring_mem,
 				      &req->page_size_pbl_level,
 				      &req->page_dir);
-		if (last && j == n)
+		if (last && i == n - 1)
 			req->flags =
 				cpu_to_le32(FUNC_BACKING_STORE_CFG_V2_REQ_FLAGS_BS_CFG_ALL_DONE);
 		rc = hwrm_req_send(bp, req);
-- 
2.51.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help