[v3,3/3] crypto/qat: move common qat files to common dir

Message ID 1530001064-32174-4-git-send-email-tomaszx.jozwiak@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Pablo de Lara Guarch
Headers
Series crypto/qat: move files to drivers/common directory |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Tomasz Jozwiak June 26, 2018, 8:17 a.m. UTC
  -  moved common qat files to common/qat dir.
  -  changed common/qat/Makefile, common/qat/meson.build,
     drivers/Makefile, crypto/Makefile
     to add possibility of using new files locations
  -  added README file into crypto/qat to clarify where
     the build is made from
  -  updated MAINTAINERS file

Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
Acked-by: Fiona Trahe <fiona.trahe@intel.com>
---
 MAINTAINERS                                        |  1 +
 drivers/Makefile                                   |  2 ++
 drivers/common/meson.build                         |  2 +-
 drivers/{crypto => common}/qat/Makefile            | 20 +++++++++++-----
 drivers/common/qat/meson.build                     | 14 +++++++++++
 .../qat/qat_adf/adf_transport_access_macros.h      |  0
 .../{crypto => common}/qat/qat_adf/icp_qat_fw.h    |  0
 .../{crypto => common}/qat/qat_adf/icp_qat_fw_la.h |  0
 .../{crypto => common}/qat/qat_adf/icp_qat_hw.h    |  0
 drivers/{crypto => common}/qat/qat_common.c        |  0
 drivers/{crypto => common}/qat/qat_common.h        |  0
 drivers/{crypto => common}/qat/qat_device.c        |  0
 drivers/{crypto => common}/qat/qat_device.h        |  0
 drivers/{crypto => common}/qat/qat_logs.c          |  0
 drivers/{crypto => common}/qat/qat_logs.h          |  0
 drivers/{crypto => common}/qat/qat_qp.c            |  0
 drivers/{crypto => common}/qat/qat_qp.h            |  0
 drivers/crypto/Makefile                            |  1 -
 drivers/crypto/qat/README                          |  8 +++++++
 drivers/crypto/qat/meson.build                     | 28 +++++++++++++---------
 drivers/crypto/qat/qat_sym.h                       |  8 +++++++
 drivers/crypto/qat/qat_sym_pmd.h                   |  3 +++
 22 files changed, 68 insertions(+), 19 deletions(-)
 rename drivers/{crypto => common}/qat/Makefile (60%)
 create mode 100644 drivers/common/qat/meson.build
 rename drivers/{crypto => common}/qat/qat_adf/adf_transport_access_macros.h (100%)
 rename drivers/{crypto => common}/qat/qat_adf/icp_qat_fw.h (100%)
 rename drivers/{crypto => common}/qat/qat_adf/icp_qat_fw_la.h (100%)
 rename drivers/{crypto => common}/qat/qat_adf/icp_qat_hw.h (100%)
 rename drivers/{crypto => common}/qat/qat_common.c (100%)
 rename drivers/{crypto => common}/qat/qat_common.h (100%)
 rename drivers/{crypto => common}/qat/qat_device.c (100%)
 rename drivers/{crypto => common}/qat/qat_device.h (100%)
 rename drivers/{crypto => common}/qat/qat_logs.c (100%)
 rename drivers/{crypto => common}/qat/qat_logs.h (100%)
 rename drivers/{crypto => common}/qat/qat_qp.c (100%)
 rename drivers/{crypto => common}/qat/qat_qp.h (100%)
 create mode 100644 drivers/crypto/qat/README
  

Patch

diff --git a/MAINTAINERS b/MAINTAINERS
index 3bc928f..bc16078 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -775,6 +775,7 @@  M: John Griffin <john.griffin@intel.com>
 M: Fiona Trahe <fiona.trahe@intel.com>
 M: Deepak Kumar Jain <deepak.k.jain@intel.com>
 F: drivers/crypto/qat/
+F: drivers/common/qat/
 F: doc/guides/cryptodevs/qat.rst
 F: doc/guides/cryptodevs/features/qat.ini
 
diff --git a/drivers/Makefile b/drivers/Makefile
index c88638c..7566076 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -13,6 +13,8 @@  DIRS-$(CONFIG_RTE_LIBRTE_BBDEV) += baseband
 DEPDIRS-baseband := common bus mempool
 DIRS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += crypto
 DEPDIRS-crypto := common bus mempool
+DIRS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += common/qat
+DEPDIRS-common/qat := bus mempool
 DIRS-$(CONFIG_RTE_LIBRTE_COMPRESSDEV) += compress
 DEPDIRS-compress := bus mempool
 DIRS-$(CONFIG_RTE_LIBRTE_EVENTDEV) += event
diff --git a/drivers/common/meson.build b/drivers/common/meson.build
index 5f6341b..d7b7d8c 100644
--- a/drivers/common/meson.build
+++ b/drivers/common/meson.build
@@ -2,6 +2,6 @@ 
 # Copyright(c) 2018 Cavium, Inc
 
 std_deps = ['eal']
