]> git.droids-corp.org - dpdk.git/commitdiff
common/cnxk: support waiting for pool filling
authorAshwin Sekhar T K <asekhar@marvell.com>
Tue, 30 Nov 2021 06:07:00 +0000 (11:37 +0530)
committerJerin Jacob <jerinj@marvell.com>
Mon, 10 Jan 2022 07:15:43 +0000 (08:15 +0100)
Add roc_npa_aura_op_available_wait() API which can be used to wait
until an NPA pool gets filled up to a certain count of pointers.

Signed-off-by: Ashwin Sekhar T K <asekhar@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
drivers/common/cnxk/roc_npa.h

index ead0e5605d3fc5222510e51191f2bdaedd96622e..371eeb6ddb5382fcf6c47423b7bdcd871fb18b56 100644 (file)
@@ -155,6 +155,32 @@ roc_npa_aura_op_available(uint64_t aura_handle)
                return reg & 0xFFFFFFFFF;
 }
 
+/* Wait for a given timeout, repeatedly checking whether the available
+ * pointers has reached the given count. Returns the available pointer
+ * count if it has reached the given count or if timeout has expired
+ */
+static inline uint32_t
+roc_npa_aura_op_available_wait(uint64_t aura_handle, uint32_t count,
+                              uint32_t tmo_ms)
+{
+#define OP_AVAIL_WAIT_MS_DEFAULT   (100)
+#define OP_AVAIL_CHECK_INTERVAL_MS (1)
+       uint32_t op_avail;
+       int retry;
+
+       tmo_ms = tmo_ms ? tmo_ms : OP_AVAIL_WAIT_MS_DEFAULT;
+
+       retry = tmo_ms / OP_AVAIL_CHECK_INTERVAL_MS;
+       op_avail = roc_npa_aura_op_available(aura_handle);
+       while (retry && (op_avail < count)) {
+               plt_delay_ms(OP_AVAIL_CHECK_INTERVAL_MS);
+               op_avail = roc_npa_aura_op_available(aura_handle);
+               retry--;
+       }
+
+       return op_avail;
+}
+
 static inline uint64_t
 roc_npa_pool_op_performance_counter(uint64_t aura_handle, const int drop)
 {