build: change indentation in infrastructure files

Switch from using tabs to 4 spaces for meson.build indentation, for the
basic infrastructure and tooling files, as well as doc and kernel
directories.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
This commit is contained in:
Bruce Richardson 2021-04-20 11:22:23 +01:00 committed by Thomas Monjalon
parent cf59165dcb
commit 8dcb898c65
16 changed files with 786 additions and 795 deletions

View File

@ -2,19 +2,19 @@
# Copyright(c) 2021 Intel Corporation # Copyright(c) 2021 Intel Corporation
if not get_option('check_includes') if not get_option('check_includes')
build = false build = false
subdir_done() subdir_done()
endif endif
if is_windows if is_windows
# for windows, the shebang line in the script won't work. # for windows, the shebang line in the script won't work.
error('option "check_includes" is not supported on windows') error('option "check_includes" is not supported on windows')
endif endif
gen_c_file_for_header = find_program('gen_c_file_for_header.py') gen_c_file_for_header = find_program('gen_c_file_for_header.py')
gen_c_files = generator(gen_c_file_for_header, gen_c_files = generator(gen_c_file_for_header,
output: '@BASENAME@.c', output: '@BASENAME@.c',
arguments: ['@INPUT@', '@OUTPUT@']) arguments: ['@INPUT@', '@OUTPUT@'])
cflags = machine_args cflags = machine_args
cflags += '-DALLOW_EXPERIMENTAL_API' cflags += '-DALLOW_EXPERIMENTAL_API'
@ -24,12 +24,12 @@ sources += gen_c_files.process(dpdk_chkinc_headers)
deps = [] deps = []
foreach l:enabled_libs foreach l:enabled_libs
deps += get_variable('static_rte_' + l) deps += get_variable('static_rte_' + l)
endforeach endforeach
executable('chkincs', sources, executable('chkincs', sources,
c_args: cflags, c_args: cflags,
include_directories: includes, include_directories: includes,
dependencies: deps, dependencies: deps,
link_whole: dpdk_static_libraries + dpdk_drivers, link_whole: dpdk_static_libraries + dpdk_drivers,
install: false) install: false)

View File

@ -10,9 +10,9 @@ binutils_avx512_check = find_program('binutils-avx512-check.sh')
# set up map-to-win script using python, either built-in or external # set up map-to-win script using python, either built-in or external
python3 = import('python').find_installation(required: false) python3 = import('python').find_installation(required: false)
if python3.found() if python3.found()
py3 = [python3] py3 = [python3]
else else
py3 = ['meson', 'runpython'] py3 = ['meson', 'runpython']
endif endif
map_to_win_cmd = py3 + files('map_to_win.py') map_to_win_cmd = py3 + files('map_to_win.py')
sphinx_wrapper = py3 + files('call-sphinx-build.py') sphinx_wrapper = py3 + files('call-sphinx-build.py')
@ -21,27 +21,27 @@ sphinx_wrapper = py3 + files('call-sphinx-build.py')
pmdinfo = py3 + files('gen-pmdinfo-cfile.py') + [meson.current_build_dir()] pmdinfo = py3 + files('gen-pmdinfo-cfile.py') + [meson.current_build_dir()]
pmdinfogen = py3 + files('pmdinfogen.py') pmdinfogen = py3 + files('pmdinfogen.py')
if host_machine.system() == 'windows' if host_machine.system() == 'windows'
if cc.get_id() == 'gcc' if cc.get_id() == 'gcc'
pmdinfo += 'ar' pmdinfo += 'ar'
else else
pmdinfo += 'llvm-ar' pmdinfo += 'llvm-ar'
endif endif
pmdinfogen += 'coff' pmdinfogen += 'coff'
else else
pmdinfo += 'ar' pmdinfo += 'ar'
pmdinfogen += 'elf' pmdinfogen += 'elf'
endif endif
# TODO: starting from Meson 0.51.0 use # TODO: starting from Meson 0.51.0 use
# python3 = import('python').find_installation('python', # python3 = import('python').find_installation('python',
# modules : python3_required_modules) # modules : python3_required_modules)
python3_required_modules = [] python3_required_modules = []
if host_machine.system() != 'windows' if host_machine.system() != 'windows'
python3_required_modules = ['elftools'] python3_required_modules = ['elftools']
endif endif
foreach module : python3_required_modules foreach module : python3_required_modules
script = 'import importlib.util; import sys; exit(importlib.util.find_spec("@0@") is None)' script = 'import importlib.util; import sys; exit(importlib.util.find_spec("@0@") is None)'
if run_command(py3, '-c', script.format(module)).returncode() != 0 if run_command(py3, '-c', script.format(module)).returncode() != 0
error('missing python module: @0@'.format(module)) error('missing python module: @0@'.format(module))
endif endif
endforeach endforeach

View File

@ -4,7 +4,7 @@
pkg = import('pkgconfig') pkg = import('pkgconfig')
pkg_extra_cflags = ['-include', 'rte_config.h'] + machine_args pkg_extra_cflags = ['-include', 'rte_config.h'] + machine_args
if is_freebsd if is_freebsd
pkg_extra_cflags += ['-D__BSD_VISIBLE'] pkg_extra_cflags += ['-D__BSD_VISIBLE']
endif endif
# When calling pkg-config --static --libs, pkg-config will always output the # When calling pkg-config --static --libs, pkg-config will always output the
@ -28,30 +28,30 @@ endif
pkg.generate(name: 'dpdk-libs', pkg.generate(name: 'dpdk-libs',
filebase: 'libdpdk-libs', filebase: 'libdpdk-libs',
description: '''Internal-only DPDK pkgconfig file. Not for direct use. description: '''Internal-only DPDK pkgconfig file. Not for direct use.
Use libdpdk.pc instead of this file to query DPDK compile/link arguments''', Use libdpdk.pc instead of this file to query DPDK compile/link arguments''',
version: meson.project_version(), version: meson.project_version(),
subdirs: [get_option('include_subdir_arch'), '.'], subdirs: [get_option('include_subdir_arch'), '.'],
extra_cflags: pkg_extra_cflags, extra_cflags: pkg_extra_cflags,
libraries: ['-Wl,--as-needed'] + dpdk_libraries, libraries: ['-Wl,--as-needed'] + dpdk_libraries,
libraries_private: dpdk_extra_ldflags) libraries_private: dpdk_extra_ldflags)
platform_flags = [] platform_flags = []
if not is_windows if not is_windows
platform_flags += ['-Wl,--export-dynamic'] # ELF only platform_flags += ['-Wl,--export-dynamic'] # ELF only
endif endif
pkg.generate(name: 'DPDK', # main DPDK pkgconfig file pkg.generate(name: 'DPDK', # main DPDK pkgconfig file
filebase: 'libdpdk', filebase: 'libdpdk',
version: meson.project_version(), version: meson.project_version(),
description: '''The Data Plane Development Kit (DPDK). description: '''The Data Plane Development Kit (DPDK).
Note that CFLAGS might contain an -march flag higher than typical baseline. Note that CFLAGS might contain an -march flag higher than typical baseline.
This is required for a number of static inline functions in the public headers.''', This is required for a number of static inline functions in the public headers.''',
requires: ['libdpdk-libs', libbsd], # may need libbsd for string funcs requires: ['libdpdk-libs', libbsd], # may need libbsd for string funcs
# if libbsd is not enabled, then this is blank # if libbsd is not enabled, then this is blank
libraries_private: ['-Wl,--whole-archive'] + libraries_private: ['-Wl,--whole-archive'] +
dpdk_drivers + dpdk_static_libraries + dpdk_drivers + dpdk_static_libraries +
['-Wl,--no-whole-archive'] + platform_flags ['-Wl,--no-whole-archive'] + platform_flags
) )
# For static linking with dependencies as shared libraries, # For static linking with dependencies as shared libraries,

View File

