EM-ODP
3.7.0
Event Machine on ODP
event_machine_hw_config.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2012, Nokia Siemens Networks
3
* Copyright (c) 2015-2022, Nokia Solutions and Networks
4
* All rights reserved.
5
*
6
* Redistribution and use in source and binary forms, with or without
7
* modification, are permitted provided that the following conditions
8
* are met:
9
*
10
* * Redistributions of source code must retain the above copyright
11
* notice, this list of conditions and the following disclaimer.
12
* * Redistributions in binary form must reproduce the above copyright
13
* notice, this list of conditions and the following disclaimer in the
14
* documentation and/or other materials provided with the distribution.
15
* * Neither the name of the copyright holder nor the names of its
16
* contributors may be used to endorse or promote products derived
17
* from this software without specific prior written permission.
18
*
19
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
*/
31
32
/**
33
* @file
34
*
35
* Event Machine HW dependent constants and definitions.
36
*
37
* @note Always use the defined names from this file instead of direct
38
* numerical values. The values are platform/implementation specific.
39
*/
40
41
#ifndef EVENT_MACHINE_HW_CONFIG_H
42
#define EVENT_MACHINE_HW_CONFIG_H
43
44
#pragma GCC visibility push(default)
45
46
#ifdef __cplusplus
47
extern
"C"
{
48
#endif
49
50
/*
51
* HW specific constants
52
***************************************
53
*/
54
55
/* Max number of EM cores supported */
56
#define EM_MAX_CORES 64
57
58
/**
59
* @def EM_UNDEF_U64
60
* EM undefined u64
61
*/
62
#define EM_UNDEF_U64 0
63
64
/**
65
* @def EM_UNDEF_U32
66
* EM undefined u32
67
*/
68
#define EM_UNDEF_U32 0
69
70
/**
71
* @def EM_UNDEF_U16
72
* EM undefined u16
73
*/
74
#define EM_UNDEF_U16 0
75
76
/**
77
* @def EM_UNDEF_U8
78
* EM undefined u8
79
*/
80
#define EM_UNDEF_U8 0
81
82
/**
83
* @def EM_UNDEF_UINTPTR
84
* EM undefined uintptr
85
*/
86
#define EM_UNDEF_UINTPTR EM_STATIC_CAST(uintptr_t, NULL)
87
88
/**
89
* @def EM_UNDEF_PTR
90
* EM undefined pointer
91
*/
92
#ifndef __cplusplus
93
#define EM_UNDEF_PTR NULL
94
#else
95
#define EM_UNDEF_PTR nullptr
96
#endif
97
98
/**
99
* @def EM_QUEUE_PRIO_NUM
100
* Number of queue scheduling priorities, normal default is 8.
101
* @see em_queue_prio_e
102
*/
103
#define EM_QUEUE_PRIO_NUM 8
104
105
/**
106
* @def EM_QUEUE_RANGE_OFFSET
107
* Determines the EM queue handles range to use.
108
* Note: value must be >= 1 and <= 'UINT16_MAX - em_queue_get_max_num() + 1'
109
* idx EM Queue handle
110
* 0 -> 0 + offset
111
* 1 -> 1 + offset
112
* ...
113
* max-1 -> max-1 + offset
114
*/
115
#define EM_QUEUE_RANGE_OFFSET 1
116
117
/*
118
* Static EM queue IDs
119
*/
120
#define _EM_QUEUE_STATIC_MIN (0 + EM_QUEUE_RANGE_OFFSET)
121
#define _EM_QUEUE_STATIC_MAX (0xFE + EM_QUEUE_RANGE_OFFSET)
122
/**
123
* @def EM_QUEUE_STATIC_MIN
124
* Minimum static queue ID
125
*/
126
#define EM_QUEUE_STATIC_MIN EM_STATIC_CAST(uint16_t, _EM_QUEUE_STATIC_MIN)
127
/**
128
* @def EM_QUEUE_STATIC_MAX
129
* Maximum static queue ID
130
*/
131
#define EM_QUEUE_STATIC_MAX EM_STATIC_CAST(uint16_t, _EM_QUEUE_STATIC_MAX)
132
/**
133
* @def EM_QUEUE_STATIC_NUM
134
* Number of static queues
135
*/
136
#define EM_QUEUE_STATIC_NUM (_EM_QUEUE_STATIC_MAX - _EM_QUEUE_STATIC_MIN + 1)
137
138
/**
139
* @def EM_MAX_QUEUE_GROUPS
140
* Maximum number of EM queue groups
141
*/
142
#define EM_MAX_QUEUE_GROUPS (EM_MAX_CORES + 64)
143
/**
144
* @def EM_QUEUE_GROUP_DEFAULT
145
* Default queue group for EM
146
*/
147
#define EM_QUEUE_GROUP_DEFAULT EM_REINTERPRET_CAST(em_queue_group_t, EM_MAX_QUEUE_GROUPS)
148
/**
149
* @def EM_QUEUE_GROUP_NAME_LEN
150
* Max queue group name length
151
*/
152
#define EM_QUEUE_GROUP_NAME_LEN 32
153
154
/**
155
* @def EM_QUEUE_GROUP_DEFAULT_NAME
156
* The name of the EM default queue group
157
*/
158
#define EM_QUEUE_GROUP_DEFAULT_NAME "default"
159
160
/**
161
* @def EM_QUEUE_GROUP_CORE_BASE_NAME
162
* Base-name of EM core-specific queue groups (one per EM-core),
163
* if created by EM (note: see the EM runtime config file for option).
164
* The full queue group name for a single-core group is: "core" + "%d",
165
* which gives "core0", "core1", ... "core99", ...
166
* EM earlier relied on these queue groups for internal core specific
167
* messaging and also allowed applications to use them. Currently EM
168
* does not internally need these groups but will create them based on
169
* an EM config file option for applications relying on their existence.
170
*
171
* Example: Find the queue group that includes only this core.
172
* (EM single-core queue group creation enabled in config file)
173
* @code
174
* char qgrp_name[EM_QUEUE_GROUP_NAME_LEN];
175
* int core = em_core_id();
176
* em_queue_group_t qgrp_core;
177
*
178
* snprintf(qgrp_name, sizeof(qgrp_name), "%s%d",
179
* EM_QUEUE_GROUP_CORE_BASE_NAME, core);
180
* ...
181
* qgrp_core = em_queue_group_find(qgrp_name);
182
* ...
183
* @endcode
184
*/
185
#define EM_QUEUE_GROUP_CORE_BASE_NAME "core"
186
187
/**
188
* @def EM_POOL_DEFAULT
189
* Define the EM default event pool
190
*/
191
#define EM_POOL_DEFAULT EM_REINTERPRET_CAST(em_pool_t, 1)
192
/**
193
* @def EM_POOL_NAME_LEN
194
* Max event pool name length
195
*/
196
#define EM_POOL_NAME_LEN 32
197
198
/**
199
* @def EM_POOL_DEFAULT_NAME
200
* The name of the EM default event pool
201
*/
202
#define EM_POOL_DEFAULT_NAME "default"
203
204
/**
205
* @def EM_POOL_SUBPOOL_STAT_INTERNAL
206
* Reserve for EM pool subpool statistic internal use
207
*/
208
#define EM_POOL_SUBPOOL_STAT_INTERNAL 129
209
210
/**
211
* @def EM_EVENT_USER_AREA_MAX_SIZE
212
* The maximum size in bytes that can be configured for the event user area.
213
* The user area is located outside of the payload in the event metadata (hdr)
214
* and can be used to store event related state without affecting the payload.
215
*/
216
#define EM_EVENT_USER_AREA_MAX_SIZE 256
217
218
/**
219
* @def EM_SCHED_MULTI_MAX_BURST
220
* The maximum number of events to request from the scheduler and then
221
* dispatch in one burst.
222
*
223
* @note the odp sched burst size is determined by the odp-config-file values:
224
* sched_basic: burst_size_default[...] and burst_size_max[...]
225
*/
226
#define EM_SCHED_MULTI_MAX_BURST 32
227
228
/**
229
* @def EM_SCHED_AG_MULTI_MAX_BURST
230
* The maximum number of events from an atomic group to dispatch in one burst.
231
*/
232
#define EM_SCHED_AG_MULTI_MAX_BURST 32
233
234
/**
235
* @def EM_QUEUE_LOCAL_MULTI_MAX_BURST
236
* The maximum number of events from a local queue (EM_QUEUE_TYPE_LOCAL) to
237
* dispatch in one burst.
238
*/
239
#define EM_QUEUE_LOCAL_MULTI_MAX_BURST 32
240
241
/**
242
* @def EM_EO_MULTIRCV_MAX_EVENTS
243
* The default maximum number of events passed to the EO's multi-event
244
* receive function (when the EO has been created with em_eo_create_multircv()).
245
* This value is used by EM as a default if the user does not specify
246
* a value (i.e. gives '0') for 'em_eo_multircv_param_t::max_events' when
247
* calling em_eo_create_multircv()
248
*/
249
#define EM_EO_MULTIRCV_MAX_EVENTS 32
250
251
/**
252
* @def EM_OUTPUT_QUEUE_IMMEDIATE
253
* '0': allow EM to buffer events sent to output queues before calling the
254
* user provided output callback to improve throughput
255
* '1': each em_send/_multi() will immediately call the user provided output
256
* queue callback with no EM internal buffering
257
* This define mostly affects behaviour and performance when sending events from
258
* an ordered scheduling context where EM needs to ensure event ordering before
259
* calling the user provided output callback function.
260
*/
261
#define EM_OUTPUT_QUEUE_IMMEDIATE 0
262
263
#ifdef __cplusplus
264
}
265
#endif
266
267
#pragma GCC visibility pop
268
#endif
/* EVENT_MACHINE_HW_CONFIG_H */