10#ifndef _RTE_RING_HTS_ELEM_PVT_H_
11#define _RTE_RING_HTS_ELEM_PVT_H_
13#include <rte_stdatomic.h>
27__rte_ring_hts_update_tail(
struct rte_ring_hts_headtail *ht, uint32_t old_tail,
28 uint32_t num, uint32_t enqueue)
34 tail = old_tail + num;
42 rte_atomic_store_explicit(&ht->ht.pos.tail, tail, rte_memory_order_release);
57__rte_ring_hts_head_wait(const struct rte_ring_hts_headtail *ht,
58 rte_memory_order memorder)
60 union __rte_ring_hts_pos p;
61 p.raw = rte_atomic_load_explicit(&ht->ht.raw, memorder);
63 while (p.pos.head != p.pos.tail) {
65 p.raw = rte_atomic_load_explicit(&ht->ht.raw, memorder);
96__rte_ring_hts_move_head(
struct rte_ring_hts_headtail *d,
102 union __rte_ring_hts_pos np, op;
119 op = __rte_ring_hts_head_wait(d, rte_memory_order_acquire);
126 stail = rte_atomic_load_explicit(&s->tail, rte_memory_order_acquire);
134 *entries = capacity + stail - op.pos.head;
144 np.pos.tail = op.pos.tail;
145 np.pos.head = op.pos.head + n;
155 }
while (rte_atomic_compare_exchange_strong_explicit(&d->ht.raw,
156 (uint64_t *)(uintptr_t)&op.raw, np.raw,
157 rte_memory_order_release,
158 rte_memory_order_relaxed) == 0);
160 *old_head = op.pos.head;
167__rte_ring_hts_move_prod_head(
struct rte_ring *r,
unsigned int num,
169 uint32_t *free_entries)
171 return __rte_ring_hts_move_head(&r->hts_prod, &r->cons,
172 r->
capacity, num, behavior, old_head, free_entries);
179__rte_ring_hts_move_cons_head(
struct rte_ring *r,
unsigned int num,
183 return __rte_ring_hts_move_head(&r->hts_cons, &r->prod,
184 0, num, behavior, old_head, entries);
210__rte_ring_do_hts_enqueue_elem(
struct rte_ring *r,
const void *obj_table,
212 uint32_t *free_space)
216 n = __rte_ring_hts_move_prod_head(r, n, behavior, &head, &free);
219 __rte_ring_enqueue_elems(r, head, obj_table, esize, n);
220 __rte_ring_hts_update_tail(&r->hts_prod, head, n, 1);
223 if (free_space != NULL)
224 *free_space = free - n;
251__rte_ring_do_hts_dequeue_elem(
struct rte_ring *r,
void *obj_table,
255 uint32_t entries, head;
257 n = __rte_ring_hts_move_cons_head(r, n, behavior, &head, &entries);
260 __rte_ring_dequeue_elems(r, head, obj_table, esize, n);
261 __rte_ring_hts_update_tail(&r->hts_cons, head, n, 0);
264 if (available != NULL)
265 *available = entries - n;
#define __rte_always_inline
static void rte_pause(void)