@ -5,22 +5,22 @@
# common flags to all aarch64 builds, with lowest priority # common flags to all aarch64 builds, with lowest priority
flags_common = [ flags_common = [
# Accelerate rte_memcpy. Be sure to run unit test (memcpy_perf_autotest) # Accelerate rte_memcpy. Be sure to run unit test (memcpy_perf_autotest)
# to determine the best threshold in code. Refer to notes in source file # to determine the best threshold in code. Refer to notes in source file
# (lib/librte_eal/arm/include/rte_memcpy_64.h) for more info. # (lib/librte_eal/arm/include/rte_memcpy_64.h) for more info.
['RTE_ARCH_ARM64_MEMCPY', false], ['RTE_ARCH_ARM64_MEMCPY', false],
# ['RTE_ARM64_MEMCPY_ALIGNED_THRESHOLD', 2048], # ['RTE_ARM64_MEMCPY_ALIGNED_THRESHOLD', 2048],
# ['RTE_ARM64_MEMCPY_UNALIGNED_THRESHOLD', 512], # ['RTE_ARM64_MEMCPY_UNALIGNED_THRESHOLD', 512],
# Leave below RTE_ARM64_MEMCPY_xxx options commented out, # Leave below RTE_ARM64_MEMCPY_xxx options commented out,
# unless there are strong reasons. # unless there are strong reasons.
# ['RTE_ARM64_MEMCPY_SKIP_GCC_VER_CHECK', false], # ['RTE_ARM64_MEMCPY_SKIP_GCC_VER_CHECK', false],
# ['RTE_ARM64_MEMCPY_ALIGN_MASK', 0xF], # ['RTE_ARM64_MEMCPY_ALIGN_MASK', 0xF],
# ['RTE_ARM64_MEMCPY_STRICT_ALIGN', false], # ['RTE_ARM64_MEMCPY_STRICT_ALIGN', false],
['RTE_SCHED_VECTOR', false], ['RTE_SCHED_VECTOR', false],
['RTE_ARM_USE_WFE', false], ['RTE_ARM_USE_WFE', false],
['RTE_ARCH_ARM64', true], ['RTE_ARCH_ARM64', true],
['RTE_CACHE_LINE_SIZE', 128] ['RTE_CACHE_LINE_SIZE', 128]
] ]
## Part numbers are specific to Arm implementers ## Part numbers are specific to Arm implementers
@ -29,439 +29,432 @@ flags_common = [
# part number specific aarch64 flags have higher priority # part number specific aarch64 flags have higher priority
# (will overwrite both common and implementer specific flags) # (will overwrite both common and implementer specific flags)
implementer_generic = { implementer_generic = {
'description': 'Generic armv8', 'description': 'Generic armv8',
'flags': [ 'flags': [
['RTE_MACHINE', '"armv8a"'], ['RTE_MACHINE', '"armv8a"'],
['RTE_USE_C11_MEM_MODEL', true], ['RTE_USE_C11_MEM_MODEL', true],
['RTE_MAX_LCORE', 256], ['RTE_MAX_LCORE', 256],
['RTE_MAX_NUMA_NODES', 4] ['RTE_MAX_NUMA_NODES', 4]
], ],
'part_number_config': { 'part_number_config': {
'generic': {'machine_args': ['-march=armv8-a+crc', 'generic': {'machine_args': ['-march=armv8-a+crc', '-moutline-atomics']}
'-moutline-atomics']} }
}
} }
part_number_config_arm = { part_number_config_arm = {
'0xd03': {'machine_args': ['-mcpu=cortex-a53']}, '0xd03': {'machine_args': ['-mcpu=cortex-a53']},
'0xd04': {'machine_args': ['-mcpu=cortex-a35']}, '0xd04': {'machine_args': ['-mcpu=cortex-a35']},
'0xd07': {'machine_args': ['-mcpu=cortex-a57']}, '0xd07': {'machine_args': ['-mcpu=cortex-a57']},
'0xd08': {'machine_args': ['-mcpu=cortex-a72']}, '0xd08': {'machine_args': ['-mcpu=cortex-a72']},
'0xd09': {'machine_args': ['-mcpu=cortex-a73']}, '0xd09': {'machine_args': ['-mcpu=cortex-a73']},
'0xd0a': {'machine_args': ['-mcpu=cortex-a75']}, '0xd0a': {'machine_args': ['-mcpu=cortex-a75']},
'0xd0b': {'machine_args': ['-mcpu=cortex-a76']}, '0xd0b': {'machine_args': ['-mcpu=cortex-a76']},
'0xd0c': { '0xd0c': {
'machine_args': ['-march=armv8.2-a+crypto', 'machine_args': ['-march=armv8.2-a+crypto', '-mcpu=neoverse-n1'],
'-mcpu=neoverse-n1'], 'flags': [
'flags': [ ['RTE_MACHINE', '"neoverse-n1"'],
['RTE_MACHINE', '"neoverse-n1"'], ['RTE_ARM_FEATURE_ATOMICS', true],
['RTE_ARM_FEATURE_ATOMICS', true], ['RTE_MAX_MEM_MB', 1048576],
['RTE_MAX_MEM_MB', 1048576], ['RTE_MAX_LCORE', 160],
['RTE_MAX_LCORE', 160], ['RTE_MAX_NUMA_NODES', 2]
['RTE_MAX_NUMA_NODES', 2] ]
] },
}, '0xd49': {
'0xd49': { 'machine_args': ['-march=armv8.5-a+crypto+sve2'],
'machine_args': ['-march=armv8.5-a+crypto+sve2'], 'flags': [
'flags': [ ['RTE_MACHINE', '"neoverse-n2"'],
['RTE_MACHINE', '"neoverse-n2"'], ['RTE_ARM_FEATURE_ATOMICS', true],
['RTE_ARM_FEATURE_ATOMICS', true], ['RTE_MAX_LCORE', 64],
['RTE_MAX_LCORE', 64], ['RTE_MAX_NUMA_NODES', 1]
['RTE_MAX_NUMA_NODES', 1] ]
] }
}
} }
implementer_arm = { implementer_arm = {
'description': 'Arm', 'description': 'Arm',
'flags': [ 'flags': [
['RTE_MACHINE', '"armv8a"'], ['RTE_MACHINE', '"armv8a"'],
['RTE_USE_C11_MEM_MODEL', true], ['RTE_USE_C11_MEM_MODEL', true],
['RTE_CACHE_LINE_SIZE', 64], ['RTE_CACHE_LINE_SIZE', 64],
['RTE_MAX_LCORE', 64], ['RTE_MAX_LCORE', 64],
['RTE_MAX_NUMA_NODES', 4] ['RTE_MAX_NUMA_NODES', 4]
], ],
'part_number_config': part_number_config_arm 'part_number_config': part_number_config_arm
} }
flags_part_number_thunderx = [ flags_part_number_thunderx = [
['RTE_MACHINE', '"thunderx"'], ['RTE_MACHINE', '"thunderx"'],
['RTE_USE_C11_MEM_MODEL', false] ['RTE_USE_C11_MEM_MODEL', false]
] ]
implementer_cavium = { implementer_cavium = {
'description': 'Cavium', 'description': 'Cavium',
'flags': [ 'flags': [
['RTE_MAX_VFIO_GROUPS', 128], ['RTE_MAX_VFIO_GROUPS', 128],
['RTE_MAX_LCORE', 96], ['RTE_MAX_LCORE', 96],
['RTE_MAX_NUMA_NODES', 2] ['RTE_MAX_NUMA_NODES', 2]
], ],
'part_number_config': { 'part_number_config': {
'0xa1': { '0xa1': {
'machine_args': ['-mcpu=thunderxt88'], 'machine_args': ['-mcpu=thunderxt88'],
'flags': flags_part_number_thunderx 'flags': flags_part_number_thunderx
}, },
'0xa2': { '0xa2': {
'machine_args': ['-mcpu=thunderxt81'], 'machine_args': ['-mcpu=thunderxt81'],
'flags': flags_part_number_thunderx 'flags': flags_part_number_thunderx
}, },
'0xa3': { '0xa3': {
'machine_args': ['-mcpu=thunderxt83'], 'machine_args': ['-mcpu=thunderxt83'],
'flags': flags_part_number_thunderx 'flags': flags_part_number_thunderx
}, },
'0xaf': { '0xaf': {
'machine_args': ['-march=armv8.1-a+crc+crypto', 'machine_args': ['-march=armv8.1-a+crc+crypto', '-mcpu=thunderx2t99'],
'-mcpu=thunderx2t99'], 'flags': [
'flags': [ ['RTE_MACHINE', '"thunderx2"'],
['RTE_MACHINE', '"thunderx2"'], ['RTE_ARM_FEATURE_ATOMICS', true],
['RTE_ARM_FEATURE_ATOMICS', true], ['RTE_USE_C11_MEM_MODEL', true],
['RTE_USE_C11_MEM_MODEL', true], ['RTE_CACHE_LINE_SIZE', 64],
['RTE_CACHE_LINE_SIZE', 64], ['RTE_MAX_LCORE', 256]
['RTE_MAX_LCORE', 256] ]
] },
}, '0xb2': {
'0xb2': { 'machine_args': ['-march=armv8.2-a+crc+crypto+lse', '-mcpu=octeontx2'],
'machine_args': ['-march=armv8.2-a+crc+crypto+lse', 'flags': [
'-mcpu=octeontx2'], ['RTE_MACHINE', '"octeontx2"'],
'flags': [ ['RTE_ARM_FEATURE_ATOMICS', true],
['RTE_MACHINE', '"octeontx2"'], ['RTE_USE_C11_MEM_MODEL', true],
['RTE_ARM_FEATURE_ATOMICS', true], ['RTE_MAX_LCORE', 36],
['RTE_USE_C11_MEM_MODEL', true], ['RTE_MAX_NUMA_NODES', 1]
['RTE_MAX_LCORE', 36], ]
['RTE_MAX_NUMA_NODES', 1] }
] }
}
}
} }
implementer_ampere = { implementer_ampere = {
'description': 'Ampere Computing', 'description': 'Ampere Computing',
'flags': [ 'flags': [
['RTE_MACHINE', '"emag"'], ['RTE_MACHINE', '"emag"'],
['RTE_CACHE_LINE_SIZE', 64], ['RTE_CACHE_LINE_SIZE', 64],
['RTE_MAX_LCORE', 32], ['RTE_MAX_LCORE', 32],
['RTE_MAX_NUMA_NODES', 1] ['RTE_MAX_NUMA_NODES', 1]
], ],
'part_number_config': { 'part_number_config': {
'0x0': {'machine_args': ['-march=armv8-a+crc+crypto', '0x0': {'machine_args': ['-march=armv8-a+crc+crypto', '-mtune=emag']}
'-mtune=emag']} }
}
} }
implementer_hisilicon = { implementer_hisilicon = {
'description': 'HiSilicon', 'description': 'HiSilicon',
'flags': [ 'flags': [
['RTE_USE_C11_MEM_MODEL', true], ['RTE_USE_C11_MEM_MODEL', true],
['RTE_CACHE_LINE_SIZE', 128] ['RTE_CACHE_LINE_SIZE', 128]
], ],
'part_number_config': { 'part_number_config': {
'0xd01': { '0xd01': {
'machine_args': ['-march=armv8.2-a+crypto', 'machine_args': ['-march=armv8.2-a+crypto', '-mtune=tsv110'],
'-mtune=tsv110'], 'flags': [
'flags': [ ['RTE_MACHINE', '"Kunpeng 920"'],
['RTE_MACHINE', '"Kunpeng 920"'], ['RTE_ARM_FEATURE_ATOMICS', true],
['RTE_ARM_FEATURE_ATOMICS', true], ['RTE_MAX_LCORE', 256],
['RTE_MAX_LCORE', 256], ['RTE_MAX_NUMA_NODES', 8]
['RTE_MAX_NUMA_NODES', 8] ]
] },
}, '0xd02': {
'0xd02': { 'machine_args': ['-march=armv8.2-a+crypto+sve'],
'machine_args': ['-march=armv8.2-a+crypto+sve'], 'flags': [
'flags': [ ['RTE_MACHINE', '"Kunpeng 930"'],
['RTE_MACHINE', '"Kunpeng 930"'], ['RTE_ARM_FEATURE_ATOMICS', true],
['RTE_ARM_FEATURE_ATOMICS', true], ['RTE_MAX_LCORE', 1280],
['RTE_MAX_LCORE', 1280], ['RTE_MAX_NUMA_NODES', 16]
['RTE_MAX_NUMA_NODES', 16] ]
] }
} }
}
} }
implementer_qualcomm = { implementer_qualcomm = {
'description': 'Qualcomm', 'description': 'Qualcomm',
'flags': [ 'flags': [
['RTE_MACHINE', '"armv8a"'], ['RTE_MACHINE', '"armv8a"'],
['RTE_USE_C11_MEM_MODEL', true], ['RTE_USE_C11_MEM_MODEL', true],
['RTE_CACHE_LINE_SIZE', 64], ['RTE_CACHE_LINE_SIZE', 64],
['RTE_MAX_LCORE', 64], ['RTE_MAX_LCORE', 64],
['RTE_MAX_NUMA_NODES', 1] ['RTE_MAX_NUMA_NODES', 1]
], ],
'part_number_config': { 'part_number_config': {
'0xc00': {'machine_args': ['-march=armv8-a+crc']} '0xc00': {'machine_args': ['-march=armv8-a+crc']}
} }
} }
## Arm implementers (ID from MIDR in Arm Architecture Reference Manual) ## Arm implementers (ID from MIDR in Arm Architecture Reference Manual)
implementers = { implementers = {
'generic': implementer_generic, 'generic': implementer_generic,
'0x41': implementer_arm, '0x41': implementer_arm,
'0x43': implementer_cavium, '0x43': implementer_cavium,
'0x48': implementer_hisilicon, '0x48': implementer_hisilicon,
'0x50': implementer_ampere, '0x50': implementer_ampere,
'0x51': implementer_qualcomm '0x51': implementer_qualcomm
} }
# SoC specific aarch64 flags have the highest priority # SoC specific aarch64 flags have the highest priority
# (will overwrite all other flags) # (will overwrite all other flags)
soc_generic = { soc_generic = {
'description': 'Generic un-optimized build for all aarch64 machines', 'description': 'Generic un-optimized build for all aarch64 machines',
'implementer': 'generic', 'implementer': 'generic',
'part_number': 'generic' 'part_number': 'generic'
} }
soc_armada = { soc_armada = {
'description': 'Marvell ARMADA', 'description': 'Marvell ARMADA',
'implementer': '0x41', 'implementer': '0x41',
'part_number': '0xd08', 'part_number': '0xd08',
'flags': [ 'flags': [
['RTE_MAX_LCORE', 16], ['RTE_MAX_LCORE', 16],
['RTE_MAX_NUMA_NODES', 1] ['RTE_MAX_NUMA_NODES', 1]
], ],
'numa': false 'numa': false
} }
soc_bluefield = { soc_bluefield = {
'description': 'NVIDIA BlueField', 'description': 'NVIDIA BlueField',
'implementer': '0x41', 'implementer': '0x41',
'part_number': '0xd08', 'part_number': '0xd08',
'flags': [ 'flags': [
['RTE_MAX_LCORE', 16], ['RTE_MAX_LCORE', 16],
['RTE_MAX_NUMA_NODES', 1] ['RTE_MAX_NUMA_NODES', 1]
], ],
'numa': false 'numa': false
} }
soc_cn10k = { soc_cn10k = {
'description' : 'Marvell OCTEON 10', 'description' : 'Marvell OCTEON 10',
'implementer' : '0x41', 'implementer' : '0x41',
'flags': [ 'flags': [
['RTE_MAX_LCORE', 24], ['RTE_MAX_LCORE', 24],
['RTE_MAX_NUMA_NODES', 1] ['RTE_MAX_NUMA_NODES', 1]
], ],
'part_number': '0xd49', 'part_number': '0xd49',
'numa': false 'numa': false
} }
soc_dpaa = { soc_dpaa = {
'description': 'NXP DPAA', 'description': 'NXP DPAA',
'implementer': '0x41', 'implementer': '0x41',
'part_number': '0xd08', 'part_number': '0xd08',
'flags': [ 'flags': [
['RTE_MACHINE', '"dpaa"'], ['RTE_MACHINE', '"dpaa"'],
['RTE_LIBRTE_DPAA2_USE_PHYS_IOVA', false], ['RTE_LIBRTE_DPAA2_USE_PHYS_IOVA', false],
['RTE_MAX_LCORE', 16], ['RTE_MAX_LCORE', 16],
['RTE_MAX_NUMA_NODES', 1] ['RTE_MAX_NUMA_NODES', 1]
], ],
'numa': false 'numa': false
} }
soc_emag = { soc_emag = {
'description': 'Ampere eMAG', 'description': 'Ampere eMAG',
'implementer': '0x50', 'implementer': '0x50',
'part_number': '0x0' 'part_number': '0x0'
} }
soc_graviton2 = { soc_graviton2 = {
'description': 'AWS Graviton2', 'description': 'AWS Graviton2',
'implementer': '0x41', 'implementer': '0x41',
'part_number': '0xd0c', 'part_number': '0xd0c',
'numa': false 'numa': false
} }
soc_kunpeng920 = { soc_kunpeng920 = {
'description': 'HiSilicon Kunpeng 920', 'description': 'HiSilicon Kunpeng 920',
'implementer': '0x48', 'implementer': '0x48',
'part_number': '0xd01', 'part_number': '0xd01',
'numa': true 'numa': true
} }
soc_kunpeng930 = { soc_kunpeng930 = {
'description': 'HiSilicon Kunpeng 930', 'description': 'HiSilicon Kunpeng 930',
'implementer': '0x48', 'implementer': '0x48',
'part_number': '0xd02', 'part_number': '0xd02',
'numa': true 'numa': true
} }
soc_n1sdp = { soc_n1sdp = {
'description': 'Arm Neoverse N1SDP', 'description': 'Arm Neoverse N1SDP',
'implementer': '0x41', 'implementer': '0x41',
'part_number': '0xd0c', 'part_number': '0xd0c',
'flags': [ 'flags': [
['RTE_MAX_LCORE', 4] ['RTE_MAX_LCORE', 4]
], ],
'numa': false 'numa': false
} }
soc_n2 = { soc_n2 = {
'description': 'Arm Neoverse N2', 'description': 'Arm Neoverse N2',
'implementer': '0x41', 'implementer': '0x41',
'part_number': '0xd49', 'part_number': '0xd49',
'numa': false 'numa': false
} }
soc_octeontx2 = { soc_octeontx2 = {
'description': 'Marvell OCTEON TX2', 'description': 'Marvell OCTEON TX2',
'implementer': '0x43', 'implementer': '0x43',
'part_number': '0xb2', 'part_number': '0xb2',
'numa': false 'numa': false
} }
soc_stingray = { soc_stingray = {
'description': 'Broadcom Stingray', 'description': 'Broadcom Stingray',
'implementer': '0x41', 'implementer': '0x41',
'flags': [ 'flags': [
['RTE_MAX_LCORE', 16], ['RTE_MAX_LCORE', 16],
['RTE_MAX_NUMA_NODES', 1] ['RTE_MAX_NUMA_NODES', 1]
], ],
'part_number': '0xd08', 'part_number': '0xd08',
'numa': false 'numa': false
} }
soc_thunderx2 = { soc_thunderx2 = {
'description': 'Marvell ThunderX2 T99', 'description': 'Marvell ThunderX2 T99',
'implementer': '0x43', 'implementer': '0x43',
'part_number': '0xaf' 'part_number': '0xaf'
} }
soc_thunderxt88 = { soc_thunderxt88 = {
'description': 'Marvell ThunderX T88', 'description': 'Marvell ThunderX T88',
'implementer': '0x43', 'implementer': '0x43',
'part_number': '0xa1' 'part_number': '0xa1'
} }
socs = { socs = {
'generic': soc_generic, 'generic': soc_generic,
'armada': soc_armada, 'armada': soc_armada,
'bluefield': soc_bluefield, 'bluefield': soc_bluefield,
'cn10k' : soc_cn10k, 'cn10k' : soc_cn10k,
'dpaa': soc_dpaa, 'dpaa': soc_dpaa,
'emag': soc_emag, 'emag': soc_emag,
'graviton2': soc_graviton2, 'graviton2': soc_graviton2,
'kunpeng920': soc_kunpeng920, 'kunpeng920': soc_kunpeng920,
'kunpeng930': soc_kunpeng930, 'kunpeng930': soc_kunpeng930,
'n1sdp': soc_n1sdp, 'n1sdp': soc_n1sdp,
'n2': soc_n2, 'n2': soc_n2,
'octeontx2': soc_octeontx2, 'octeontx2': soc_octeontx2,
'stingray': soc_stingray, 'stingray': soc_stingray,
'thunderx2': soc_thunderx2, 'thunderx2': soc_thunderx2,
'thunderxt88': soc_thunderxt88 'thunderxt88': soc_thunderxt88
} }
dpdk_conf.set('RTE_ARCH_ARM', 1) dpdk_conf.set('RTE_ARCH_ARM', 1)
dpdk_conf.set('RTE_FORCE_INTRINSICS', 1) dpdk_conf.set('RTE_FORCE_INTRINSICS', 1)
if dpdk_conf.get('RTE_ARCH_32') if dpdk_conf.get('RTE_ARCH_32')
# armv7 build # armv7 build
dpdk_conf.set('RTE_CACHE_LINE_SIZE', 64) dpdk_conf.set('RTE_CACHE_LINE_SIZE', 64)
dpdk_conf.set('RTE_ARCH_ARMv7', 1) dpdk_conf.set('RTE_ARCH_ARMv7', 1)
# the minimum architecture supported, armv7-a, needs the following, # the minimum architecture supported, armv7-a, needs the following,
machine_args += '-mfpu=neon' machine_args += '-mfpu=neon'
else else
# aarch64 build # aarch64 build
soc = get_option('platform') soc = get_option('platform')
soc_config = {} soc_config = {}
if not meson.is_cross_build() if not meson.is_cross_build()
if machine == 'generic' if machine == 'generic'
# generic build # generic build
if soc != '' if soc != ''
error('Building for a particular platform is ' + error('Building for a particular platform is unsupported with generic build.')
'unsupported with generic build.') endif
endif implementer_id = 'generic'
implementer_id = 'generic' part_number = 'generic'
part_number = 'generic' elif soc != ''
elif soc != '' soc_config = socs.get(soc, {'not_supported': true})
soc_config = socs.get(soc, {'not_supported': true}) else
else # native build
# native build # The script returns ['Implementer', 'Variant', 'Architecture',
# The script returns ['Implementer', 'Variant', 'Architecture', # 'Primary Part number', 'Revision']
# 'Primary Part number', 'Revision'] detect_vendor = find_program(join_paths(meson.current_source_dir(),
detect_vendor = find_program(join_paths( 'armv8_machine.py'))
meson.current_source_dir(), 'armv8_machine.py')) cmd = run_command(detect_vendor.path())
cmd = run_command(detect_vendor.path()) if cmd.returncode() == 0
if cmd.returncode() == 0 cmd_output = cmd.stdout().to_lower().strip().split(' ')
cmd_output = cmd.stdout().to_lower().strip().split(' ') implementer_id = cmd_output[0]
implementer_id = cmd_output[0] part_number = cmd_output[3]
part_number = cmd_output[3] else
else error('Error when getting Arm Implementer ID and part number.')
error('Error when getting Arm Implementer ID and part number.') endif
endif endif
endif else
else # cross build
# cross build soc = meson.get_cross_property('platform', '')
soc = meson.get_cross_property('platform', '') if soc == ''
if soc == '' error('Arm SoC must be specified in the cross file.')
error('Arm SoC must be specified in the cross file.') endif
endif soc_config = socs.get(soc, {'not_supported': true})
soc_config = socs.get(soc, {'not_supported': true}) endif
endif
soc_flags = [] soc_flags = []
if soc_config.has_key('not_supported') if soc_config.has_key('not_supported')
error('SoC @0@ not supported.'.format(soc)) error('SoC @0@ not supported.'.format(soc))
elif soc_config != {} elif soc_config != {}
implementer_id = soc_config['implementer'] implementer_id = soc_config['implementer']
implementer_config = implementers[implementer_id] implementer_config = implementers[implementer_id]
part_number = soc_config['part_number'] part_number = soc_config['part_number']
soc_flags = soc_config.get('flags', []) soc_flags = soc_config.get('flags', [])
if not soc_config.get('numa', true) if not soc_config.get('numa', true)
has_libnuma = 0 has_libnuma = 0
endif endif
disable_drivers += ',' + soc_config.get('disable_drivers', '') disable_drivers += ',' + soc_config.get('disable_drivers', '')
enable_drivers += ',' + soc_config.get('enable_drivers', '') enable_drivers += ',' + soc_config.get('enable_drivers', '')
endif endif
if implementers.has_key(implementer_id) if implementers.has_key(implementer_id)
implementer_config = implementers[implementer_id] implementer_config = implementers[implementer_id]
else else
error('Unsupported Arm implementer: @0@. '.format(implementer_id) + error('Unsupported Arm implementer: @0@. '.format(implementer_id) +
'Please add support for it or use the generic ' + 'Please add support for it or use the generic ' +
'(-Dmachine=generic) build.') '(-Dmachine=generic) build.')
endif endif
message('Arm implementer: ' + implementer_config['description']) message('Arm implementer: ' + implementer_config['description'])
message('Arm part number: ' + part_number) message('Arm part number: ' + part_number)
part_number_config = implementer_config['part_number_config'] part_number_config = implementer_config['part_number_config']
if part_number_config.has_key(part_number) if part_number_config.has_key(part_number)
# use the specified part_number machine args if found # use the specified part_number machine args if found
part_number_config = part_number_config[part_number] part_number_config = part_number_config[part_number]
else else
# unknown part number # unknown part number
error('Unsupported part number @0@ of implementer @1@. ' error('Unsupported part number @0@ of implementer @1@. '
.format(part_number, implementer_id) + .format(part_number, implementer_id) +
'Please add support for it or use the generic ' + 'Please add support for it or use the generic ' +
'(-Dmachine=generic) build.') '(-Dmachine=generic) build.')
endif endif
# add/overwrite flags in the proper order # add/overwrite flags in the proper order
dpdk_flags = flags_common + implementer_config['flags'] + part_number_config.get('flags', []) + soc_flags dpdk_flags = flags_common + implementer_config['flags'] + part_number_config.get('flags', []) + soc_flags
# apply supported machine args # apply supported machine args
machine_args = [] # Clear previous machine args machine_args = [] # Clear previous machine args
foreach flag: part_number_config['machine_args'] foreach flag: part_number_config['machine_args']
if cc.has_argument(flag) if cc.has_argument(flag)
machine_args += flag machine_args += flag
endif endif
endforeach endforeach
# apply flags # apply flags
foreach flag: dpdk_flags foreach flag: dpdk_flags
if flag.length() > 0 if flag.length() > 0
dpdk_conf.set(flag[0], flag[1]) dpdk_conf.set(flag[0], flag[1])
endif endif
endforeach endforeach
endif endif
message('Using machine args: @0@'.format(machine_args)) message('Using machine args: @0@'.format(machine_args))
if (cc.get_define('__ARM_NEON', args: machine_args) != '' or if (cc.get_define('__ARM_NEON', args: machine_args) != '' or
cc.get_define('__aarch64__', args: machine_args) != '') cc.get_define('__aarch64__', args: machine_args) != '')
compile_time_cpuflags += ['RTE_CPUFLAG_NEON'] compile_time_cpuflags += ['RTE_CPUFLAG_NEON']
endif endif
if cc.get_define('__ARM_FEATURE_CRC32', args: machine_args) != '' if cc.get_define('__ARM_FEATURE_CRC32', args: machine_args) != ''
compile_time_cpuflags += ['RTE_CPUFLAG_CRC32'] compile_time_cpuflags += ['RTE_CPUFLAG_CRC32']
endif endif
if cc.get_define('__ARM_FEATURE_CRYPTO', args: machine_args) != '' if cc.get_define('__ARM_FEATURE_CRYPTO', args: machine_args) != ''
compile_time_cpuflags += ['RTE_CPUFLAG_AES', 'RTE_CPUFLAG_PMULL', compile_time_cpuflags += ['RTE_CPUFLAG_AES', 'RTE_CPUFLAG_PMULL',
'RTE_CPUFLAG_SHA1', 'RTE_CPUFLAG_SHA2'] 'RTE_CPUFLAG_SHA1', 'RTE_CPUFLAG_SHA2']
endif endif

