[v3,26/45] dma/skeleton: use rte stdatomic API

Message ID 1711579078-10624-27-git-send-email-roretzla@linux.microsoft.com (mailing list archive)
State Superseded
Delegated to: Thomas Monjalon
Headers
Series use stdatomic API |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Tyler Retzlaff March 27, 2024, 10:37 p.m. UTC
  Replace the use of gcc builtin __atomic_xxx intrinsics with
corresponding rte_atomic_xxx optional rte stdatomic API.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/dma/skeleton/skeleton_dmadev.c | 5 +++--
 drivers/dma/skeleton/skeleton_dmadev.h | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)
  

Patch

diff --git a/drivers/dma/skeleton/skeleton_dmadev.c b/drivers/dma/skeleton/skeleton_dmadev.c
index 48f88f9..926c188 100644
--- a/drivers/dma/skeleton/skeleton_dmadev.c
+++ b/drivers/dma/skeleton/skeleton_dmadev.c
@@ -142,7 +142,7 @@ 
 		else if (desc->op == SKELDMA_OP_FILL)
 			do_fill(desc);
 
-		__atomic_fetch_add(&hw->completed_count, 1, __ATOMIC_RELEASE);
+		rte_atomic_fetch_add_explicit(&hw->completed_count, 1, rte_memory_order_release);
 		(void)rte_ring_enqueue(hw->desc_completed, (void *)desc);
 	}
 
@@ -335,7 +335,8 @@ 
 	RTE_SET_USED(vchan);
 
 	*status = RTE_DMA_VCHAN_IDLE;
-	if (hw->submitted_count != __atomic_load_n(&hw->completed_count, __ATOMIC_ACQUIRE)
+	if (hw->submitted_count != rte_atomic_load_explicit(&hw->completed_count,
+	    rte_memory_order_acquire)
 			|| hw->zero_req_count == 0)
 		*status = RTE_DMA_VCHAN_ACTIVE;
 	return 0;
diff --git a/drivers/dma/skeleton/skeleton_dmadev.h b/drivers/dma/skeleton/skeleton_dmadev.h
index c9bf315..3730cbc 100644
--- a/drivers/dma/skeleton/skeleton_dmadev.h
+++ b/drivers/dma/skeleton/skeleton_dmadev.h
@@ -81,7 +81,7 @@  struct skeldma_hw {
 	/* Cache delimiter for cpuwork thread's operation data */
 	char cache2 __rte_cache_aligned;
 	volatile uint32_t zero_req_count;
-	uint64_t completed_count;
+	RTE_ATOMIC(uint64_t) completed_count;
 };
 
 #endif /* SKELETON_DMADEV_H */