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,
32 tail = old_tail + num;
40 rte_atomic_store_explicit(&ht->ht.pos.tail, tail, rte_memory_order_release);
55__rte_ring_hts_head_wait(const struct rte_ring_hts_headtail *ht,
56 rte_memory_order memorder)
58 union __rte_ring_hts_pos p;
59 p.raw = rte_atomic_load_explicit(&ht->ht.raw, memorder);
61 while (p.pos.head != p.pos.tail) {
63 p.raw = rte_atomic_load_explicit(&ht->ht.raw, memorder);
94__rte_ring_hts_move_head(
struct rte_ring_hts_headtail *d,
100 union __rte_ring_hts_pos np, op;
117 op = __rte_ring_hts_head_wait(d, rte_memory_order_acquire);
124 stail = rte_atomic_load_explicit(&s->tail, rte_memory_order_acquire);
132 *entries = capacity + stail - op.pos.head;
142 np.pos.tail = op.pos.tail;
143 np.pos.head = op.pos.head + n;
153 }
while (rte_atomic_compare_exchange_strong_explicit(&d->ht.raw,
154 (uint64_t *)(uintptr_t)&op.raw, np.raw,
155 rte_memory_order_release,
156 rte_memory_order_relaxed) == 0);
158 *old_head = op.pos.head;
165__rte_ring_hts_move_prod_head(
struct rte_ring *r,
unsigned int num,
167 uint32_t *free_entries)
169 return __rte_ring_hts_move_head(&r->hts_prod, &r->cons,
170 r->
capacity, num, behavior, old_head, free_entries);
177__rte_ring_hts_move_cons_head(
struct rte_ring *r,
unsigned int num,
181 return __rte_ring_hts_move_head(&r->hts_cons, &r->prod,
182 0, num, behavior, old_head, entries);
208__rte_ring_do_hts_enqueue_elem(
struct rte_ring *r,
const void *obj_table,
210 uint32_t *free_space)
214 n = __rte_ring_hts_move_prod_head(r, n, behavior, &head, &free);
217 __rte_ring_enqueue_elems(r, head, obj_table, esize, n);
218 __rte_ring_hts_update_tail(&r->hts_prod, head, n);
221 if (free_space != NULL)
222 *free_space = free - n;
249__rte_ring_do_hts_dequeue_elem(
struct rte_ring *r,
void *obj_table,
253 uint32_t entries, head;
255 n = __rte_ring_hts_move_cons_head(r, n, behavior, &head, &entries);
258 __rte_ring_dequeue_elems(r, head, obj_table, esize, n);
259 __rte_ring_hts_update_tail(&r->hts_cons, head, n);
262 if (available != NULL)
263 *available = entries - n;
#define __rte_always_inline
static void rte_pause(void)