DPDK 22.11.4
rte_ring_rts.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-3-Clause
2 *
3 * Copyright (c) 2010-2020 Intel Corporation
4 * Copyright (c) 2007-2009 Kip Macy kmacy@freebsd.org
5 * All rights reserved.
6 * Derived from FreeBSD's bufring.h
7 * Used as BSD-3 Licensed with permission from Kip Macy.
8 */
9
10#ifndef _RTE_RING_RTS_H_
11#define _RTE_RING_RTS_H_
12
54#ifdef __cplusplus
55extern "C" {
56#endif
57
59
79static __rte_always_inline unsigned int
80rte_ring_mp_rts_enqueue_bulk_elem(struct rte_ring *r, const void *obj_table,
81 unsigned int esize, unsigned int n, unsigned int *free_space)
82{
83 return __rte_ring_do_rts_enqueue_elem(r, obj_table, esize, n,
84 RTE_RING_QUEUE_FIXED, free_space);
85}
86
106static __rte_always_inline unsigned int
108 unsigned int esize, unsigned int n, unsigned int *available)
109{
110 return __rte_ring_do_rts_dequeue_elem(r, obj_table, esize, n,
111 RTE_RING_QUEUE_FIXED, available);
112}
113
133static __rte_always_inline unsigned int
134rte_ring_mp_rts_enqueue_burst_elem(struct rte_ring *r, const void *obj_table,
135 unsigned int esize, unsigned int n, unsigned int *free_space)
136{
137 return __rte_ring_do_rts_enqueue_elem(r, obj_table, esize, n,
138 RTE_RING_QUEUE_VARIABLE, free_space);
139}
140
162static __rte_always_inline unsigned int
164 unsigned int esize, unsigned int n, unsigned int *available)
165{
166 return __rte_ring_do_rts_dequeue_elem(r, obj_table, esize, n,
167 RTE_RING_QUEUE_VARIABLE, available);
168}
169
185static __rte_always_inline unsigned int
186rte_ring_mp_rts_enqueue_bulk(struct rte_ring *r, void * const *obj_table,
187 unsigned int n, unsigned int *free_space)
188{
189 return rte_ring_mp_rts_enqueue_bulk_elem(r, obj_table,
190 sizeof(uintptr_t), n, free_space);
191}
192
208static __rte_always_inline unsigned int
209rte_ring_mc_rts_dequeue_bulk(struct rte_ring *r, void **obj_table,
210 unsigned int n, unsigned int *available)
211{
212 return rte_ring_mc_rts_dequeue_bulk_elem(r, obj_table,
213 sizeof(uintptr_t), n, available);
214}
215
231static __rte_always_inline unsigned int
232rte_ring_mp_rts_enqueue_burst(struct rte_ring *r, void * const *obj_table,
233 unsigned int n, unsigned int *free_space)
234{
235 return rte_ring_mp_rts_enqueue_burst_elem(r, obj_table,
236 sizeof(uintptr_t), n, free_space);
237}
238
256static __rte_always_inline unsigned int
257rte_ring_mc_rts_dequeue_burst(struct rte_ring *r, void **obj_table,
258 unsigned int n, unsigned int *available)
259{
260 return rte_ring_mc_rts_dequeue_burst_elem(r, obj_table,
261 sizeof(uintptr_t), n, available);
262}
263
273static inline uint32_t
275{
276 if (r->prod.sync_type == RTE_RING_SYNC_MT_RTS)
277 return r->rts_prod.htd_max;
278 return UINT32_MAX;
279}
280
292static inline int
294{
295 if (r->prod.sync_type != RTE_RING_SYNC_MT_RTS)
296 return -ENOTSUP;
297
298 r->rts_prod.htd_max = v;
299 return 0;
300}
301
311static inline uint32_t
313{
314 if (r->cons.sync_type == RTE_RING_SYNC_MT_RTS)
315 return r->rts_cons.htd_max;
316 return UINT32_MAX;
317}
318
330static inline int
332{
333 if (r->cons.sync_type != RTE_RING_SYNC_MT_RTS)
334 return -ENOTSUP;
335
336 r->rts_cons.htd_max = v;
337 return 0;
338}
339
340#ifdef __cplusplus
341}
342#endif
343
344#endif /* _RTE_RING_RTS_H_ */
#define __rte_always_inline
Definition: rte_common.h:255
@ RTE_RING_QUEUE_VARIABLE
Definition: rte_ring_core.h:47
@ RTE_RING_QUEUE_FIXED
Definition: rte_ring_core.h:45
@ RTE_RING_SYNC_MT_RTS
Definition: rte_ring_core.h:59
static __rte_always_inline unsigned int rte_ring_mp_rts_enqueue_bulk(struct rte_ring *r, void *const *obj_table, unsigned int n, unsigned int *free_space)
Definition: rte_ring_rts.h:186
static __rte_always_inline unsigned int rte_ring_mp_rts_enqueue_bulk_elem(struct rte_ring *r, const void *obj_table, unsigned int esize, unsigned int n, unsigned int *free_space)
Definition: rte_ring_rts.h:80
static __rte_always_inline unsigned int rte_ring_mc_rts_dequeue_burst_elem(struct rte_ring *r, void *obj_table, unsigned int esize, unsigned int n, unsigned int *available)
Definition: rte_ring_rts.h:163
static __rte_always_inline unsigned int rte_ring_mc_rts_dequeue_bulk(struct rte_ring *r, void **obj_table, unsigned int n, unsigned int *available)
Definition: rte_ring_rts.h:209
static __rte_always_inline unsigned int rte_ring_mp_rts_enqueue_burst_elem(struct rte_ring *r, const void *obj_table, unsigned int esize, unsigned int n, unsigned int *free_space)
Definition: rte_ring_rts.h:134
static __rte_always_inline unsigned int rte_ring_mc_rts_dequeue_burst(struct rte_ring *r, void **obj_table, unsigned int n, unsigned int *available)
Definition: rte_ring_rts.h:257
static int rte_ring_set_prod_htd_max(struct rte_ring *r, uint32_t v)
Definition: rte_ring_rts.h:293
static uint32_t rte_ring_get_cons_htd_max(const struct rte_ring *r)
Definition: rte_ring_rts.h:312
static __rte_always_inline unsigned int rte_ring_mc_rts_dequeue_bulk_elem(struct rte_ring *r, void *obj_table, unsigned int esize, unsigned int n, unsigned int *available)
Definition: rte_ring_rts.h:107
static __rte_always_inline unsigned int rte_ring_mp_rts_enqueue_burst(struct rte_ring *r, void *const *obj_table, unsigned int n, unsigned int *free_space)
Definition: rte_ring_rts.h:232
static int rte_ring_set_cons_htd_max(struct rte_ring *r, uint32_t v)
Definition: rte_ring_rts.h:331
static uint32_t rte_ring_get_prod_htd_max(const struct rte_ring *r)
Definition: rte_ring_rts.h:274
enum rte_ring_sync_type sync_type
Definition: rte_ring_core.h:74