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