1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2020 Arm Limited
6 #include "test_ring_stress_impl.h"
7 #include <rte_ring_elem.h>
10 _st_ring_dequeue_bulk(struct rte_ring *r, void **obj, uint32_t n,
14 struct rte_ring_zc_data zcd;
16 static rte_spinlock_t lck = RTE_SPINLOCK_INITIALIZER;
18 rte_spinlock_lock(&lck);
20 m = rte_ring_dequeue_zc_bulk_start(r, n, &zcd, avail);
22 /* Copy the data from the ring */
23 test_ring_copy_from(&zcd, obj, -1, m);
24 rte_ring_dequeue_zc_finish(r, m);
27 rte_spinlock_unlock(&lck);
31 static inline uint32_t
32 _st_ring_enqueue_bulk(struct rte_ring *r, void * const *obj, uint32_t n,
36 struct rte_ring_zc_data zcd;
38 static rte_spinlock_t lck = RTE_SPINLOCK_INITIALIZER;
40 rte_spinlock_lock(&lck);
42 m = rte_ring_enqueue_zc_bulk_start(r, n, &zcd, free);
44 /* Copy the data from the ring */
45 test_ring_copy_to(&zcd, obj, -1, m);
46 rte_ring_enqueue_zc_finish(r, m);
49 rte_spinlock_unlock(&lck);
54 _st_ring_init(struct rte_ring *r, const char *name, uint32_t num)
56 return rte_ring_init(r, name, num, RING_F_SP_ENQ | RING_F_SC_DEQ);
59 const struct test test_ring_st_peek_stress_zc = {
61 .nb_case = RTE_DIM(tests),