-drivers = ['octeontx']
+drivers = ['octeontx', 'qat']
 config_flag_fmt = 'RTE_LIBRTE_@0@_COMMON'
 driver_name_fmt = 'rte_common_@0@'
diff --git a/drivers/crypto/qat/Makefile b/drivers/common/qat/Makefile
similarity index 60%
rename from drivers/crypto/qat/Makefile
rename to drivers/common/qat/Makefile
index a939eca..069ac8c 100644
--- a/drivers/crypto/qat/Makefile
+++ b/drivers/common/qat/Makefile
@@ -13,8 +13,13 @@  LIBABIVER := 1
 CFLAGS += $(WERROR_FLAGS)
 CFLAGS += -O3
 
+# build directories
+QAT_CRYPTO_DIR := $(RTE_SDK)/drivers/crypto/qat
+
 # external library include paths
 CFLAGS += -I$(SRCDIR)/qat_adf
+CFLAGS += -I$(SRCDIR)
+CFLAGS += -I$(QAT_CRYPTO_DIR)
 
 # library common source files
 SRCS-y += qat_device.c
@@ -23,11 +28,14 @@  SRCS-y += qat_logs.c
 SRCS-y += qat_qp.c
 
 # library symetric crypto source files
-LDLIBS += -lrte_cryptodev
-LDLIBS += -lcrypto
-SRCS-y += qat_sym.c
-SRCS-y += qat_sym_session.c
-SRCS-y += qat_sym_pmd.c
+ifeq ($(CONFIG_RTE_LIBRTE_CRYPTODEV),y)
+	LDLIBS += -lrte_cryptodev
+	LDLIBS += -lcrypto
+	CFLAGS += -DBUILD_QAT_SYM
+	SRCS-y += $(QAT_CRYPTO_DIR)/qat_sym.c
+	SRCS-y += $(QAT_CRYPTO_DIR)/qat_sym_session.c
+	SRCS-y += $(QAT_CRYPTO_DIR)/qat_sym_pmd.c
+endif
 
 LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool
 LDLIBS += -lrte_pci -lrte_bus_pci
@@ -36,6 +44,6 @@  LDLIBS += -lrte_pci -lrte_bus_pci
 SYMLINK-y-include +=
 
 # versioning export map
-EXPORT_MAP := rte_pmd_qat_version.map
+EXPORT_MAP := ../../crypto/qat/rte_pmd_qat_version.map
 
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/common/qat/meson.build b/drivers/common/qat/meson.build
new file mode 100644
index 0000000..80b6b25
--- /dev/null
+++ b/drivers/common/qat/meson.build
@@ -0,0 +1,14 @@ 
+# 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
+qat_deps = ['bus_pci']
+qat_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 = []
diff --git a/drivers/crypto/qat/qat_adf/adf_transport_access_macros.h b/drivers/common/qat/qat_adf/adf_transport_access_macros.h
similarity index 100%
rename from drivers/crypto/qat/qat_adf/adf_transport_access_macros.h
rename to drivers/common/qat/qat_adf/adf_transport_access_macros.h
diff --git a/drivers/crypto/qat/qat_adf/icp_qat_fw.h b/drivers/common/qat/qat_adf/icp_qat_fw.h
similarity index 100%
rename from drivers/crypto/qat/qat_adf/icp_qat_fw.h
rename to drivers/common/qat/qat_adf/icp_qat_fw.h
diff --git a/drivers/crypto/qat/qat_adf/icp_qat_fw_la.h b/drivers/common/qat/qat_adf/icp_qat_fw_la.h
similarity index 100%
rename from drivers/crypto/qat/qat_adf/icp_qat_fw_la.h
rename to drivers/common/qat/qat_adf/icp_qat_fw_la.h
diff --git a/drivers/crypto/qat/qat_adf/icp_qat_hw.h b/drivers/common/qat/qat_adf/icp_qat_hw.h
similarity index 100%
rename from drivers/crypto/qat/qat_adf/icp_qat_hw.h
rename to drivers/common/qat/qat_adf/icp_qat_hw.h
diff --git a/drivers/crypto/qat/qat_common.c b/drivers/common/qat/qat_common.c
similarity index 100%
rename from drivers/crypto/qat/qat_common.c
rename to drivers/common/qat/qat_common.c
diff --git a/drivers/crypto/qat/qat_common.h b/drivers/common/qat/qat_common.h
similarity index 100%
rename from drivers/crypto/qat/qat_common.h
rename to drivers/common/qat/qat_common.h
diff --git a/drivers/crypto/qat/qat_device.c b/drivers/common/qat/qat_device.c
similarity index 100%
rename from drivers/crypto/qat/qat_device.c
rename to drivers/common/qat/qat_device.c
diff --git a/drivers/crypto/qat/qat_device.h b/drivers/common/qat/qat_device.h
similarity index 100%
rename from drivers/crypto/qat/qat_device.h
rename to drivers/common/qat/qat_device.h
diff --git a/drivers/crypto/qat/qat_logs.c b/drivers/common/qat/qat_logs.c
similarity index 100%
rename from drivers/crypto/qat/qat_logs.c
rename to drivers/common/qat/qat_logs.c
diff --git a/drivers/crypto/qat/qat_logs.h b/drivers/common/qat/qat_logs.h
similarity index 100%
rename from drivers/crypto/qat/qat_logs.h
rename to drivers/common/qat/qat_logs.h
diff --git a/drivers/crypto/qat/qat_qp.c b/drivers/common/qat/qat_qp.c
similarity index 100%
rename from drivers/crypto/qat/qat_qp.c
rename to drivers/common/qat/qat_qp.c
diff --git a/drivers/crypto/qat/qat_qp.h b/drivers/common/qat/qat_qp.h
similarity index 100%
rename from drivers/crypto/qat/qat_qp.h
rename to drivers/common/qat/qat_qp.h
diff --git a/drivers/crypto/Makefile b/drivers/crypto/Makefile
index 1d0c88e..c480cbd 100644
--- a/drivers/crypto/Makefile
+++ b/drivers/crypto/Makefile
@@ -8,7 +8,6 @@  DIRS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB) += aesni_mb
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_ARMV8_CRYPTO) += armv8
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_CCP) += ccp
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_OPENSSL) += openssl
-DIRS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_CRYPTO_SCHEDULER) += scheduler
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G) += snow3g
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_KASUMI) += kasumi
diff --git a/drivers/crypto/qat/README b/drivers/crypto/qat/README
new file mode 100644
index 0000000..38972a2
--- /dev/null
+++ b/drivers/crypto/qat/README
@@ -0,0 +1,8 @@ 
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2015-2018 Intel Corporation
+
+Makefile for crypto QAT PMD is in common/qat directory.
+The build for the QAT driver is done from there as only one library is built for the
+whole QAT pci device and that library includes all the services (crypto, compression)
+which are enabled on the device.
+
diff --git a/drivers/crypto/qat/meson.build b/drivers/crypto/qat/meson.build
index db4af2c..2873637 100644
--- a/drivers/crypto/qat/meson.build
+++ b/drivers/crypto/qat/meson.build
@@ -1,18 +1,24 @@ 
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017-2018 Intel Corporation
 