View File

@ -5,13 +5,13 @@
supported_exec_envs = ['freebsd', 'linux', 'windows'] supported_exec_envs = ['freebsd', 'linux', 'windows']
exec_env = host_machine.system() exec_env = host_machine.system()
if not supported_exec_envs.contains(exec_env) if not supported_exec_envs.contains(exec_env)
error('unsupported system type "@0@"'.format(exec_env)) error('unsupported system type "@0@"'.format(exec_env))
endif endif
# define a handy variable for checking which OS we have. # define a handy variable for checking which OS we have.
# gives us "is_windows", "is_freebsd" and "is_linux" # gives us "is_windows", "is_freebsd" and "is_linux"
foreach env:supported_exec_envs foreach env:supported_exec_envs
set_variable('is_' + env, exec_env == env) set_variable('is_' + env, exec_env == env)
endforeach endforeach
# MS linker requires special treatment. # MS linker requires special treatment.
@ -22,8 +22,7 @@ is_ms_linker = is_windows and (cc.get_id() == 'clang')
# depending on the configuration options # depending on the configuration options
pver = meson.project_version().split('.') pver = meson.project_version().split('.')
major_version = '@0@.@1@'.format(pver.get(0), pver.get(1)) major_version = '@0@.@1@'.format(pver.get(0), pver.get(1))
abi_version = run_command(find_program('cat', 'more'), abi_version = run_command(find_program('cat', 'more'), abi_version_file).stdout().strip()
abi_version_file).stdout().strip()
# Libraries have the abi_version as the filename extension # Libraries have the abi_version as the filename extension
# and have the soname be all but the final part of the abi_version. # and have the soname be all but the final part of the abi_version.
@ -35,21 +34,21 @@ so_version = abi_version.split('.')[0]
dpdk_conf.set('RTE_VER_YEAR', pver.get(0).to_int()) dpdk_conf.set('RTE_VER_YEAR', pver.get(0).to_int())
dpdk_conf.set('RTE_VER_MONTH', pver.get(1).to_int()) dpdk_conf.set('RTE_VER_MONTH', pver.get(1).to_int())
if pver.get(2).contains('-rc') if pver.get(2).contains('-rc')
rc_ver = pver.get(2).split('-rc') rc_ver = pver.get(2).split('-rc')
dpdk_conf.set('RTE_VER_MINOR', rc_ver.get(0).to_int()) dpdk_conf.set('RTE_VER_MINOR', rc_ver.get(0).to_int())
dpdk_conf.set_quoted('RTE_VER_SUFFIX', '-rc') dpdk_conf.set_quoted('RTE_VER_SUFFIX', '-rc')
dpdk_conf.set('RTE_VER_RELEASE', rc_ver.get(1).to_int()) dpdk_conf.set('RTE_VER_RELEASE', rc_ver.get(1).to_int())
else else
dpdk_conf.set('RTE_VER_MINOR', pver.get(2).to_int()) dpdk_conf.set('RTE_VER_MINOR', pver.get(2).to_int())
dpdk_conf.set_quoted('RTE_VER_SUFFIX', '') dpdk_conf.set_quoted('RTE_VER_SUFFIX', '')
# for actual, non-rc releases, set the release value to 99 to ensure releases # for actual, non-rc releases, set the release value to 99 to ensure releases
# have higher version numbers than their respective release candidates # have higher version numbers than their respective release candidates
dpdk_conf.set('RTE_VER_RELEASE', 99) dpdk_conf.set('RTE_VER_RELEASE', 99)
endif endif
pmd_subdir_opt = get_option('drivers_install_subdir') pmd_subdir_opt = get_option('drivers_install_subdir')
if pmd_subdir_opt.contains('<VERSION>') if pmd_subdir_opt.contains('<VERSION>')
pmd_subdir_opt = abi_version.join(pmd_subdir_opt.split('<VERSION>')) pmd_subdir_opt = abi_version.join(pmd_subdir_opt.split('<VERSION>'))
endif endif
driver_install_path = join_paths(get_option('libdir'), pmd_subdir_opt) driver_install_path = join_paths(get_option('libdir'), pmd_subdir_opt)
eal_pmd_path = join_paths(get_option('prefix'), driver_install_path) eal_pmd_path = join_paths(get_option('prefix'), driver_install_path)
@ -58,9 +57,8 @@ eal_pmd_path = join_paths(get_option('prefix'), driver_install_path)
# e.g. ixgbe depends on librte_bus_pci. This means that the bus drivers need # e.g. ixgbe depends on librte_bus_pci. This means that the bus drivers need
# to be in the library path, so symlink the drivers from the main lib directory. # to be in the library path, so symlink the drivers from the main lib directory.
if not is_windows if not is_windows
meson.add_install_script('../buildtools/symlink-drivers-solibs.sh', meson.add_install_script('../buildtools/symlink-drivers-solibs.sh',
get_option('libdir'), get_option('libdir'), pmd_subdir_opt)
pmd_subdir_opt)
endif endif
# init disable/enable driver lists that will be populated in different places # init disable/enable driver lists that will be populated in different places
@ -69,9 +67,9 @@ enable_drivers = ''
# set the machine type and cflags for it # set the machine type and cflags for it
if meson.is_cross_build() if meson.is_cross_build()
machine = host_machine.cpu() machine = host_machine.cpu()
else else
machine = get_option('machine') machine = get_option('machine')
endif endif
# machine type 'generic' is special, it selects the per arch agreed common # machine type 'generic' is special, it selects the per arch agreed common
@ -82,17 +80,17 @@ endif
# This can be bumped up by the DPDK project, but it can never be an # This can be bumped up by the DPDK project, but it can never be an
# invariant like 'native' # invariant like 'native'
if machine == 'default' or machine == 'generic' if machine == 'default' or machine == 'generic'
if host_machine.cpu_family().startswith('x86') if host_machine.cpu_family().startswith('x86')
# matches the old pre-meson build systems generic machine # matches the old pre-meson build systems generic machine
machine = 'corei7' machine = 'corei7'
elif host_machine.cpu_family().startswith('arm') elif host_machine.cpu_family().startswith('arm')
machine = 'armv7-a' machine = 'armv7-a'
elif host_machine.cpu_family().startswith('aarch') elif host_machine.cpu_family().startswith('aarch')
# arm64 manages generic config in config/arm/meson.build # arm64 manages generic config in config/arm/meson.build
machine = 'generic' machine = 'generic'
elif host_machine.cpu_family().startswith('ppc') elif host_machine.cpu_family().startswith('ppc')
machine = 'power8' machine = 'power8'
endif endif
endif endif
dpdk_conf.set('RTE_MACHINE', machine) dpdk_conf.set('RTE_MACHINE', machine)
@ -100,10 +98,10 @@ machine_args = []
# ppc64 does not support -march= at all, use -mcpu and -mtune for that # ppc64 does not support -march= at all, use -mcpu and -mtune for that
if host_machine.cpu_family().startswith('ppc') if host_machine.cpu_family().startswith('ppc')
machine_args += '-mcpu=' + machine machine_args += '-mcpu=' + machine
machine_args += '-mtune=' + machine machine_args += '-mtune=' + machine
else else
machine_args += '-march=' + machine machine_args += '-march=' + machine
endif endif
toolchain = cc.get_id() toolchain = cc.get_id()
@ -114,88 +112,88 @@ dpdk_conf.set('RTE_ARCH_64', cc.sizeof('void *') == 8)
dpdk_conf.set('RTE_ARCH_32', cc.sizeof('void *') == 4) dpdk_conf.set('RTE_ARCH_32', cc.sizeof('void *') == 4)
if not is_windows if not is_windows
add_project_link_arguments('-Wl,--no-as-needed', language: 'c') add_project_link_arguments('-Wl,--no-as-needed', language: 'c')
endif endif
# use pthreads if available for the platform # use pthreads if available for the platform
if not is_windows if not is_windows
add_project_link_arguments('-pthread', language: 'c') add_project_link_arguments('-pthread', language: 'c')
dpdk_extra_ldflags += '-pthread' dpdk_extra_ldflags += '-pthread'
endif endif
# on some OS, maths functions are in a separate library # on some OS, maths functions are in a separate library
if cc.find_library('m', required : false).found() if cc.find_library('m', required : false).found()
# some libs depend on maths lib # some libs depend on maths lib
add_project_link_arguments('-lm', language: 'c') add_project_link_arguments('-lm', language: 'c')
dpdk_extra_ldflags += '-lm' dpdk_extra_ldflags += '-lm'
endif endif
if is_linux if is_linux
link_lib = 'dl' link_lib = 'dl'
else else
link_lib = '' link_lib = ''
endif endif
# if link_lib is empty, do not add it to project properties # if link_lib is empty, do not add it to project properties
if link_lib != '' if link_lib != ''
add_project_link_arguments('-l' + link_lib, language: 'c') add_project_link_arguments('-l' + link_lib, language: 'c')
dpdk_extra_ldflags += '-l' + link_lib dpdk_extra_ldflags += '-l' + link_lib
endif endif
# check for libraries used in multiple places in DPDK # check for libraries used in multiple places in DPDK
has_libnuma = 0 has_libnuma = 0
find_libnuma = true find_libnuma = true
if meson.is_cross_build() and not meson.get_cross_property('numa', true) if meson.is_cross_build() and not meson.get_cross_property('numa', true)
# don't look for libnuma if explicitly disabled in cross build # don't look for libnuma if explicitly disabled in cross build
find_libnuma = false find_libnuma = false
endif endif
if find_libnuma if find_libnuma
numa_dep = cc.find_library('numa', required: false) numa_dep = cc.find_library('numa', required: false)
if numa_dep.found() and cc.has_header('numaif.h') if numa_dep.found() and cc.has_header('numaif.h')
dpdk_conf.set10('RTE_HAS_LIBNUMA', true) dpdk_conf.set10('RTE_HAS_LIBNUMA', true)
has_libnuma = 1 has_libnuma = 1
add_project_link_arguments('-lnuma', language: 'c') add_project_link_arguments('-lnuma', language: 'c')
dpdk_extra_ldflags += '-lnuma' dpdk_extra_ldflags += '-lnuma'
endif endif
endif endif
has_libfdt = 0 has_libfdt = 0
fdt_dep = cc.find_library('libfdt', required: false) fdt_dep = cc.find_library('libfdt', required: false)
if fdt_dep.found() and cc.has_header('fdt.h') if fdt_dep.found() and cc.has_header('fdt.h')
dpdk_conf.set10('RTE_HAS_LIBFDT', true) dpdk_conf.set10('RTE_HAS_LIBFDT', true)
has_libfdt = 1 has_libfdt = 1
add_project_link_arguments('-lfdt', language: 'c') add_project_link_arguments('-lfdt', language: 'c')
dpdk_extra_ldflags += '-lfdt' dpdk_extra_ldflags += '-lfdt'
endif endif
libexecinfo = cc.find_library('libexecinfo', required: false) libexecinfo = cc.find_library('libexecinfo', required: false)
if libexecinfo.found() and cc.has_header('execinfo.h') if libexecinfo.found() and cc.has_header('execinfo.h')
add_project_link_arguments('-lexecinfo', language: 'c') add_project_link_arguments('-lexecinfo', language: 'c')
dpdk_extra_ldflags += '-lexecinfo' dpdk_extra_ldflags += '-lexecinfo'
endif endif
# check for libbsd # check for libbsd
libbsd = dependency('libbsd', required: false, method: 'pkg-config') libbsd = dependency('libbsd', required: false, method: 'pkg-config')
if libbsd.found() if libbsd.found()
dpdk_conf.set('RTE_USE_LIBBSD', 1) dpdk_conf.set('RTE_USE_LIBBSD', 1)
endif endif
# check for pcap # check for pcap
pcap_dep = dependency('libpcap', required: false, method: 'pkg-config') pcap_dep = dependency('libpcap', required: false, method: 'pkg-config')
if not pcap_dep.found() if not pcap_dep.found()
# pcap got a pkg-config file only in 1.9.0 # pcap got a pkg-config file only in 1.9.0
pcap_dep = cc.find_library('pcap', required: false) pcap_dep = cc.find_library('pcap', required: false)
endif endif
if pcap_dep.found() and cc.has_header('pcap.h', dependencies: pcap_dep) if pcap_dep.found() and cc.has_header('pcap.h', dependencies: pcap_dep)
dpdk_conf.set('RTE_PORT_PCAP', 1) dpdk_conf.set('RTE_PORT_PCAP', 1)
dpdk_extra_ldflags += '-lpcap' dpdk_extra_ldflags += '-lpcap'
endif endif
# for clang 32-bit compiles we need libatomic for 64-bit atomic ops # for clang 32-bit compiles we need libatomic for 64-bit atomic ops
if cc.get_id() == 'clang' and dpdk_conf.get('RTE_ARCH_64') == false if cc.get_id() == 'clang' and dpdk_conf.get('RTE_ARCH_64') == false
atomic_dep = cc.find_library('atomic', required: true) atomic_dep = cc.find_library('atomic', required: true)
add_project_link_arguments('-latomic', language: 'c') add_project_link_arguments('-latomic', language: 'c')
dpdk_extra_ldflags += '-latomic' dpdk_extra_ldflags += '-latomic'
endif endif
# add -include rte_config to cflags # add -include rte_config to cflags
@ -203,48 +201,48 @@ add_project_arguments('-include', 'rte_config.h', language: 'c')
# enable extra warnings and disable any unwanted warnings # enable extra warnings and disable any unwanted warnings
warning_flags = [ warning_flags = [
# -Wall is added by meson by default, so add -Wextra only # -Wall is added by meson by default, so add -Wextra only
'-Wextra', '-Wextra',
# additional warnings in alphabetical order # additional warnings in alphabetical order
'-Wcast-qual', '-Wcast-qual',
'-Wdeprecated', '-Wdeprecated',
'-Wformat', '-Wformat',
'-Wformat-nonliteral', '-Wformat-nonliteral',
'-Wformat-security', '-Wformat-security',
'-Wmissing-declarations', '-Wmissing-declarations',
'-Wmissing-prototypes', '-Wmissing-prototypes',
'-Wnested-externs', '-Wnested-externs',
'-Wold-style-definition', '-Wold-style-definition',
'-Wpointer-arith', '-Wpointer-arith',
'-Wsign-compare', '-Wsign-compare',
'-Wstrict-prototypes', '-Wstrict-prototypes',
'-Wundef', '-Wundef',
'-Wwrite-strings', '-Wwrite-strings',
# globally disabled warnings # globally disabled warnings
'-Wno-address-of-packed-member', '-Wno-address-of-packed-member',
'-Wno-packed-not-aligned', '-Wno-packed-not-aligned',
'-Wno-missing-field-initializers' '-Wno-missing-field-initializers',
] ]
if cc.get_id() == 'gcc' and cc.version().version_compare('>=10.0') if cc.get_id() == 'gcc' and cc.version().version_compare('>=10.0')
# FIXME: Bugzilla 396 # FIXME: Bugzilla 396
warning_flags += '-Wno-zero-length-bounds' warning_flags += '-Wno-zero-length-bounds'
endif endif
if not dpdk_conf.get('RTE_ARCH_64') if not dpdk_conf.get('RTE_ARCH_64')
# for 32-bit, don't warn about casting a 32-bit pointer to 64-bit int - it's fine!! # for 32-bit, don't warn about casting a 32-bit pointer to 64-bit int - it's fine!!
warning_flags += '-Wno-pointer-to-int-cast' warning_flags += '-Wno-pointer-to-int-cast'
endif endif
if cc.get_id() == 'intel' if cc.get_id() == 'intel'
warning_ids = [181, 188, 2203, 2279, 2557, 3179, 3656] warning_ids = [181, 188, 2203, 2279, 2557, 3179, 3656]
foreach i:warning_ids foreach i:warning_ids
warning_flags += '-diag-disable=@0@'.format(i) warning_flags += '-diag-disable=@0@'.format(i)
endforeach endforeach
endif endif
foreach arg: warning_flags foreach arg: warning_flags
if cc.has_argument(arg) if cc.has_argument(arg)
add_project_arguments(arg, language: 'c') add_project_arguments(arg, language: 'c')
endif endif
endforeach endforeach
# set other values pulled from the build options # set other values pulled from the build options
@ -258,9 +256,9 @@ dpdk_conf.set('RTE_MAX_VFIO_GROUPS', 64)
dpdk_conf.set('RTE_DRIVER_MEMPOOL_BUCKET_SIZE_KB', 64) dpdk_conf.set('RTE_DRIVER_MEMPOOL_BUCKET_SIZE_KB', 64)
dpdk_conf.set('RTE_LIBRTE_DPAA2_USE_PHYS_IOVA', true) dpdk_conf.set('RTE_LIBRTE_DPAA2_USE_PHYS_IOVA', true)
if dpdk_conf.get('RTE_ARCH_64') if dpdk_conf.get('RTE_ARCH_64')
dpdk_conf.set('RTE_MAX_MEM_MB', 524288) dpdk_conf.set('RTE_MAX_MEM_MB', 524288)
else # for 32-bit we need smaller reserved memory areas else # for 32-bit we need smaller reserved memory areas
dpdk_conf.set('RTE_MAX_MEM_MB', 2048) dpdk_conf.set('RTE_MAX_MEM_MB', 2048)
endif endif
@ -270,24 +268,24 @@ dpdk_conf.set('RTE_COMPILE_TIME_CPUFLAGS', ','.join(compile_time_cpuflags))
# apply cross-specific options # apply cross-specific options
if meson.is_cross_build() if meson.is_cross_build()
# configure RTE_MAX_LCORE and RTE_MAX_NUMA_NODES from cross file # configure RTE_MAX_LCORE and RTE_MAX_NUMA_NODES from cross file
cross_max_lcores = meson.get_cross_property('max_lcores', 0) cross_max_lcores = meson.get_cross_property('max_lcores', 0)
if cross_max_lcores != 0 if cross_max_lcores != 0
message('Setting RTE_MAX_LCORE from cross file') message('Setting RTE_MAX_LCORE from cross file')
dpdk_conf.set('RTE_MAX_LCORE', cross_max_lcores) dpdk_conf.set('RTE_MAX_LCORE', cross_max_lcores)
endif endif
cross_max_numa_nodes = meson.get_cross_property('max_numa_nodes', 0) cross_max_numa_nodes = meson.get_cross_property('max_numa_nodes', 0)
if cross_max_numa_nodes != 0 if cross_max_numa_nodes != 0
message('Setting RTE_MAX_NUMA_NODES from cross file') message('Setting RTE_MAX_NUMA_NODES from cross file')
dpdk_conf.set('RTE_MAX_NUMA_NODES', cross_max_numa_nodes) dpdk_conf.set('RTE_MAX_NUMA_NODES', cross_max_numa_nodes)
endif endif
endif endif
# set the install path for the drivers # set the install path for the drivers
dpdk_conf.set_quoted('RTE_EAL_PMD_PATH', eal_pmd_path) dpdk_conf.set_quoted('RTE_EAL_PMD_PATH', eal_pmd_path)
install_headers(['rte_config.h'], install_headers(['rte_config.h'],
subdir: get_option('include_subdir_arch')) subdir: get_option('include_subdir_arch'))
# enable VFIO only if it is linux OS # enable VFIO only if it is linux OS
dpdk_conf.set('RTE_EAL_VFIO', is_linux) dpdk_conf.set('RTE_EAL_VFIO', is_linux)
@ -297,53 +295,53 @@ add_project_arguments('-D_GNU_SOURCE', language: 'c')
# specify -D__BSD_VISIBLE for FreeBSD # specify -D__BSD_VISIBLE for FreeBSD
if is_freebsd if is_freebsd
add_project_arguments('-D__BSD_VISIBLE', language: 'c') add_project_arguments('-D__BSD_VISIBLE', language: 'c')
endif endif
if is_windows if is_windows
# VirtualAlloc2() is available since Windows 10 / Server 2016. # VirtualAlloc2() is available since Windows 10 / Server 2016.
add_project_arguments('-D_WIN32_WINNT=0x0A00', language: 'c') add_project_arguments('-D_WIN32_WINNT=0x0A00', language: 'c')
# Use MinGW-w64 stdio, because DPDK assumes ANSI-compliant formatting. # Use MinGW-w64 stdio, because DPDK assumes ANSI-compliant formatting.
if cc.get_id() == 'gcc' if cc.get_id() == 'gcc'
add_project_arguments('-D__USE_MINGW_ANSI_STDIO', language: 'c') add_project_arguments('-D__USE_MINGW_ANSI_STDIO', language: 'c')
endif endif
# Disable secure CRT deprecated warnings for clang # Disable secure CRT deprecated warnings for clang
if cc.get_id() == 'clang' if cc.get_id() == 'clang'
add_project_arguments('-D_CRT_SECURE_NO_WARNINGS', language: 'c') add_project_arguments('-D_CRT_SECURE_NO_WARNINGS', language: 'c')
endif endif
add_project_link_arguments('-lws2_32', language: 'c') add_project_link_arguments('-lws2_32', language: 'c')
# Contrary to docs, VirtualAlloc2() is exported by mincore.lib # Contrary to docs, VirtualAlloc2() is exported by mincore.lib
# in Windows SDK, while MinGW exports it by advapi32.a. # in Windows SDK, while MinGW exports it by advapi32.a.
if is_ms_linker if is_ms_linker
add_project_link_arguments('-lmincore', language: 'c') add_project_link_arguments('-lmincore', language: 'c')
endif endif
add_project_link_arguments('-ladvapi32', '-lsetupapi', language: 'c') add_project_link_arguments('-ladvapi32', '-lsetupapi', language: 'c')
add_project_link_arguments('-ldbghelp', language: 'c') add_project_link_arguments('-ldbghelp', language: 'c')
endif endif
if get_option('b_lto') if get_option('b_lto')
if cc.has_argument('-ffat-lto-objects') if cc.has_argument('-ffat-lto-objects')
add_project_arguments('-ffat-lto-objects', language: 'c') add_project_arguments('-ffat-lto-objects', language: 'c')
else else
error('compiler does not support fat LTO objects - please turn LTO off') error('compiler does not support fat LTO objects - please turn LTO off')
endif endif
# workaround for gcc bug 81440 # workaround for gcc bug 81440
if cc.get_id() == 'gcc' and cc.version().version_compare('<8.0') if cc.get_id() == 'gcc' and cc.version().version_compare('<8.0')
add_project_arguments('-Wno-lto-type-mismatch', language: 'c') add_project_arguments('-Wno-lto-type-mismatch', language: 'c')
add_project_link_arguments('-Wno-lto-type-mismatch', language: 'c') add_project_link_arguments('-Wno-lto-type-mismatch', language: 'c')
endif endif
endif endif
if get_option('default_library') == 'both' if get_option('default_library') == 'both'
error( ''' error( '''
Unsupported value "both" for "default_library" option. Unsupported value "both" for "default_library" option.
NOTE: DPDK always builds both shared and static libraries. Please set NOTE: DPDK always builds both shared and static libraries. Please set
"default_library" to either "static" or "shared" to select default linkage "default_library" to either "static" or "shared" to select default linkage
for apps and any examples.''') for apps and any examples.''')
endif endif

