DPDK
25.11.0
Toggle main menu visibility
Loading...
Searching...
No Matches
rte_ring_core.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_CORE_H_
11
#define _RTE_RING_CORE_H_
12
21
22
#include <stdalign.h>
23
#include <stdio.h>
24
#include <stdint.h>
25
#include <string.h>
26
#include <errno.h>
27
#include <
rte_common.h
>
28
#include <rte_config.h>
29
#include <
rte_memory.h
>
30
#include <
rte_lcore.h
>
31
#include <
rte_atomic.h
>
32
#include <
rte_branch_prediction.h
>
33
#include <
rte_memzone.h
>
34
#include <
rte_pause.h
>
35
#include <
rte_debug.h
>
36
37
#define RTE_TAILQ_RING_NAME "RTE_RING"
38
40
enum
rte_ring_queue_behavior
{
42
RTE_RING_QUEUE_FIXED
= 0,
44
RTE_RING_QUEUE_VARIABLE
45
};
46
47
#define RTE_RING_MZ_PREFIX "RG_"
49
#define RTE_RING_NAMESIZE (RTE_MEMZONE_NAMESIZE - \
50
sizeof(RTE_RING_MZ_PREFIX) + 1)
51
53
enum
rte_ring_sync_type
{
54
RTE_RING_SYNC_MT
,
55
RTE_RING_SYNC_ST
,
56
RTE_RING_SYNC_MT_RTS
,
57
RTE_RING_SYNC_MT_HTS
,
58
};
59
65
struct
rte_ring_headtail
{
66
volatile
RTE_ATOMIC(uint32_t) head;
67
volatile
RTE_ATOMIC(uint32_t) tail;
68
union
{
70
enum
rte_ring_sync_type
sync_type
;
72
uint32_t
single
;
73
};
74
};
75
76
union
__rte_ring_rts_poscnt {
78
alignas
(
sizeof
(uint64_t)) RTE_ATOMIC(uint64_t) raw;
79
struct
{
80
uint32_t cnt;
81
uint32_t pos;
82
} val;
83
};
84
85
struct
rte_ring_rts_headtail {
86
volatile
union
__rte_ring_rts_poscnt tail;
87
enum
rte_ring_sync_type
sync_type;
88
uint32_t htd_max;
89
volatile
union
__rte_ring_rts_poscnt head;
90
};
91
92
union
__rte_ring_hts_pos {
94
alignas
(
sizeof
(uint64_t)) RTE_ATOMIC(uint64_t) raw;
95
struct
{
96
RTE_ATOMIC(uint32_t) head;
97
RTE_ATOMIC(uint32_t) tail;
98
} pos;
99
};
100
101
struct
rte_ring_hts_headtail {
102
volatile
union
__rte_ring_hts_pos ht;
103
enum
rte_ring_sync_type
sync_type;
104
};
105
116
struct
rte_ring
{
117
alignas
(RTE_CACHE_LINE_SIZE)
char
name
[
RTE_RING_NAMESIZE
];
119
int
flags
;
120
const
struct
rte_memzone
*
memzone
;
122
uint32_t
size
;
123
uint32_t
mask
;
124
uint32_t
capacity
;
125
126
RTE_CACHE_GUARD;
127
129
union
__rte_cache_aligned
{
130
struct
rte_ring_headtail
prod;
131
struct
rte_ring_hts_headtail hts_prod;
132
struct
rte_ring_rts_headtail rts_prod;
133
};
134
135
RTE_CACHE_GUARD;
136
138
union
__rte_cache_aligned
{
139
struct
rte_ring_headtail
cons;
140
struct
rte_ring_hts_headtail hts_cons;
141
struct
rte_ring_rts_headtail rts_cons;
142
};
143
144
RTE_CACHE_GUARD
;
145
};
146
147
#define RING_F_SP_ENQ 0x0001
148
#define RING_F_SC_DEQ 0x0002
157
#define RING_F_EXACT_SZ 0x0004
158
#define RTE_RING_SZ_MASK (0x7fffffffU)
159
160
#define RING_F_MP_RTS_ENQ 0x0008
161
#define RING_F_MC_RTS_DEQ 0x0010
162
163
#define RING_F_MP_HTS_ENQ 0x0020
164
#define RING_F_MC_HTS_DEQ 0x0040
165
166
#endif
/* _RTE_RING_CORE_H_ */
rte_atomic.h
rte_branch_prediction.h
rte_common.h
RTE_CACHE_GUARD
#define RTE_CACHE_GUARD
Definition
rte_common.h:755
rte_debug.h
rte_lcore.h
rte_memory.h
rte_memzone.h
rte_pause.h
RTE_RING_NAMESIZE
#define RTE_RING_NAMESIZE
Definition
rte_ring_core.h:49
rte_ring_queue_behavior
rte_ring_queue_behavior
Definition
rte_ring_core.h:40
RTE_RING_QUEUE_VARIABLE
@ RTE_RING_QUEUE_VARIABLE
Definition
rte_ring_core.h:44
RTE_RING_QUEUE_FIXED
@ RTE_RING_QUEUE_FIXED
Definition
rte_ring_core.h:42
rte_ring_sync_type
rte_ring_sync_type
Definition
rte_ring_core.h:53
RTE_RING_SYNC_MT
@ RTE_RING_SYNC_MT
Definition
rte_ring_core.h:54
RTE_RING_SYNC_MT_RTS
@ RTE_RING_SYNC_MT_RTS
Definition
rte_ring_core.h:56
RTE_RING_SYNC_MT_HTS
@ RTE_RING_SYNC_MT_HTS
Definition
rte_ring_core.h:57
RTE_RING_SYNC_ST
@ RTE_RING_SYNC_ST
Definition
rte_ring_core.h:55
rte_memzone
Definition
rte_memzone.h:48
rte_ring_headtail
Definition
rte_ring_core.h:65
rte_ring_headtail::single
uint32_t single
Definition
rte_ring_core.h:72
rte_ring_headtail::sync_type
enum rte_ring_sync_type sync_type
Definition
rte_ring_core.h:70
rte_ring
Definition
rte_ring_core.h:116
rte_ring::name
char name[RTE_RING_NAMESIZE]
Definition
rte_ring_core.h:117
rte_ring::capacity
uint32_t capacity
Definition
rte_ring_core.h:124
rte_ring::size
uint32_t size
Definition
rte_ring_core.h:122
rte_ring::flags
int flags
Definition
rte_ring_core.h:119
rte_ring::mask
uint32_t mask
Definition
rte_ring_core.h:123
rte_ring::memzone
const struct rte_memzone * memzone
Definition
rte_ring_core.h:120
rte_ring::__rte_cache_aligned
Definition
rte_ring_core.h:129
lib
ring
rte_ring_core.h
Generated by
1.17.0