1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2017 Intel Corporation
3 * Copyright(c) 2019 Arm Limited
4 */
5
6
7 #include "rte_event_ring.h"
8
9 int
rte_event_ring_init(struct rte_event_ring * r,const char * name,unsigned int count,unsigned int flags)10 rte_event_ring_init(struct rte_event_ring *r, const char *name,
11 unsigned int count, unsigned int flags)
12 {
13 /* compilation-time checks */
14 RTE_BUILD_BUG_ON((sizeof(struct rte_event_ring) &
15 RTE_CACHE_LINE_MASK) != 0);
16
17 /* init the ring structure */
18 return rte_ring_init(&r->r, name, count, flags);
19 }
20
21 /* create the ring */
22 struct rte_event_ring *
rte_event_ring_create(const char * name,unsigned int count,int socket_id,unsigned int flags)23 rte_event_ring_create(const char *name, unsigned int count, int socket_id,
24 unsigned int flags)
25 {
26 return (struct rte_event_ring *)rte_ring_create_elem(name,
27 sizeof(struct rte_event),
28 count, socket_id, flags);
29 }
30
31
32 struct rte_event_ring *
rte_event_ring_lookup(const char * name)33 rte_event_ring_lookup(const char *name)
34 {
35 return (struct rte_event_ring *)rte_ring_lookup(name);
36 }
37
38 /* free the ring */
39 void
rte_event_ring_free(struct rte_event_ring * r)40 rte_event_ring_free(struct rte_event_ring *r)
41 {
42 rte_ring_free((struct rte_ring *)r);
43 }
44