View File

@ -2,7 +2,7 @@
# Copyright(c) 2018 Luca Boccassi <bluca@debian.org> # Copyright(c) 2018 Luca Boccassi <bluca@debian.org>
if not dpdk_conf.get('RTE_ARCH_64') if not dpdk_conf.get('RTE_ARCH_64')
error('Only 64-bit compiles are supported for this platform type') error('Only 64-bit compiles are supported for this platform type')
endif endif
dpdk_conf.set('RTE_ARCH', 'ppc_64') dpdk_conf.set('RTE_ARCH', 'ppc_64')
dpdk_conf.set('RTE_ARCH_PPC_64', 1) dpdk_conf.set('RTE_ARCH_PPC_64', 1)
@ -12,9 +12,9 @@ dpdk_conf.set('RTE_ARCH_PPC_64', 1)
# is used, resulting in a build failure. # is used, resulting in a build failure.
power9_supported = cc.has_argument('-mcpu=power9') power9_supported = cc.has_argument('-mcpu=power9')
if not power9_supported if not power9_supported
machine = 'power8' machine = 'power8'
machine_args = ['-mcpu=power8', '-mtune=power8'] machine_args = ['-mcpu=power8', '-mtune=power8']
dpdk_conf.set('RTE_MACHINE','power8') dpdk_conf.set('RTE_MACHINE','power8')
endif endif
# overrides specific to ppc64 # overrides specific to ppc64

