Repository navigation
Expand file tree
/
Copy pathws_main.py
More file actions
3262 lines (2696 loc) · 114 KB
/
Copy pathws_main.py
File metadata and controls
3262 lines (2696 loc) · 114 KB
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
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/usr/bin/env python
# encoding: utf-8
#
# Hanoh Haim
# Cisco Systems, Inc.
VERSION='0.0.1'
APPNAME='cxx_test'
import os
import shutil
import copy
import re
import uuid
import subprocess
import platform
from waflib import Logs
from waflib.Configure import conf
from waflib import Build
import sys
import compile_bird
from distutils.version import StrictVersion
# use hostname as part of cache filename
Build.CACHE_SUFFIX = '_%s_cache.py' % platform.node()
# these variables are mandatory ('/' are converted automatically)
top = '../'
out = 'build_dpdk'
march = os.uname()[4]
b_path ="./build/linux_dpdk/"
8BD0
so_path = '../scripts/so/' + march
bird_path = '../scripts/bird'
C_VER_FILE = "version.c"
H_VER_FILE = "version.h"
H_DPDK_CONFIG = "dpdk_config.h"
BUILD_NUM_FILE = "../VERSION"
USERS_ALLOWED_TO_RELEASE = ['hhaim']
clang_flags = ['-Wno-null-conversion',
'-Wno-sign-compare',
'-Wno-strict-aliasing',
'-Wno-address-of-packed-member',
'-Wno-inconsistent-missing-override',
'-Wno-deprecated',
'-Wno-unused-private-field',
'-Wno-unused-value',
'-Wno-expansion-to-defined',
'-Wno-pointer-sign',
'-Wno-macro-redefined']
gcc_flags = ['-Wall',
'-Werror',
'-Wno-literal-suffix',
'-Wno-sign-compare',
'-Wno-strict-aliasing',
'-mrtm',
'-Wno-address-of-packed-member']
REQUIRED_CC_VERSION = "4.7.0"
SANITIZE_CC_VERSION = "4.9.0"
GCC6_DIRS = ['/usr/local/gcc-6.2/bin', '/opt/rh/devtoolset-6/root/usr/bin']
GCC7_DIRS = ['/usr/local/gcc-7.4/bin', '/opt/rh/devtoolset-7/root/usr/bin']
GCC8_DIRS = ['/usr/local/gcc-8.3/bin', '/opt/rh/devtoolset-8/root/usr/bin']
MAX_PKG_SIZE = 290 # MB
#######################################
# utility for group source code
###################################
orig_system = os.system
def verify_system(cmd):
ret = orig_system(cmd)
if ret:
raise Exception('Return code %s on command: system("%s")' % (ret, cmd))
os.system = verify_system
class SrcGroup:
' group of source by directory '
def __init__(self,dir,src_list):
self.dir = dir
self.src_list = src_list
self.group_list = None
assert (type(src_list)==list)
assert (type(dir)==str)
def file_list (self,top):
' return the long list of the files '
res=''
for file in self.src_list:
res= res + top+'/'+self.dir+'/'+file+' '
return res
def __str__ (self):
return (self.file_list(''))
def __repr__ (self):
return (self.file_list(''))
class SrcGroups:
' group of source groups '
def __init__(self,list_group):
self.list_group = list_group
assert (type(list_group)==list)
def file_list (self,top):
' return the long list of the files '
res=''
for o in self.list_group:
res += o.file_list(top)
return res
def __str__ (self):
return (self.file_list(''))
def __repr__ (self):
return (self.file_list(''))
def options(opt):
opt.load('compiler_cxx')
opt.load('compiler_c')
opt.add_option('--pkg-dir', '--pkg_dir', dest='pkg_dir', default=False, action='store', help="Destination folder for 'pkg' option.")
opt.add_option('--pkg-file', '--pkg_file', dest='pkg_file', default=False, action='store', help="Destination filename for 'pkg' option.")
opt.add_option('--publish-commit', '--publish_commit', dest='publish_commit', default=False, action='store', help="Specify commit id for 'publish_both' option (Please make sure it's good!)")
opt.add_option('--no-bnxt', dest='no_bnxt', default=False, action='store_true', help="don't use bnxt dpdk driver. use with ./b configure --no-bnxt. no need to run build with it")
opt.add_option('--no-mlx', dest='no_mlx', default=(True if march == 'aarch64' else False), action='store', help="don't use mlx4/mlx5 dpdk driver. use with ./b configure --no-mlx. no need to run build with it")
opt.add_option('--with-mana', dest='with_mana', default=False, action='store_true', help="Use Mana dpdk driver. Use with ./b configure --with-mana.")
opt.add_option('--with-ntacc', dest='with_ntacc', default=False, action='store_true', help="Use Napatech dpdk driver. Use with ./b configure --with-ntacc.")
opt.add_option('--with-bird', default=False, action='store_true', help="Build Bird server. Use with ./b configure --with-bird.")
opt.add_option('--new-memory', default=False, action='store_true', help="Build by new DPDK memory subsystem.")
opt.add_option('--with-archive', default=False, action='store_true', help="Build with lib archive")
opt.add_option('--no-ver', action = 'store_true', help = "Don't update version file.")
opt.add_option('--no-old', action = 'store_true', help = "Don't build old targets.")
opt.add_option('--private', dest='private', action = 'store_true', help = "private publish, do not replace latest/be_latest image with this image")
opt.add_option('--tap', dest='tap', default=False, action = 'store_true', help = "Add tap dpdk driver for Azure use-cases")
opt.add_option('--no-ofed-check', dest='no_ofed_check', default=False, action = 'store_true', help = "Skip ofed check in case of Azure")
co = opt.option_groups['configure options']
co.add_option('--sanitized', dest='sanitized', default=False, action='store_true',
help='for GCC {0}+ use address sanitizer to catch memory errors'.format(SANITIZE_CC_VERSION))
co.add_option('--gcc6', dest='gcc6', default=False, action='store_true',
help='use GCC 6.2 instead of the machine version')
co.add_option('--gcc7', dest='gcc7', default=False, action='store_true',
help='use GCC 7.4 instead of the machine version')
co.add_option('--gcc8', dest='gcc8', default=False, action='store_true',
help='use GCC 8.3 instead of the machine version')
def check_ibverbs_deps(bld):
if 'LDD' not in bld.env or not len(bld.env['LDD']):
bld.fatal('Please run configure. Missing key LDD.')
cmd = '%s %s/external_libs/ibverbs/%s/libibverbs.so' % (bld.env['LDD'][0], top, march)
ret, out = getstatusoutput(cmd)
if ret or not out:
bld.fatal("Command of checking libraries '%s' failed.\nReturn status: %s\nOutput: %s" % (cmd, ret, out))
if '=> not found' in out:
Logs.pprint('YELLOW', 'Could not find dependency libraries of libibverbs.so:')
for line in out.splitlines():
if '=> not found' in line:
Logs.pprint('YELLOW', line)
dumy_libs_path = os.path.abspath(top + 'scripts/dumy_libs')
Logs.pprint('YELLOW', 'Adding rpath of %s' % dumy_libs_path)
rpath_linkage.append(dumy_libs_path)
def missing_pkg_msg(fedora, ubuntu):
msg = 'not found\n'
fedora_install = 'Fedora/CentOS install:\nsudo yum install %s\n' % fedora
ubuntu_install = 'Ubuntu install:\nsudo apt install %s\n' % ubuntu
unknown_install = 'Could not determine Linux distribution.\n%s\n%s' % (fedora_install, ubuntu_install)
try:
dist = platform.linux_distribution(full_distribution_name=False)[0].capitalize()
except:
return msg + unknown_install
if dist == 'Ubuntu':
msg += ubuntu_install
elif dist in ('Fedora', 'Centos'):
msg += fedora_install
else:
msg += unknown_install
return msg
@conf
def configure_dummy_mlx5 (ctx):
ctx.start_msg('Configuring dummy MLX5 autoconf')
autoconf_file = 'src/dpdk/drivers/common/mlx5/mlx5_autoconf.h'
autoconf_path = os.path.join(top, autoconf_file)
os.system('rm -rf %s' % autoconf_path)
# a copy with some modification of the generated autoconf_file of the function configure_mlx5
dummy_file_data = '''
#ifndef HAVE_IBV_MLX5_MOD_SWP
#define HAVE_IBV_MLX5_MOD_SWP 1
#endif /* HAVE_IBV_MLX5_MOD_SWP */
/* HAVE_IBV_DEVICE_COUNTERS_SET_V42 is not defined. */
#ifndef HAVE_IBV_DEVICE_COUNTERS_SET_V45
#define HAVE_IBV_DEVICE_COUNTERS_SET_V45 1
#endif /* HAVE_IBV_DEVICE_COUNTERS_SET_V45 */
#ifndef HAVE_MLX5DV_DEVX_UAR_OFFSET
#define HAVE_MLX5DV_DEVX_UAR_OFFSET 1
#endif /* HAVE_MLX5DV_DEVX_UAR_OFFSET */
#ifndef HAVE_IBV_RELAXED_ORDERING
#define HAVE_IBV_RELAXED_ORDERING 1
#endif /* HAVE_IBV_RELAXED_ORDERING */
#ifndef HAVE_IBV_DEVICE_STRIDING_RQ_SUPPORT
#define HAVE_IBV_DEVICE_STRIDING_RQ_SUPPORT 1
#endif /* HAVE_IBV_DEVICE_STRIDING_RQ_SUPPORT */
#ifndef HAVE_IBV_DEVICE_TUNNEL_SUPPORT
#define HAVE_IBV_DEVICE_TUNNEL_SUPPORT 1
#endif /* HAVE_IBV_DEVICE_TUNNEL_SUPPORT */
#ifndef HAVE_IBV_MLX5_MOD_MPW
#define HAVE_IBV_MLX5_MOD_MPW 1
#endif /* HAVE_IBV_MLX5_MOD_MPW */
#ifndef HAVE_IBV_MLX5_MOD_CQE_128B_COMP
#define HAVE_IBV_MLX5_MOD_CQE_128B_COMP 1
#endif /* HAVE_IBV_MLX5_MOD_CQE_128B_COMP */
#ifndef HAVE_IBV_MLX5_MOD_CQE_128B_PAD
#define HAVE_IBV_MLX5_MOD_CQE_128B_PAD 1
#endif /* HAVE_IBV_MLX5_MOD_CQE_128B_PAD */
#ifndef HAVE_IBV_FLOW_DV_SUPPORT
#define HAVE_IBV_FLOW_DV_SUPPORT 1
#endif /* HAVE_IBV_FLOW_DV_SUPPORT */
#ifndef HAVE_IBV_DEVICE_MPLS_SUPPORT
#define HAVE_IBV_DEVICE_MPLS_SUPPORT 1
#endif /* HAVE_IBV_DEVICE_MPLS_SUPPORT */
#ifndef HAVE_IBV_WQ_FLAGS_PCI_WRITE_END_PADDING
#define HAVE_IBV_WQ_FLAGS_PCI_WRITE_END_PADDING 1
#endif /* HAVE_IBV_WQ_FLAGS_PCI_WRITE_END_PADDING */
/* HAVE_IBV_WQ_FLAG_RX_END_PADDING is not defined. */
/* HAVE_MLX5DV_DR_DEVX_PORT is not defined. */
#ifndef HAVE_IBV_DEVX_OBJ
#define HAVE_IBV_DEVX_OBJ 1
#endif /* HAVE_IBV_DEVX_OBJ */
#ifndef HAVE_IBV_FLOW_DEVX_COUNTERS
#define HAVE_IBV_FLOW_DEVX_COUNTERS 1
#endif /* HAVE_IBV_FLOW_DEVX_COUNTERS */
#ifndef HAVE_MLX5_DR_CREATE_ACTION_DEFAULT_MISS
#define HAVE_MLX5_DR_CREATE_ACTION_DEFAULT_MISS 1
#endif /* HAVE_MLX5_DR_CREATE_ACTION_DEFAULT_MISS */
#ifndef HAVE_IBV_DEVX_ASYNC
#define HAVE_IBV_DEVX_ASYNC 1
#endif /* HAVE_IBV_DEVX_ASYNC */
#ifndef HAVE_IBV_DEVX_QP
#define HAVE_IBV_DEVX_QP 1
#endif /* HAVE_IBV_DEVX_QP */
#ifndef HAVE_MLX5DV_PP_ALLOC
#define HAVE_MLX5DV_PP_ALLOC 1
#endif /* HAVE_MLX5DV_PP_ALLOC */
#ifndef HAVE_MLX5DV_DR_ACTION_DEST_DEVX_TIR
#define HAVE_MLX5DV_DR_ACTION_DEST_DEVX_TIR 1
#endif /* HAVE_MLX5DV_DR_ACTION_DEST_DEVX_TIR */
#ifndef HAVE_IBV_DEVX_EVENT
#define HAVE_IBV_DEVX_EVENT 1
#endif /* HAVE_IBV_DEVX_EVENT */
#ifndef HAVE_MLX5_DR_CREATE_ACTION_FLOW_METER
#define HAVE_MLX5_DR_CREATE_ACTION_FLOW_METER 1
#endif /* HAVE_MLX5_DR_CREATE_ACTION_FLOW_METER */
#ifndef HAVE_MLX5DV_MMAP_GET_NC_PAGES_CMD
#define HAVE_MLX5DV_MMAP_GET_NC_PAGES_CMD 1
#endif /* HAVE_MLX5DV_MMAP_GET_NC_PAGES_CMD */
#ifndef HAVE_MLX5DV_DR
#define HAVE_MLX5DV_DR 1
#endif /* HAVE_MLX5DV_DR */
#ifndef HAVE_MLX5DV_DR_ESWITCH
#define HAVE_MLX5DV_DR_ESWITCH 1
#endif /* HAVE_MLX5DV_DR_ESWITCH */
#ifndef HAVE_MLX5DV_DR_VLAN
#define HAVE_MLX5DV_DR_VLAN 1
#endif /* HAVE_MLX5DV_DR_VLAN */
#ifndef HAVE_IBV_VAR
#define HAVE_IBV_VAR 1
#endif /* HAVE_IBV_VAR */
/* HAVE_MLX5_OPCODE_ENHANCED_MPSW is not defined. */
/* HAVE_MLX5_OPCODE_SEND_EN is not defined. */
/* HAVE_MLX5_OPCODE_WAIT is not defined. */
/* HAVE_MLX5_OPCODE_ACCESS_ASO is not defined. */
#ifndef HAVE_SUPPORTED_40000baseKR4_Full
#define HAVE_SUPPORTED_40000baseKR4_Full 1
#endif /* HAVE_SUPPORTED_40000baseKR4_Full */
#ifndef HAVE_SUPPORTED_40000baseCR4_Full
#define HAVE_SUPPORTED_40000baseCR4_Full 1
#endif /* HAVE_SUPPORTED_40000baseCR4_Full */
#ifndef HAVE_SUPPORTED_40000baseSR4_Full
#define HAVE_SUPPORTED_40000baseSR4_Full 1
#endif /* HAVE_SUPPORTED_40000baseSR4_Full */
#ifndef HAVE_SUPPORTED_40000baseLR4_Full
#define HAVE_SUPPORTED_40000baseLR4_Full 1
#endif /* HAVE_SUPPORTED_40000baseLR4_Full */
#ifndef HAVE_SUPPORTED_56000baseKR4_Full
#define HAVE_SUPPORTED_56000baseKR4_Full 1
#endif /* HAVE_SUPPORTED_56000baseKR4_Full */
#ifndef HAVE_SUPPORTED_56000baseCR4_Full
#define HAVE_SUPPORTED_56000baseCR4_Full 1
#endif /* HAVE_SUPPORTED_56000baseCR4_Full */
#ifndef HAVE_SUPPORTED_56000baseSR4_Full
#define HAVE_SUPPORTED_56000baseSR4_Full 1
#endif /* HAVE_SUPPORTED_56000baseSR4_Full */
#ifndef HAVE_SUPPORTED_56000baseLR4_Full
#define HAVE_SUPPORTED_56000baseLR4_Full 1
#endif /* HAVE_SUPPORTED_56000baseLR4_Full */
#ifndef HAVE_ETHTOOL_LINK_MODE_25G
#define HAVE_ETHTOOL_LINK_MODE_25G 1
#endif /* HAVE_ETHTOOL_LINK_MODE_25G */
#ifndef HAVE_ETHTOOL_LINK_MODE_50G
#define HAVE_ETHTOOL_LINK_MODE_50G 1
#endif /* HAVE_ETHTOOL_LINK_MODE_50G */
#ifndef HAVE_ETHTOOL_LINK_MODE_100G
#define HAVE_ETHTOOL_LINK_MODE_100G 1
#endif /* HAVE_ETHTOOL_LINK_MODE_100G */
#ifndef HAVE_IFLA_NUM_VF
#define HAVE_IFLA_NUM_VF 1
#endif /* HAVE_IFLA_NUM_VF */
#ifndef HAVE_IFLA_EXT_MASK
#define HAVE_IFLA_EXT_MASK 1
#endif /* HAVE_IFLA_EXT_MASK */
#ifndef HAVE_IFLA_PHYS_SWITCH_ID
#define HAVE_IFLA_PHYS_SWITCH_ID 1
#endif /* HAVE_IFLA_PHYS_SWITCH_ID */
#ifndef HAVE_IFLA_PHYS_PORT_NAME
#define HAVE_IFLA_PHYS_PORT_NAME 1
#endif /* HAVE_IFLA_PHYS_PORT_NAME */
#ifndef HAVE_RDMA_NL_NLDEV
#define HAVE_RDMA_NL_NLDEV 1
#endif /* HAVE_RDMA_NL_NLDEV */
#ifndef HAVE_RDMA_NLDEV_CMD_GET
#define HAVE_RDMA_NLDEV_CMD_GET 1
#endif /* HAVE_RDMA_NLDEV_CMD_GET */
#ifndef HAVE_RDMA_NLDEV_CMD_PORT_GET
#define HAVE_RDMA_NLDEV_CMD_PORT_GET 1
#endif /* HAVE_RDMA_NLDEV_CMD_PORT_GET */
#ifndef HAVE_RDMA_NLDEV_ATTR_DEV_INDEX
#define HAVE_RDMA_NLDEV_ATTR_DEV_INDEX 1
#endif /* HAVE_RDMA_NLDEV_ATTR_DEV_INDEX */
#ifndef HAVE_RDMA_NLDEV_ATTR_DEV_NAME
#define HAVE_RDMA_NLDEV_ATTR_DEV_NAME 1
#endif /* HAVE_RDMA_NLDEV_ATTR_DEV_NAME */
#ifndef HAVE_RDMA_NLDEV_ATTR_PORT_INDEX
#define HAVE_RDMA_NLDEV_ATTR_PORT_INDEX 1
#endif /* HAVE_RDMA_NLDEV_ATTR_PORT_INDEX */
#ifndef HAVE_RDMA_NLDEV_ATTR_NDEV_INDEX
#define HAVE_RDMA_NLDEV_ATTR_NDEV_INDEX 1
#endif /* HAVE_RDMA_NLDEV_ATTR_NDEV_INDEX */
#ifndef HAVE_MLX5_DR_FLOW_DUMP
#define HAVE_MLX5_DR_FLOW_DUMP 1
#endif /* HAVE_MLX5_DR_FLOW_DUMP */
#ifndef HAVE_DEVLINK
#define HAVE_DEVLINK 1
#endif /* HAVE_DEVLINK */
#ifndef HAVE_DEVLINK_DUMMY
#define HAVE_DEVLINK_DUMMY 1
#endif /* HAVE_DEVLINK_DUMMY */
#ifndef HAVE_MLX5_DR_CREATE_ACTION_ASO
#define HAVE_MLX5_DR_CREATE_ACTION_ASO 1
#endif /* HAVE_MLX5_DR_CREATE_ACTION_ASO */
#ifndef HAVE_INFINIBAND_VERBS_H
#define HAVE_INFINIBAND_VERBS_H 1
#endif /* HAVE_INFINIBAND_VERBS_H */
#ifndef HAVE_MLX5_DR_CREATE_ACTION_DEST_ARRAY
#define HAVE_MLX5_DR_CREATE_ACTION_DEST_ARRAY 1
#endif /* HAVE_MLX5_DR_CREATE_ACTION_DEST_ARRAY */
#ifndef HAVE_MLX5DV_DR_MEM_RECLAIM
#define HAVE_MLX5DV_DR_MEM_RECLAIM 1
#endif /* HAVE_MLX5DV_DR_MEM_RECLAIM */
#ifndef HAVE_MLX5_DR_CREATE_ACTION_FLOW_SAMPLE
#define HAVE_MLX5_DR_CREATE_ACTION_FLOW_SAMPLE 1
#endif /* HAVE_MLX5_DR_CREATE_ACTION_FLOW_SAMPLE */
#define ETHTOOL_LINK_MODE_25000baseCR_Full_BIT 31
#define ETHTOOL_LINK_MODE_25000baseKR_Full_BIT 32
#define ETHTOOL_LINK_MODE_25000baseSR_Full_BIT 33
#define ETHTOOL_LINK_MODE_50000baseCR2_Full_BIT 34
#define ETHTOOL_LINK_MODE_50000baseKR2_Full_BIT 35
#define ETHTOOL_LINK_MODE_100000baseKR4_Full_BIT 36
#define ETHTOOL_LINK_MODE_100000baseSR4_Full_BIT 37
#define ETHTOOL_LINK_MODE_100000baseCR4_Full_BIT 38
#define ETHTOOL_LINK_MODE_100000baseLR4_ER4_Full_BIT 39
'''
f = open(autoconf_path, "w")
f.write(dummy_file_data)
f.close()
ctx.end_msg('done', 'GREEN')
@conf
def configure_tap (ctx):
ctx.start_msg('Configuring tap autoconf')
autoconf_file = 'src/dpdk/drivers/net/tap/tap_autoconf.h'
autoconf_path = os.path.join(top, autoconf_file)
os.system('rm -rf %s' % autoconf_path)
has_sym_args = [
[ 'HAVE_TC_FLOWER', 'linux/pkt_cls.h',
'enum', 'TCA_FLOWER_UNSPEC' ],
[ 'HAVE_TC_VLAN_ID', 'linux/pkt_cls.h',
'enum', 'TCA_FLOWER_KEY_VLAN_PRIO' ],
[ 'HAVE_TC_BPF', 'linux/pkt_cls.h',
'enum', 'TCA_BPF_UNSPEC' ],
[ 'HAVE_TC_BPF_FD', 'linux/pkt_cls.h',
'enum','TCA_BPF_FD' ],
[ 'HAVE_TC_ACT_BPF', 'linux/tc_act/tc_bpf.h',
'enum','TCA_ACT_BPF_UNSPEC' ],
[ 'HAVE_TC_ACT_BPF_FD', 'linux/tc_act/tc_bpf.h',
'enum','TCA_ACT_BPF_FD' ],
]
autoconf_script = 'src/dpdk/auto-config-h.sh'
autoconf_command = os.path.join(top, autoconf_script)
for arg in has_sym_args:
result, output = getstatusoutput("%s %s '%s' '%s' '%s' '%s' > /dev/null" %
(autoconf_command, autoconf_path, arg[0], arg[1], arg[2], arg[3]))
if result != 0:
ctx.end_msg('failed\n%s\n' % output, 'YELLOW')
break
if result == 0:
ctx.end_msg('done', 'GREEN')
@conf
def configure_mlx5 (ctx):
ctx.start_msg('Configuring MLX5 autoconf')
autoconf_file = 'src/dpdk/drivers/common/mlx5/mlx5_autoconf.h'
autoconf_path = os.path.join(top, autoconf_file)
os.system('rm -rf %s' % autoconf_path)
# input array for meson symbol search:
# [ "MACRO to define if found", "header for the search",
# "symbol type to search" "symbol name to search" ]
has_sym_args = [
[ 'HAVE_IBV_MLX5_MOD_SWP', 'infiniband/mlx5dv.h',
'type', 'struct mlx5dv_sw_parsing_caps' ],
[ 'HAVE_IBV_DEVICE_COUNTERS_SET_V42', 'infiniband/verbs.h',
'type', 'struct ibv_counter_set_init_attr' ],
[ 'HAVE_IBV_DEVICE_COUNTERS_SET_V45', 'infiniband/verbs.h',
'type', 'struct ibv_counters_init_attr' ],
[ 'HAVE_MLX5DV_DEVX_UAR_OFFSET', 'infiniband/mlx5dv.h',
'field', 'struct mlx5dv_devx_uar.mmap_off'],
[ 'HAVE_IBV_RELAXED_ORDERING', 'infiniband/verbs.h',
'enum','IBV_ACCESS_RELAXED_ORDERING '],
[ 'HAVE_IBV_DEVICE_STRIDING_RQ_SUPPORT', 'infiniband/mlx5dv.h',
'enum', 'MLX5DV_CQE_RES_FORMAT_CSUM_STRIDX' ],
[ 'HAVE_IBV_DEVICE_TUNNEL_SUPPORT', 'infiniband/mlx5dv.h',
'enum', 'MLX5DV_CONTEXT_MASK_TUNNEL_OFFLOADS' ],
[ 'HAVE_IBV_MLX5_MOD_MPW', 'infiniband/mlx5dv.h',
'enum', 'MLX5DV_CONTEXT_FLAGS_MPW_ALLOWED' ],
[ 'HAVE_IBV_MLX5_MOD_CQE_128B_COMP', 'infiniband/mlx5dv.h',
'enum', 'MLX5DV_CONTEXT_FLAGS_CQE_128B_COMP' ],
[ 'HAVE_IBV_MLX5_MOD_CQE_128B_PAD', 'infiniband/mlx5dv.h',
'enum', 'MLX5DV_CQ_INIT_ATTR_FLAGS_CQE_PAD' ],
[ 'HAVE_IBV_FLOW_DV_SUPPORT', 'infiniband/mlx5dv.h',
'func', 'mlx5dv_create_flow_action_packet_reformat' ],
[ 'HAVE_IBV_DEVICE_MPLS_SUPPORT', 'infiniband/verbs.h',
'enum', 'IBV_FLOW_SPEC_MPLS' ],
[ 'HAVE_IBV_WQ_FLAGS_PCI_WRITE_END_PADDING', 'infiniband/verbs.h',
'enum', 'IBV_WQ_FLAGS_PCI_WRITE_END_PADDING' ],
[ 'HAVE_IBV_WQ_FLAG_RX_END_PADDING', 'infiniband/verbs.h',
'enum', 'IBV_WQ_FLAG_RX_END_PADDING' ],
[ 'HAVE_MLX5DV_DR_DEVX_PORT', 'infiniband/mlx5dv.h',
'func', 'mlx5dv_query_devx_port' ],
[ 'HAVE_IBV_DEVX_OBJ', 'infiniband/mlx5dv.h',
'func', 'mlx5dv_devx_obj_create' ],
[ 'HAVE_IBV_FLOW_DEVX_COUNTERS', 'infiniband/mlx5dv.h',
'enum', 'MLX5DV_FLOW_ACTION_COUNTERS_DEVX' ],
[ 'HAVE_MLX5_DR_CREATE_ACTION_DEFAULT_MISS', 'infiniband/mlx5dv.h',
'enum','MLX5DV_FLOW_ACTION_DEFAULT_MISS' ],
[ 'HAVE_IBV_DEVX_ASYNC', 'infiniband/mlx5dv.h',
'func', 'mlx5dv_devx_obj_query_async' ],
[ 'HAVE_IBV_DEVX_QP', 'infiniband/mlx5dv.h',
'func','mlx5dv_devx_qp_query' ],
[ 'HAVE_MLX5DV_PP_ALLOC', 'infiniband/mlx5dv.h',
'func','mlx5dv_pp_alloc' ],
[ 'HAVE_MLX5DV_DR_ACTION_DEST_DEVX_TIR', 'infiniband/mlx5dv.h',
'func', 'mlx5dv_dr_action_create_dest_devx_tir' ],
[ 'HAVE_IBV_DEVX_EVENT', 'infiniband/mlx5dv.h',
'func', 'mlx5dv_devx_get_event' ],
[ 'HAVE_MLX5_DR_CREATE_ACTION_FLOW_METER', 'infiniband/mlx5dv.h',
'func', 'mlx5dv_dr_action_create_flow_meter' ],
[ 'HAVE_MLX5DV_MMAP_GET_NC_PAGES_CMD', 'infiniband/mlx5dv.h',
'enum', 'MLX5_MMAP_GET_NC_PAGES_CMD' ],
[ 'HAVE_MLX5DV_DR', 'infiniband/mlx5dv.h',
'enum', 'MLX5DV_DR_DOMAIN_TYPE_NIC_RX' ],
[ 'HAVE_MLX5DV_DR_ESWITCH', 'infiniband/mlx5dv.h',
'enum', 'MLX5DV_DR_DOMAIN_TYPE_FDB' ],
[ 'HAVE_MLX5DV_DR_VLAN', 'infiniband/mlx5dv.h',
'func', 'mlx5dv_dr_action_create_push_vlan' ],
[ 'HAVE_IBV_VAR', 'infiniband/mlx5dv.h',
'func', 'mlx5dv_alloc_var' ],
[ 'HAVE_MLX5_OPCODE_ENHANCED_MPSW', 'infiniband/mlx5dv.h',
'enum','MLX5_OPCODE_ENHANCED_MPSW' ],
[ 'HAVE_MLX5_OPCODE_SEND_EN', 'infiniband/mlx5dv.h',
'enum','MLX5_OPCODE_SEND_EN' ],
[ 'HAVE_MLX5_OPCODE_WAIT', 'infiniband/mlx5dv.h',
'enum', 'MLX5_OPCODE_WAIT' ],
[ 'HAVE_MLX5_OPCODE_ACCESS_ASO', 'infiniband/mlx5dv.h',
'enum','MLX5_OPCODE_ACCESS_ASO' ],
[ 'HAVE_IFLA_NUM_VF', 'linux/if_link.h',
'enum', 'IFLA_NUM_VF' ],
[ 'HAVE_IFLA_EXT_MASK', 'linux/if_link.h',
'enum', 'IFLA_EXT_MASK' ],
[ 'HAVE_IFLA_PHYS_SWITCH_ID', 'linux/if_link.h',
'enum', 'IFLA_PHYS_SWITCH_ID' ],
[ 'HAVE_IFLA_PHYS_PORT_NAME', 'linux/if_link.h',
'enum', 'IFLA_PHYS_PORT_NAME' ],
[ 'HAVE_RDMA_NL_NLDEV', 'rdma/rdma_netlink.h',
'enum', 'RDMA_NL_NLDEV' ],
[ 'HAVE_RDMA_NLDEV_CMD_GET', 'rdma/rdma_netlink.h',
'enum', 'RDMA_NLDEV_CMD_GET' ],
[ 'HAVE_RDMA_NLDEV_CMD_PORT_GET', 'rdma/rdma_netlink.h',
'enum', 'RDMA_NLDEV_CMD_PORT_GET' ],
[ 'HAVE_RDMA_NLDEV_ATTR_DEV_INDEX', 'rdma/rdma_netlink.h',
'enum', 'RDMA_NLDEV_ATTR_DEV_INDEX' ],
[ 'HAVE_RDMA_NLDEV_ATTR_DEV_NAME', 'rdma/rdma_netlink.h',
'enum', 'RDMA_NLDEV_ATTR_DEV_NAME' ],
[ 'HAVE_RDMA_NLDEV_ATTR_PORT_INDEX', 'rdma/rdma_netlink.h',
'enum', 'RDMA_NLDEV_ATTR_PORT_INDEX' ],
[ 'HAVE_RDMA_NLDEV_ATTR_NDEV_INDEX', 'rdma/rdma_netlink.h',
'enum', 'RDMA_NLDEV_ATTR_NDEV_INDEX' ],
[ 'HAVE_MLX5_DR_FLOW_DUMP', 'infiniband/mlx5dv.h',
'func', 'mlx5dv_dump_dr_domain'],
[ 'HAVE_DEVLINK', 'linux/devlink.h',
'define', 'DEVLINK_GENL_NAME' ],
[ 'HAVE_MLX5_DR_CREATE_ACTION_ASO', 'infiniband/mlx5dv.h',
'func','mlx5dv_dr_action_create_aso' ],
[ 'HAVE_INFINIBAND_VERBS_H', 'infiniband/verbs.h',
'define', 'INFINIBAND_VERBS_H' ],
[ 'HAVE_MLX5_DR_CREATE_ACTION_DEST_ARRAY', 'infiniband/mlx5dv.h',
'func','mlx5dv_dr_action_create_dest_array'],
[ 'HAVE_MLX5DV_DR_MEM_RECLAIM', 'infiniband/mlx5dv.h',
'func','mlx5dv_dr_domain_set_reclaim_device_memory'],
[ 'HAVE_MLX5_DR_CREATE_ACTION_FLOW_SAMPLE', 'infiniband/mlx5dv.h',
'func','mlx5dv_dr_action_create_flow_sampler'],
[ 'HAVE_MLX5DV_FLOW_MATCHER_FT_TYPE', 'infiniband/mlx5dv.h',
'field', 'struct mlx5dv_flow_matcher_attr.ft_type' ],
[ 'HAVE_IBV_FLOW_SPEC_ESP', 'infiniband/verbs.h',
'enum', 'IBV_FLOW_SPEC_ESP' ],
[ 'HAVE_IBV_RX_HASH_IPSEC_SPI', 'infiniband/verbs.h',
'enum', 'IBV_RX_HASH_IPSEC_SPI' ],
[ 'HAVE_MLX5DV_DR_DEVX_PORT_V35', 'infiniband/mlx5dv.h',
'func', 'mlx5dv_query_port' ],
[ 'HAVE_MLX5DV_DR_CREATE_DEST_IB_PORT', 'infiniband/mlx5dv.h',
'func', 'mlx5dv_dr_action_create_dest_ib_port' ],
[ 'HAVE_RDMA_NLDEV_ATTR_PORT_STATE', 'rdma/rdma_netlink.h',
'enum', 'RDMA_NLDEV_ATTR_PORT_STATE' ],
[ 'HAVE_MLX5_UMR_IMKEY', 'infiniband/mlx5dv.h',
'enum', 'MLX5_WQE_UMR_CTRL_FLAG_INLINE' ],
[ 'HAVE_MLX5_DR_FLOW_DUMP_RULE', 'infiniband/mlx5dv.h',
'func', 'mlx5dv_dump_dr_rule' ],
[ 'HAVE_MLX5_DR_ACTION_ASO_CT', 'infiniband/mlx5dv.h',
'enum', 'MLX5DV_DR_ACTION_FLAGS_ASO_CT_DIRECTION_INITIATOR' ],
[ 'HAVE_MLX5_DR_ALLOW_DUPLICATE', 'infiniband/mlx5dv.h',
'func', 'mlx5dv_dr_domain_allow_duplicate_rules' ],
[ 'HAVE_MLX5_IBV_REG_MR_IOVA', 'infiniband/verbs.h',
'func', 'ibv_reg_mr_iova' ],
[ 'HAVE_MLX5_IBV_IMPORT_CTX_PD_AND_MR', 'infiniband/verbs.h',
'type', 'ibv_import_device' ],
[ 'HAVE_MLX5DV_DR_ACTION_CREATE_DEST_ROOT_TABLE', 'infiniband/mlx5dv.h',
'func', 'mlx5dv_dr_action_create_dest_root_table' ],
[ 'HAVE_MLX5DV_CREATE_STEERING_ANCHOR', 'infiniband/mlx5dv.h',
'func', 'mlx5dv_create_steering_anchor'],
[ 'HAVE_IBV_FORK_UNNEEDED', 'infiniband/verbs.h',
'func', 'ibv_is_fork_initialized'],
]
autoconf_script = 'src/dpdk/auto-config-h.sh'
autoconf_command = os.path.join(top, autoconf_script)
for arg in has_sym_args:
result, output = getstatusoutput("%s %s '%s' '%s' '%s' '%s' > /dev/null" %
(autoconf_command, autoconf_path, arg[0], arg[1], arg[2], arg[3]))
if result != 0:
ctx.end_msg('failed\n%s\n' % output, 'YELLOW')
break
if result == 0:
ctx.end_msg('done', 'GREEN')
@conf
def check_ofed(ctx):
ctx.start_msg('Checking for OFED')
ofed_info='/usr/bin/ofed_info'
ofed_ver_re = re.compile('.*[-](\d+)[.](\d+)[-].*')
ofed_major_ver = 4
ofed_minor_ver = 2
ofed_ver_show= '4.2'
if not os.path.isfile(ofed_info):
ctx.end_msg('not found', 'YELLOW')
return False
ret, out = getstatusoutput(ofed_info)
if ret:
ctx.end_msg("Can't run %s to verify version:\n%s" % (ofed_info, out), 'YELLOW')
return False
lines = out.splitlines()
if len(lines) < 2:
ctx.end_msg('Expected several output lines from %s, got:\n%s' % (ofed_info, out), 'YELLOW')
return False
m= ofed_ver_re.match(str(lines[0]))
if m:
is_version_okay = False
if int(m.group(1)) > ofed_major_ver:
is_version_okay = True
elif int(m.group(1)) == ofed_major_ver and int(m.group(2)) >= ofed_minor_ver:
is_version_okay = True
if not is_version_okay:
ctx.end_msg("installed OFED version is '%s' should be at least '%s' and up - try with ./b configure --no-mlx flag" % (lines[0],ofed_ver_show),'YELLOW')
return False
else:
ctx.end_msg("not found valid OFED version '%s' " % (lines[0]),'YELLOW')
return False
if not os.path.isfile("/usr/include/infiniband/mlx5dv.h"):
ctx.end_msg("ERROR, OFED should be installed using '$./mlnxofedinstall --with-mft --with-mstflint --dpdk --upstream-libs' try to reinstall or see manual", 'YELLOW')
return False
ctx.end_msg('Found version %s.%s' % (m.group(1), m.group(2)))
return True
@conf
def check_ntapi(ctx):
ctx.start_msg('Checking for NTAPI')
ntapi_lib='/opt/napatech3/lib/libntapi.so'
if not os.path.isfile(ntapi_lib):
ctx.end_msg('not found', 'YELLOW')
return False
ctx.end_msg('Found needed NTAPI library')
return True
def verify_cc_version (env, min_ver = REQUIRED_CC_VERSION):
ver = StrictVersion('.'.join(env['CC_VERSION']))
return (ver >= min_ver, ver, min_ver)
@conf
def get_ld_search_path(ctx):
ctx.start_msg('Getting LD search path')
cmd = 'ld --verbose'
ret, out = getstatusoutput(cmd)
if ret != 0:
ctx.end_msg('failed', 'YELLOW')
ctx.fatal('\nCommand: %s\n\nOutput: %s' % (cmd, out))
path_arr = []
regex_str = '\s*SEARCH_DIR\("=?([^"]+)"\)\s*'
regex = re.compile(regex_str)
for line in out.splitlines():
if line.startswith('SEARCH_DIR'):
for elem in line.split(';'):
if not elem.strip():
continue
m = regex.match(elem)
if m is None:
ctx.end_msg('failed', 'YELLOW')
Logs.pprint('NORMAL', '\nCommand: %s\n\nOutput: %s' % (cmd, out))
ctx.fatal('Regex (%s0 does not match output (%s).' % (regex_str, elem))
else:
path_arr.append(m.group(1))
if not path_arr:
ctx.end_msg('failed', 'YELLOW')
Logs.pprint('NORMAL', '\nCommand: %s\n\nOutput: %s' % (cmd, out))
ctx.fatal('Could not find SEARCH_DIR in output')
ctx.env.LD_SEARCH_PATH = path_arr
ctx.end_msg('ok', 'GREEN')
def check_version_glibc(lib_so):
max_num =0
for so in lib_so:
cmd = 'strings {}'.format(so)
s, lines = getstatusoutput(cmd)
if s ==0:
ls= lines.split('\n')
for line in ls:
prefix = 'GLIBCXX_'
if line.startswith(prefix):
fix = line[len(prefix):]
d=fix.split('.')
if len(d) == 3:
num = int(d[0])*1000 +int(d[1])*100+int(d[2])
if num >max_num:
max_num = num
return max_num
def configure(conf):
conf.find_program('strings')
so = ['/usr/lib/x86_64-linux-gnu/libstdc++.so.6','/usr/lib64/libstdc++.so.6']
our_so = '../scripts/so/x86_64/libstdc++.so.6'
d_so = '../scripts/so/x86_64/_libstdc++.so.6'
ver = check_version_glibc(so)
if ver > 3424:
Logs.pprint('YELLOW', 'you have newer {} libstdc++.so remove the old one, do not commit this \n'.format(ver))
try:
os.system("mv %s %s " %(our_so,d_so))
except Exception as ex:
pass
conf.load('clang_compilation_database',tooldir=['../external_libs/waf-tools'])
if int(conf.options.gcc6) + int(conf.options.gcc7) + int(conf.options.gcc8) > 1:
conf.fatal('--gcc6, --gcc7 and --gcc8 are mutually exclusive')
if conf.options.gcc6:
if march == 'ppc64le':
conf.fatal('Power9 CPU not supported by GCC6')
configure_gcc(conf, GCC6_DIRS)
elif conf.options.gcc7:
if march == 'ppc64le':
conf.fatal('Power9 CPU not supported by GCC7')
conf.environ['AR']="x86_64-pc-linux-gnu-gcc-ar"
configure_gcc(conf, GCC7_DIRS)
elif conf.options.gcc8:
conf.environ['AR']="x86_64-pc-linux-gnu-gcc-ar"
configure_gcc(conf, GCC8_DIRS)
else:
configure_gcc(conf)
conf.find_program('ldd')
conf.check_cxx(lib = 'z', errmsg = missing_pkg_msg(fedora = 'zlib-devel', ubuntu = 'zlib1g-dev'))
no_mlx = conf.options.no_mlx
no_bnxt = conf.options.no_bnxt
with_mana = conf.options.with_mana
with_ntacc = conf.options.with_ntacc
with_bird = conf.options.with_bird
with_sanitized = conf.options.sanitized
new_memory = conf.options.new_memory
configure_sanitized(conf, with_sanitized)
conf.env.NO_MLX = no_mlx
conf.env.TAP = conf.options.tap
if no_mlx != 'all':
if conf.options.no_ofed_check:
ofed_ok = True
else:
ofed_ok = conf.check_ofed(mandatory = False)
conf.env.OFED_OK = ofed_ok
conf.check_cxx(lib = 'mnl', mandatory = False, errmsg = 'not found, will use internal version')
if ofed_ok:
conf.configure_mlx5(mandatory = False)
conf.get_ld_search_path(mandatory = True)
conf.check_cxx(lib = 'ibverbs', errmsg = 'Could not find library ibverbs, will use internal version.', mandatory = False)
else:
conf.configure_dummy_mlx5(mandatory = False)
Logs.pprint('YELLOW', 'Warning: will use internal version of ibverbs. If you need to use Mellanox NICs, install OFED:\n' +
'https://trex-tgn.cisco.com/trex/doc/trex_manual.html#_mellanox_connectx_4_support')
if no_mlx != 'mlx5':
Logs.pprint('YELLOW', 'Building mlx5 PMD')
conf.env.NO_BNXT = no_bnxt
if not no_bnxt:
Logs.pprint('YELLOW', 'Building bnxt PMD')
if conf.env.TAP:
conf.configure_tap(mandatory = False)
conf.env.WITH_MANA = with_mana
conf.env.WITH_NTACC = with_ntacc
conf.env.WITH_BIRD = with_bird
if with_mana:
conf.get_ld_search_path(mandatory = True)
conf.check_cxx(lib = 'mana', errmsg = 'Could not find library mana, will use internal version.', mandatory = False)
Logs.pprint('YELLOW', 'Building mana PMD')
if with_ntacc:
ntapi_ok = conf.check_ntapi(mandatory = False)
if not ntapi_ok:
Logs.pprint('RED', 'Cannot find NTAPI. If you need to use Napatech NICs, install the Napatech driver:\n' +
'https://www.napatech.com/downloads/')
raise Exception("Cannot find libntapi");
conf.env.DPDK_NEW_MEMORY = new_memory
if new_memory:
conf.check_cxx(lib = 'numa', errmsg = missing_pkg_msg(fedora = 'libnuma-devel', ubuntu = 'libnuma-dev'))
s = '#ifndef RTE_EAL_NUMA_AWARE_HUGEPAGES\n'
s += '#define RTE_EAL_NUMA_AWARE_HUGEPAGES 1\n'
s += '#endif\n'
write_file(os.path.join(conf.bldnode.abspath(), H_DPDK_CONFIG), s)
conf.env.DPDK_WITH_ARCHIVE = False
if conf.options.with_archive:
if conf.check_cxx(lib = 'archive', errmsg = 'Could not find libarchive', mandatory = False):
conf.env.DPDK_WITH_ARCHIVE = True
def search_in_paths(paths):
for path in paths:
if os.path.exists(path):
return path
def load_compiler(conf):
if 'clang' in conf.environ.get('CXX', ''):
conf.load('clang++')
conf.load('clang')
else:
conf.load('g++')
conf.load('gcc')
return
def configure_gcc(conf, explicit_paths = None):
# use the system path
if explicit_paths is None:
load_compiler(conf)
return
if type(explicit_paths) is not list:
explicit_paths = [explicit_paths]
explicit_path = search_in_paths(explicit_paths)
if not explicit_path:
conf.fatal('unable to find GCC in installation dir(s): {0}'.format(explicit_paths))
saved = conf.environ['PATH']
try:
conf.environ['PATH'] = explicit_path
load_compiler(conf)
finally:
conf.environ['PATH'] = saved
def configure_sanitized (conf, with_sanitized):
# first we turn off SANITIZED
conf.env.SANITIZED = False
# if sanitized is required - check GCC version for sanitizing
conf.start_msg('Build sanitized images (GCC >= {0})'.format(SANITIZE_CC_VERSION))
# not required
if not with_sanitized:
conf.end_msg('no', 'YELLOW')
else:
rc = verify_cc_version(conf.env, SANITIZE_CC_VERSION)
if not rc[0]:
conf.fatal('--sanitized is supported only with GCC {0}+ - current {1}'.format(rc[2], rc[1]))
else:
conf.end_msg('yes', 'GREEN')
conf.env.SANITIZED = True
def getstatusoutput(cmd):
""" Return (status, output) of executing cmd in a shell. Taken from Python3 subprocess.getstatusoutput"""
try:
data = subprocess.check_output(cmd, shell=True, universal_newlines=True, stderr=subprocess.STDOUT)
status = 0
except subprocess.CalledProcessError as ex:
data = ex.output
status = ex.returncode
if data[-1:] == '\n':
data = data[:-1]
return status, data
main_src = SrcGroup(dir='src',
src_list=[
'44bsd/tcp_output.cpp',
#'44bsd/tcp_timer.cpp',
#'44bsd/tcp_debug.cpp',
'44bsd/tcp_subr.cpp',
'44bsd/flow_table.cpp',
'44bsd/tcp_input.cpp',
#'44bsd/tcp_usrreq.cpp',
'44bsd/tcp_socket.cpp',
'44bsd/tcp_dpdk.cpp',
'44bsd/sch_rampup.cpp',
'44bsd/tick_cmd_clock.cpp',
'44bsd/udp.cpp',
'44bsd/udp_latency.cpp',
'tunnels/gtp_man.cpp',
'tunnels/tunnel_db.cpp',
'hdrh/hdr_time.c',
'hdrh/hdr_encoding.c',
'hdrh/hdr_histogram.c',
'hdrh/hdr_histogram_log.c',