raw/ifpga/base: fix interrupt handler instance usage
[dpdk.git] / app / test / test_ring_mt_peek_stress_zc.c
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2020 Arm Limited
3  */
4
5 #include "test_ring.h"
6 #include "test_ring_stress_impl.h"
7 #include <rte_ring_elem.h>
8
9 static inline uint32_t
10 _st_ring_dequeue_bulk(struct rte_ring *r, void **obj, uint32_t n,
11         uint32_t *avail)
12 {
13         uint32_t m;
14         struct rte_ring_zc_data zcd;
15
16         m = rte_ring_dequeue_zc_bulk_start(r, n, &zcd, avail);
17         n = (m == n) ? n : 0;
18         if (n != 0) {
19                 /* Copy the data from the ring */
20                 test_ring_copy_from(&zcd, obj, -1, n);
21                 rte_ring_dequeue_zc_finish(r, n);
22         }
23
24         return n;
25 }
26
27 static inline uint32_t
28 _st_ring_enqueue_bulk(struct rte_ring *r, void * const *obj, uint32_t n,
29         uint32_t *free)
30 {
31         uint32_t m;
32         struct rte_ring_zc_data zcd;
33
34         m = rte_ring_enqueue_zc_bulk_start(r, n, &zcd, free);
35         n = (m == n) ? n : 0;
36         if (n != 0) {
37                 /* Copy the data from the ring */
38                 test_ring_copy_to(&zcd, obj, -1, n);
39                 rte_ring_enqueue_zc_finish(r, n);
40         }
41
42         return n;
43 }
44
45 static int
46 _st_ring_init(struct rte_ring *r, const char *name, uint32_t num)
47 {
48         return rte_ring_init(r, name, num,
49                 RING_F_MP_HTS_ENQ | RING_F_MC_HTS_DEQ);
50 }
51
52 const struct test test_ring_mt_peek_stress_zc = {
53         .name = "MT_PEEK_ZC",
54         .nb_case = RTE_DIM(tests),
55         .cases = tests,
56 };