View File

@ -3,57 +3,57 @@
# get binutils version for the workaround of Bug 97 # get binutils version for the workaround of Bug 97
if not is_windows if not is_windows
binutils_ok = run_command(binutils_avx512_check) binutils_ok = run_command(binutils_avx512_check)
if binutils_ok.returncode() != 0 and cc.has_argument('-mno-avx512f') if binutils_ok.returncode() != 0 and cc.has_argument('-mno-avx512f')
machine_args += '-mno-avx512f' machine_args += '-mno-avx512f'
warning('Binutils error with AVX512 assembly, disabling AVX512 support') warning('Binutils error with AVX512 assembly, disabling AVX512 support')
endif endif
endif endif
# we require SSE4.2 for DPDK # we require SSE4.2 for DPDK
if cc.get_define('__SSE4_2__', args: machine_args) == '' if cc.get_define('__SSE4_2__', args: machine_args) == ''
message('SSE 4.2 not enabled by default, explicitly enabling') message('SSE 4.2 not enabled by default, explicitly enabling')
machine_args += '-msse4' machine_args += '-msse4'
endif endif
base_flags = ['SSE', 'SSE2', 'SSE3','SSSE3', 'SSE4_1', 'SSE4_2'] base_flags = ['SSE', 'SSE2', 'SSE3','SSSE3', 'SSE4_1', 'SSE4_2']
foreach f:base_flags foreach f:base_flags
compile_time_cpuflags += ['RTE_CPUFLAG_' + f] compile_time_cpuflags += ['RTE_CPUFLAG_' + f]
endforeach endforeach
optional_flags = [ optional_flags = [
'AES', 'AES',
'AVX', 'AVX',
'AVX2', 'AVX2',
'AVX512BW', 'AVX512BW',
'AVX512CD', 'AVX512CD',
'AVX512DQ', 'AVX512DQ',
'AVX512F', 'AVX512F',
'AVX512VL', 'AVX512VL',
'PCLMUL', 'PCLMUL',
'RDRND', 'RDRND',
'RDSEED', 'RDSEED',
'VPCLMULQDQ', 'VPCLMULQDQ',
] ]
foreach f:optional_flags foreach f:optional_flags
if cc.get_define('__@0@__'.format(f), args: machine_args) == '1' if cc.get_define('__@0@__'.format(f), args: machine_args) == '1'
if f == 'PCLMUL' # special case flags with different defines if f == 'PCLMUL' # special case flags with different defines
f = 'PCLMULQDQ' f = 'PCLMULQDQ'
elif f == 'RDRND' elif f == 'RDRND'
f = 'RDRAND' f = 'RDRAND'
endif endif
compile_time_cpuflags += ['RTE_CPUFLAG_' + f] compile_time_cpuflags += ['RTE_CPUFLAG_' + f]
endif endif
endforeach endforeach
dpdk_conf.set('RTE_ARCH_X86', 1) dpdk_conf.set('RTE_ARCH_X86', 1)
if dpdk_conf.get('RTE_ARCH_64') if dpdk_conf.get('RTE_ARCH_64')
dpdk_conf.set('RTE_ARCH_X86_64', 1) dpdk_conf.set('RTE_ARCH_X86_64', 1)
dpdk_conf.set('RTE_ARCH', 'x86_64') dpdk_conf.set('RTE_ARCH', 'x86_64')
else else
dpdk_conf.set('RTE_ARCH_I686', 1) dpdk_conf.set('RTE_ARCH_I686', 1)
dpdk_conf.set('RTE_ARCH', 'i686') dpdk_conf.set('RTE_ARCH', 'i686')
endif endif
dpdk_conf.set('RTE_CACHE_LINE_SIZE', 64) dpdk_conf.set('RTE_CACHE_LINE_SIZE', 64)

