patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Ajit Khaparde <ajit.khaparde@broadcom.com>
To: dev@dpdk.org
Cc: Damodharam Ammepalli <damodharam.ammepalli@broadcom.com>,
	stable@dpdk.org
Subject: [PATCH 2/3] net/bnxt: refactor backing store qcaps v2
Date: Thu,  6 Jun 2024 16:31:15 -0700	[thread overview]
Message-ID: <20240606233116.38445-3-ajit.khaparde@broadcom.com> (raw)
In-Reply-To: <20240606233116.38445-1-ajit.khaparde@broadcom.com>

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

From: Damodharam Ammepalli <damodharam.ammepalli@broadcom.com>

During bnxt_hwrm_func_backing_store_types_count driver
increments types only for valid type but not in
bnxt_hwrm_func_backing_store_cfg_v2. Implement the same
logic in store cfg also to prevent ctx types control loop
exiting the loop prematurely while firmware still has valid
types to return if queried.

Fixes: fe2f715ca580 ("net/bnxt: support backing store v2")
Cc: stable@dpdk.org

Signed-off-by: Damodharam Ammepalli <damodharam.ammepalli@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_hwrm.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 6ea7089a3f..9ea5cc090f 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -6352,11 +6352,14 @@ int bnxt_hwrm_func_backing_store_qcaps_v2(struct bnxt *bp)
 	uint16_t types, type;
 	int rc;
 
-	for (types = 0, type = 0; types < bp->ctx->types && type != BNXT_CTX_INV; types++) {
-		struct bnxt_ctx_mem *ctxm = &bp->ctx->ctx_arr[types];
+	types = 0;
+	type = 0;
+	do {
+		struct bnxt_ctx_mem *ctxm;
 		uint8_t init_val, init_off, i;
 		uint32_t *p;
 		uint32_t flags;
+		bool cnt = true;
 
 		HWRM_PREP(&req, HWRM_FUNC_BACKING_STORE_QCAPS_V2, BNXT_USE_CHIMP_MB);
 		req.type = rte_cpu_to_le_16(type);
@@ -6365,9 +6368,12 @@ int bnxt_hwrm_func_backing_store_qcaps_v2(struct bnxt *bp)
 
 		flags = rte_le_to_cpu_32(resp->flags);
 		type = rte_le_to_cpu_16(resp->next_valid_type);
-		if (!(flags & HWRM_FUNC_BACKING_STORE_QCAPS_V2_OUTPUT_FLAGS_TYPE_VALID))
+		if (!(flags & HWRM_FUNC_BACKING_STORE_QCAPS_V2_OUTPUT_FLAGS_TYPE_VALID)) {
+			cnt = false;
 			goto next;
+		}
 
+		ctxm = &bp->ctx->ctx_arr[types];
 		ctxm->type = rte_le_to_cpu_16(resp->type);
 
 		ctxm->flags = flags;
@@ -6404,8 +6410,10 @@ int bnxt_hwrm_func_backing_store_qcaps_v2(struct bnxt *bp)
 		last_valid_type = ctxm->type;
 		last_valid_idx = types;
 next:
+		if (cnt)
+			types++;
 		HWRM_UNLOCK();
-	}
+	} while (types < bp->ctx->types && type != BNXT_CTX_INV);
 	ctx->ctx_arr[last_valid_idx].last = true;
 	PMD_DRV_LOG(DEBUG, "Last valid type 0x%x\n", last_valid_type);
 
-- 
2.39.2 (Apple Git-143)


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

  parent reply	other threads:[~2024-06-06 23:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20240606233116.38445-1-ajit.khaparde@broadcom.com>
2024-06-06 23:31 ` [PATCH 1/3] net/bnxt: fix vector mode for P7 devices Ajit Khaparde
2024-06-06 23:31 ` Ajit Khaparde [this message]
2024-06-06 23:31 ` [PATCH 3/3] net/bnxt: fix backing store logging Ajit Khaparde

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240606233116.38445-3-ajit.khaparde@broadcom.com \
    --to=ajit.khaparde@broadcom.com \
    --cc=damodharam.ammepalli@broadcom.com \
    --cc=dev@dpdk.org \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).