DPDK 21.11.9
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
22#ifdef __cplusplus
23extern "C" {
24#endif
25
26#include <stdio.h>
27#include <stdint.h>
28#include <string.h>
29#include <errno.h>
30#include <rte_common.h>
31#include <rte_config.h>
32#include <rte_memory.h>
33#include <rte_lcore.h>
34#include <rte_atomic.h>
36#include <rte_memzone.h>
37#include <rte_pause.h>
38#include <rte_debug.h>
39
40#define RTE_TAILQ_RING_NAME "RTE_RING"
41
48};
49
50#define RTE_RING_MZ_PREFIX "RG_"
52#define RTE_RING_NAMESIZE (RTE_MEMZONE_NAMESIZE - \
53 sizeof(RTE_RING_MZ_PREFIX) + 1)
54
61};
62
69 volatile uint32_t head;
70 volatile uint32_t tail;
72 union {
76 uint32_t single;
77 };
78};
79
80union __rte_ring_rts_poscnt {
82 uint64_t raw __rte_aligned(8);
83 struct {
84 uint32_t cnt;
85 uint32_t pos;
86 } val;
87};
88
89struct rte_ring_rts_headtail {
90 volatile union __rte_ring_rts_poscnt tail;
91 enum rte_ring_sync_type sync_type;
92 uint32_t htd_max;
93 volatile union __rte_ring_rts_poscnt head;
94};
95
96union __rte_ring_hts_pos {
98 uint64_t raw __rte_aligned(8);
99 struct {
100 uint32_t head;
101 uint32_t tail;
102 } pos;
103};
104
105struct rte_ring_hts_headtail {
106 volatile union __rte_ring_hts_pos ht;
107 enum rte_ring_sync_type sync_type;
108};
109
120struct rte_ring {
123 int flags;
124 const struct rte_memzone *memzone;
126 uint32_t size;
127 uint32_t mask;
128 uint32_t capacity;
134 union {
135 struct rte_ring_headtail prod;
136 struct rte_ring_hts_headtail hts_prod;
137 struct rte_ring_rts_headtail rts_prod;
139
144 union {
145 struct rte_ring_headtail cons;
146 struct rte_ring_hts_headtail hts_cons;
147 struct rte_ring_rts_headtail rts_cons;
149
151};
152
153#define RING_F_SP_ENQ 0x0001
154#define RING_F_SC_DEQ 0x0002
163#define RING_F_EXACT_SZ 0x0004
164#define RTE_RING_SZ_MASK (0x7fffffffU)
166#define RING_F_MP_RTS_ENQ 0x0008
167#define RING_F_MC_RTS_DEQ 0x0010
169#define RING_F_MP_HTS_ENQ 0x0020
170#define RING_F_MC_HTS_DEQ 0x0040
172#ifdef __cplusplus
173}
174#endif
175
176#endif /* _RTE_RING_CORE_H_ */
#define RTE_STD_C11
Definition: rte_common.h:42
__extension__ struct rte_eth_link __rte_aligned(8)
#define RTE_RING_NAMESIZE
Definition: rte_ring_core.h:52
rte_ring_queue_behavior
Definition: rte_ring_core.h:43
@ RTE_RING_QUEUE_VARIABLE
Definition: rte_ring_core.h:47
@ RTE_RING_QUEUE_FIXED
Definition: rte_ring_core.h:45
rte_ring_sync_type
Definition: rte_ring_core.h:56
@ RTE_RING_SYNC_MT
Definition: rte_ring_core.h:57
@ RTE_RING_SYNC_MT_RTS
Definition: rte_ring_core.h:59
@ RTE_RING_SYNC_MT_HTS
Definition: rte_ring_core.h:60
@ RTE_RING_SYNC_ST
Definition: rte_ring_core.h:58
enum rte_ring_sync_type sync_type
Definition: rte_ring_core.h:74
volatile uint32_t head
Definition: rte_ring_core.h:69
volatile uint32_t tail
Definition: rte_ring_core.h:70
uint32_t capacity
char name[RTE_RING_NAMESIZE] __rte_cache_aligned
uint32_t size
char pad0 __rte_cache_aligned
uint32_t mask
const struct rte_memzone * memzone
char pad1 __rte_cache_aligned
char pad2 __rte_cache_aligned