View File

@ -23,12 +23,12 @@ htmldir = join_paths(get_option('datadir'), 'doc', 'dpdk')
# false it would be impossible to install the docs. # false it would be impossible to install the docs.
# So use a configure option for now. # So use a configure option for now.
example = custom_target('examples.dox', example = custom_target('examples.dox',
output: 'examples.dox', output: 'examples.dox',
command: [generate_examples, join_paths(meson.source_root(), 'examples'), '@OUTPUT@'], command: [generate_examples, join_paths(meson.source_root(), 'examples'), '@OUTPUT@'],
depfile: 'examples.dox.d', depfile: 'examples.dox.d',
install: get_option('enable_docs'), install: get_option('enable_docs'),
install_dir: htmldir, install_dir: htmldir,
build_by_default: get_option('enable_docs')) build_by_default: get_option('enable_docs'))
cdata = configuration_data() cdata = configuration_data()
cdata.set('VERSION', meson.project_version()) cdata.set('VERSION', meson.project_version())
@ -39,23 +39,23 @@ cdata.set('TOPDIR', meson.source_root())
cdata.set('STRIP_FROM_PATH', meson.source_root()) cdata.set('STRIP_FROM_PATH', meson.source_root())
cdata.set('WARN_AS_ERROR', 'NO') cdata.set('WARN_AS_ERROR', 'NO')
if get_option('werror') if get_option('werror')
cdata.set('WARN_AS_ERROR', 'YES') cdata.set('WARN_AS_ERROR', 'YES')
endif endif
doxy_conf = configure_file(input: 'doxy-api.conf.in', doxy_conf = configure_file(input: 'doxy-api.conf.in',
output: 'doxy-api.conf', output: 'doxy-api.conf',
configuration: cdata) configuration: cdata)
doxy_build = custom_target('doxygen', doxy_build = custom_target('doxygen',
depends: example, depends: example,
depend_files: 'doxy-api-index.md', depend_files: 'doxy-api-index.md',
input: doxy_conf, input: doxy_conf,
output: 'html', output: 'html',
depfile: 'html.d', depfile: 'html.d',
command: [generate_doxygen, '@INPUT@', '@OUTPUT@', generate_css], command: [generate_doxygen, '@INPUT@', '@OUTPUT@', generate_css],
install: get_option('enable_docs'), install: get_option('enable_docs'),
install_dir: htmldir, install_dir: htmldir,
build_by_default: get_option('enable_docs')) build_by_default: get_option('enable_docs'))
doc_targets += doxy_build doc_targets += doxy_build
doc_target_names += 'Doxygen_API' doc_target_names += 'Doxygen_API'

View File

@ -4,28 +4,27 @@
sphinx = find_program('sphinx-build', required: get_option('enable_docs')) sphinx = find_program('sphinx-build', required: get_option('enable_docs'))
if not sphinx.found() if not sphinx.found()
subdir_done() subdir_done()
endif endif
extra_sphinx_args = [] extra_sphinx_args = []
if get_option('werror') if get_option('werror')
extra_sphinx_args += '-W' extra_sphinx_args += '-W'
endif endif
htmldir = join_paths(get_option('datadir'), 'doc', 'dpdk') htmldir = join_paths(get_option('datadir'), 'doc', 'dpdk')
html_guides = custom_target('html_guides', html_guides = custom_target('html_guides',
input: files('index.rst'), input: files('index.rst'),
output: 'html', output: 'html',
command: [sphinx_wrapper, sphinx, meson.project_version(), command: [sphinx_wrapper, sphinx, meson.project_version(),
meson.current_source_dir(), meson.current_build_dir(), meson.current_source_dir(), meson.current_build_dir(),
extra_sphinx_args], extra_sphinx_args],
depfile: '.html.d', depfile: '.html.d',
build_by_default: get_option('enable_docs'), build_by_default: get_option('enable_docs'),
install: get_option('enable_docs'), install: get_option('enable_docs'),
install_dir: htmldir) install_dir: htmldir)
install_data(files('custom.css'), install_data(files('custom.css'), install_dir: join_paths(htmldir,'_static', 'css'))
install_dir: join_paths(htmldir,'_static', 'css'))
doc_targets += html_guides doc_targets += html_guides
doc_target_names += 'HTML_Guides' doc_target_names += 'HTML_Guides'

