# for checking defines we need to use the correct compiler flags
march_opt = '-march=@0@'.format(machine)
-dpdk_conf.set('RTE_FORCE_INTRINSICS', 1)
-if cc.sizeof('void *') == 8
- dpdk_conf.set('RTE_CACHE_LINE_SIZE', 128)
- dpdk_conf.set('RTE_ARCH_ARM64', 1)
- dpdk_conf.set('RTE_ARCH_64', 1)
+machine_args_generic = [
+ ['default', ['-march=armv8-a+crc+crypto']]]
+machine_args_cavium = [
+ ['default', ['-march=armv8-a+crc+crypto','-mcpu=thunderx']],
+ ['0xa1', ['-mcpu=thunderxt88']],
+ ['0xa2', ['-mcpu=thunderxt81']],
+ ['0xa3', ['-mcpu=thunderxt83']]]
+
+flags_generic = [[]]
+flags_cavium = [
+ ['RTE_MACHINE', '"thunderx"'],
+ ['RTE_CACHE_LINE_SIZE', 128],
+ ['RTE_MAX_NUMA_NODES', 2],
+ ['RTE_MAX_LCORE', 96],
+ ['RTE_MAX_VFIO_GROUPS', 128],
+ ['RTE_RING_USE_C11_MEM_MODEL', false]]
+
+impl_generic = ['Generic armv8', flags_generic, machine_args_generic]
+impl_0x43 = ['Cavium', flags_cavium, machine_args_cavium]
+
+if cc.get_define('__clang__') != ''
+ dpdk_conf.set_quoted('RTE_TOOLCHAIN', 'clang')
+ dpdk_conf.set('RTE_TOOLCHAIN_CLANG', 1)
else
+ dpdk_conf.set_quoted('RTE_TOOLCHAIN', 'gcc')
+ dpdk_conf.set('RTE_TOOLCHAIN_GCC', 1)
+endif
+
+dpdk_conf.set('RTE_FORCE_INTRINSICS', 1)
+
+if cc.sizeof('void *') != 8
dpdk_conf.set('RTE_CACHE_LINE_SIZE', 64)
dpdk_conf.set('RTE_ARCH_ARM', 1)
dpdk_conf.set('RTE_ARCH_ARMv7', 1)
+else
+ dpdk_conf.set('RTE_CACHE_LINE_SIZE', 128)
+ dpdk_conf.set('RTE_ARCH_ARM64', 1)
+ dpdk_conf.set('RTE_ARCH_64', 1)
+
+ machine = []
+ cmd_generic = ['generic', '', '', 'default', '']
+ cmd_output = cmd_generic # Set generic by default
+ machine_args = [] # Clear previous machine args
+ if not meson.is_cross_build()
+ # The script returns ['Implementer', 'Variant', 'Architecture',
+ # 'Primary Part number', 'Revision']
+ detect_vendor = find_program(join_paths(
+ meson.current_source_dir(), 'armv8_machine.py'))
+ cmd = run_command(detect_vendor.path())
+ if cmd.returncode() == 0
+ cmd_output = cmd.stdout().strip().split(' ')
+ endif
+ # Set to generic if variable is not found
+ machine = get_variable('impl_' + cmd_output[0], 'generic')
+ else
+ impl_id = meson.get_cross_property('implementor_id', 'generic')
+ machine = get_variable('impl_' + impl_id)
+ endif
+
+ if machine == 'generic'
+ machine = impl_generic
+ cmd_output = cmd_generic
+ endif
+
+ message('Implementer : ' + machine[0])
+ foreach flag: machine[1]
+ if flag.length() > 0
+ dpdk_conf.set(flag[0], flag[1])
+ endif
+ endforeach
+ # Primary part number based mcpu flags are supported
+ # for gcc versions > 7
+ if cc.version().version_compare(
+ '<7.0') or cmd_output.length() == 0
+ foreach marg: machine[2]
+ if marg[0] == 'default'
+ foreach f: marg[1]
+ machine_args += f
+ endforeach
+ endif
+ endforeach
+ else
+ foreach marg: machine[2]
+ if marg[0] == cmd_output[3]
+ foreach f: marg[1]
+ machine_args += f
+ endforeach
+ endif
+ endforeach
+ endif
endif
+message(machine_args)
-if cc.get_define('__ARM_NEON', args: march_opt) != ''
+if cc.get_define('__ARM_NEON', args: machine_args) != ''
dpdk_conf.set('RTE_MACHINE_CPUFLAG_NEON', 1)
compile_time_cpuflags += ['RTE_CPUFLAG_NEON']
endif
-if cc.get_define('__ARM_FEATURE_CRC32', args: march_opt) != ''
+if cc.get_define('__ARM_FEATURE_CRC32', args: machine_args) != ''
dpdk_conf.set('RTE_MACHINE_CPUFLAG_CRC32', 1)
compile_time_cpuflags += ['RTE_CPUFLAG_CRC32']
endif
-if cc.get_define('__ARM_FEATURE_CRYPTO', args: march_opt) != ''
+if cc.get_define('__ARM_FEATURE_CRYPTO', args: machine_args) != ''
dpdk_conf.set('RTE_MACHINE_CPUFLAG_AES', 1)
dpdk_conf.set('RTE_MACHINE_CPUFLAG_PMULL', 1)
dpdk_conf.set('RTE_MACHINE_CPUFLAG_SHA1', 1)
machine = get_option('machine')
endif
dpdk_conf.set('RTE_MACHINE', machine)
-machine_arg = '-march=' + machine
+machine_args = []
+machine_args += '-march=' + machine
# use pthreads
add_project_link_arguments('-pthread', language: 'c')
endif
endforeach
+# set other values pulled from the build options
+dpdk_conf.set('RTE_MAX_LCORE', get_option('max_lcores'))
+dpdk_conf.set('RTE_MAX_NUMA_NODES', get_option('max_numa_nodes'))
+dpdk_conf.set('RTE_LIBEAL_USE_HPET', get_option('use_hpet'))
+dpdk_conf.set('RTE_EAL_ALLOW_INV_SOCKET_ID', get_option('allow_invalid_socket_id'))
+# values which have defaults which may be overridden
+dpdk_conf.set('RTE_MAX_VFIO_GROUPS', 64)
+
compile_time_cpuflags = []
if host_machine.cpu_family().startswith('x86')
arch_subdir = 'x86'
# set the install path for the drivers
dpdk_conf.set_quoted('RTE_EAL_PMD_PATH', eal_pmd_path)
-# set other values pulled from the build options
-dpdk_conf.set('RTE_MAX_LCORE', get_option('max_lcores'))
-dpdk_conf.set('RTE_MAX_NUMA_NODES', get_option('max_numa_nodes'))
-dpdk_conf.set('RTE_LIBEAL_USE_HPET', get_option('use_hpet'))
-dpdk_conf.set('RTE_EAL_ALLOW_INV_SOCKET_ID', get_option('allow_invalid_socket_id'))
-# values which have defaults which may be overridden
-dpdk_conf.set('RTE_MAX_VFIO_GROUPS', 64)
-
install_headers('rte_config.h', subdir: get_option('include_subdir_arch'))