CNDP 22.08.0
Loading...
Searching...
No Matches
ring_private.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright (c) 2020-2022 Intel Corporation
3 */
4
5#ifndef _RING_PRIVATE_H_
6#define _RING_PRIVATE_H_
7
8#include <cne_atomic.h>
9
14
15#ifdef __cplusplus
16extern "C" {
17#endif
18
19/* @internal defines for passing to the enqueue dequeue worker functions */
20#define __IS_SP 1
21#define __IS_MP 0
22#define __IS_SC 1
23#define __IS_MC 0
24
25enum cne_ring_queue_behavior {
26 CNE_RING_QUEUE_FIXED_ITEMS = 0, /* Enq/Deq a fixed number of items from a ring */
27 CNE_RING_QUEUE_VARIABLE_ITEMS /* Enq/Deq as many items as possible from ring */
28};
29
30/* @internal structure to hold a pair of head/tail values and other metadata */
31struct cne_ring_headtail {
32 CNE_ATOMIC(uint_least32_t) head;
33 CNE_ATOMIC(uint_least32_t) tail;
34 uint32_t single;
35};
36
47struct cne_ring {
48 char name[CNE_RING_NAMESIZE] __cne_cache_aligned;
49 void *ring_mem;
50 int flags;
51 uint32_t size;
52 uint32_t mask;
53 uint32_t capacity;
54
55 char pad0 __cne_cache_aligned;
56
58 struct cne_ring_headtail prod __cne_cache_aligned;
59 char pad1 __cne_cache_aligned;
60
62 struct cne_ring_headtail cons __cne_cache_aligned;
63 char pad2 __cne_cache_aligned;
64};
65
66#ifdef __cplusplus
67}
68#endif
69
70#endif /* _RING_PRIVATE_H_ */
#define CNE_RING_NAMESIZE
Definition cne_ring.h:43