View File

@ -7,9 +7,9 @@ subdir('api')
subdir('guides') subdir('guides')
if doc_targets.length() == 0 if doc_targets.length() == 0
message = 'No docs targets found' message = 'No docs targets found'
else else
message = 'Building docs:' message = 'Building docs:'
endif endif
run_target('doc', command: ['echo', message, doc_target_names], run_target('doc', command: ['echo', message, doc_target_names],
depends: doc_targets) depends: doc_targets)

View File

@ -10,26 +10,26 @@ kmods = ['contigmem', 'nic_uio']
# files from the individual meson.build files, and then use a custom # files from the individual meson.build files, and then use a custom
# target to call make, passing in the values as env parameters. # target to call make, passing in the values as env parameters.
kmod_cflags = ['-I' + meson.build_root(), kmod_cflags = ['-I' + meson.build_root(),
'-I' + join_paths(meson.source_root(), 'config'), '-I' + join_paths(meson.source_root(), 'config'),
'-include rte_config.h'] '-include rte_config.h']
# to avoid warnings due to race conditions with creating the dev_if.h, etc. # to avoid warnings due to race conditions with creating the dev_if.h, etc.
# files, serialize the kernel module builds. Each module will depend on # files, serialize the kernel module builds. Each module will depend on
# previous ones # previous ones
built_kmods = [] built_kmods = []
foreach k:kmods foreach k:kmods
subdir(k) subdir(k)
built_kmods += custom_target(k, built_kmods += custom_target(k,
input: [files('BSDmakefile.meson'), sources], input: [files('BSDmakefile.meson'), sources],
output: k + '.ko', output: k + '.ko',
command: ['make', '-f', '@INPUT0@', command: ['make', '-f', '@INPUT0@',
'KMOD_OBJDIR=@OUTDIR@', 'KMOD_OBJDIR=@OUTDIR@',
'KMOD_SRC=@INPUT1@', 'KMOD_SRC=@INPUT1@',
'KMOD=' + k, 'KMOD=' + k,
'KMOD_CFLAGS=' + ' '.join(kmod_cflags), 'KMOD_CFLAGS=' + ' '.join(kmod_cflags),
'CC=clang'], 'CC=clang'],
depends: built_kmods, # make each module depend on prev depends: built_kmods, # make each module depend on prev
build_by_default: get_option('enable_kmods'), build_by_default: get_option('enable_kmods'),
install: get_option('enable_kmods'), install: get_option('enable_kmods'),
install_dir: '/boot/modules/') install_dir: '/boot/modules/')
endforeach endforeach

View File

@ -2,27 +2,28 @@
# Copyright(c) 2018 Luca Boccassi <bluca@debian.org> # Copyright(c) 2018 Luca Boccassi <bluca@debian.org>
kni_mkfile = custom_target('rte_kni_makefile', kni_mkfile = custom_target('rte_kni_makefile',
output: 'Makefile', output: 'Makefile',
command: ['touch', '@OUTPUT@']) command: ['touch', '@OUTPUT@'])
kni_sources = files( kni_sources = files(
'kni_misc.c', 'kni_misc.c',
'kni_net.c', 'kni_net.c',
'Kbuild') 'Kbuild',
)
custom_target('rte_kni', custom_target('rte_kni',
input: kni_sources, input: kni_sources,
output: 'rte_kni.ko', output: 'rte_kni.ko',
command: ['make', '-j4', '-C', kernel_build_dir, command: ['make', '-j4', '-C', kernel_build_dir,
'M=' + meson.current_build_dir(), 'M=' + meson.current_build_dir(),
'src=' + meson.current_source_dir(), 'src=' + meson.current_source_dir(),
'MODULE_CFLAGS=-include ' + meson.source_root() + '/config/rte_config.h' + 'MODULE_CFLAGS=-include ' + meson.source_root() + '/config/rte_config.h' +
' -I' + meson.source_root() + '/lib/librte_eal/include' + ' -I' + meson.source_root() + '/lib/librte_eal/include' +
' -I' + meson.source_root() + '/lib/librte_kni' + ' -I' + meson.source_root() + '/lib/librte_kni' +
' -I' + meson.build_root() + ' -I' + meson.build_root() +
' -I' + meson.current_source_dir(), ' -I' + meson.current_source_dir(),
'modules'] + cross_args, 'modules'] + cross_args,
depends: kni_mkfile, depends: kni_mkfile,
install: install, install: install,
install_dir: kernel_install_dir, install_dir: kernel_install_dir,
build_by_default: get_option('enable_kmods')) build_by_default: get_option('enable_kmods'))

View File

@ -9,84 +9,83 @@ install = not meson.is_cross_build()
cross_args = [] cross_args = []
if not meson.is_cross_build() if not meson.is_cross_build()
# native build # native build
kernel_version = run_command('uname', '-r').stdout().strip() kernel_version = run_command('uname', '-r').stdout().strip()
kernel_install_dir = '/lib/modules/' + kernel_version + '/extra/dpdk' kernel_install_dir = '/lib/modules/' + kernel_version + '/extra/dpdk'
if kernel_build_dir == '' if kernel_build_dir == ''
# use default path for native builds # use default path for native builds
kernel_build_dir = '/lib/modules/' + kernel_version + '/build' kernel_build_dir = '/lib/modules/' + kernel_version + '/build'
endif endif
# test running make in kernel directory, using "make kernelversion" # test running make in kernel directory, using "make kernelversion"
make_returncode = run_command('make', '-sC', kernel_build_dir, make_returncode = run_command('make', '-sC', kernel_build_dir,
'kernelversion').returncode() 'kernelversion').returncode()
if make_returncode != 0 if make_returncode != 0
# backward compatibility: # backward compatibility:
# the headers could still be in the 'build' subdir # the headers could still be in the 'build' subdir
if not kernel_build_dir.endswith('build') and not kernel_build_dir.endswith('build/') if not kernel_build_dir.endswith('build') and not kernel_build_dir.endswith('build/')
kernel_build_dir = join_paths(kernel_build_dir, 'build') kernel_build_dir = join_paths(kernel_build_dir, 'build')
make_returncode = run_command('make', '-sC', kernel_build_dir, make_returncode = run_command('make', '-sC', kernel_build_dir,
'kernelversion').returncode() 'kernelversion').returncode()
endif endif
endif endif
if make_returncode != 0 if make_returncode != 0
error('Cannot compile kernel modules as requested - are kernel headers installed?') error('Cannot compile kernel modules as requested - are kernel headers installed?')
endif endif
# DO ACTUAL MODULE BUILDING # DO ACTUAL MODULE BUILDING
foreach d:subdirs foreach d:subdirs
subdir(d) subdir(d)
endforeach endforeach
subdir_done() subdir_done()
endif endif
# cross build # cross build
# if we are cross-compiling we need kernel_build_dir specified # if we are cross-compiling we need kernel_build_dir specified
if kernel_build_dir == '' if kernel_build_dir == ''
error('Need "kernel_dir" option for kmod compilation when cross-compiling') error('Need "kernel_dir" option for kmod compilation when cross-compiling')
endif endif
cross_compiler = find_program('c').path() cross_compiler = find_program('c').path()
if cross_compiler.endswith('gcc') if cross_compiler.endswith('gcc')
cross_prefix = run_command([py3, '-c', 'print("' + cross_compiler + '"[:-3])']).stdout().strip() cross_prefix = run_command([py3, '-c', 'print("' + cross_compiler + '"[:-3])']).stdout().strip()
elif cross_compiler.endswith('clang') elif cross_compiler.endswith('clang')
cross_prefix = '' cross_prefix = ''
found_target = false found_target = false
# search for '-target' and use the arg that follows # search for '-target' and use the arg that follows
# (i.e. the value of '-target') as cross_prefix # (i.e. the value of '-target') as cross_prefix
foreach cross_c_arg : meson.get_cross_property('c_args') foreach cross_c_arg : meson.get_cross_property('c_args')
if found_target and cross_prefix == '' if found_target and cross_prefix == ''
cross_prefix = cross_c_arg cross_prefix = cross_c_arg
endif endif
if cross_c_arg == '-target' if cross_c_arg == '-target'
found_target = true found_target = true
endif endif
endforeach endforeach
if cross_prefix == '' if cross_prefix == ''
error('Didn\'t find -target and its value in' + error('Did not find -target and its value in c_args in input cross-file.')
' c_args in input cross-file.') endif
endif linker = 'lld'
linker = 'lld' foreach cross_c_link_arg : meson.get_cross_property('c_link_args')
foreach cross_c_link_arg : meson.get_cross_property('c_link_args') if cross_c_link_arg.startswith('-fuse-ld')
if cross_c_link_arg.startswith('-fuse-ld') linker = cross_c_link_arg.split('=')[1]
linker = cross_c_link_arg.split('=')[1] endif
endif endforeach
endforeach cross_args += ['CC=@0@'.format(cross_compiler), 'LD=ld.@0@'.format(linker)]
cross_args += ['CC=@0@'.format(cross_compiler), 'LD=ld.@0@'.format(linker)]
else else
error('Unsupported cross compiler: @0@'.format(cross_compiler)) error('Unsupported cross compiler: @0@'.format(cross_compiler))
endif endif
cross_arch = host_machine.cpu_family() cross_arch = host_machine.cpu_family()
if host_machine.cpu_family() == 'aarch64' if host_machine.cpu_family() == 'aarch64'
cross_arch = 'arm64' cross_arch = 'arm64'
endif endif
cross_args += ['ARCH=@0@'.format(cross_arch), cross_args += ['ARCH=@0@'.format(cross_arch),
'CROSS_COMPILE=@0@'.format(cross_prefix)] 'CROSS_COMPILE=@0@'.format(cross_prefix)]
# DO ACTUAL MODULE BUILDING # DO ACTUAL MODULE BUILDING
foreach d:subdirs foreach d:subdirs
subdir(d) subdir(d)
endforeach endforeach

View File

