10#ifndef _RTE_RING_RTS_ELEM_PVT_H_
11#define _RTE_RING_RTS_ELEM_PVT_H_
25__rte_ring_rts_update_tail(
struct rte_ring_rts_headtail *ht)
27 union __rte_ring_rts_poscnt h, ot, nt;
34 ot.raw = rte_atomic_load_explicit(&ht->tail.raw, rte_memory_order_acquire);
38 h.raw = rte_atomic_load_explicit(&ht->head.raw, rte_memory_order_relaxed);
41 if (++nt.val.cnt == h.val.cnt)
42 nt.val.pos = h.val.pos;
44 }
while (rte_atomic_compare_exchange_strong_explicit(&ht->tail.raw,
45 (uint64_t *)(uintptr_t)&ot.raw, nt.raw,
46 rte_memory_order_release, rte_memory_order_acquire) == 0);
54__rte_ring_rts_head_wait(
const struct rte_ring_rts_headtail *ht,
55 union __rte_ring_rts_poscnt *h)
61 while (h->val.pos - ht->tail.val.pos > max) {
63 h->raw = rte_atomic_load_explicit(&ht->head.raw, rte_memory_order_acquire);
92__rte_ring_rts_move_head(
struct rte_ring_rts_headtail *d,
98 union __rte_ring_rts_poscnt nh, oh;
100 oh.raw = rte_atomic_load_explicit(&d->head.raw,
101 rte_memory_order_acquire);
112 __rte_ring_rts_head_wait(d, &oh);
120 *entries = capacity + s->tail - oh.val.pos;
130 nh.val.pos = oh.val.pos + n;
131 nh.val.cnt = oh.val.cnt + 1;
138 }
while (rte_atomic_compare_exchange_strong_explicit(&d->head.raw,
139 (uint64_t *)(uintptr_t)&oh.raw, nh.raw,
140 rte_memory_order_acquire,
141 rte_memory_order_acquire) == 0);
143 *old_head = oh.val.pos;
151__rte_ring_rts_move_prod_head(
struct rte_ring *r, uint32_t num,
153 uint32_t *free_entries)
155 return __rte_ring_rts_move_head(&r->rts_prod, &r->cons,
156 r->
capacity, num, behavior, old_head, free_entries);
163__rte_ring_rts_move_cons_head(
struct rte_ring *r, uint32_t num,
167 return __rte_ring_rts_move_head(&r->rts_cons, &r->prod,
168 0, num, behavior, old_head, entries);
194__rte_ring_do_rts_enqueue_elem(
struct rte_ring *r,
const void *obj_table,
196 uint32_t *free_space)
200 n = __rte_ring_rts_move_prod_head(r, n, behavior, &head, &free);
203 __rte_ring_enqueue_elems(r, head, obj_table, esize, n);
204 __rte_ring_rts_update_tail(&r->rts_prod);
207 if (free_space != NULL)
208 *free_space = free - n;
235__rte_ring_do_rts_dequeue_elem(
struct rte_ring *r,
void *obj_table,
239 uint32_t entries, head;
241 n = __rte_ring_rts_move_cons_head(r, n, behavior, &head, &entries);
244 __rte_ring_dequeue_elems(r, head, obj_table, esize, n);
245 __rte_ring_rts_update_tail(&r->rts_cons);
248 if (available != NULL)
249 *available = entries - n;
#define __rte_always_inline
static void rte_pause(void)