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;
35 rte_atomic_store_explicit(&ht->ht.pos.tail, tail, rte_memory_order_release);
44__rte_ring_hts_head_wait(
const struct rte_ring_hts_headtail *ht,
45 union __rte_ring_hts_pos *p)
47 while (p->pos.head != p->pos.tail) {
49 p->raw = rte_atomic_load_explicit(&ht->ht.raw, rte_memory_order_acquire);
78__rte_ring_hts_move_head(
struct rte_ring_hts_headtail *d,
84 union __rte_ring_hts_pos np, op;
86 op.raw = rte_atomic_load_explicit(&d->ht.raw, rte_memory_order_acquire);
97 __rte_ring_hts_head_wait(d, &op);
105 *entries = capacity + s->tail - op.pos.head;
115 np.pos.tail = op.pos.tail;
116 np.pos.head = op.pos.head + n;
123 }
while (rte_atomic_compare_exchange_strong_explicit(&d->ht.raw,
124 (uint64_t *)(uintptr_t)&op.raw, np.raw,
125 rte_memory_order_acquire,
126 rte_memory_order_acquire) == 0);
128 *old_head = op.pos.head;
135__rte_ring_hts_move_prod_head(
struct rte_ring *r,
unsigned int num,
137 uint32_t *free_entries)
139 return __rte_ring_hts_move_head(&r->hts_prod, &r->cons,
140 r->
capacity, num, behavior, old_head, free_entries);
147__rte_ring_hts_move_cons_head(
struct rte_ring *r,
unsigned int num,
151 return __rte_ring_hts_move_head(&r->hts_cons, &r->prod,
152 0, num, behavior, old_head, entries);
178__rte_ring_do_hts_enqueue_elem(
struct rte_ring *r,
const void *obj_table,
180 uint32_t *free_space)
184 n = __rte_ring_hts_move_prod_head(r, n, behavior, &head, &free);
187 __rte_ring_enqueue_elems(r, head, obj_table, esize, n);
188 __rte_ring_hts_update_tail(&r->hts_prod, head, n, 1);
191 if (free_space != NULL)
192 *free_space = free - n;
219__rte_ring_do_hts_dequeue_elem(
struct rte_ring *r,
void *obj_table,
223 uint32_t entries, head;
225 n = __rte_ring_hts_move_cons_head(r, n, behavior, &head, &entries);
228 __rte_ring_dequeue_elems(r, head, obj_table, esize, n);
229 __rte_ring_hts_update_tail(&r->hts_cons, head, n, 0);
232 if (available != NULL)
233 *available = entries - n;
#define __rte_always_inline
static void rte_pause(void)