summaryrefslogtreecommitdiffstats
path: root/src/vnet/flow/ipfix_info_elements.h
blob: ee6f53804bf6e7af2d0f0d0a0f99899ae140316a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
/*
 * Copyright (c) 2015 Cisco and/or its affiliates.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at:
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
#ifndef __included_ipfix_info_elements_h__
#define __included_ipfix_info_elements_h__

#define foreach_ipfix_info_element_t                                    \
_(octetDeltaCount, 1, u64)                                              \
_(packetDeltaCount, 2, u64)                                             \
_(deltaFlowCount, 3, u64)                                               \
_(protocolIdentifier, 4, u8)                                            \
_(ipClassOfService, 5, u8)                                              \
_(tcpControlBits, 6, u16)                                               \
_(sourceTransportPort, 7, u16)                                          \
_(sourceIPv4Address, 8, ip4_address_t)                                  \
_(sourceIPv4PrefixLength, 9, u8)                                        \
_(ingressInterface, 10, u32)                                            \
_(destinationTransportPort, 11, u16)                                    \
_(destinationIPv4Address, 12, ip4_address_t)                            \
_(destinationIPv4PrefixLength, 13, u8)                                  \
_(egressInterface, 14, u32)                                             \
_(ipNextHopIPv4Address, 15, ip4_address_t)                              \
_(bgpSourceAsNumber, 16, u32)                                           \
_(bgpDestinationAsNumber, 17, u32)                                      \
_(bgpNextHopIPv4Address, 18, ip4_address_t)                             \
_(postMCastPacketDeltaCount, 19, u64)                                   \
_(postMCastOctetDeltaCount, 20, u64)                                    \
_(flowEndSysUpTime, 21, u32)                                            \
_(flowStartSysUpTime, 22, u32)                                          \
_(postOctetDeltaCount, 23, u64)                                         \
_(postPacketDeltaCount, 24, u64)                                        \
_(minimumIpTotalLength, 25, u64)                                        \
_(maximumIpTotalLength, 26, u64)                                        \
_(sourceIPv6Address, 27, ip6_address_t)                                 \
_(destinationIPv6Address, 28, ip6_address_t)                            \
_(sourceIPv6PrefixLength, 29, u8)                                       \
_(destinationIPv6PrefixLength, 30, u8)                                  \
_(flowLabelIPv6, 31, u32)                                               \
_(icmpTypeCodeIPv4, 32, u16)                                            \
_(igmpType, 33, u8)                                                     \
_(samplingInterval, 34, u32)                                            \
_(samplingAlgorithm, 35, u8)                                            \
_(flowActiveTimeout, 36, u16)                                           \
_(flowIdleTimeout, 37, u16)                                             \
_(engineType, 38, u8)                                                   \
_(engineId, 39, u8)                                                     \
_(exportedOctetTotalCount, 40, u64)                                     \
_(exportedMessageTotalCount, 41, u64)                                   \
_(exportedFlowRecordTotalCount, 42, u64)                                \
_(ipv4RouterSc, 43, ip4_address_t)                                      \
_(sourceIPv4Prefix, 44, ip4_address_t)                                  \
_(destinationIPv4Prefix, 45, ip4_address_t)                             \
_(mplsTopLabelType, 46, u8)                                             \
_(mplsTopLabelIPv4Address, 47, ip4_address_t)                           \
_(samplerId, 48, u8)                                                    \
_(samplerMode, 49, u8)                                                  \
_(samplerRandomInterval, 50, u32)                                       \
_(classId, 51, u8)                                                      \
_(minimumTTL, 52, u8)                                                   \
_(maximumTTL, 53, u8)                                                   \
_(fragmentIdentification, 54, u32)                                      \
_(postIpClassOfService, 55, u8)                                         \
_(sourceMacAddress, 56, macAddress)                                     \
_(postDestinationMacAddress, 57, macAddress)                            \
_(vlanId, 58, u16)                                                      \
_(postVlanId, 59, u16)                                                  \
_(ipVersion, 60, u8)                                                    \
_(flowDirection, 61, u8)                                                \
_(ipNextHopIPv6Address, 62, ip6_address_t)                              \
_(bgpNextHopIPv6Address, 63, ip6_address_t)                             \
_(ipv6ExtensionHeaders, 64, u32)                                        \
_(mplsTopLabelStackSection, 70, octetArray)                             \
_(mplsLabelStackSection2, 71, octetArray)                               \
_(mplsLabelStackSection3, 72, octetArray)                               \
_(mplsLabelStackSection4, 73, octetArray)                               \
_(mplsLabelStackSection5, 74, octetArray)                               \
_(mplsLabelStackSection6, 75, octetArray)                               \
_(mplsLabelStackSection7, 76, octetArray)                               \
_(mplsLabelStackSection8, 77, octetArray)                               \
_(mplsLabelStackSection9, 78, octetArray)                               \
_(mplsLabelStackSection10, 79, octetArray)                              \
_(destinationMacAddress, 80, macAddress)                                \
_(postSourceMacAddress, 81, macAddress)                                 \
_(interfaceName, 82, string)                                            \
_(interfaceDescription, 83, string)                                     \
_(samplerName, 84, string)                                              \
_(octetTotalCount, 85, u64)                                             \
_(packetTotalCount, 86, u64)                                            \
_(flagsAndSamplerId, 87, u32)                                           \
_(fragmentOffset, 88, u16)                                              \
_(forwardingStatus, 89, u32)                                            \
_(mplsVpnRouteDistinguisher, 90, octetArray)                            \
_(mplsTopLabelPrefixLength, 91, u8)                                     \
_(srcTrafficIndex, 92, u32)                                             \
_(dstTrafficIndex, 93, u32)                                             \
_(applicationDescription, 94, string)                                   \
_(applicationId, 95, octetArray)                                        \
_(applicationName, 96, string)                                          \
_(Assigned, 97, for NetFlow v9 compatibility	)                       \
_(postIpDiffServCodePoint, 98, u8)                                      \
_(multicastReplicationFactor, 99, u32)                                  \
_(className, 100, string)                                               \
_(classificationEngineId, 101, u8)                                      \
_(layer2packetSectionOffset, 102, u16)                                  \
_(layer2packetSectionSize, 103, u16)                                    \
_(layer2packetSectionData, 104, octetArray)                             \
_(bgpNextAdjacentAsNumber, 128, u32)                                    \
_(bgpPrevAdjacentAsNumber, 129, u32)                                    \
_(exporterIPv4Address, 130, ip4_address_t)                              \
_(exporterIPv6Address, 131, ip6_address_t)                              \
_(droppedOctetDeltaCount, 132, u64)                                     \
_(droppedPacketDeltaCount, 133, u64)                                    \
_(droppedOctetTotalCount, 134, u64)                                     \
_(droppedPacketTotalCount, 135, u64)                                    \
_(flowEndReason, 136, u8)                                               \
_(commonPropertiesId, 137, u64)                                         \
_(observationPointId, 138, u64)                                         \
_(icmpTypeCodeIPv6, 139, u16)                                           \
_(mplsTopLabelIPv6Address, 140, ip6_address_t)                          \
_(lineCardId, 141, u32)                                                 \
_(portId, 142, u32)                                                     \
_(meteringProcessId, 143, u32)                                          \
_(exportingProcessId, 144, u32)                                         \
_(templateId, 145, u16)                                                 \
_(wlanChannelId, 146, u8)                                               \
_(wlanSSID, 147, string)                                                \
_(flowId, 148, u64)                                                     \
_(observationDomainId, 149, u32)                                        \
_(flowStartSeconds, 150, dateTimeSeconds)                               \
_(flowEndSeconds, 151, dateTimeSeconds)                                 \
_(flowStartMilliseconds, 152, dateTimeMilliseconds)                     \
_(flowEndMilliseconds, 153, dateTimeMilliseconds)                       \
_(flowStartMicroseconds, 154, dateTimeMicroseconds)                     \
_(flowEndMicroseconds, 155, dateTimeMicroseconds)                       \
_(flowStartNanoseconds, 156, dateTimeNanoseconds)                       \
_(flowEndNanoseconds, 157, dateTimeNanoseconds)                         \
_(flowStartDeltaMicroseconds, 158, u32)                                 \
_(flowEndDeltaMicroseconds, 159, u32)                                   \
_(systemInitTimeMilliseconds, 160, dateTimeMilliseconds)                \
_(flowDurationMilliseconds, 161, u32)                                   \
_(flowDurationMicroseconds, 162, u32)                                   \
_(observedFlowTotalCount, 163, u64)                                     \
_(ignoredPacketTotalCount, 164, u64)                                    \
_(ignoredOctetTotalCount, 165, u64)                                     \
_(notSentFlowTotalCount, 166, u64)                                      \
_(notSentPacketTotalCount, 167, u64)                                    \
_(notSentOctetTotalCount, 168, u64)                                     \
_(destinationIPv6Prefix, 169, ip6_address_t)                            \
_(sourceIPv6Prefix, 170, ip6_address_t)                                 \
_(postOctetTotalCount, 171, u64)                                        \
_(postPacketTotalCount, 172, u64)                                       \
_(flowKeyIndicator, 173, u64)                                           \
_(postMCastPacketTotalCount, 174, u64)                                  \
_(postMCastOctetTotalCount, 175, u64)                                   \
_(icmpTypeIPv4, 176, u8)                                                \
_(icmpCodeIPv4, 177, u8)                                                \
_(icmpTypeIPv6, 178, u8)                                                \
_(icmpCodeIPv6, 179, u8)                                                \
_(udpSourcePort, 180, u16)                                              \
_(udpDestinationPort, 181, u16)                                         \
_(tcpSourcePort, 182, u16)                                              \
_(tcpDestinationPort, 183, u16)                                         \
_(tcpSequenceNumber, 184, u32)                                          \
_(tcpAcknowledgementNumber, 185, u32)                                   \
_(tcpWindowSize, 186, u16)                                              \
_(tcpUrgentPointer, 187, u16)                                           \
_(tcpHeaderLength, 188, u8)                                             \
_(ipHeaderLength, 189, u8)                                              \
_(totalLengthIPv4, 190, u16)                                            \
_(payloadLengthIPv6, 191, u16)                                          \
_(ipTTL, 192, u8)                                                       \
_(nextHeaderIPv6, 193, u8)                                              \
_(mplsPayloadLength, 194, u32)                                          \
_(ipDiffServCodePoint, 195, u8)                                         \
_(ipPrecedence, 196, u8)                                                \
_(fragmentFlags, 197, u8)                                               \
_(octetDeltaSumOfSquares, 198, u64)                                     \
_(octetTotalSumOfSquares, 199, u64)                                     \
_(mplsTopLabelTTL, 200, u8)                                             \
_(mplsLabelStackLength, 201, u32)                                       \
_(mplsLabelStackDepth, 202, u32)                                        \
_(mplsTopLabelExp, 203, u8)                                             \
_(ipPayloadLength, 204, u32)                                            \
_(udpMessageLength, 205, u16)                                           \
_(isMulticast, 206, u8)                                                 \
_(ipv4IHL, 207, u8)                                                     \
_(ipv4Options, 208, u32)                                                \
_(tcpOptions, 209, u64)                                                 \
_(paddingOctets, 210, octetArray)                                       \
_(collectorIPv4Address, 211, ip4_address_t)                             \
_(collectorIPv6Address, 212, ip6_address_t)                             \
_(exportInterface, 213, u32)                                            \
_(exportProtocolVersion, 214, u8)                                       \
_(exportTransportProtocol, 215, u8)                                     \
_(collectorTransportPort, 216, u16)                                     \
_(exporterTransportPort, 217, u16)                                      \
_(tcpSynTotalCount, 218, u64)                                           \
_(tcpFinTotalCount, 219, u64)                                           \
_(tcpRstTotalCount, 220, u64)                                           \
_(tcpPshTotalCount, 221, u64)                                           \
_(tcpAckTotalCount, 222, u64)                                           \
_(tcpUrgTotalCount, 223, u64)                                           \
_(ipTotalLength, 224, u64)                                              \
_(postNATSourceIPv4Address, 225, ip4_address_t)                         \
_(postNATDestinationIPv4Address, 226, ip4_address_t)                    \
_(postNAPTSourceTransportPort, 227, u16)                                \
_(postNAPTDestinationTransportPort, 228, u16)                           \
_(natOriginatingAddressRealm, 229, u8)                                  \
_(natEvent, 230, u8)                                                    \
_(initiatorOctets, 231, u64)                                            \
_(responderOctets, 232, u64)                                            \
_(firewallEvent, 233, u8)                                               \
_(ingressVRFID, 234, u32)                                               \
_(egressVRFID, 235, u32)                                                \
_(VRFname, 236, string)                                                 \
_(postMplsTopLabelExp, 237, u8)                                         \
_(tcpWindowScale, 238, u16)                                             \
_(biflowDirection, 239, u8)                                             \
_(ethernetHeaderLength, 240, u8)                                        \
_(ethernetPayloadLength, 241, u16)                                      \
_(ethernetTotalLength, 242, u16)                                        \
_(dot1qVlanId, 243, u16)                                                \
_(dot1qPriority, 244, u8)                                               \
_(dot1qCustomerVlanId, 245, u16)                                        \
_(dot1qCustomerPriority, 246, u8)                                       \
_(metroEvcId, 247, string)                                              \
_(metroEvcType, 248, u8)                                                \
_(pseudoWireId, 249, u32)                                               \
_(pseudoWireType, 250, u16)                                             \
_(pseudoWireControlWord, 251, u32)                                      \
_(ingressPhysicalInterface, 252, u32)                                   \
_(egressPhysicalInterface, 253, u32)                                    \
_(postDot1qVlanId, 254, u16)                                            \
_(postDot1qCustomerVlanId, 255, u16)                                    \
_(ethernetType, 256, u16)                                               \
_(postIpPrecedence, 257, u8)                                            \
_(collectionTimeMilliseconds, 258, dateTimeMilliseconds)                \
_(exportSctpStreamId, 259, u16)                                         \
_(maxExportSeconds, 260, dateTimeSeconds)                               \
_(maxFlowEndSeconds, 261, dateTimeSeconds)                              \
_(messageMD5Checksum, 262, octetArray)                                  \
_(messageScope, 263, u8)                                                \
_(minExportSeconds, 264, dateTimeSeconds)                               \
_(minFlowStartSeconds, 265, dateTimeSeconds)                            \
_(opaqueOctets, 266, octetArray)                                        \
_(sessionScope, 267, u8)                                                \
_(maxFlowEndMicroseconds, 268, dateTimeMicroseconds)                    \
_(maxFlowEndMilliseconds, 269, dateTimeMilliseconds)                    \
_(maxFlowEndNanoseconds, 270, dateTimeNanoseconds)                      \
_(minFlowStartMicroseconds, 271, dateTimeMicroseconds)                  \
_(minFlowStartMilliseconds, 272, dateTimeMilliseconds)                  \
_(minFlowStartNanoseconds, 273, dateTimeNanoseconds)                    \
_(collectorCertificate, 274, octetArray)                                \
_(exporterCertificate, 275, octetArray)                                 \
_(dataRecordsReliability, 276, boolean)                                 \
_(observationPointType, 277, u8)                                        \
_(newConnectionDeltaCount, 278, u32)                                    \
_(connectionSumDurationSeconds, 279, u64)                               \
_(connectionTransactionId, 280, u64)                                    \
_(postNATSourceIPv6Address, 281, ip6_address_t)                         \
_(postNATDestinationIPv6Address, 282, ip6_address_t)                    \
_(natPoolId, 283, u32)                                                  \
_(natPoolName, 284, string)                                             \
_(anonymizationFlags, 285, u16)                                         \
_(anonymizationTechnique, 286, u16)                                     \
_(informationElementIndex, 287, u16)                                    \
_(p2pTechnology, 288, string)                                           \
_(tunnelTechnology, 289, string)                                        \
_(encryptedTechnology, 290, string)                                     \
_(basicList, 291, basicList)                                            \
_(subTemplateList, 292, subTemplateList)                                \
_(subTemplateMultiList, 293, subTemplateMultiList)                      \
_(bgpValidityState, 294, u8)                                            \
_(IPSecSPI, 295, u32)                                                   \
_(greKey, 296, u32)                                                     \
_(natType, 297, u8)                                                     \
_(initiatorPackets, 298, u64)                                           \
_(responderPackets, 299, u64)                                           \
_(observationDomainName, 300, string)                                   \
_(selectionSequenceId, 301, u64)                                        \
_(selectorId, 302, u64)                                                 \
_(informationElementId, 303, u16)                                       \
_(selectorAlgorithm, 304, u16)                                          \
_(samplingPacketInterval, 305, u32)                                     \
_(samplingPacketSpace, 306, u32)                                        \
_(samplingTimeInterval, 307, u32)                                       \
_(samplingTimeSpace, 308, u32)                                          \
_(samplingSize, 309, u32)                                               \
_(samplingPopulation, 310, u32)                                         \
_(samplingProbability, 311, float64)                                    \
_(dataLinkFrameSize, 312, u16)                                          \
_(ipHeaderPacketSection, 313, octetArray)                               \
_(ipPayloadPacketSection, 314, octetArray)                              \
_(dataLinkFrameSection, 315, octetArray)                                \
_(mplsLabelStackSection, 316, octetArray)                               \
_(mplsPayloadPacketSection, 317, octetArray)                            \
_(selectorIdTotalPktsObserved, 318, u64)                                \
_(selectorIdTotalPktsSelected, 319, u64)                                \
_(absoluteError, 320, float64)                                          \
_(relativeError, 321, float64)                                          \
_(observationTimeSeconds, 322, dateTimeSeconds)                         \
_(observationTimeMilliseconds, 323, dateTimeMilliseconds)               \
_(observationTimeMicroseconds, 324, dateTimeMicroseconds)               \
_(observationTimeNanoseconds, 325, dateTimeNanoseconds)                 \
_(digestHashValue, 326, u64)                                            \
_(hashIPPayloadOffset, 327, u64)                                        \
_(hashIPPayloadSize, 328, u64)                                          \
_(hashOutputRangeMin, 329, u64)                                         \
_(hashOutputRangeMax, 330, u64)                                         \
_(hashSelectedRangeMin, 331, u64)                                       \
_(hashSelectedRangeMax, 332, u64)                                       \
_(hashDigestOutput, 333, boolean)                                       \
_(hashInitialiserValue, 334, u64)                                       \
_(selectorName, 335, string)                                            \
_(upperCILimit, 336, float64)                                           \
_(lowerCILimit, 337, float64)                                           \
_(confidenceLevel, 338, float64)                                        \
_(informationElementDataType, 339, u8)                                  \
_(informationElementDescription, 340, string)                           \
_(informationElementName, 341, string)                                  \
_(informationElementRangeBegin, 342, u64)                               \
_(informationElementRangeEnd, 343, u64)                                 \
_(informationElementSemantics, 344, u8)                                 \
_(informationElementUnits, 345, u16)                                    \
_(privateEnterpriseNumber, 346, u32)                                    \
_(virtualStationInterfaceId, 347, octetArray)                           \
_(virtualStationInterfaceName, 348, string)                             \
_(virtualStationUUID, 349, octetArray)                                  \
_(virtualStationName, 350, string)                                      \
_(layer2SegmentId, 351, u64)                                            \
_(layer2OctetDeltaCount, 352, u64)                                      \
_(layer2OctetTotalCount, 353, u64)                                      \
_(ingressUnicastPacketTotalCount, 354, u64)                             \
_(ingressMulticastPacketTotalCount, 355, u64)                           \
_(ingressBroadcastPacketTotalCount, 356, u64)                           \
_(egressUnicastPacketTotalCount, 357, u64)                              \
_(egressBroadcastPacketTotalCount, 358, u64)                            \
_(monitoringIntervalStartMilliSeconds, 359, dateTimeMilliseconds)       \
_(monitoringIntervalEndMilliSeconds, 360, dateTimeMilliseconds)         \
_(portRangeStart, 361, u16)                                             \
_(portRangeEnd, 362, u16)                                               \
_(portRangeStepSize, 363, u16)                                          \
_(portRangeNumPorts, 364, u16)                                          \
_(staMacAddress, 365, macAddress)                                       \
_(staIPv4Address, 366, ip4_address_t)                                   \
_(wtpMacAddress, 367, macAddress )                                      \
_(ingressInterfaceType, 368, u32)                                       \
_(egressInterfaceType, 369, u32)                                        \
_(rtpSequenceNumber, 370, u16)                                          \
_(userName, 371, string)                                                \
_(applicationCategoryName, 372, string)                                 \
_(applicationSubCategoryName, 373, string)                              \
_(applicationGroupName, 374, string)                                    \
_(originalFlowsPresent, 375, u64)                                       \
_(originalFlowsInitiated, 376, u64)                                     \
_(originalFlowsCompleted, 377, u64)                                     \
_(distinctCountOfSourceIPAddress, 378, u64)                             \
_(distinctCountOfDestinationIPAddress, 379, u64)                        \
_(distinctCountOfSourceIPv4Address, 380, u32)                           \
_(distinctCountOfDestinationIPv4Address, 381, u32)                      \
_(distinctCountOfSourceIPv6Address, 382, u64)                           \
_(distinctCountOfDestinationIPv6Address, 383, u64)                      \
_(valueDistributionMethod, 384, u8)                                     \
_(rfc3550JitterMilliseconds, 385, u32)                                  \
_(rfc3550JitterMicroseconds, 386, u32)                                  \
_(rfc3550JitterNanoseconds, 387, u32)                                   \
_(dot1qDEI, 388, boolean)                                               \
_(dot1qCustomerDEI, 389, boolean)                                       \
_(flowSelectorAlgorithm, 390, u16)                                      \
_(flowSelectedOctetDeltaCount, 391, u64)                                \
_(flowSelectedPacketDeltaCount, 392, u64)                               \
_(flowSelectedFlowDeltaCount, 393, u64)                                 \
_(selectorIDTotalFlowsObserved, 394, u64)                               \
_(selectorIDTotalFlowsSelected, 395, u64)                               \
_(samplingFlowInterval, 396, u64)                                       \
_(samplingFlowSpacing, 397, u64)                                        \
_(flowSamplingTimeInterval, 398, u64)                                   \
_(flowSamplingTimeSpacing, 399, u64)                                    \
_(hashFlowDomain, 400, u16)                                             \
_(transportOctetDeltaCount, 401, u64)                                   \
_(transportPacketDeltaCount, 402, u64)                                  \
_(originalExporterIPv4Address, 403, ip4_address_t)                      \
_(originalExporterIPv6Address, 404, ip6_address_t)                      \
_(originalObservationDomainId, 405, u32)                                \
_(intermediateProcessId, 406, u32)                                      \
_(ignoredDataRecordTotalCount, 407, u64)                                \
_(dataLinkFrameType, 408, u16)                                          \
_(sectionOffset, 409, u16)                                              \
_(sectionExportedOctets, 410, u16)                                      \
_(dot1qServiceInstanceTag, 411, octetArray)                             \
_(dot1qServiceInstanceId, 412, u32)                                     \
_(dot1qServiceInstancePriority, 413, u8)                                \
_(dot1qCustomerSourceMacAddress, 414, macAddress)                       \
_(dot1qCustomerDestinationMacAddress, 415, macAddress)                  \
_(postLayer2OctetDeltaCount, 417, u64)                                  \
_(postMCastLayer2OctetDeltaCount, 418, u64)                             \
_(postLayer2OctetTotalCount, 420, u64)                                  \
_(postMCastLayer2OctetTotalCount, 421, u64)                             \
_(minimumLayer2TotalLength, 422, u64)                                   \
_(maximumLayer2TotalLength, 423, u64)                                   \
_(droppedLayer2OctetDeltaCount, 424, u64)                               \
_(droppedLayer2OctetTotalCount, 425, u64)                               \
_(ignoredLayer2OctetTotalCount, 426, u64)                               \
_(notSentLayer2OctetTotalCount, 427, u64)                               \
_(layer2OctetDeltaSumOfSquares, 428, u64)                               \
_(layer2OctetTotalSumOfSquares, 429, u64)                               \
_(layer2FrameDeltaCount, 430, u64)                                      \
_(layer2FrameTotalCount, 431, u64)                                      \
_(pseudoWireDestinationIPv4Address, 432, ip4_address_t)                 \
_(ignoredLayer2FrameTotalCount, 433, u64)                               \
_(natQuotaExceededEvent, 466, u32)

typedef enum
{
#define _(n,v,t) n = v,
  foreach_ipfix_info_element_t
#undef _
} ipfix_info_element_id_t;

#endif /* __included_ipfix_info_elements_h__ */