@ -2,27 +2,27 @@
# Copyright(c) 2017-2019 Intel Corporation # Copyright(c) 2017-2019 Intel Corporation
project('DPDK', 'C', project('DPDK', 'C',
# Get version number from file. # Get version number from file.
# Fallback to "more" for Windows compatibility. # Fallback to "more" for Windows compatibility.
version: run_command(find_program('cat', 'more'), version: run_command(find_program('cat', 'more'),
files('VERSION')).stdout().strip(), files('VERSION')).stdout().strip(),
license: 'BSD', license: 'BSD',
default_options: ['buildtype=release', 'default_library=static'], default_options: ['buildtype=release', 'default_library=static'],
meson_version: '>= 0.49.2' meson_version: '>= 0.49.2'
) )
# check for developer mode # check for developer mode
developer_mode = false developer_mode = false
if get_option('developer_mode').auto() if get_option('developer_mode').auto()
if meson.version().version_compare('>=0.53') # fs module available if meson.version().version_compare('>=0.53') # fs module available
fs = import('fs') fs = import('fs')
developer_mode = fs.is_dir('.git') developer_mode = fs.is_dir('.git')
endif endif
else else
developer_mode = get_option('developer_mode').enabled() developer_mode = get_option('developer_mode').enabled()
endif endif
if developer_mode if developer_mode
message('## Building in Developer Mode ##') message('## Building in Developer Mode ##')
endif endif
# set up some global vars for compiler, platform, configuration, etc. # set up some global vars for compiler, platform, configuration, etc.
@ -39,20 +39,20 @@ dpdk_drvs_disabled = []
abi_version_file = files('ABI_VERSION') abi_version_file = files('ABI_VERSION')
if host_machine.cpu_family().startswith('x86') if host_machine.cpu_family().startswith('x86')
arch_subdir = 'x86' arch_subdir = 'x86'
elif host_machine.cpu_family().startswith('arm') or host_machine.cpu_family().startswith('aarch') elif host_machine.cpu_family().startswith('arm') or host_machine.cpu_family().startswith('aarch')
arch_subdir = 'arm' arch_subdir = 'arm'
elif host_machine.cpu_family().startswith('ppc') elif host_machine.cpu_family().startswith('ppc')
arch_subdir = 'ppc' arch_subdir = 'ppc'
endif endif
# configure the build, and make sure configs here and in config folder are # configure the build, and make sure configs here and in config folder are
# able to be included in any file. We also store a global array of include dirs # able to be included in any file. We also store a global array of include dirs
# for passing to pmdinfogen scripts # for passing to pmdinfogen scripts
global_inc = include_directories('.', 'config', global_inc = include_directories('.', 'config',
'lib/librte_eal/include', 'lib/librte_eal/include',
'lib/librte_eal/@0@/include'.format(host_machine.system()), 'lib/librte_eal/@0@/include'.format(host_machine.system()),
'lib/librte_eal/@0@/include'.format(arch_subdir), 'lib/librte_eal/@0@/include'.format(arch_subdir),
) )
# do configuration and get tool paths # do configuration and get tool paths
@ -74,25 +74,25 @@ subdir('doc')
# install any example code into the appropriate install path # install any example code into the appropriate install path
subdir('examples') subdir('examples')
install_subdir('examples', install_subdir('examples',
install_dir: get_option('datadir') + '/dpdk', install_dir: get_option('datadir') + '/dpdk',
exclude_files: ex_file_excludes) exclude_files: ex_file_excludes)
# build kernel modules if enabled # build kernel modules if enabled
if get_option('enable_kmods') if get_option('enable_kmods')
subdir('kernel') subdir('kernel')
endif endif
# check header includes if requested # check header includes if requested
if get_option('check_includes') if get_option('check_includes')
subdir('buildtools/chkincs') subdir('buildtools/chkincs')
endif endif
# write the build config # write the build config
build_cfg = 'rte_build_config.h' build_cfg = 'rte_build_config.h'
configure_file(output: build_cfg, configure_file(output: build_cfg,
configuration: dpdk_conf, configuration: dpdk_conf,
install_dir: join_paths(get_option('includedir'), install_dir: join_paths(get_option('includedir'),
get_option('include_subdir_arch'))) get_option('include_subdir_arch')))
# build pkg-config files for dpdk # build pkg-config files for dpdk
subdir('buildtools/pkg-config') subdir('buildtools/pkg-config')
@ -103,40 +103,40 @@ output_message = '\n=================\nLibraries Enabled\n=================\n'
output_message += '\nlibs:\n\t' output_message += '\nlibs:\n\t'
output_count = 0 output_count = 0
foreach lib:enabled_libs foreach lib:enabled_libs
output_message += lib + ', ' output_message += lib + ', '
output_count += 1 output_count += 1
if output_count == 8 if output_count == 8
output_message += '\n\t' output_message += '\n\t'
output_count = 0 output_count = 0
endif endif
endforeach endforeach
message(output_message + '\n') message(output_message + '\n')
output_message = '\n===============\nDrivers Enabled\n===============\n' output_message = '\n===============\nDrivers Enabled\n===============\n'
foreach class:dpdk_driver_classes foreach class:dpdk_driver_classes
class_drivers = get_variable(class + '_drivers') class_drivers = get_variable(class + '_drivers')
output_message += '\n' + class + ':\n\t' output_message += '\n' + class + ':\n\t'
output_count = 0 output_count = 0
foreach drv:class_drivers foreach drv:class_drivers
output_message += drv + ', ' output_message += drv + ', '
output_count += 1 output_count += 1
if output_count == 8 if output_count == 8
output_message += '\n\t' output_message += '\n\t'
output_count = 0 output_count = 0
endif endif
endforeach endforeach
endforeach endforeach
message(output_message + '\n') message(output_message + '\n')
output_message = '\n=================\nContent Skipped\n=================\n' output_message = '\n=================\nContent Skipped\n=================\n'
output_message += '\nlibs:\n\t' output_message += '\nlibs:\n\t'
foreach lib:dpdk_libs_disabled foreach lib:dpdk_libs_disabled
reason = get_variable(lib.underscorify() + '_disable_reason') reason = get_variable(lib.underscorify() + '_disable_reason')
output_message += lib + ':\t' + reason + '\n\t' output_message += lib + ':\t' + reason + '\n\t'
endforeach endforeach
output_message += '\ndrivers:\n\t' output_message += '\ndrivers:\n\t'
foreach drv:dpdk_drvs_disabled foreach drv:dpdk_drvs_disabled
reason = get_variable(drv.underscorify() + '_disable_reason') reason = get_variable(drv.underscorify() + '_disable_reason')
output_message += drv + ':\t' + reason + '\n\t' output_message += drv + ':\t' + reason + '\n\t'
endforeach endforeach
message(output_message + '\n') message(output_message + '\n')

View File

@ -1,44 +1,44 @@
# Please keep these options sorted alphabetically. # Please keep these options sorted alphabetically.
option('check_includes', type: 'boolean', value: false, option('check_includes', type: 'boolean', value: false, description:
description: 'build "chkincs" to verify each header file can compile alone') 'build "chkincs" to verify each header file can compile alone')
option('developer_mode', type: 'feature', option('developer_mode', type: 'feature', description:
description: 'turn on additional build checks relevant for DPDK developers') 'turn on additional build checks relevant for DPDK developers')
option('disable_drivers', type: 'string', value: '', option('disable_drivers', type: 'string', value: '', description:
description: 'Comma-separated list of drivers to explicitly disable.') 'Comma-separated list of drivers to explicitly disable.')
option('drivers_install_subdir', type: 'string', value: 'dpdk/pmds-<VERSION>', option('drivers_install_subdir', type: 'string', value: 'dpdk/pmds-<VERSION>', description:
description: 'Subdirectory of libdir where to install PMDs. Defaults to using a versioned subdirectory.') 'Subdirectory of libdir where to install PMDs. Defaults to using a versioned subdirectory.')
option('enable_docs', type: 'boolean', value: false, option('enable_docs', type: 'boolean', value: false, description:
description: 'build documentation') 'build documentation')
option('enable_drivers', type: 'string', value: '', option('enable_drivers', type: 'string', value: '', description:
description: 'Comma-separated list of drivers to build. If unspecified, build all drivers.') 'Comma-separated list of drivers to build. If unspecified, build all drivers.')
option('enable_driver_sdk', type: 'boolean', value: false, option('enable_driver_sdk', type: 'boolean', value: false, description:
description: 'Install headers to build drivers.') 'Install headers to build drivers.')
option('enable_kmods', type: 'boolean', value: false, option('enable_kmods', type: 'boolean', value: false, description:
description: 'build kernel modules') 'build kernel modules')
option('examples', type: 'string', value: '', option('examples', type: 'string', value: '', description:
description: 'Comma-separated list of examples to build by default') 'Comma-separated list of examples to build by default')
option('flexran_sdk', type: 'string', value: '', option('flexran_sdk', type: 'string', value: '', description:
description: 'Path to FlexRAN SDK optional Libraries for BBDEV device') 'Path to FlexRAN SDK optional Libraries for BBDEV device')
option('ibverbs_link', type: 'combo', choices : ['static', 'shared', 'dlopen'], value: 'shared', option('ibverbs_link', type: 'combo', choices : ['static', 'shared', 'dlopen'], value: 'shared', description:
description: 'Linkage method (static/shared/dlopen) for Mellanox PMDs with ibverbs dependencies.') 'Linkage method (static/shared/dlopen) for Mellanox PMDs with ibverbs dependencies.')
option('include_subdir_arch', type: 'string', value: '', option('include_subdir_arch', type: 'string', value: '', description:
description: 'subdirectory where to install arch-dependent headers') 'subdirectory where to install arch-dependent headers')
option('kernel_dir', type: 'string', value: '', option('kernel_dir', type: 'string', value: '', description:
description: 'Path to the kernel for building kernel modules. Headers must be in $kernel_dir or $kernel_dir/build. Modules will be installed in /lib/modules.') 'Path to the kernel for building kernel modules. Headers must be in $kernel_dir or $kernel_dir/build. Modules will be installed in /lib/modules.')
option('machine', type: 'string', value: 'native', option('machine', type: 'string', value: 'native', description:
description: 'set the target machine type or "generic", a build usable on all machines of the build machine architecture or "native", which lets the compiler pick the architecture of the build machine.') 'set the target machine type or "generic", a build usable on all machines of the build machine architecture or "native", which lets the compiler pick the architecture of the build machine.')
option('max_ethports', type: 'integer', value: 32, option('max_ethports', type: 'integer', value: 32, description:
description: 'maximum number of Ethernet devices') 'maximum number of Ethernet devices')
option('max_lcores', type: 'integer', value: 128, option('max_lcores', type: 'integer', value: 128, description:
description: 'maximum number of cores/threads supported by EAL') 'maximum number of cores/threads supported by EAL')
option('max_numa_nodes', type: 'integer', value: 32, option('max_numa_nodes', type: 'integer', value: 32, description:
description: 'maximum number of NUMA nodes supported by EAL') 'maximum number of NUMA nodes supported by EAL')
option('platform', type: 'string', value: '', option('platform', type: 'string', value: '', description:
description: 'use configuration for a particular platform (such as a SoC).') 'use configuration for a particular platform (such as a SoC).')
option('enable_trace_fp', type: 'boolean', value: false, option('enable_trace_fp', type: 'boolean', value: false, description:
description: 'enable fast path trace points.') 'enable fast path trace points.')
option('tests', type: 'boolean', value: true, option('tests', type: 'boolean', value: true, description:
description: 'build unit tests') 'build unit tests')
option('use_hpet', type: 'boolean', value: false, option('use_hpet', type: 'boolean', value: false, description:
description: 'use HPET timer in EAL') 'use HPET timer in EAL')

View File

@ -2,8 +2,9 @@
# Copyright(c) 2017 Intel Corporation # Copyright(c) 2017 Intel Corporation
install_data([ install_data([
'dpdk-devbind.py', 'dpdk-devbind.py',
'dpdk-pmdinfo.py', 'dpdk-pmdinfo.py',
'dpdk-telemetry.py', 'dpdk-telemetry.py',
'dpdk-hugepages.py' 'dpdk-hugepages.py',
],install_dir: 'bin') ],
install_dir: 'bin')