diff mbox series

[2/3] common/cnxk: wait for sqb pool to fill

Message ID 20211130060702.2697517-3-asekhar@marvell.com (mailing list archive)
State Accepted
Delegated to: Jerin Jacob
Headers show
Series Wait for NPA pools to get filled | expand

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Ashwin Sekhar Thalakalath Kottilveetil Nov. 30, 2021, 6:07 a.m. UTC
Wait for SQB pool to get filled with the freed pointers
before proceeding.

Signed-off-by: Ashwin Sekhar T K <asekhar@marvell.com>
---
 drivers/common/cnxk/roc_nix_queue.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
diff mbox series

Patch

diff --git a/drivers/common/cnxk/roc_nix_queue.c b/drivers/common/cnxk/roc_nix_queue.c
index c8c8401d81..c638cd43e4 100644
--- a/drivers/common/cnxk/roc_nix_queue.c
+++ b/drivers/common/cnxk/roc_nix_queue.c
@@ -638,11 +638,21 @@  sqb_pool_populate(struct roc_nix *roc_nix, struct roc_nix_sq *sq)
 		roc_npa_aura_op_free(sq->aura_handle, 0, iova);
 		iova += blk_sz;
 	}
+
+	if (roc_npa_aura_op_available_wait(sq->aura_handle, NIX_MAX_SQB, 0) !=
+	    NIX_MAX_SQB) {
+		plt_err("Failed to free all pointers to the pool");
+		rc = NIX_ERR_NO_MEM;
+		goto npa_fail;
+	}
+
 	roc_npa_aura_op_range_set(sq->aura_handle, (uint64_t)sq->sqe_mem, iova);
 	roc_npa_aura_limit_modify(sq->aura_handle, sq->nb_sqb_bufs);
 	sq->aura_sqb_bufs = NIX_MAX_SQB;
 
 	return rc;
+npa_fail:
+	plt_free(sq->sqe_mem);
 nomem:
 	roc_npa_pool_destroy(sq->aura_handle);
 fail: