1
2
3
4
5#include "test_ring_stress_impl.h"
6#include <rte_ring_elem.h>
7
8static inline uint32_t
9_st_ring_dequeue_bulk(struct rte_ring *r, void **obj, uint32_t n,
10 uint32_t *avail)
11{
12 uint32_t m;
13
14 static rte_spinlock_t lck = RTE_SPINLOCK_INITIALIZER;
15
16 rte_spinlock_lock(&lck);
17
18 m = rte_ring_dequeue_bulk_start(r, obj, n, avail);
19 n = (m == n) ? n : 0;
20 rte_ring_dequeue_finish(r, n);
21
22 rte_spinlock_unlock(&lck);
23 return n;
24}
25
26static inline uint32_t
27_st_ring_enqueue_bulk(struct rte_ring *r, void * const *obj, uint32_t n,
28 uint32_t *free)
29{
30 uint32_t m;
31
32 static rte_spinlock_t lck = RTE_SPINLOCK_INITIALIZER;
33
34 rte_spinlock_lock(&lck);
35
36 m = rte_ring_enqueue_bulk_start(r, n, free);
37 n = (m == n) ? n : 0;
38 rte_ring_enqueue_finish(r, obj, n);
39
40 rte_spinlock_unlock(&lck);
41 return n;
42}
43
44static int
45_st_ring_init(struct rte_ring *r, const char *name, uint32_t num)
46{
47 return rte_ring_init(r, name, num, RING_F_SP_ENQ | RING_F_SC_DEQ);
48}
49
50const struct test test_ring_st_peek_stress = {
51 .name = "ST_PEEK",
52 .nb_case = RTE_DIM(tests),
53 .cases = tests,
54};
55