1# SPDX-License-Identifier: BSD-3-Clause 2# Copyright(c) 2017-2022 Intel Corporation 3 4if is_windows 5 build = false 6 reason = 'not supported on Windows' 7 subdir_done() 8endif 9 10qat_crypto = true 11qat_crypto_path = 'crypto/qat' 12qat_crypto_relpath = '../../' + qat_crypto_path 13qat_compress = true 14qat_compress_path = 'compress/qat' 15qat_compress_relpath = '../../' + qat_compress_path 16 17if disable_drivers.contains(qat_crypto_path) 18 qat_crypto = false 19 dpdk_drvs_disabled += qat_crypto_path 20 set_variable('drv_' + qat_crypto_path.underscorify() + '_disable_reason', 21 'Explicitly disabled via build config') 22endif 23if disable_drivers.contains(qat_compress_path) 24 qat_compress = false 25 dpdk_drvs_disabled += qat_compress_path 26 set_variable('drv_' + qat_compress_path.underscorify() + '_disable_reason', 27 'Explicitly disabled via build config') 28endif 29 30libcrypto = dependency('libcrypto', required: false, method: 'pkg-config') 31 32if arch_subdir == 'arm' 33 if libcrypto.found() 34 ext_deps += libcrypto 35 dpdk_conf.set('RTE_QAT_OPENSSL', true) 36 else 37 qat_crypto = false 38 dpdk_drvs_disabled += qat_crypto_path 39 set_variable('drv_' + qat_crypto_path.underscorify() + '_disable_reason', 40 'missing dependency for Arm, libcrypto') 41 endif 42else 43 IMB_required_ver = '1.4.0' 44 IMB_header = '#include<intel-ipsec-mb.h>' 45 libipsecmb = cc.find_library('IPSec_MB', required: false) 46 if libipsecmb.found() and cc.links( 47 'int main(void) {return 0;}', dependencies: libipsecmb) 48 # version comes with quotes, so we split based on " and take the middle 49 imb_ver = cc.get_define('IMB_VERSION_STR', 50 prefix : IMB_header).split('"')[1] 51 52 if (imb_ver.version_compare('>=' + IMB_required_ver)) 53 ext_deps += libipsecmb 54 elif libcrypto.found() 55 ext_deps += libcrypto 56 dpdk_conf.set('RTE_QAT_OPENSSL', true) 57 else 58 qat_crypto = false 59 dpdk_drvs_disabled += qat_crypto_path 60 set_variable('drv_' + qat_crypto_path.underscorify() + '_disable_reason', 61 'missing dependency, libipsecmb or libcrypto') 62 endif 63 elif libcrypto.found() 64 ext_deps += libcrypto 65 dpdk_conf.set('RTE_QAT_OPENSSL', true) 66 else 67 qat_crypto = false 68 dpdk_drvs_disabled += qat_crypto_path 69 set_variable('drv_' + qat_crypto_path.underscorify() + '_disable_reason', 70 'missing dependency, libipsecmb or libcrypto') 71 endif 72endif 73 74deps += ['bus_pci', 'cryptodev', 'net', 'compressdev'] 75sources += files( 76 'qat_common.c', 77 'qat_qp.c', 78 'qat_device.c', 79 'qat_logs.c', 80 'qat_pf2vf.c', 81 'dev/qat_dev_gen1.c', 82 'dev/qat_dev_gen2.c', 83 'dev/qat_dev_gen3.c', 84 'dev/qat_dev_gen4.c', 85 'dev/qat_dev_gen5.c', 86 'dev/qat_dev_gen_lce.c', 87) 88includes += include_directories( 89 'qat_adf', 90 qat_crypto_relpath, 91 qat_compress_relpath, 92) 93 94if qat_compress 95 foreach f: ['qat_comp_pmd.c', 'qat_comp.c', 96 'dev/qat_comp_pmd_gen1.c', 97 'dev/qat_comp_pmd_gen2.c', 98 'dev/qat_comp_pmd_gen3.c', 99 'dev/qat_comp_pmd_gen4.c', 100 'dev/qat_comp_pmd_gen5.c', 101 ] 102 sources += files(join_paths(qat_compress_relpath, f)) 103 endforeach 104endif 105 106if qat_crypto 107 foreach f: ['qat_sym.c', 'qat_sym_session.c', 108 'qat_asym.c', 'qat_crypto.c', 109 'dev/qat_sym_pmd_gen1.c', 110 'dev/qat_asym_pmd_gen1.c', 111 'dev/qat_crypto_pmd_gen2.c', 112 'dev/qat_crypto_pmd_gen3.c', 113 'dev/qat_crypto_pmd_gen4.c', 114 'dev/qat_crypto_pmd_gen5.c', 115 'dev/qat_crypto_pmd_gen_lce.c', 116 ] 117 sources += files(join_paths(qat_crypto_relpath, f)) 118 endforeach 119 deps += ['security'] 120 cflags += ['-DBUILD_QAT_SYM', '-DBUILD_QAT_ASYM'] 121endif 122