mempool/cnxk: support optional wait when counting
authorAshwin Sekhar T K <asekhar@marvell.com>
Fri, 10 Jun 2022 16:07:14 +0000 (21:37 +0530)
committerJerin Jacob <jerinj@marvell.com>
Wed, 15 Jun 2022 19:32:56 +0000 (21:32 +0200)
When counting the batch allocated pointers in cnxk mempool driver,
currently it always waits for in-flight batch operations to finish.
Add a provision to make this waiting optional.

Signed-off-by: Ashwin Sekhar T K <asekhar@marvell.com>
drivers/common/cnxk/roc_npa.h
drivers/mempool/cnxk/cn10k_mempool_ops.c

index 0339876..59d13d8 100644 (file)
@@ -264,7 +264,8 @@ roc_npa_batch_alloc_wait(uint64_t *cache_line)
 }
 
 static inline unsigned int
-roc_npa_aura_batch_alloc_count(uint64_t *aligned_buf, unsigned int num)
+roc_npa_aura_batch_alloc_count(uint64_t *aligned_buf, unsigned int num,
+                              unsigned int do_wait)
 {
        unsigned int count, i;
 
@@ -278,7 +279,9 @@ roc_npa_aura_batch_alloc_count(uint64_t *aligned_buf, unsigned int num)
 
                status = (struct npa_batch_alloc_status_s *)&aligned_buf[i];
 
-               roc_npa_batch_alloc_wait(&aligned_buf[i]);
+               if (do_wait)
+                       roc_npa_batch_alloc_wait(&aligned_buf[i]);
+
                count += status->count;
        }
 
index a02e01c..ba826f0 100644 (file)
@@ -177,8 +177,8 @@ cn10k_mempool_get_count(const struct rte_mempool *mp)
                struct batch_op_mem *mem = &op_data->mem[i];
 
                if (mem->status == BATCH_ALLOC_OP_ISSUED)
-                       count += roc_npa_aura_batch_alloc_count(mem->objs,
-                                                               BATCH_ALLOC_SZ);
+                       count += roc_npa_aura_batch_alloc_count(
+                               mem->objs, BATCH_ALLOC_SZ, 1);
 
                if (mem->status == BATCH_ALLOC_OP_DONE)
                        count += mem->sz;