common/qat: build drivers from common folder
authorBruce Richardson <bruce.richardson@intel.com>
Thu, 15 Oct 2020 15:05:50 +0000 (16:05 +0100)
committerThomas Monjalon <thomas@monjalon.net>
Mon, 19 Oct 2020 20:12:48 +0000 (22:12 +0200)
Since the drivers in the common directory can be processed out of order, in
this case following the "bus" directory, we can simplify somewhat the build
of the QAT driver to be done entirely from the "common/qat" folder rather
than having it's build distributed across 3 folders.

This also opens up the possibility of building the QAT driver with crypto
only and the compression part disabled. It further allows more sensible
naming of the resulting shared library in case of standardizing library
names based on device class; i.e. common_qat is more descriptive for a
combined crypto/compression driver than either of the other two prefixes
individually.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Luca Boccassi <bluca@debian.org>
drivers/common/meson.build
drivers/common/qat/meson.build
drivers/common/qat/rte_common_qat_version.map [new file with mode: 0644]
drivers/compress/meson.build
drivers/compress/qat/meson.build [deleted file]
drivers/compress/qat/rte_pmd_qat_version.map [deleted file]
drivers/crypto/meson.build
drivers/meson.build

index 7ac1ca7..abb4f15 100644 (file)
@@ -6,6 +6,6 @@ if is_windows
 endif
 
 std_deps = ['eal']
-drivers = ['cpt', 'dpaax', 'iavf', 'mvep', 'octeontx', 'octeontx2', 'qat', 'sfc_efx']
+drivers = ['cpt', 'dpaax', 'iavf', 'mvep', 'octeontx', 'octeontx2', 'sfc_efx']
 config_flag_fmt = 'RTE_LIBRTE_@0@_COMMON'
 driver_name_fmt = 'rte_common_@0@'
index 8de2492..a94182c 100644 (file)
@@ -1,15 +1,66 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017-2018 Intel Corporation
 
-# This does not build a driver, but instead holds common files for
-# the crypto and compression drivers.
-build = false
-reason = '' # sentinal value to suppress printout
-qat_deps = ['bus_pci']
-qat_sources = files('qat_common.c',
+config_flag_fmt = 'RTE_LIBRTE_@0@_COMMON'
+driver_name_fmt = 'rte_common_@0@'
+
+qat_crypto = true
+qat_crypto_path = 'crypto/qat'
+qat_crypto_relpath = '../../' + qat_crypto_path
+qat_compress = true
+qat_compress_path = 'compress/qat'
+qat_compress_relpath = '../../' + qat_compress_path
+
+if disabled_drivers.contains(qat_crypto_path)
+       qat_crypto = false
+       dpdk_drvs_disabled += qat_crypto_path
+       set_variable(qat_crypto_path.underscorify() + '_disable_reason',
+                       'Explicitly disabled via build config')
+endif
+if disabled_drivers.contains(qat_compress_path)
+       qat_compress = false
+       dpdk_drvs_disabled += qat_compress_path
+       set_variable(qat_compress_path.underscorify() + '_disable_reason',
+                       'Explicitly disabled via build config')
+endif
+
+libcrypto = dependency('libcrypto', required: false)
+if qat_crypto and not libcrypto.found()
+       qat_crypto = false
+       dpdk_drvs_disabled += qat_crypto_path
+       set_variable(qat_crypto_path.underscorify() + '_disable_reason',
+                       'missing dependency, libcrypto')
+endif
+
+# The driver should not build if both compression and crypto are disabled
+#FIXME common code depends on compression files so check only compress!
+if not qat_compress # and not qat_crypto
+       build = false
+       reason = '' # rely on reason for compress/crypto above
+       subdir_done()
+endif
+
+deps += ['bus_pci', 'cryptodev', 'net', 'compressdev']
+sources += files('qat_common.c',
                'qat_qp.c',
                'qat_device.c',
                'qat_logs.c')
-qat_includes = [include_directories('.', 'qat_adf')]
-qat_ext_deps = []
-qat_cflags = []
+includes += include_directories('qat_adf',
+               qat_crypto_relpath,
+               qat_compress_relpath)
+
+if qat_compress
+       foreach f: ['qat_comp_pmd.c', 'qat_comp.c']
+               sources += files(join_paths(qat_compress_relpath, f))
+       endforeach
+endif
+
+if qat_crypto
+       foreach f: ['qat_sym_pmd.c', 'qat_sym.c', 'qat_sym_session.c',
+                       'qat_sym_hw_dp.c', 'qat_asym_pmd.c', 'qat_asym.c']
+               sources += files(join_paths(qat_crypto_relpath, f))
+       endforeach
+       deps += ['security']
+       ext_deps += libcrypto
+       cflags += ['-DBUILD_QAT_SYM', '-DBUILD_QAT_ASYM']
+endif
diff --git a/drivers/common/qat/rte_common_qat_version.map b/drivers/common/qat/rte_common_qat_version.map
new file mode 100644 (file)
index 0000000..4a76d1d
--- /dev/null
@@ -0,0 +1,3 @@
+DPDK_21 {
+       local: *;
+};
index bea1720..3a4723c 100644 (file)
@@ -5,7 +5,7 @@ if is_windows
        subdir_done()
 endif
 
-drivers = ['isal', 'octeontx', 'qat', 'zlib']
+drivers = ['isal', 'octeontx', 'zlib']
 
 std_deps = ['compressdev'] # compressdev pulls in all other needed deps
 config_flag_fmt = 'RTE_LIBRTE_PMD_@0@'
diff --git a/drivers/compress/qat/meson.build b/drivers/compress/qat/meson.build
deleted file mode 100644 (file)
index a002469..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-# SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2017-2018 Intel Corporation
-
-
-# Add our sources files to the list
-qat_sources += files('qat_comp_pmd.c',
-                    'qat_comp.c')
-qat_includes += include_directories('.')
-qat_deps += 'compressdev'
-qat_ext_deps += dep
-
-# build the whole driver
-sources += qat_sources
-cflags += qat_cflags
-deps += qat_deps
-ext_deps += qat_ext_deps
-includes += qat_includes
diff --git a/drivers/compress/qat/rte_pmd_qat_version.map b/drivers/compress/qat/rte_pmd_qat_version.map
deleted file mode 100644 (file)
index 4a76d1d..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-DPDK_21 {
-       local: *;
-};
index aef4c21..fcb3766 100644 (file)
@@ -20,7 +20,6 @@ drivers = ['aesni_gcm',
           'octeontx',
           'octeontx2',
           'openssl',
-          'qat',
           'scheduler',
           'snow3g',
           'virtio',
index b5ac483..b95b005 100644 (file)
@@ -6,6 +6,7 @@ subdirs = [
        'common',
        'bus',
        'common/mlx5', # depends on bus.
+       'common/qat', # depends on bus.
        'mempool', # depends on common and bus.
        'net',     # depends on common, bus, mempool
        'raw',     # depends on common, bus and net.