/*
 * fd.io coding-style-patch-verification: ON
 *
 * Local Variables:
 * eval: (c-set-style "gnu")
 * End:
 */
="kt">void expired_timer_single_callback (u32 * expired_timers) { int i; u32 pool_index, timer_id; tw_timer_test_elt_t *e; tw_timer_test_main_t *tm = &tw_timer_test_main; for (i = 0; i < vec_len (expired_timers); i++) { pool_index = expired_timers[i] & 0x7FFFFFFF; timer_id = expired_timers[i] >> 31; ASSERT (timer_id == 1); e = pool_elt_at_index (tm->test_elts, pool_index); if (e->expected_to_expire != tm->single_wheel.current_tick) { fformat (stdout, "[%d] expired at %lld not %lld\n", e - tm->test_elts, tm->single_wheel.current_tick, e->expected_to_expire); } pool_put (tm->test_elts, e); } } static void expired_timer_double_callback (u32 * expired_timers) { int i; u32 pool_index, timer_id; tw_timer_test_elt_t *e; tw_timer_test_main_t *tm = &tw_timer_test_main; for (i = 0; i < vec_len (expired_timers); i++) { pool_index = expired_timers[i] & 0x0FFFFFFF; timer_id = expired_timers[i] >> 28; ASSERT (timer_id == 14); e = pool_elt_at_index (tm->test_elts, pool_index); if (e->expected_to_expire != tm->double_wheel.current_tick) { fformat (stdout, "[%d] expired at %lld not %lld\n", e - tm->test_elts, tm->double_wheel.current_tick, e->expected_to_expire); } pool_put (tm->test_elts, e); } } static void expired_timer_triple_callback (u32 * expired_timers) { int i; u32 pool_index, timer_id; tw_timer_test_elt_t *e; tw_timer_test_main_t *tm = &tw_timer_test_main; for (i = 0; i < vec_len (expired_timers); i++) { pool_index = expired_timers[i] & 0x3FFFFFFF; timer_id = expired_timers[i] >> 30; ASSERT (timer_id == 3); e = pool_elt_at_index (tm->test_elts, pool_index); if (e->expected_to_expire != tm->triple_wheel.current_tick) { fformat (stdout, "[%d] expired at %lld not %lld\n", e - tm->test_elts, tm->triple_wheel.current_tick, e->expected_to_expire); } pool_put (tm->test_elts, e); } } static void expired_timer_triple_ov_callback (u32 * expired_timers) { int i; u32 pool_index; tw_timer_test_elt_t *e; tw_timer_test_main_t *tm = &tw_timer_test_main; for (i = 0; i < vec_len (expired_timers); i++) { pool_index = expired_timers[i]; e = pool_elt_at_index (tm->test_elts, pool_index); if (e->expected_to_expire != tm->triple_ov_wheel.current_tick) { fformat (stdout, "[%d] expired at %lld not %lld\n", e - tm->test_elts, tm->triple_ov_wheel.current_tick, e->expected_to_expire); } pool_put (tm->test_elts, e); } } static clib_error_t * test2_single (tw_timer_test_main_t * tm) { u32 i, j; tw_timer_test_elt_t *e; u32 initial_wheel_offset; u64 expiration_time; u32 max_expiration_time = 0; u32 *deleted_indices = 0; u32 adds = 0, deletes = 0; f64 before, after; clib_time_init (&tm->clib_time); tw_timer_wheel_init_2t_1w_2048sl (&tm->single_wheel, expired_timer_single_callback, 1.0 /* timer interval */ , ~0); /* Prime offset */ initial_wheel_offset = 757; run_single_wheel (&tm->single_wheel, initial_wheel_offset); fformat (stdout, "initial wheel time %d, fast index %d\n", tm->single_wheel.current_tick, tm->single_wheel.current_index[TW_TIMER_RING_FAST]); initial_wheel_offset = tm->single_wheel.current_tick; fformat (stdout, "test %d timers, %d iter, %d ticks per iter, 0x%llx seed\n", tm->ntimers, tm->niter, tm->ticks_per_iter, tm->seed); before = clib_time_now (&tm->clib_time); /* Prime the pump */ for (i = 0; i < tm->ntimers; i++) { pool_get (tm->test_elts, e); clib_memset (e, 0, sizeof (*e)); do { expiration_time = random_u64 (&tm->seed) & (2047); } while (expiration_time == 0); if (expiration_time > max_expiration_time) max_expiration_time = expiration_time; e->expected_to_expire = expiration_time + initial_wheel_offset; e->stop_timer_handle = tw_timer_start_2t_1w_2048sl (&tm->single_wheel, e - tm->test_elts, 1 /* timer id */ , expiration_time); } adds += i; for (i = 0; i < tm->niter; i++) { run_single_wheel (&tm->single_wheel, tm->ticks_per_iter); j = 0; vec_reset_length (deleted_indices); /* *INDENT-OFF* */ pool_foreach (e, tm->test_elts, ({ tw_timer_stop_2t_1w_2048sl (&tm->single_wheel, e->stop_timer_handle); vec_add1 (deleted_indices, e - tm->test_elts); if (++j >= tm->ntimers / 4) goto del_and_re_add; })); /* *INDENT-ON* */ del_and_re_add: for (j = 0; j < vec_len (deleted_indices); j++) { pool_put_index (tm->test_elts, deleted_indices[j]); } deletes += j; for (j = 0; j < tm->ntimers / 4; j++) { pool_get (tm->test_elts, e); clib_memset (e, 0, sizeof (*e)); do { expiration_time = random_u64 (&tm->seed) & (2047); } while (expiration_time == 0); if (expiration_time > max_expiration_time) max_expiration_time = expiration_time; e->expected_to_expire = expiration_time + tm->single_wheel.current_tick; e->stop_timer_handle = tw_timer_start_2t_1w_2048sl (&tm->single_wheel, e - tm->test_elts, 1 /* timer id */ , expiration_time); } adds += j; } vec_free (deleted_indices); run_single_wheel (&tm->single_wheel, max_expiration_time + 1); after = clib_time_now (&tm->clib_time); fformat (stdout, "%d adds, %d deletes, %d ticks\n", adds, deletes, tm->single_wheel.current_tick); fformat (stdout, "test ran %.2f seconds, %.2f ops/second\n", (after - before), ((f64) adds + (f64) deletes + (f64) tm->single_wheel.current_tick) / (after - before)); if (pool_elts (tm->test_elts)) fformat (stdout, "Note: %d elements remain in pool\n", pool_elts (tm->test_elts)); /* *INDENT-OFF* */ pool_foreach (e, tm->test_elts, ({ fformat (stdout, "[%d] expected to expire %d\n", e - tm->test_elts, e->expected_to_expire); })); /* *INDENT-ON* */ pool_free (tm->test_elts); tw_timer_wheel_free_2t_1w_2048sl (&tm->single_wheel); return 0; } static clib_error_t * test2_double (tw_timer_test_main_t * tm) { u32 i, j; tw_timer_test_elt_t *e; u32 initial_wheel_offset; u32 expiration_time; u32 max_expiration_time = 0; u32 *deleted_indices = 0; u32 adds = 0, deletes = 0; f64 before, after; clib_time_init (&tm->clib_time); tw_timer_wheel_init_16t_2w_512sl (&tm->double_wheel, expired_timer_double_callback, 1.0 /* timer interval */ , ~0); /* Prime offset */ initial_wheel_offset = 7577; run_double_wheel (&tm->double_wheel, initial_wheel_offset); fformat (stdout, "initial wheel time %d, fast index %d slow index %d\n", tm->double_wheel.current_tick, tm->double_wheel.current_index[TW_TIMER_RING_FAST], tm->double_wheel.current_index[TW_TIMER_RING_SLOW]); initial_wheel_offset = tm->double_wheel.current_tick; fformat (stdout, "test %d timers, %d iter, %d ticks per iter, 0x%llx seed\n", tm->ntimers, tm->niter, tm->ticks_per_iter, tm->seed); before = clib_time_now (&tm->clib_time); /* Prime the pump */ for (i = 0; i < tm->ntimers; i++) { pool_get (tm->test_elts, e); clib_memset (e, 0, sizeof (*e)); do { expiration_time = random_u64 (&tm->seed) & ((1 << 17) - 1); } while (expiration_time == 0); if (expiration_time > max_expiration_time) max_expiration_time = expiration_time; e->expected_to_expire = expiration_time + initial_wheel_offset; e->stop_timer_handle = tw_timer_start_16t_2w_512sl (&tm->double_wheel, e - tm->test_elts, 14 /* timer id */ , expiration_time); } adds += i; for (i = 0; i < tm->niter; i++) { run_double_wheel (&tm->double_wheel, tm->ticks_per_iter); j = 0; vec_reset_length (deleted_indices); /* *INDENT-OFF* */ pool_foreach (e, tm->test_elts, ({ tw_timer_stop_16t_2w_512sl (&tm->double_wheel, e->stop_timer_handle); vec_add1 (deleted_indices, e - tm->test_elts); if (++j >= tm->ntimers / 4) goto del_and_re_add; })); /* *INDENT-ON* */ del_and_re_add: for (j = 0; j < vec_len (deleted_indices); j++) pool_put_index (tm->test_elts, deleted_indices[j]); deletes += j; for (j = 0; j < tm->ntimers / 4; j++) { pool_get (tm->test_elts, e); clib_memset (e, 0, sizeof (*e)); do { expiration_time = random_u64 (&tm->seed) & ((1 << 17) - 1); } while (expiration_time == 0); if (expiration_time > max_expiration_time) max_expiration_time = expiration_time; e->expected_to_expire = expiration_time + tm->double_wheel.current_tick; e->stop_timer_handle = tw_timer_start_16t_2w_512sl (&tm->double_wheel, e - tm->test_elts, 14 /* timer id */ , expiration_time); } adds += j; } vec_free (deleted_indices); run_double_wheel (&tm->double_wheel, max_expiration_time + 1); after = clib_time_now (&tm->clib_time); fformat (stdout, "%d adds, %d deletes, %d ticks\n", adds, deletes, tm->double_wheel.current_tick); fformat (stdout, "test ran %.2f seconds, %.2f ops/second\n", (after - before), ((f64) adds + (f64) deletes + (f64) tm->double_wheel.current_tick) / (after - before)); if (pool_elts (tm->test_elts)) fformat (stdout, "Note: %d elements remain in pool\n", pool_elts (tm->test_elts)); /* *INDENT-OFF* */ pool_foreach (e, tm->test_elts, ({ fformat (stdout, "[%d] expected to expire %d\n", e - tm->test_elts, e->expected_to_expire); })); /* *INDENT-ON* */ pool_free (tm->test_elts); tw_timer_wheel_free_16t_2w_512sl (&tm->double_wheel); return 0; } static u32 get_expiration_time (tw_timer_test_main_t * tm) { u32 expiration_time; do { expiration_time = random_u64 (&tm->seed) & ((1 << 17) - 1); } while (expiration_time == 0); return expiration_time; } static clib_error_t * test2_double_updates (tw_timer_test_main_t * tm) { u32 i, j; tw_timer_test_elt_t *e; u32 initial_wheel_offset; u32 expiration_time; u32 max_expiration_time = 0, updates = 0; f64 before, after; clib_time_init (&tm->clib_time); tw_timer_wheel_init_16t_2w_512sl (&tm->double_wheel, expired_timer_double_callback, 1.0 /* timer interval */ , ~0); /* Prime offset */ initial_wheel_offset = 7577; run_double_wheel (&tm->double_wheel, initial_wheel_offset); fformat (stdout, "initial wheel time %d, fast index %d slow index %d\n", tm->double_wheel.current_tick, tm->double_wheel.current_index[TW_TIMER_RING_FAST], tm->double_wheel.current_index[TW_TIMER_RING_SLOW]); initial_wheel_offset = tm->double_wheel.current_tick; fformat (stdout, "test %d timers, %d iter, %d ticks per iter, 0x%llx seed\n", tm->ntimers, tm->niter, tm->ticks_per_iter, tm->seed); before = clib_time_now (&tm->clib_time); /* Prime the pump */ for (i = 0; i < tm->ntimers; i++) { pool_get (tm->test_elts, e); clib_memset (e, 0, sizeof (*e)); expiration_time = get_expiration_time (tm); max_expiration_time = clib_max (expiration_time, max_expiration_time); e->expected_to_expire = expiration_time + initial_wheel_offset; e->stop_timer_handle = tw_timer_start_16t_2w_512sl (&tm->double_wheel, e - tm->test_elts, 14 /* timer id */ , expiration_time); } for (i = 0; i < tm->niter; i++) { run_double_wheel (&tm->double_wheel, tm->ticks_per_iter); j = 0; /* *INDENT-OFF* */ pool_foreach (e, tm->test_elts, ({ expiration_time = get_expiration_time (tm); max_expiration_time = clib_max (expiration_time, max_expiration_time); e->expected_to_expire = expiration_time + tm->double_wheel.current_tick; tw_timer_update_16t_2w_512sl (&tm->double_wheel, e->stop_timer_handle, expiration_time); if (++j >= tm->ntimers / 4) goto done; })); /* *INDENT-ON* */ done: updates += j; } run_double_wheel (&tm->double_wheel, max_expiration_time + 1); after = clib_time_now (&tm->clib_time); fformat (stdout, "%d updates, %d ticks\n", updates, tm->double_wheel.current_tick); fformat (stdout, "test ran %.2f seconds, %.2f ops/second\n", (after - before), ((f64) updates + (f64) tm->double_wheel.current_tick) / (after - before)); if (pool_elts (tm->test_elts)) fformat (stdout, "Note: %d elements remain in pool\n", pool_elts (tm->test_elts)); /* *INDENT-OFF* */ pool_foreach (e, tm->test_elts, ({ fformat (stdout, "[%d] expected to expire %d\n", e - tm->test_elts, e->expected_to_expire); })); /* *INDENT-ON* */ pool_free (tm->test_elts); tw_timer_wheel_free_16t_2w_512sl (&tm->double_wheel); return 0; } static clib_error_t * test2_triple (tw_timer_test_main_t * tm) { u32 i, j; tw_timer_test_elt_t *e; u32 initial_wheel_offset = 0; u32 expiration_time; u32 max_expiration_time = 0; u32 *deleted_indices = 0; u32 adds = 0, deletes = 0; f64 before, after; clib_time_init (&tm->clib_time); tw_timer_wheel_init_4t_3w_256sl (&tm->triple_wheel, expired_timer_triple_callback, 1.0 /* timer interval */ , ~0); /* Prime offset */ initial_wheel_offset = 75700; run_triple_wheel (&tm->triple_wheel, initial_wheel_offset); fformat (stdout, "initial wheel time %d, fi %d si %d gi %d\n", tm->triple_wheel.current_tick, tm->triple_wheel.current_index[TW_TIMER_RING_FAST], tm->triple_wheel.current_index[TW_TIMER_RING_SLOW], tm->triple_wheel.current_index[TW_TIMER_RING_GLACIER]); initial_wheel_offset = tm->triple_wheel.current_tick; fformat (stdout, "test %d timers, %d iter, %d ticks per iter, 0x%llx seed\n", tm->ntimers, tm->niter, tm->ticks_per_iter, tm->seed); before = clib_time_now (&tm->clib_time); /* Prime the pump */ for (i = 0; i < tm->ntimers; i++) { pool_get (tm->test_elts, e); clib_memset (e, 0, sizeof (*e)); do { expiration_time = random_u64 (&tm->seed) & ((1 << 17) - 1); } while (expiration_time == 0); if (expiration_time > max_expiration_time) max_expiration_time = expiration_time; e->expected_to_expire = expiration_time + initial_wheel_offset; e->stop_timer_handle = tw_timer_start_4t_3w_256sl (&tm->triple_wheel, e - tm->test_elts, 3 /* timer id */ , expiration_time); } adds += i; for (i = 0; i < tm->niter; i++) { run_triple_wheel (&tm->triple_wheel, tm->ticks_per_iter); j = 0; vec_reset_length (deleted_indices); /* *INDENT-OFF* */ pool_foreach (e, tm->test_elts, ({ tw_timer_stop_4t_3w_256sl (&tm->triple_wheel, e->stop_timer_handle); vec_add1 (deleted_indices, e - tm->test_elts); if (++j >= tm->ntimers / 4) goto del_and_re_add; })); /* *INDENT-ON* */ del_and_re_add: for (j = 0; j < vec_len (deleted_indices); j++) pool_put_index (tm->test_elts, deleted_indices[j]); deletes += j; for (j = 0; j < tm->ntimers / 4; j++) { pool_get (tm->test_elts, e); clib_memset (e, 0, sizeof (*e)); do { expiration_time = random_u64 (&tm->seed) & ((1 << 17) - 1); } while (expiration_time == 0); if (expiration_time > max_expiration_time) max_expiration_time = expiration_time; e->expected_to_expire = expiration_time + tm->triple_wheel.current_tick; e->stop_timer_handle = tw_timer_start_4t_3w_256sl (&tm->triple_wheel, e - tm->test_elts, 3 /* timer id */ , expiration_time); } adds += j; } vec_free (deleted_indices); run_triple_wheel (&tm->triple_wheel, max_expiration_time + 1); after = clib_time_now (&tm->clib_time); fformat (stdout, "%d adds, %d deletes, %d ticks\n", adds, deletes, tm->triple_wheel.current_tick); fformat (stdout, "test ran %.2f seconds, %.2f ops/second\n", (after - before), ((f64) adds + (f64) deletes + (f64) tm->triple_wheel.current_tick) / (after - before)); if (pool_elts (tm->test_elts)) fformat (stdout, "Note: %d elements remain in pool\n", pool_elts (tm->test_elts)); /* *INDENT-OFF* */ pool_foreach (e, tm->test_elts, ({ fformat (stdout, "[%d] expected to expire %d\n", e - tm->test_elts, e->expected_to_expire); })); /* *INDENT-ON* */ pool_free (tm->test_elts); tw_timer_wheel_free_4t_3w_256sl (&tm->triple_wheel); return 0; } static clib_error_t * test2_triple_ov (tw_timer_test_main_t * tm) { u32 i, j; tw_timer_test_elt_t *e; u32 initial_wheel_offset = 0; u32 expiration_time; u32 max_expiration_time = 0; u32 *deleted_indices = 0; u32 adds = 0, deletes = 0; f64 before, after; clib_time_init (&tm->clib_time); tw_timer_wheel_init_1t_3w_1024sl_ov (&tm->triple_ov_wheel, expired_timer_triple_ov_callback, 1.0 /* timer interval */ , ~0); /* Prime offset */ initial_wheel_offset = 75700; run_triple_ov_wheel (&tm->triple_ov_wheel, initial_wheel_offset); fformat (stdout, "initial wheel time %d, fi %d si %d gi %d\n", tm->triple_ov_wheel.current_tick, tm->triple_ov_wheel.current_index[TW_TIMER_RING_FAST], tm->triple_ov_wheel.current_index[TW_TIMER_RING_SLOW], tm->triple_ov_wheel.current_index[TW_TIMER_RING_GLACIER]); initial_wheel_offset = tm->triple_ov_wheel.current_tick; fformat (stdout, "test %d timers, %d iter, %d ticks per iter, 0x%llx seed\n", tm->ntimers, tm->niter, tm->ticks_per_iter, tm->seed); before = clib_time_now (&tm->clib_time); /* Prime the pump */ for (i = 0; i < tm->ntimers; i++) { pool_get (tm->test_elts, e); clib_memset (e, 0, sizeof (*e)); do { expiration_time = random_u64 (&tm->seed) & ((1 << 17) - 1); } while (expiration_time == 0); if (expiration_time > max_expiration_time) max_expiration_time = expiration_time; e->expected_to_expire = expiration_time + initial_wheel_offset; e->stop_timer_handle = tw_timer_start_1t_3w_1024sl_ov (&tm->triple_ov_wheel, e - tm->test_elts, 0 /* timer id */ , expiration_time); } adds += i; for (i = 0; i < tm->niter; i++) { run_triple_ov_wheel (&tm->triple_ov_wheel, tm->ticks_per_iter); j = 0; vec_reset_length (deleted_indices); /* *INDENT-OFF* */ pool_foreach (e, tm->test_elts, ({ tw_timer_stop_1t_3w_1024sl_ov (&tm->triple_ov_wheel, e->stop_timer_handle); vec_add1 (deleted_indices, e - tm->test_elts); if (++j >= tm->ntimers / 4) goto del_and_re_add; })); /* *INDENT-ON* */ del_and_re_add: for (j = 0; j < vec_len (deleted_indices); j++) pool_put_index (tm->test_elts, deleted_indices[j]); deletes += j; for (j = 0; j < tm->ntimers / 4; j++) { pool_get (tm->test_elts, e); clib_memset (e, 0, sizeof (*e)); do { expiration_time = random_u64 (&tm->seed) & ((1 << 17) - 1); } while (expiration_time == 0); if (expiration_time > max_expiration_time) max_expiration_time = expiration_time; e->expected_to_expire = expiration_time + tm->triple_ov_wheel.current_tick; e->stop_timer_handle = tw_timer_start_1t_3w_1024sl_ov (&tm->triple_ov_wheel, e - tm->test_elts, 0 /* timer id */ , expiration_time); } adds += j; } vec_free (deleted_indices); run_triple_ov_wheel (&tm->triple_ov_wheel, max_expiration_time + 1); after = clib_time_now (&tm->clib_time); fformat (stdout, "%d adds, %d deletes, %d ticks\n", adds, deletes, tm->triple_ov_wheel.current_tick); fformat (stdout, "test ran %.2f seconds, %.2f ops/second\n", (after - before), ((f64) adds + (f64) deletes + (f64) tm->triple_ov_wheel.current_tick) / (after - before)); if (pool_elts (tm->test_elts)) fformat (stdout, "Note: %d elements remain in pool\n", pool_elts (tm->test_elts)); /* *INDENT-OFF* */ pool_foreach (e, tm->test_elts, ({ TWT (tw_timer) * t; fformat (stdout, "[%d] expected to expire %d\n", e - tm->test_elts, e->expected_to_expire); t = pool_elt_at_index (tm->triple_ov_wheel.timers, e->stop_timer_handle); fformat (stdout, " expiration_time %lld\n", t->expiration_time); })); /* *INDENT-ON* */ pool_free (tm->test_elts); tw_timer_wheel_free_1t_3w_1024sl_ov (&tm->triple_ov_wheel); return 0; } static clib_error_t * test1_single (tw_timer_test_main_t * tm) { u32 i; tw_timer_test_elt_t *e; u32 offset; tw_timer_wheel_init_2t_1w_2048sl (&tm->single_wheel, expired_timer_single_callback, 1.0 /* timer interval */ , ~0); /* * Prime offset, to make sure that the wheel starts in a * non-trivial position */ offset = 123; run_single_wheel (&tm->single_wheel, offset); fformat (stdout, "initial wheel time %d, fast index %d\n", tm->single_wheel.current_tick, tm->single_wheel.current_index[TW_TIMER_RING_FAST]); offset = tm->single_wheel.current_tick; for (i = 0; i < tm->ntimers; i++) { u32 expected_to_expire; u32 timer_arg; timer_arg = 1 + i; timer_arg &= 2047; if (timer_arg == 0) timer_arg = 1; expected_to_expire = timer_arg + offset; pool_get (tm->test_elts, e); clib_memset (e, 0, sizeof (*e)); e->expected_to_expire = expected_to_expire; e->stop_timer_handle = tw_timer_start_2t_1w_2048sl (&tm->single_wheel, e - tm->test_elts, 1 /* timer id */ , timer_arg); } run_single_wheel (&tm->single_wheel, tm->ntimers + 3); if (pool_elts (tm->test_elts)) fformat (stdout, "Note: %d elements remain in pool\n", pool_elts (tm->test_elts)); /* *INDENT-OFF* */ pool_foreach (e, tm->test_elts, ({ fformat(stdout, "[%d] expected to expire %d\n", e - tm->test_elts, e->expected_to_expire); })); /* *INDENT-ON* */ fformat (stdout, "final wheel time %d, fast index %d\n", tm->single_wheel.current_tick, tm->single_wheel.current_index[TW_TIMER_RING_FAST]); pool_free (tm->test_elts); tw_timer_wheel_free_2t_1w_2048sl (&tm->single_wheel); return 0; } static clib_error_t * test1_double (tw_timer_test_main_t * tm) { u32 i; tw_timer_test_elt_t *e; u32 offset; tw_timer_wheel_init_16t_2w_512sl (&tm->double_wheel, expired_timer_double_callback, 1.0 /* timer interval */ , ~0); /* * Prime offset, to make sure that the wheel starts in a * non-trivial position */ offset = 227989; run_double_wheel (&tm->double_wheel, offset); fformat (stdout, "initial wheel time %d, fast index %d\n", tm->double_wheel.current_tick, tm->double_wheel.current_index[TW_TIMER_RING_FAST]); for (i = 0; i < tm->ntimers; i++) { pool_get (tm->test_elts, e); clib_memset (e, 0, sizeof (*e)); e->expected_to_expire = i + offset + 1; e->stop_timer_handle = tw_timer_start_16t_2w_512sl (&tm->double_wheel, e - tm->test_elts, 14 /* timer id */ , i + 1); } run_double_wheel (&tm->double_wheel, tm->ntimers + 3); if (pool_elts (tm->test_elts)) fformat (stdout, "Note: %d elements remain in pool\n", pool_elts (tm->test_elts)); /* *INDENT-OFF* */ pool_foreach (e, tm->test_elts, ({ fformat(stdout, "[%d] expected to expire %d\n", e - tm->test_elts, e->expected_to_expire); })); /* *INDENT-ON* */ fformat (stdout, "final wheel time %d, fast index %d\n", tm->double_wheel.current_tick, tm->double_wheel.current_index[TW_TIMER_RING_FAST]); pool_free (tm->test_elts); tw_timer_wheel_free_16t_2w_512sl (&tm->double_wheel); return 0; } static clib_error_t * test3_triple_double (tw_timer_test_main_t * tm) { tw_timer_test_elt_t *e; u32 initial_wheel_offset = 0; u32 expiration_time; u32 max_expiration_time = 0; u32 adds = 0, deletes = 0; f64 before, after; clib_time_init (&tm->clib_time); tw_timer_wheel_init_4t_3w_256sl (&tm->triple_wheel, expired_timer_triple_callback, 1.0 /* timer interval */ , ~0); initial_wheel_offset = 0; run_triple_wheel (&tm->triple_wheel, initial_wheel_offset); fformat (stdout, "initial wheel time %d, fi %d si %d gi %d\n", tm->triple_wheel.current_tick, tm->triple_wheel.current_index[TW_TIMER_RING_FAST], tm->triple_wheel.current_index[TW_TIMER_RING_SLOW], tm->triple_wheel.current_index[TW_TIMER_RING_GLACIER]); initial_wheel_offset = tm->triple_wheel.current_tick; fformat (stdout, "Create a timer which expires at wheel-time (1, 0, 0)\n"); before = clib_time_now (&tm->clib_time); /* Prime the pump */ pool_get (tm->test_elts, e); clib_memset (e, 0, sizeof (*e)); /* 1 glacier ring tick from now */ expiration_time = TW_SLOTS_PER_RING * TW_SLOTS_PER_RING; e->expected_to_expire = expiration_time + initial_wheel_offset; max_expiration_time = expiration_time; e->stop_timer_handle = tw_timer_start_4t_3w_256sl (&tm->triple_wheel, e - tm->test_elts, 3 /* timer id */ , expiration_time); run_triple_wheel (&tm->triple_wheel, max_expiration_time + 1); after = clib_time_now (&tm->clib_time); fformat (stdout, "%d adds, %d deletes, %d ticks\n", adds, deletes, tm->triple_wheel.current_tick); fformat (stdout, "test ran %.2f seconds, %.2f ops/second\n", (after - before), ((f64) adds + (f64) deletes + (f64) tm->triple_wheel.current_tick) / (after - before)); if (pool_elts (tm->test_elts)) fformat (stdout, "Note: %d elements remain in pool\n", pool_elts (tm->test_elts)); /* *INDENT-OFF* */ pool_foreach (e, tm->test_elts, ({ fformat (stdout, "[%d] expected to expire %d\n", e - tm->test_elts, e->expected_to_expire); })); /* *INDENT-ON* */ pool_free (tm->test_elts); tw_timer_wheel_free_4t_3w_256sl (&tm->triple_wheel); return 0; } static clib_error_t * test4_double_double (tw_timer_test_main_t * tm) { u32 i; tw_timer_test_elt_t *e; u32 initial_wheel_offset; u32 expiration_time; u32 max_expiration_time = 0; u32 *deleted_indices = 0; u32 adds = 0, deletes = 0; f64 before, after; clib_time_init (&tm->clib_time); tw_timer_wheel_init_16t_2w_512sl (&tm->double_wheel, expired_timer_double_callback, 1.0 /* timer interval */ , ~0); /* Prime offset */ initial_wheel_offset = 0; run_double_wheel (&tm->double_wheel, initial_wheel_offset); fformat (stdout, "initial wheel time %d, fast index %d slow index %d\n", tm->double_wheel.current_tick, tm->double_wheel.current_index[TW_TIMER_RING_FAST], tm->double_wheel.current_index[TW_TIMER_RING_SLOW]); initial_wheel_offset = tm->double_wheel.current_tick; fformat (stdout, "test timer which expires at 512 ticks\n"); before = clib_time_now (&tm->clib_time); /* Prime the pump */ for (i = 0; i < tm->ntimers; i++) { pool_get (tm->test_elts, e); clib_memset (e, 0, sizeof (*e)); expiration_time = 512; if (expiration_time > max_expiration_time) max_expiration_time = expiration_time; e->expected_to_expire = expiration_time + initial_wheel_offset; e->stop_timer_handle = tw_timer_start_16t_2w_512sl (&tm->double_wheel, e - tm->test_elts, 14 /* timer id */ , expiration_time); } adds = 1; vec_free (deleted_indices); run_double_wheel (&tm->double_wheel, max_expiration_time + 1); after = clib_time_now (&tm->clib_time); fformat (stdout, "%d adds, %d deletes, %d ticks\n", adds, deletes, tm->double_wheel.current_tick); fformat (stdout, "test ran %.2f seconds, %.2f ops/second\n", (after - before), ((f64) adds + (f64) deletes + (f64) tm->double_wheel.current_tick) / (after - before)); if (pool_elts (tm->test_elts)) fformat (stdout, "Note: %d elements remain in pool\n", pool_elts (tm->test_elts)); /* *INDENT-OFF* */ pool_foreach (e, tm->test_elts, ({ fformat (stdout, "[%d] expected to expire %d\n", e - tm->test_elts, e->expected_to_expire); })); /* *INDENT-ON* */ pool_free (tm->test_elts); tw_timer_wheel_free_16t_2w_512sl (&tm->double_wheel); return 0; } static clib_error_t * test5_double (tw_timer_test_main_t * tm) { u32 i; tw_timer_test_elt_t *e; u32 initial_wheel_offset; u32 expiration_time; u32 max_expiration_time = 0; u32 adds = 0, deletes = 0; f64 before, after; clib_time_init (&tm->clib_time); tw_timer_wheel_init_16t_2w_512sl (&tm->double_wheel, expired_timer_double_callback, 1.0 /* timer interval */ , ~0); /* Prime offset */ initial_wheel_offset = 7567; run_double_wheel (&tm->double_wheel, initial_wheel_offset); fformat (stdout, "initial wheel time %d, fast index %d slow index %d\n", tm->double_wheel.current_tick, tm->double_wheel.current_index[TW_TIMER_RING_FAST], tm->double_wheel.current_index[TW_TIMER_RING_SLOW]); initial_wheel_offset = tm->double_wheel.current_tick; fformat (stdout, "test %d timers, %d iter, %d ticks per iter, 0x%llx seed\n", tm->ntimers, tm->niter, tm->ticks_per_iter, tm->seed); before = clib_time_now (&tm->clib_time); /* Prime the pump */ for (i = 0; i < tm->ntimers; i++) { pool_get (tm->test_elts, e); clib_memset (e, 0, sizeof (*e)); expiration_time = i + 1; if (expiration_time > max_expiration_time) max_expiration_time = expiration_time; e->expected_to_expire = expiration_time + initial_wheel_offset; e->stop_timer_handle = tw_timer_start_16t_2w_512sl (&tm->double_wheel, e - tm->test_elts, 14 /* timer id */ , expiration_time); } adds += i; run_double_wheel (&tm->double_wheel, max_expiration_time + 1); after = clib_time_now (&tm->clib_time); fformat (stdout, "%d adds, %d deletes, %d ticks\n", adds, deletes, tm->double_wheel.current_tick); fformat (stdout, "test ran %.2f seconds, %.2f ops/second\n", (after - before), ((f64) adds + (f64) deletes + (f64) tm->double_wheel.current_tick) / (after - before)); if (pool_elts (tm->test_elts)) fformat (stdout, "Note: %d elements remain in pool\n", pool_elts (tm->test_elts)); /* *INDENT-OFF* */ pool_foreach (e, tm->test_elts, ({ fformat (stdout, "[%d] expected to expire %d\n", e - tm->test_elts, e->expected_to_expire); })); /* *INDENT-ON* */ pool_free (tm->test_elts); tw_timer_wheel_free_16t_2w_512sl (&tm->double_wheel); return 0; } static clib_error_t * timer_test_command_fn (tw_timer_test_main_t * tm, unformat_input_t * input) { int is_test1 = 0, is_updates = 0; int num_wheels = 1; int is_test2 = 0; int is_test3 = 0; int is_test4 = 0; int is_test5 = 0; int overflow = 0; clib_memset (tm, 0, sizeof (*tm)); /* Default values */ tm->ntimers = 100000; tm->seed = 0xDEADDABEB00BFACE; tm->niter = 1000; tm->ticks_per_iter = 727; while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT) { if (unformat (input, "seed %lld", &tm->seed)) ; else if (unformat (input, "test1")) is_test1 = 1; else if (unformat (input, "test2")) is_test2 = 1; else if (unformat (input, "overflow")) overflow = 1; else if (unformat (input, "lebron")) is_test3 = 1; else if (unformat (input, "wilt")) is_test4 = 1; else if (unformat (input, "linear")) is_test5 = 1; else if (unformat (input, "updates")) is_updates = 1; else if (unformat (input, "wheels %d", &num_wheels)) ; else if (unformat (input, "ntimers %d", &tm->ntimers)) ; else if (unformat (input, "niter %d", &tm->niter)) ; else if (unformat (input, "ticks_per_iter %d", &tm->ticks_per_iter)) ; else break; } if (is_test1 + is_test2 + is_test3 + is_test4 + is_test5 == 0) return clib_error_return (0, "No test specified [test1..n]"); if (num_wheels < 1 || num_wheels > 3) return clib_error_return (0, "unsupported... 1 or 2 wheels only"); if (is_test1) { if (num_wheels == 1) return test1_single (tm); else return test1_double (tm); } if (is_test2) { if (num_wheels == 1) return test2_single (tm); else if (num_wheels == 2) if (is_updates) return test2_double_updates (tm); else return test2_double (tm); else if (num_wheels == 3) { if (overflow == 0) return test2_triple (tm); else return test2_triple_ov (tm); } } if (is_test3) return test3_triple_double (tm); if (is_test4) return test4_double_double (tm); if (is_test5) return test5_double (tm); /* NOTREACHED */ return 0; } #ifdef CLIB_UNIX int main (int argc, char *argv[]) { unformat_input_t i; clib_error_t *error; tw_timer_test_main_t *tm = &tw_timer_test_main; clib_mem_init (0, 3ULL << 30); unformat_init_command_line (&i, argv); error = timer_test_command_fn (tm, &i); unformat_free (&i); if (error) { clib_error_report (error); return 1; } return 0; } #endif /* CLIB_UNIX */ /* For debugging... */ int pifi (void *p, u32 index) { return pool_is_free_index (p, index); } u32 vl (void *p) { return vec_len (p); } uword pe (void *v) { return (pool_elts (v)); } /* * fd.io coding-style-patch-verification: ON * * Local Variables: * eval: (c-set-style "gnu") * End: */