Wait for SQB pool to get filled with the freed pointers
before proceeding.

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

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:
-- 
2.32.0

Reply via email to