10 #ifndef _RTE_RING_C11_MEM_H_
11 #define _RTE_RING_C11_MEM_H_
14 update_tail(
struct rte_ring_headtail *ht, uint32_t old_val, uint32_t new_val,
15 uint32_t single, uint32_t enqueue)
24 while (
unlikely(ht->tail != old_val))
27 __atomic_store_n(&ht->tail, new_val, __ATOMIC_RELEASE);
54 __rte_ring_move_prod_head(
struct rte_ring *r,
unsigned int is_sp,
55 unsigned int n,
enum rte_ring_queue_behavior behavior,
56 uint32_t *old_head, uint32_t *new_head,
57 uint32_t *free_entries)
67 *old_head = __atomic_load_n(&r->prod.head,
76 *free_entries = (capacity + r->cons.tail - *old_head);
80 n = (behavior == RTE_RING_QUEUE_FIXED) ?
86 *new_head = *old_head + n;
88 r->prod.head = *new_head, success = 1;
90 success = __atomic_compare_exchange_n(&r->prod.head,
122 __rte_ring_move_cons_head(
struct rte_ring *r,
int is_sc,
123 unsigned int n,
enum rte_ring_queue_behavior behavior,
124 uint32_t *old_head, uint32_t *new_head,
127 unsigned int max = n;
134 *old_head = __atomic_load_n(&r->cons.head,
142 *entries = (r->prod.tail - *old_head);
146 n = (behavior == RTE_RING_QUEUE_FIXED) ? 0 : *entries;
151 *new_head = *old_head + n;
153 r->cons.head = *new_head, success = 1;
155 success = __atomic_compare_exchange_n(&r->cons.head,