forked from intel/cloudwpa-rwpa_dp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
uplink_macros.h
804 lines (632 loc) · 39.9 KB
/
uplink_macros.h
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
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
/*
* BSD LICENSE
*
* Copyright(c) 2007-2017 Intel Corporation. All rights reserved.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Intel Corporation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* version: RWPA_VNF.L.18.02.0-42
*/
#ifndef __INCLUDE_UPLINK_MACROS_H__
#define __INCLUDE_UPLINK_MACROS_H__
/*
* HELPER MACROS
* - should not be called from outside this file
*/
////////////////////////////////////////////////////////////////////////////////
#if !defined RWPA_STATS_CAPTURE_STA_LOOKUP_OFF && defined RWPA_STATS_CAPTURE
#define _STORE_STA_BULK_LOOKUP_STATS(n, f) \
({ \
uint8_t matched = 0; \
for (unsigned int i = 0; i < n; i++) { \
if (f[i] >= 0) \
matched++; \
} \
\
struct stats_sta_lookup *stats = \
stats_capture_sta_lookup_get_mem_info(STATS_STA_LOOKUP_TYPE_UL); \
\
if (likely(stats != NULL)) { \
stats->matched += matched; \
stats->unmatched += n - matched; \
stats->num_pkts += n; \
stats->last_burst[ \
stats->last_burst_index++ % \
STA_LOOKUP_BURST_LEN] = n; \
stats->call_num += 1; \
} \
})
#else // !defined RWPA_STATS_CAPTURE_STA_LOOKUP_OFF && defined RWPA_STATS_CAPTURE
#define _STORE_STA_BULK_LOOKUP_STATS(n, f) \
do {} while(0)
#endif // !defined RWPA_STATS_CAPTURE_STA_LOOKUP_OFF && defined RWPA_STATS_CAPTURE
////////////////////////////////////////////////////////////////////////////////
#if !defined RWPA_STATS_CAPTURE_CRYPTO_OFF && defined RWPA_STATS_CAPTURE
#define _CCMP_BURST_ENQUEUE_STATS(l, e) \
({ \
struct stats_crypto *stats = \
stats_capture_crypto_get_mem_info(STATS_CRYPTO_TYPE_UL); \
\
if (likely(stats != NULL)) { \
stats->driver_id = crypto_driver_id_get(); \
stats->call_num += 1; \
stats->total_packets_enqueued += e; \
stats->total_enqueue_calls += 1; \
if (unlikely(enq < l)) \
stats->total_enqueue_errors += (l - e); \
} \
})
#define _CCMP_BURST_DEQUEUE_CALL_STATS \
({ \
struct stats_crypto *stats = \
stats_capture_crypto_get_mem_info(STATS_CRYPTO_TYPE_UL); \
\
if (likely(stats != NULL)) { \
stats->call_num += 1; \
stats->total_dequeue_calls += 1; \
} \
})
#else // !defined RWPA_STATS_CAPTURE_CRYPTO_OFF && defined RWPA_STATS_CAPTURE
#define _CCMP_BURST_ENQUEUE_STATS(l, e) \
do {} while(0)
#define _CCMP_BURST_DEQUEUE_CALL_STATS \
do {} while(0)
#endif // !defined RWPA_STATS_CAPTURE_CRYPTO_OFF && defined RWPA_STATS_CAPTURE
////////////////////////////////////////////////////////////////////////////////
#if !defined RWPA_STATS_CAPTURE_PORTS_OFF && !defined RWPA_STATS_CAPTURE_UPLINK_OFF
#define _UL_PMD_RX_CYCLE_CAPTURE_START \
CYCLE_CAPTURE_START(CYCLE_CAPTURE_UL_PMD_RX)
#define _UL_PMD_RX_CYCLE_CAPTURE_STOP \
CYCLE_CAPTURE_STOP(CYCLE_CAPTURE_UL_PMD_RX)
#define _UL_PMD_RX_CYCLE_CAPTURE_COPY_LAST \
CYCLE_CAPTURE_COPY_LAST(CYCLE_CAPTURE_UL_PMD_RX_EXCL_EMPTIES, \
CYCLE_CAPTURE_UL_PMD_RX)
#else // !defined RWPA_STATS_CAPTURE_PORTS_OFF && !defined RWPA_STATS_CAPTURE_UPLINK_OFF
#define _UL_PMD_RX_CYCLE_CAPTURE_START
#define _UL_PMD_RX_CYCLE_CAPTURE_STOP
#define _UL_PMD_RX_CYCLE_CAPTURE_COPY_LAST
#endif // !defined RWPA_STATS_CAPTURE_PORTS_OFF && !defined RWPA_STATS_CAPTURE_UPLINK_OFF
////////////////////////////////////////////////////////////////////////////////
#if !defined RWPA_STATS_CAPTURE_STA_LOOKUP_OFF && \
!defined RWPA_STATS_CAPTURE_UPLINK_OFF && \
defined RWPA_CYCLE_CAPTURE && \
RWPA_CYCLE_CAPTURE == CYCLE_CAPTURE_LEVEL_HIGH
#define _UL_STA_LOOKUP_CYCLE_CAPTURE_START \
CYCLE_CAPTURE_START(CYCLE_CAPTURE_UL_STA_LOOKUP)
#define _UL_STA_LOOKUP_CYCLE_CAPTURE_STOP \
CYCLE_CAPTURE_STOP(CYCLE_CAPTURE_UL_STA_LOOKUP)
#else // !defined RWPA_STATS_CAPTURE_STA_LOOKUP_OFF &&
// !defined RWPA_STATS_CAPTURE_UPLINK_OFF &&
// defined RWPA_CYCLE_CAPTURE &&
// RWPA_CYCLE_CAPTURE == CYCLE_CAPTURE_LEVEL_HIGH
#define _UL_STA_LOOKUP_CYCLE_CAPTURE_START
#define _UL_STA_LOOKUP_CYCLE_CAPTURE_STOP
#endif // !defined RWPA_STATS_CAPTURE_STA_LOOKUP_OFF &&
// !defined RWPA_STATS_CAPTURE_UPLINK_OFF &&
// defined RWPA_CYCLE_CAPTURE &&
// RWPA_CYCLE_CAPTURE == CYCLE_CAPTURE_LEVEL_HIGH
////////////////////////////////////////////////////////////////////////////////
#if !defined RWPA_STATS_CAPTURE_CRYPTO_OFF && \
!defined RWPA_STATS_CAPTURE_UPLINK_OFF && \
defined RWPA_CYCLE_CAPTURE && \
RWPA_CYCLE_CAPTURE == CYCLE_CAPTURE_LEVEL_HIGH
#define _UL_CRYPTO_ENQUEUE_CYCLE_CAPTURE_START \
CYCLE_CAPTURE_START(CYCLE_CAPTURE_UL_CRYPTO_ENQUEUE)
#define _UL_CRYPTO_ENQUEUE_CYCLE_CAPTURE_STOP \
CYCLE_CAPTURE_STOP(CYCLE_CAPTURE_UL_CRYPTO_ENQUEUE)
#define _UL_CRYPTO_DEQUEUE_CYCLE_CAPTURE_START \
CYCLE_CAPTURE_START(CYCLE_CAPTURE_UL_CRYPTO_DEQUEUE)
#define _UL_CRYPTO_DEQUEUE_CYCLE_CAPTURE_STOP \
CYCLE_CAPTURE_STOP(CYCLE_CAPTURE_UL_CRYPTO_DEQUEUE)
#else // !defined RWPA_STATS_CAPTURE_CRYPTO_OFF &&
// !defined RWPA_STATS_CAPTURE_UPLINK_OFF &&
// defined RWPA_CYCLE_CAPTURE &&
// RWPA_CYCLE_CAPTURE == CYCLE_CAPTURE_LEVEL_HIGH
#define _UL_CRYPTO_ENQUEUE_CYCLE_CAPTURE_START
#define _UL_CRYPTO_ENQUEUE_CYCLE_CAPTURE_STOP
#define _UL_CRYPTO_DEQUEUE_CYCLE_CAPTURE_START
#define _UL_CRYPTO_DEQUEUE_CYCLE_CAPTURE_STOP
#endif // !defined RWPA_STATS_CAPTURE_CRYPTO_OFF &&
// !defined RWPA_STATS_CAPTURE_UPLINK_OFF &&
// defined RWPA_CYCLE_CAPTURE &&
// RWPA_CYCLE_CAPTURE == CYCLE_CAPTURE_LEVEL_HIGH
////////////////////////////////////////////////////////////////////////////////
#if !defined RWPA_STATS_CAPTURE_UPLINK_OFF && \
defined RWPA_CYCLE_CAPTURE && \
RWPA_CYCLE_CAPTURE == CYCLE_CAPTURE_LEVEL_HIGH
#define _UL_INITIAL_PKT_CLASSIFY_CYCLE_CAPTURE_START \
CYCLE_CAPTURE_START(CYCLE_CAPTURE_UL_INITIAL_PKT_CLASSIFY)
#define _UL_INITIAL_PKT_CLASSIFY_CYCLE_CAPTURE_STOP \
CYCLE_CAPTURE_STOP(CYCLE_CAPTURE_UL_INITIAL_PKT_CLASSIFY)
#define _UL_AP_TUNNEL_DECAP_CYCLE_CAPTURE_START \
CYCLE_CAPTURE_START(CYCLE_CAPTURE_UL_AP_TUNNEL_DECAP)
#define _UL_AP_TUNNEL_DECAP_CYCLE_CAPTURE_STOP \
CYCLE_CAPTURE_STOP(CYCLE_CAPTURE_UL_AP_TUNNEL_DECAP)
#define _UL_VAP_HDR_PARSE_CYCLE_CAPTURE_START \
CYCLE_CAPTURE_START(CYCLE_CAPTURE_UL_VAP_HDR_PARSE)
#define _UL_VAP_HDR_PARSE_CYCLE_CAPTURE_STOP \
CYCLE_CAPTURE_STOP(CYCLE_CAPTURE_UL_VAP_HDR_PARSE)
#define _UL_VAP_HDR_DECAP_CYCLE_CAPTURE_START \
CYCLE_CAPTURE_START(CYCLE_CAPTURE_UL_VAP_HDR_DECAP)
#define _UL_VAP_HDR_DECAP_CYCLE_CAPTURE_STOP \
CYCLE_CAPTURE_STOP(CYCLE_CAPTURE_UL_VAP_HDR_DECAP)
#define _UL_VAP_TLV_DECAP_CYCLE_CAPTURE_START \
CYCLE_CAPTURE_START(CYCLE_CAPTURE_UL_VAP_TLV_DECAP)
#define _UL_VAP_TLV_DECAP_CYCLE_CAPTURE_STOP \
CYCLE_CAPTURE_STOP(CYCLE_CAPTURE_UL_VAP_TLV_DECAP)
#define _UL_IEEE80211_PKT_PARSE_CYCLE_CAPTURE_START \
CYCLE_CAPTURE_START(CYCLE_CAPTURE_UL_IEEE80211_PKT_PARSE)
#define _UL_IEEE80211_PKT_PARSE_CYCLE_CAPTURE_STOP \
CYCLE_CAPTURE_STOP(CYCLE_CAPTURE_UL_IEEE80211_PKT_PARSE)
#define _UL_STA_LOCK_CYCLE_CAPTURE_START \
CYCLE_CAPTURE_START(CYCLE_CAPTURE_UL_STA_LOCK)
#define _UL_STA_LOCK_CYCLE_CAPTURE_STOP \
CYCLE_CAPTURE_STOP(CYCLE_CAPTURE_UL_STA_LOCK)
#define _UL_STA_DECRYPT_DATA_GET_CYCLE_CAPTURE_START \
CYCLE_CAPTURE_START(CYCLE_CAPTURE_UL_STA_DECRYPT_DATA_GET)
#define _UL_STA_DECRYPT_DATA_GET_CYCLE_CAPTURE_STOP \
CYCLE_CAPTURE_STOP(CYCLE_CAPTURE_UL_STA_DECRYPT_DATA_GET)
#define _UL_CCMP_REPLAY_DETECT_CYCLE_CAPTURE_START \
CYCLE_CAPTURE_START(CYCLE_CAPTURE_UL_CCMP_REPLAY_DETECT)
#define _UL_CCMP_REPLAY_DETECT_CYCLE_CAPTURE_STOP \
CYCLE_CAPTURE_STOP(CYCLE_CAPTURE_UL_CCMP_REPLAY_DETECT)
#define _UL_STA_DECRYPT_DATA_UPDATE_CYCLE_CAPTURE_START \
CYCLE_CAPTURE_START(CYCLE_CAPTURE_UL_STA_DECRYPT_DATA_UPDATE)
#define _UL_STA_DECRYPT_DATA_UPDATE_CYCLE_CAPTURE_STOP \
CYCLE_CAPTURE_STOP(CYCLE_CAPTURE_UL_STA_DECRYPT_DATA_UPDATE)
#define _UL_STA_UNLOCK_CYCLE_CAPTURE_START \
CYCLE_CAPTURE_START(CYCLE_CAPTURE_UL_STA_UNLOCK)
#define _UL_STA_UNLOCK_CYCLE_CAPTURE_STOP \
CYCLE_CAPTURE_STOP(CYCLE_CAPTURE_UL_STA_UNLOCK)
#define _UL_IEEE80211_PKT_CLASSIFY_CYCLE_CAPTURE_START \
CYCLE_CAPTURE_START(CYCLE_CAPTURE_UL_IEEE80211_PKT_CLASSIFY)
#define _UL_IEEE80211_PKT_CLASSIFY_CYCLE_CAPTURE_STOP \
CYCLE_CAPTURE_STOP(CYCLE_CAPTURE_UL_IEEE80211_PKT_CLASSIFY)
#define _UL_IEEE80211_TO_ETHER_CONV_CYCLE_CAPTURE_START \
CYCLE_CAPTURE_START(CYCLE_CAPTURE_UL_IEEE80211_TO_ETHER_CONV);
#define _UL_IEEE80211_TO_ETHER_CONV_CYCLE_CAPTURE_STOP \
CYCLE_CAPTURE_STOP(CYCLE_CAPTURE_UL_IEEE80211_TO_ETHER_CONV);
#define _UL_GRE_ENCAP_CYCLE_CAPTURE_START \
CYCLE_CAPTURE_START(CYCLE_CAPTURE_UL_GRE_ENCAP);
#define _UL_GRE_ENCAP_CYCLE_CAPTURE_STOP \
CYCLE_CAPTURE_STOP(CYCLE_CAPTURE_UL_GRE_ENCAP);
#define _UL_CCMP_DECAP_CYCLE_CAPTURE_START \
CYCLE_CAPTURE_START(CYCLE_CAPTURE_UL_CCMP_DECAP);
#define _UL_CCMP_DECAP_CYCLE_CAPTURE_STOP \
CYCLE_CAPTURE_STOP(CYCLE_CAPTURE_UL_CCMP_DECAP);
#define _UL_WPAPT_CDI_FRAME_ENCAP_CYCLE_CAPTURE_START \
CYCLE_CAPTURE_START(CYCLE_CAPTURE_UL_WPAPT_CDI_FRAME_ENCAP);
#define _UL_WPAPT_CDI_FRAME_ENCAP_CYCLE_CAPTURE_STOP \
CYCLE_CAPTURE_STOP(CYCLE_CAPTURE_UL_WPAPT_CDI_FRAME_ENCAP);
#define _UL_WPAPT_CDI_HDR_ENCAP_CYCLE_CAPTURE_START \
CYCLE_CAPTURE_START(CYCLE_CAPTURE_UL_WPAPT_CDI_HDR_ENCAP);
#define _UL_WPAPT_CDI_HDR_ENCAP_CYCLE_CAPTURE_STOP \
CYCLE_CAPTURE_STOP(CYCLE_CAPTURE_UL_WPAPT_CDI_HDR_ENCAP);
#define _UL_TLS_TX_CYCLE_CAPTURE_START \
CYCLE_CAPTURE_START(CYCLE_CAPTURE_UL_TLS_TX);
#define _UL_TLS_TX_CYCLE_CAPTURE_STOP \
CYCLE_CAPTURE_STOP(CYCLE_CAPTURE_UL_TLS_TX);
#else // !defined RWPA_STATS_CAPTURE_UPLINK_OFF &&
// defined RWPA_CYCLE_CAPTURE &&
// RWPA_CYCLE_CAPTURE == CYCLE_CAPTURE_LEVEL_HIGH
#define _UL_INITIAL_PKT_CLASSIFY_CYCLE_CAPTURE_START
#define _UL_INITIAL_PKT_CLASSIFY_CYCLE_CAPTURE_STOP
#define _UL_AP_TUNNEL_DECAP_CYCLE_CAPTURE_START
#define _UL_AP_TUNNEL_DECAP_CYCLE_CAPTURE_STOP
#define _UL_VAP_HDR_PARSE_CYCLE_CAPTURE_START
#define _UL_VAP_HDR_PARSE_CYCLE_CAPTURE_STOP
#define _UL_VAP_HDR_DECAP_CYCLE_CAPTURE_START
#define _UL_VAP_HDR_DECAP_CYCLE_CAPTURE_STOP
#define _UL_VAP_TLV_DECAP_CYCLE_CAPTURE_START
#define _UL_VAP_TLV_DECAP_CYCLE_CAPTURE_STOP
#define _UL_IEEE80211_PKT_PARSE_CYCLE_CAPTURE_START
#define _UL_IEEE80211_PKT_PARSE_CYCLE_CAPTURE_STOP
#define _UL_STA_LOCK_CYCLE_CAPTURE_START
#define _UL_STA_LOCK_CYCLE_CAPTURE_STOP
#define _UL_STA_DECRYPT_DATA_GET_CYCLE_CAPTURE_START
#define _UL_STA_DECRYPT_DATA_GET_CYCLE_CAPTURE_STOP
#define _UL_CCMP_REPLAY_DETECT_CYCLE_CAPTURE_START
#define _UL_CCMP_REPLAY_DETECT_CYCLE_CAPTURE_STOP
#define _UL_STA_DECRYPT_DATA_UPDATE_CYCLE_CAPTURE_START
#define _UL_STA_DECRYPT_DATA_UPDATE_CYCLE_CAPTURE_STOP
#define _UL_STA_UNLOCK_CYCLE_CAPTURE_START
#define _UL_STA_UNLOCK_CYCLE_CAPTURE_STOP
#define _UL_IEEE80211_PKT_CLASSIFY_CYCLE_CAPTURE_START
#define _UL_IEEE80211_PKT_CLASSIFY_CYCLE_CAPTURE_STOP
#define _UL_IEEE80211_TO_ETHER_CONV_CYCLE_CAPTURE_START
#define _UL_IEEE80211_TO_ETHER_CONV_CYCLE_CAPTURE_STOP
#define _UL_GRE_ENCAP_CYCLE_CAPTURE_START
#define _UL_GRE_ENCAP_CYCLE_CAPTURE_STOP
#define _UL_CCMP_DECAP_CYCLE_CAPTURE_START
#define _UL_CCMP_DECAP_CYCLE_CAPTURE_STOP
#define _UL_WPAPT_CDI_FRAME_ENCAP_CYCLE_CAPTURE_START
#define _UL_WPAPT_CDI_FRAME_ENCAP_CYCLE_CAPTURE_STOP
#define _UL_WPAPT_CDI_HDR_ENCAP_CYCLE_CAPTURE_START
#define _UL_WPAPT_CDI_HDR_ENCAP_CYCLE_CAPTURE_STOP
#define _UL_TLS_TX_CYCLE_CAPTURE_START
#define _UL_TLS_TX_CYCLE_CAPTURE_STOP
#endif // !defined RWPA_STATS_CAPTURE_UPLINK_OFF &&
// defined RWPA_CYCLE_CAPTURE &&
// RWPA_CYCLE_CAPTURE == CYCLE_CAPTURE_LEVEL_HIGH
////////////////////////////////////////////////////////////////////////////////
#if !defined RWPA_STATS_CAPTURE_PORTS_OFF && \
!defined RWPA_STATS_CAPTURE_UPLINK_OFF && \
defined RWPA_CYCLE_CAPTURE && \
RWPA_CYCLE_CAPTURE == CYCLE_CAPTURE_LEVEL_HIGH
#define _UL_PMD_TX_CYCLE_CAPTURE_START \
CYCLE_CAPTURE_START(CYCLE_CAPTURE_UL_PMD_TX)
#define _UL_PMD_TX_CYCLE_CAPTURE_STOP \
CYCLE_CAPTURE_STOP(CYCLE_CAPTURE_UL_PMD_TX)
#else // !defined RWPA_STATS_CAPTURE_PORTS_OFF &&
// !defined RWPA_STATS_CAPTURE_UPLINK_OFF &&
// defined RWPA_CYCLE_CAPTURE &&
// RWPA_CYCLE_CAPTURE == CYCLE_CAPTURE_LEVEL_HIGH
#define _UL_PMD_TX_CYCLE_CAPTURE_START
#define _UL_PMD_TX_CYCLE_CAPTURE_STOP
#endif // !defined RWPA_STATS_CAPTURE_PORTS_OFF &&
// !defined RWPA_STATS_CAPTURE_UPLINK_OFF &&
// defined RWPA_CYCLE_CAPTURE &&
// RWPA_CYCLE_CAPTURE == CYCLE_CAPTURE_LEVEL_HIGH
////////////////////////////////////////////////////////////////////////////////
/*
* PUBLIC MACROS
*/
////////////////////////////////////////////////////////////////////////////////
#if !defined RWPA_STATS_CAPTURE_UPLINK_OFF && defined RWPA_STATS_CAPTURE
#define UL_DATA_DROP_STAT_INC(stat, amt) \
stats_capture_uplink_drops_inc(stat, (uint64_t)amt);
#define UL_DATA_PMD_READ_STAT_INC(stat, amt) \
stats_capture_uplink_pmd_reads_inc(stat, (uint64_t)amt);
#else
#define UL_DATA_DROP_STAT_INC(stat, amt)
#define UL_DATA_PMD_READ_STAT_INC(stat, amt)
#endif
////////////////////////////////////////////////////////////////////////////////
#if !defined RWPA_STATS_CAPTURE_CONTROL_OFF && defined RWPA_STATS_CAPTURE
#define UL_CTRL_DROP_STAT_INC(stat, amt) \
stats_capture_control_drops_inc(stat, (uint64_t)amt);
#else
#define UL_CTRL_DROP_STAT_INC(stat, amt)
#endif
////////////////////////////////////////////////////////////////////////////////
#define DATA_LOG_AND_DROP(p_mbuf, level, logtype, err_msg, stat) \
({ \
UL_DATA_DROP_STAT_INC(stat, 1); \
RWPA_LOG(level, logtype, err_msg); \
DROP(p_mbuf); \
})
#define CTRL_LOG_AND_DROP(p_mbuf, level, logtype, err_msg, stat) \
({ \
UL_CTRL_DROP_STAT_INC(stat, 1); \
RWPA_LOG(level, logtype, err_msg); \
DROP(p_mbuf); \
})
////////////////////////////////////////////////////////////////////////////////
#if !defined RWPA_STATS_CAPTURE_CRYPTO_OFF && defined RWPA_STATS_CAPTURE
#define CCMP_BURST_DEQUEUE_STATS(nb_to_deq, nb_deq_success) \
({ \
struct stats_crypto *stats = \
stats_capture_crypto_get_mem_info(STATS_CRYPTO_TYPE_UL); \
\
if (likely(stats != NULL)) { \
stats->total_packets_dequeued += nb_to_deq; \
if (unlikely(nb_deq_success < nb_to_deq)) \
stats->total_dequeue_errors += (nb_to_deq - nb_deq_success); \
} \
})
#else // !defined RWPA_STATS_CAPTURE_CRYPTO_OFF && defined RWPA_STATS_CAPTURE
#define CCMP_BURST_DEQUEUE_STATS(nb_to_deq, nb_deq_success) \
do {} while(0)
#endif // !defined RWPA_STATS_CAPTURE_CRYPTO_OFF && defined RWPA_STATS_CAPTURE
////////////////////////////////////////////////////////////////////////////////
#if !defined RWPA_STATS_CAPTURE_UPLINK_OFF && \
defined RWPA_CYCLE_CAPTURE && \
RWPA_CYCLE_CAPTURE == CYCLE_CAPTURE_LEVEL_HIGH
#define UL_VAP_PAYLOAD_REASSEMBLE_CYCLE_CAPTURE_START \
CYCLE_CAPTURE_START(CYCLE_CAPTURE_UL_VAP_PAYLOAD_REASSEMBLE)
#define UL_VAP_PAYLOAD_REASSEMBLE_CYCLE_CAPTURE_STOP \
CYCLE_CAPTURE_START(CYCLE_CAPTURE_UL_VAP_PAYLOAD_REASSEMBLE)
#else // !defined RWPA_STATS_CAPTURE_UPLINK_OFF &&
// defined RWPA_CYCLE_CAPTURE &&
// RWPA_CYCLE_CAPTURE == CYCLE_CAPTURE_LEVEL_HIGH
#define UL_VAP_PAYLOAD_REASSEMBLE_CYCLE_CAPTURE_START
#define UL_VAP_PAYLOAD_REASSEMBLE_CYCLE_CAPTURE_STOP
#endif // !defined RWPA_STATS_CAPTURE_UPLINK_OFF &&
// defined RWPA_CYCLE_CAPTURE &&
// RWPA_CYCLE_CAPTURE == CYCLE_CAPTURE_LEVEL_HIGH
#if !defined RWPA_STATS_CAPTURE_UPLINK_OFF && \
defined RWPA_CYCLE_CAPTURE && \
RWPA_CYCLE_CAPTURE == CYCLE_CAPTURE_LEVEL_LOW
#define UL_PROCESS_FULL_CYCLE_CAPTURE_START \
CYCLE_CAPTURE_START(CYCLE_CAPTURE_UL_PROCESS_FULL)
#define UL_PROCESS_FULL_CYCLE_CAPTURE_STOP \
CYCLE_CAPTURE_STOP(CYCLE_CAPTURE_UL_PROCESS_FULL)
#else // !defined RWPA_STATS_CAPTURE_UPLINK_OFF &&
// defined RWPA_CYCLE_CAPTURE &&
// RWPA_CYCLE_CAPTURE == CYCLE_CAPTURE_LEVEL_LOW
#define UL_PROCESS_FULL_CYCLE_CAPTURE_START
#define UL_PROCESS_FULL_CYCLE_CAPTURE_STOP
#endif // !defined RWPA_STATS_CAPTURE_UPLINK_OFF &&
// defined RWPA_CYCLE_CAPTURE &&
// RWPA_CYCLE_CAPTURE == CYCLE_CAPTURE_LEVEL_LOW
////////////////////////////////////////////////////////////////////////////////
#ifndef RWPA_CYCLE_CAPTURE
#define RTE_ETH_RX_BURST(p, q, r, n) rte_eth_rx_burst(p, q, r, n)
#define INITIAL_PACKET_CLASSIFY(m) initial_packet_classify(m)
#ifndef RWPA_AP_TUNNELLING_GRE
#define AP_TUNNEL_DECAP(m, meta) udp_decap(m, meta)
#else
#define AP_TUNNEL_DECAP(m, meta) gre_decap(m, meta)
#endif
#define VAP_HDR_PARSE(m, meta) vap_hdr_parse(m, meta)
#define VAP_HDR_DECAP(m) vap_hdr_decap(m)
#define VAP_TLV_DECAP(m) vap_tlv_decap(m)
#define IEEE80211_PACKET_PARSE(m, meta) ieee80211_packet_parse(m, meta)
#if !defined RWPA_STATS_CAPTURE_STA_LOOKUP_OFF && defined RWPA_STATS_CAPTURE
#define STORE_STA_BULK_LOOKUP(a, n, f) \
({ \
store_sta_bulk_lookup(a, n, f); \
_STORE_STA_BULK_LOOKUP_STATS(n, f); \
})
#else // !defined RWPA_STATS_CAPTURE_STA_LOOKUP_OFF && defined RWPA_STATS_CAPTURE
#define STORE_STA_BULK_LOOKUP(a, n, f) \
store_sta_bulk_lookup(a, n, f)
#endif // !defined RWPA_STATS_CAPTURE_STA_LOOKUP_OFF && defined RWPA_STATS_CAPTURE
#define STA_READ_LOCK(s) sta_read_lock(s)
#define STA_DECRYPT_DATA_GET(s, t, a, c, v) sta_decrypt_data_get(s, t, a, c, v)
#define CCMP_REPLAY_DETECT(h, c) ccmp_replay_detect(h, c)
#define STA_PTK_DECRYPT_COUNTER_SET(s, t, c) \
sta_ptk_decrypt_counter_set(s, t, c)
#if !defined RWPA_STATS_CAPTURE_CRYPTO_OFF && defined RWPA_STATS_CAPTURE
#define CCMP_BURST_ENQUEUE(b, l, m, o, q, s) \
({ \
uint16_t enq = ccmp_burst_enqueue(b, l, m, o, q, s); \
_CCMP_BURST_ENQUEUE_STATS(l, enq); \
enq; \
})
#define CCMP_BURST_DEQUEUE(b, l, q, n, s) \
({ \
uint16_t deq = ccmp_burst_dequeue(b, l, q, n, s); \
_CCMP_BURST_DEQUEUE_CALL_STATS; \
deq; \
})
#else // !defined RWPA_STATS_CAPTURE_CRYPTO_OFF && defined RWPA_STATS_CAPTURE
#define CCMP_BURST_ENQUEUE(b, l, m, o, q, s) \
ccmp_burst_enqueue(b, l, m, o, q, s)
#define CCMP_BURST_DEQUEUE(b, l, q, n, s) \
ccmp_burst_dequeue(b, l, q, n, s)
#endif // !defined RWPA_STATS_CAPTURE_CRYPTO_OFF && defined RWPA_STATS_CAPTURE
#define STA_READ_UNLOCK(s) sta_read_unlock(s)
#define IEEE80211_PACKET_CLASSIFY(m, meta) ieee80211_packet_classify(m, meta)
#define IEEE80211_TO_ETHER_CONVERT(m, meta) ieee80211_to_ether_convert(m, meta)
#define GRE_ENCAP(m, si, sm, di, dm) gre_encap(m, si, sm, di, dm, 0, 0)
#define RTE_ETH_TX_BUFFER(p, q, t, m) rte_eth_tx_buffer(p, q, t, m)
#define CCMP_DECAP(m, meta) ccmp_decap(m, meta)
#define WPAPT_CDI_FRAME_ENCAP(m, meta, l) wpapt_cdi_frame_encap(m, meta, l)
#define WPAPT_CDI_HDR_ENCAP(m, i, l) wpapt_cdi_hdr_encap(m, i, l)
#define TLS_SOCKET_WRITE(t, m) tls_socket_write(t, m)
#else // ifndef RWPA_CYCLE_CAPTURE
#define RTE_ETH_RX_BURST(p, q, r, n) \
({ \
_UL_PMD_RX_CYCLE_CAPTURE_START; \
unsigned len = rte_eth_rx_burst(p, q, r, n); \
_UL_PMD_RX_CYCLE_CAPTURE_STOP; \
if (len) { \
_UL_PMD_RX_CYCLE_CAPTURE_COPY_LAST; \
} \
len; \
})
#define INITIAL_PACKET_CLASSIFY(m) \
({ \
_UL_INITIAL_PKT_CLASSIFY_CYCLE_CAPTURE_START; \
enum outer_pkt_type type = initial_packet_classify(m); \
_UL_INITIAL_PKT_CLASSIFY_CYCLE_CAPTURE_STOP; \
type; \
})
#ifndef RWPA_AP_TUNNELLING_GRE
#define AP_TUNNEL_DECAP(m, meta) \
({ \
_UL_AP_TUNNEL_DECAP_CYCLE_CAPTURE_START; \
enum rwpa_status sts = udp_decap(m, meta); \
_UL_AP_TUNNEL_DECAP_CYCLE_CAPTURE_STOP; \
sts; \
})
#else
#define AP_TUNNEL_DECAP(m, meta) \
({ \
_UL_AP_TUNNEL_DECAP_CYCLE_CAPTURE_START; \
enum rwpa_status sts = gre_decap(m, meta); \
_UL_AP_TUNNEL_DECAP_CYCLE_CAPTURE_STOP; \
sts; \
})
#endif
#define VAP_HDR_PARSE(m, meta) \
({ \
_UL_VAP_HDR_PARSE_CYCLE_CAPTURE_START; \
enum rwpa_status sts = vap_hdr_parse(m, meta); \
_UL_VAP_HDR_PARSE_CYCLE_CAPTURE_STOP; \
sts; \
})
#define VAP_HDR_DECAP(m) \
({ \
_UL_VAP_HDR_DECAP_CYCLE_CAPTURE_START; \
enum rwpa_status sts = vap_hdr_decap(m); \
_UL_VAP_HDR_DECAP_CYCLE_CAPTURE_STOP; \
sts; \
})
#define VAP_TLV_DECAP(m) \
({ \
_UL_VAP_TLV_DECAP_CYCLE_CAPTURE_START; \
enum rwpa_status sts = vap_tlv_decap(m); \
_UL_VAP_TLV_DECAP_CYCLE_CAPTURE_STOP; \
sts; \
})
#define IEEE80211_PACKET_PARSE(m, meta) \
({ \
_UL_IEEE80211_PKT_PARSE_CYCLE_CAPTURE_START; \
ieee80211_packet_parse(m, meta); \
_UL_IEEE80211_PKT_PARSE_CYCLE_CAPTURE_STOP; \
})
#if !defined RWPA_STATS_CAPTURE_STA_LOOKUP_OFF && defined RWPA_STATS_CAPTURE
#define STORE_STA_BULK_LOOKUP(a, n, f) \
({ \
_UL_STA_LOOKUP_CYCLE_CAPTURE_START; \
store_sta_bulk_lookup(a, n, f); \
_UL_STA_LOOKUP_CYCLE_CAPTURE_STOP; \
_STORE_STA_BULK_LOOKUP_STATS(n, f); \
})
#else // !defined RWPA_STATS_CAPTURE_STA_LOOKUP_OFF && defined RWPA_STATS_CAPTURE
#define STORE_STA_BULK_LOOKUP(a, n, f) \
({ \
_UL_STA_LOOKUP_CYCLE_CAPTURE_START; \
store_sta_bulk_lookup(a, n, f); \
_UL_STA_LOOKUP_CYCLE_CAPTURE_STOP; \
})
#endif // !defined RWPA_STATS_CAPTURE_STA_LOOKUP_OFF && defined RWPA_STATS_CAPTURE
#define STA_READ_LOCK(s) \
({ \
_UL_STA_LOCK_CYCLE_CAPTURE_START; \
sta_read_lock(s); \
_UL_STA_LOCK_CYCLE_CAPTURE_STOP; \
})
#define STA_DECRYPT_DATA_GET(s, t, a, c, v) \
({ \
_UL_STA_DECRYPT_DATA_GET_CYCLE_CAPTURE_START; \
sta_decrypt_data_get(s, t, a, c, v); \
_UL_STA_DECRYPT_DATA_GET_CYCLE_CAPTURE_STOP; \
})
#define CCMP_REPLAY_DETECT(h, c) \
({ \
_UL_CCMP_REPLAY_DETECT_CYCLE_CAPTURE_START; \
enum rwpa_status sts = ccmp_replay_detect(h, c); \
_UL_CCMP_REPLAY_DETECT_CYCLE_CAPTURE_STOP; \
sts; \
})
#define STA_PTK_DECRYPT_COUNTER_SET(s, t, c) \
({ \
_UL_STA_DECRYPT_DATA_UPDATE_CYCLE_CAPTURE_START; \
sta_ptk_decrypt_counter_set(s, t, c); \
_UL_STA_DECRYPT_DATA_UPDATE_CYCLE_CAPTURE_STOP; \
})
#if !defined RWPA_STATS_CAPTURE_CRYPTO_OFF && defined RWPA_STATS_CAPTURE
#define CCMP_BURST_ENQUEUE(b, l, m, o, q, s) \
({ \
_UL_CRYPTO_ENQUEUE_CYCLE_CAPTURE_START; \
uint16_t enq = ccmp_burst_enqueue(b, l, m, o, q, s); \
_UL_CRYPTO_ENQUEUE_CYCLE_CAPTURE_STOP; \
_CCMP_BURST_ENQUEUE_STATS(l, enq); \
enq; \
})
#define CCMP_BURST_DEQUEUE(b, l, q, n, s) \
({ \
_UL_CRYPTO_DEQUEUE_CYCLE_CAPTURE_START; \
uint16_t deq = ccmp_burst_dequeue(b, l, q, n, s); \
_UL_CRYPTO_DEQUEUE_CYCLE_CAPTURE_STOP; \
_CCMP_BURST_DEQUEUE_CALL_STATS; \
deq; \
})
#else // !defined RWPA_STATS_CAPTURE_CRYPTO_OFF && defined RWPA_STATS_CAPTURE
#define CCMP_BURST_ENQUEUE(b, l, m, o, q, s) \
({ \
_UL_CRYPTO_ENQUEUE_CYCLE_CAPTURE_START; \
uint16_t enq = ccmp_burst_enqueue(b, l, m, o, q, s); \
_UL_CRYPTO_ENQUEUE_CYCLE_CAPTURE_STOP; \
enq; \
})
#define CCMP_BURST_DEQUEUE(b, l, q, n, s) \
({ \
_UL_CRYPTO_DEQUEUE_CYCLE_CAPTURE_START; \
uint16_t deq = ccmp_burst_dequeue(b, l, q, n, s); \
_UL_CRYPTO_DEQUEUE_CYCLE_CAPTURE_STOP; \
deq; \
})
#endif // !defined RWPA_STATS_CAPTURE_CRYPTO_OFF && defined RWPA_STATS_CAPTURE
#define STA_READ_UNLOCK(s) \
({ \
_UL_STA_UNLOCK_CYCLE_CAPTURE_START; \
sta_read_unlock(s); \
_UL_STA_UNLOCK_CYCLE_CAPTURE_STOP; \
})
#define IEEE80211_PACKET_CLASSIFY(m, meta) \
({ \
_UL_IEEE80211_PKT_CLASSIFY_CYCLE_CAPTURE_START; \
enum ieee80211_pkt_type pkt_type = \
ieee80211_packet_classify(m, meta); \
_UL_IEEE80211_PKT_CLASSIFY_CYCLE_CAPTURE_STOP; \
pkt_type; \
})
#define IEEE80211_TO_ETHER_CONVERT(m, meta) \
({ \
_UL_IEEE80211_TO_ETHER_CONV_CYCLE_CAPTURE_START; \
enum rwpa_status sts = ieee80211_to_ether_convert(m, meta); \
_UL_IEEE80211_TO_ETHER_CONV_CYCLE_CAPTURE_STOP; \
sts; \
})
#define GRE_ENCAP(m, si, sm, di, dm) \
({ \
_UL_GRE_ENCAP_CYCLE_CAPTURE_START; \
enum rwpa_status sts = gre_encap(m, si, sm, di, dm, 0, 0); \
_UL_GRE_ENCAP_CYCLE_CAPTURE_STOP; \
sts; \
})
#define RTE_ETH_TX_BUFFER(p, q, t, m) \
({ \
_UL_PMD_TX_CYCLE_CAPTURE_START; \
rte_eth_tx_buffer(p, q, t, m); \
_UL_PMD_TX_CYCLE_CAPTURE_STOP; \
})
#define CCMP_DECAP(m, meta) \
({ \
_UL_CCMP_DECAP_CYCLE_CAPTURE_START; \
enum rwpa_status sts = ccmp_decap(m, meta); \
_UL_CCMP_DECAP_CYCLE_CAPTURE_STOP; \
sts; \
})
#define WPAPT_CDI_FRAME_ENCAP(m, meta, l) \
({ \
_UL_WPAPT_CDI_FRAME_ENCAP_CYCLE_CAPTURE_START; \
enum rwpa_status sts = wpapt_cdi_frame_encap(m, meta, l); \
_UL_WPAPT_CDI_FRAME_ENCAP_CYCLE_CAPTURE_STOP; \
sts; \
})
#define WPAPT_CDI_HDR_ENCAP(m, i, l) \
({ \
_UL_WPAPT_CDI_HDR_ENCAP_CYCLE_CAPTURE_START; \
enum rwpa_status sts = wpapt_cdi_hdr_encap(m, i, l); \
_UL_WPAPT_CDI_HDR_ENCAP_CYCLE_CAPTURE_STOP; \
sts; \
})
#define TLS_SOCKET_WRITE(t, m) \
({ \
_UL_TLS_TX_CYCLE_CAPTURE_START; \
tls_socket_write(t, m); \
_UL_TLS_TX_CYCLE_CAPTURE_STOP; \
})
#endif // ifndef RWPA_CYCLE_CAPTURE
////////////////////////////////////////////////////////////////////////////////
#endif // __INCLUDE_UPLINK_MACROS_H__