CNDP  22.08.0
cne_ring_api_internal.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: BSD-3-Clause
2  *
3  * Copyright (c) 2020-2022 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 
16 #ifndef _CNE_RING_API_INTERNAL_H_
17 #define _CNE_RING_API_INTERNAL_H_
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 
23 /****************************************************************************
24  * Ring Generic Functions *
25  ****************************************************************************/
44 unsigned int cne_ring_mp_enqueue_bulk(cne_ring_t *r, void *const *obj_table, unsigned int n,
45  unsigned int *free_space);
46 
62 unsigned int cne_ring_sp_enqueue_bulk(cne_ring_t *r, void *const *obj_table, unsigned int n,
63  unsigned int *free_space);
64 
80 cne_ring_mp_enqueue(cne_ring_t *r, void *obj)
81 {
82  return cne_ring_mp_enqueue_bulk(r, &obj, 1, NULL) ? 0 : -ENOBUFS;
83 }
84 
97 cne_ring_sp_enqueue(cne_ring_t *r, void *obj)
98 {
99  return cne_ring_sp_enqueue_bulk(r, &obj, 1, NULL) ? 0 : -ENOBUFS;
100 }
101 
120 unsigned int cne_ring_mc_dequeue_bulk(cne_ring_t *r, void **obj_table, unsigned int n,
121  unsigned int *available);
122 
139 unsigned int cne_ring_sc_dequeue_bulk(cne_ring_t *r, void **obj_table, unsigned int n,
140  unsigned int *available);
141 
158 cne_ring_mc_dequeue(cne_ring_t *r, void **obj_p)
159 {
160  return cne_ring_mc_dequeue_bulk(r, obj_p, 1, NULL) ? 0 : -ENOENT;
161 }
162 
176 cne_ring_sc_dequeue(cne_ring_t *r, void **obj_p)
177 {
178  return cne_ring_sc_dequeue_bulk(r, obj_p, 1, NULL) ? 0 : -ENOENT;
179 }
180 
199 unsigned cne_ring_mp_enqueue_burst(cne_ring_t *r, void *const *obj_table, unsigned int n,
200  unsigned int *free_space);
201 
217 unsigned cne_ring_sp_enqueue_burst(cne_ring_t *r, void *const *obj_table, unsigned int n,
218  unsigned int *free_space);
219 
240 unsigned cne_ring_mc_dequeue_burst(cne_ring_t *r, void **obj_table, unsigned int n,
241  unsigned int *available);
242 
260 unsigned cne_ring_sc_dequeue_burst(cne_ring_t *r, void **obj_table, unsigned int n,
261  unsigned int *available);
262 
263 /****************************************************************************
264  * Ring Elem Functions *
265  ****************************************************************************/
288 unsigned int cne_ring_mp_enqueue_bulk_elem(cne_ring_t *r, const void *obj_table, unsigned int esize,
289  unsigned int n, unsigned int *free_space);
290 
312 unsigned int cne_ring_sp_enqueue_bulk_elem(cne_ring_t *r, const void *obj_table, unsigned int esize,
313  unsigned int n, unsigned int *free_space);
314 
334 cne_ring_mp_enqueue_elem(cne_ring_t *r, void *obj, unsigned int esize)
335 {
336  return cne_ring_mp_enqueue_bulk_elem(r, obj, esize, 1, NULL) ? 0 : -ENOBUFS;
337 }
338 
357 cne_ring_sp_enqueue_elem(cne_ring_t *r, void *obj, unsigned int esize)
358 {
359  return cne_ring_sp_enqueue_bulk_elem(r, obj, esize, 1, NULL) ? 0 : -ENOBUFS;
360 }
361 
384 unsigned int cne_ring_mc_dequeue_bulk_elem(cne_ring_t *r, void *obj_table, unsigned int esize,
385  unsigned int n, unsigned int *available);
386 
407 unsigned int cne_ring_sc_dequeue_bulk_elem(cne_ring_t *r, void *obj_table, unsigned int esize,
408  unsigned int n, unsigned int *available);
409 
430 cne_ring_mc_dequeue_elem(cne_ring_t *r, void *obj_p, unsigned int esize)
431 {
432  return cne_ring_mc_dequeue_bulk_elem(r, obj_p, esize, 1, NULL) ? 0 : -ENOENT;
433 }
434 
452 cne_ring_sc_dequeue_elem(cne_ring_t *r, void *obj_p, unsigned int esize)
453 {
454  return cne_ring_sc_dequeue_bulk_elem(r, obj_p, esize, 1, NULL) ? 0 : -ENOENT;
455 }
456 
479 unsigned cne_ring_mp_enqueue_burst_elem(cne_ring_t *r, const void *obj_table, unsigned int esize,
480  unsigned int n, unsigned int *free_space);
481 
503 unsigned cne_ring_sp_enqueue_burst_elem(cne_ring_t *r, const void *obj_table, unsigned int esize,
504  unsigned int n, unsigned int *free_space);
505 
530 unsigned cne_ring_mc_dequeue_burst_elem(cne_ring_t *r, void *obj_table, unsigned int esize,
531  unsigned int n, unsigned int *available);
532 
554 unsigned cne_ring_sc_dequeue_burst_elem(cne_ring_t *r, void *obj_table, unsigned int esize,
555  unsigned int n, unsigned int *available);
556 
557 #ifdef __cplusplus
558 }
559 #endif
560 
561 #endif /* _CNE_RING_API_INTERNAL_H_ */
#define __cne_always_inline
Definition: cne_common.h:218
__cne_always_inline int cne_ring_sc_dequeue_elem(cne_ring_t *r, void *obj_p, unsigned int esize)
__cne_always_inline int cne_ring_mp_enqueue_elem(cne_ring_t *r, void *obj, unsigned int esize)
unsigned cne_ring_sp_enqueue_burst(cne_ring_t *r, void *const *obj_table, unsigned int n, unsigned int *free_space)
unsigned cne_ring_mc_dequeue_burst(cne_ring_t *r, void **obj_table, unsigned int n, unsigned int *available)
unsigned cne_ring_sc_dequeue_burst_elem(cne_ring_t *r, void *obj_table, unsigned int esize, unsigned int n, unsigned int *available)
unsigned int cne_ring_sc_dequeue_bulk_elem(cne_ring_t *r, void *obj_table, unsigned int esize, unsigned int n, unsigned int *available)
unsigned int cne_ring_mp_enqueue_bulk(cne_ring_t *r, void *const *obj_table, unsigned int n, unsigned int *free_space)
unsigned int cne_ring_mc_dequeue_bulk(cne_ring_t *r, void **obj_table, unsigned int n, unsigned int *available)
__cne_always_inline int cne_ring_mc_dequeue(cne_ring_t *r, void **obj_p)
__cne_always_inline int cne_ring_sp_enqueue(cne_ring_t *r, void *obj)
__cne_always_inline int cne_ring_sc_dequeue(cne_ring_t *r, void **obj_p)
__cne_always_inline int cne_ring_mp_enqueue(cne_ring_t *r, void *obj)
unsigned int cne_ring_mp_enqueue_bulk_elem(cne_ring_t *r, const void *obj_table, unsigned int esize, unsigned int n, unsigned int *free_space)
__cne_always_inline int cne_ring_sp_enqueue_elem(cne_ring_t *r, void *obj, unsigned int esize)
unsigned int cne_ring_sc_dequeue_bulk(cne_ring_t *r, void **obj_table, unsigned int n, unsigned int *available)
unsigned cne_ring_mp_enqueue_burst_elem(cne_ring_t *r, const void *obj_table, unsigned int esize, unsigned int n, unsigned int *free_space)
unsigned cne_ring_mp_enqueue_burst(cne_ring_t *r, void *const *obj_table, unsigned int n, unsigned int *free_space)
__cne_always_inline int cne_ring_mc_dequeue_elem(cne_ring_t *r, void *obj_p, unsigned int esize)
unsigned cne_ring_sc_dequeue_burst(cne_ring_t *r, void **obj_table, unsigned int n, unsigned int *available)
unsigned int cne_ring_sp_enqueue_bulk_elem(cne_ring_t *r, const void *obj_table, unsigned int esize, unsigned int n, unsigned int *free_space)
unsigned int cne_ring_sp_enqueue_bulk(cne_ring_t *r, void *const *obj_table, unsigned int n, unsigned int *free_space)
unsigned int cne_ring_mc_dequeue_bulk_elem(cne_ring_t *r, void *obj_table, unsigned int esize, unsigned int n, unsigned int *available)
unsigned cne_ring_sp_enqueue_burst_elem(cne_ring_t *r, const void *obj_table, unsigned int esize, unsigned int n, unsigned int *free_space)
unsigned cne_ring_mc_dequeue_burst_elem(cne_ring_t *r, void *obj_table, unsigned int esize, unsigned int n, unsigned int *available)