+build = false
 dep = dependency('libcrypto', required: false)
-
-sources = files('qat_common.c',
-		'qat_qp.c',
-		'qat_device.c',
-		'qat_logs.c')
-
 if dep.found()
-	sources += files('qat_sym_pmd.c', 'qat_sym.c', 'qat_sym_session.c')
+	# Add our sources files to the list
+	qat_sources += files('qat_sym_pmd.c',
+			     'qat_sym.c',
+			     'qat_sym_session.c')
+	qat_includes += include_directories('.')
+	qat_deps += 'cryptodev'
+	qat_ext_deps += dep
 	pkgconfig_extra_libs += '-lcrypto'
-endif
+	qat_cflags += '-DBUILD_QAT_SYM'
 
-includes += include_directories('qat_adf')
-deps += ['bus_pci']
-ext_deps += dep
+	# build the whole driver
+	sources += qat_sources
+	cflags += qat_cflags
+	deps += qat_deps
+	ext_deps += qat_ext_deps
+	includes += qat_includes
+	build = true
+endif
diff --git a/drivers/crypto/qat/qat_sym.h b/drivers/crypto/qat/qat_sym.h
index 126c191..d425892 100644
--- a/drivers/crypto/qat/qat_sym.h
+++ b/drivers/crypto/qat/qat_sym.h
@@ -6,6 +6,8 @@ 
 #define _QAT_SYM_H_
 
 #include <rte_cryptodev_pmd.h>
+
+#ifdef BUILD_QAT_SYM
 #include <openssl/evp.h>
 
 #include "qat_common.h"
@@ -152,5 +154,11 @@  qat_sym_process_response(void **op, uint8_t *resp)
 	}
 	*op = (void *)rx_op;
 }
+#else
 
+static inline void
+qat_sym_process_response(void **op __rte_unused, uint8_t *resp __rte_unused)
+{
+}
+#endif
 #endif /* _QAT_SYM_H_ */
diff --git a/drivers/crypto/qat/qat_sym_pmd.h b/drivers/crypto/qat/qat_sym_pmd.h
index 1e2344c..439aeb9 100644
--- a/drivers/crypto/qat/qat_sym_pmd.h
+++ b/drivers/crypto/qat/qat_sym_pmd.h
@@ -5,6 +5,8 @@ 
 #ifndef _QAT_SYM_PMD_H_
 #define _QAT_SYM_PMD_H_
 
+#ifdef BUILD_QAT_SYM
+
 #include <rte_cryptodev.h>
 
 #include "qat_sym_capabilities.h"
@@ -36,4 +38,5 @@  qat_sym_dev_create(struct qat_pci_device *qat_pci_dev);
 int
 qat_sym_dev_destroy(struct qat_pci_device *qat_pci_dev);
 
+#endif
 #endif /* _QAT_SYM_PMD_H_ */