DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 0/4] crypto/qat: move files to drivers/common directory
@ 2018-05-22  6:51 Tomasz Jozwiak
  2018-05-22  6:51 ` [dpdk-dev] [PATCH 1/4] crypto/qat: add weak functions Tomasz Jozwiak
                   ` (7 more replies)
  0 siblings, 8 replies; 21+ messages in thread
From: Tomasz Jozwiak @ 2018-05-22  6:51 UTC (permalink / raw)
  To: fiona.trahe, tomaszx.jozwiak, pablo.de.lara.guarch, dev

This patchset depends on QAT dynamic logging patchset and should be
targetig on 18.08.
Patchset refactors the PMD in order that files are split into several
places: common, crypto.
New drivers/common/qat and drivers/common/qat/qat were added and files
split between locations.
Also added libcrypto detection and QAT PMD is build only if this
library is installed. Updated documentation.

Tomasz Jozwiak (4):
  crypto/qat: add weak functions
  crypto/qat: add libcrypto detection to Makefile
  crypto/qat: move common qat files to common dir
  doc/qat: document libcrypto detection

 config/common_base                                 |  5 ++-
 doc/guides/cryptodevs/qat.rst                      |  9 +++-
 drivers/Makefile                                   |  2 +
 drivers/common/qat/Makefile                        | 51 ++++++++++++++++++++++
 drivers/common/qat/meson.build                     |  8 ++++
 drivers/common/qat/qat/meson.build                 | 24 ++++++++++
 .../qat}/qat/rte_pmd_qat_version.map               |  0
 .../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        | 39 ++++++++++++++++-
 drivers/{crypto => common}/qat/qat_device.h        | 20 +++++++++
 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/meson.build                         |  2 +-
 drivers/crypto/qat/Makefile                        | 40 -----------------
 drivers/crypto/qat/README                          |  7 +++
 drivers/crypto/qat/meson.build                     | 18 --------
 drivers/crypto/qat/qat_asym_pmd.c                  | 17 --------
 drivers/crypto/qat/qat_asym_pmd.h                  | 15 -------
 drivers/crypto/qat/qat_comp_pmd.c                  | 18 --------
 drivers/crypto/qat/qat_comp_pmd.h                  | 29 ------------
 drivers/crypto/qat/qat_sym.h                       |  9 ++++
 drivers/crypto/qat/qat_sym_pmd.h                   |  5 +++
 drivers/meson.build                                |  1 +
 31 files changed, 175 insertions(+), 145 deletions(-)
 create mode 100644 drivers/common/qat/Makefile
 create mode 100644 drivers/common/qat/meson.build
 create mode 100644 drivers/common/qat/qat/meson.build
 rename drivers/{crypto => common/qat}/qat/rte_pmd_qat_version.map (100%)
 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 (88%)
 rename drivers/{crypto => common}/qat/qat_device.h (80%)
 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%)
 delete mode 100644 drivers/crypto/qat/Makefile
 create mode 100644 drivers/crypto/qat/README
 delete mode 100644 drivers/crypto/qat/meson.build
 delete mode 100644 drivers/crypto/qat/qat_asym_pmd.c
 delete mode 100644 drivers/crypto/qat/qat_asym_pmd.h
 delete mode 100644 drivers/crypto/qat/qat_comp_pmd.c
 delete mode 100644 drivers/crypto/qat/qat_comp_pmd.h

-- 
2.7.4

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dpdk-dev] [PATCH 1/4] crypto/qat: add weak functions
  2018-05-22  6:51 [dpdk-dev] [PATCH 0/4] crypto/qat: move files to drivers/common directory Tomasz Jozwiak
@ 2018-05-22  6:51 ` Tomasz Jozwiak
  2018-05-22  6:51 ` [dpdk-dev] [PATCH 2/4] crypto/qat: add libcrypto detection to Makefile Tomasz Jozwiak
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 21+ messages in thread
From: Tomasz Jozwiak @ 2018-05-22  6:51 UTC (permalink / raw)
  To: fiona.trahe, tomaszx.jozwiak, pablo.de.lara.guarch, dev

This patch adds following weak functions to facilitate conditional
compilation of code for those services:
  -  qat_sym_dev_create
  -  qat_asym_dev_create
  -  qat_comp_dev_create
  -  qat_sym_dev_destroy
  -  qat_asym_dev_destroy
  -  qat_comp_dev_destroy
and removes unused files with empty definitions of above functions.

Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
Acked-by: Fiona Trahe <fiona.trahe@intel.com>
---
 drivers/crypto/qat/Makefile       |  2 --
 drivers/crypto/qat/meson.build    |  4 +---
 drivers/crypto/qat/qat_asym_pmd.c | 17 -----------------
 drivers/crypto/qat/qat_asym_pmd.h | 15 ---------------
 drivers/crypto/qat/qat_comp_pmd.c | 18 ------------------
 drivers/crypto/qat/qat_comp_pmd.h | 29 -----------------------------
 drivers/crypto/qat/qat_device.c   | 39 +++++++++++++++++++++++++++++++++++++--
 drivers/crypto/qat/qat_device.h   | 20 ++++++++++++++++++++
 8 files changed, 58 insertions(+), 86 deletions(-)
 delete mode 100644 drivers/crypto/qat/qat_asym_pmd.c
 delete mode 100644 drivers/crypto/qat/qat_asym_pmd.h
 delete mode 100644 drivers/crypto/qat/qat_comp_pmd.c
 delete mode 100644 drivers/crypto/qat/qat_comp_pmd.h

diff --git a/drivers/crypto/qat/Makefile b/drivers/crypto/qat/Makefile
index ef4a567..64f39fd 100644
--- a/drivers/crypto/qat/Makefile
+++ b/drivers/crypto/qat/Makefile
@@ -28,8 +28,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat_sym_session.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat_common.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat_logs.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat_sym_pmd.c
-SRCS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat_asym_pmd.c
-SRCS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat_comp_pmd.c
 
 # export include files
 SYMLINK-y-include +=
diff --git a/drivers/crypto/qat/meson.build b/drivers/crypto/qat/meson.build
index bcab16e..6d01dac 100644
--- a/drivers/crypto/qat/meson.build
+++ b/drivers/crypto/qat/meson.build
@@ -9,9 +9,7 @@ sources = files('qat_common.c',
 		'qat_qp.c',
 		'qat_device.c',
 		'qat_logs.c',
-		'qat_sym_pmd.c', 'qat_sym.c', 'qat_sym_session.c',
-		'qat_asym_pmd.c',
-		'qat_comp_pmd.c')
+		'qat_sym_pmd.c', 'qat_sym.c', 'qat_sym_session.c')
 includes += include_directories('qat_adf')
 deps += ['bus_pci']
 ext_deps += dep
diff --git a/drivers/crypto/qat/qat_asym_pmd.c b/drivers/crypto/qat/qat_asym_pmd.c
deleted file mode 100644
index 8d36300..0000000
--- a/drivers/crypto/qat/qat_asym_pmd.c
+++ /dev/null
@@ -1,17 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2018 Intel Corporation
- */
-
-#include "qat_asym_pmd.h"
-
-int
-qat_asym_dev_create(struct qat_pci_device *qat_pci_dev __rte_unused)
-{
-	return 0;
-}
-
-int
-qat_asym_dev_destroy(struct qat_pci_device *qat_pci_dev __rte_unused)
-{
-	return 0;
-}
diff --git a/drivers/crypto/qat/qat_asym_pmd.h b/drivers/crypto/qat/qat_asym_pmd.h
deleted file mode 100644
index 0465e03..0000000
--- a/drivers/crypto/qat/qat_asym_pmd.h
+++ /dev/null
@@ -1,15 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2018 Intel Corporation
- */
-
-#ifndef _QAT_ASYM_PMD_H_
-#define _QAT_ASYM_PMD_H_
-
-#include "qat_device.h"
-
-int
-qat_asym_dev_create(struct qat_pci_device *qat_pci_dev);
-
-int
-qat_asym_dev_destroy(struct qat_pci_device *qat_pci_dev);
-#endif /* _QAT_ASYM_PMD_H_ */
diff --git a/drivers/crypto/qat/qat_comp_pmd.c b/drivers/crypto/qat/qat_comp_pmd.c
deleted file mode 100644
index 547b3db..0000000
--- a/drivers/crypto/qat/qat_comp_pmd.c
+++ /dev/null
@@ -1,18 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2018 Intel Corporation
- */
-
-#include "qat_comp_pmd.h"
-
-
-int
-qat_comp_dev_create(struct qat_pci_device *qat_pci_dev __rte_unused)
-{
-	return 0;
-}
-
-int
-qat_comp_dev_destroy(struct qat_pci_device *qat_pci_dev __rte_unused)
-{
-	return 0;
-}
diff --git a/drivers/crypto/qat/qat_comp_pmd.h b/drivers/crypto/qat/qat_comp_pmd.h
deleted file mode 100644
index cc31246..0000000
--- a/drivers/crypto/qat/qat_comp_pmd.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2018 Intel Corporation
- */
-
-#ifndef _QAT_COMP_PMD_H_
-#define _QAT_COMP_PMD_H_
-
-#include "qat_device.h"
-
-
-/**< Intel(R) QAT Compression PMD device name */
-#define COMPRESSDEV_NAME_QAT_PMD	comp_qat
-
-
-/** private data structure for a QAT compression device.
- * This QAT device is a device offering only a compression service,
- * there can be one of these on each qat_pci_device (VF).
- */
-struct qat_comp_dev_private {
-	struct qat_pci_device *qat_dev;
-	/**< The qat pci device hosting the service */
-};
-
-int
-qat_comp_dev_create(struct qat_pci_device *qat_pci_dev);
-
-int
-qat_comp_dev_destroy(struct qat_pci_device *qat_pci_dev);
-#endif /* _QAT_COMP_PMD_H_ */
diff --git a/drivers/crypto/qat/qat_device.c b/drivers/crypto/qat/qat_device.c
index 4b97c84..64f236e 100644
--- a/drivers/crypto/qat/qat_device.c
+++ b/drivers/crypto/qat/qat_device.c
@@ -5,8 +5,6 @@
 #include "qat_device.h"
 #include "adf_transport_access_macros.h"
 #include "qat_sym_pmd.h"
-#include "qat_asym_pmd.h"
-#include "qat_comp_pmd.h"
 
 /* Hardware device information per generation */
 __extension__
@@ -238,5 +236,42 @@ static struct rte_pci_driver rte_qat_pmd = {
 	.probe = qat_pci_probe,
 	.remove = qat_pci_remove
 };
+
+__attribute__((weak)) int
+qat_sym_dev_create(struct qat_pci_device *qat_pci_dev __rte_unused)
+{
+	return 0;
+}
+
+__attribute__((weak)) int
+qat_asym_dev_create(struct qat_pci_device *qat_pci_dev __rte_unused)
+{
+	return 0;
+}
+
+__attribute__((weak)) int
+qat_sym_dev_destroy(struct qat_pci_device *qat_pci_dev __rte_unused)
+{
+	return 0;
+}
+
+__attribute__((weak)) int
+qat_asym_dev_destroy(struct qat_pci_device *qat_pci_dev __rte_unused)
+{
+	return 0;
+}
+
+__attribute__((weak)) int
+qat_comp_dev_create(struct qat_pci_device *qat_pci_dev __rte_unused)
+{
+	return 0;
+}
+
+__attribute__((weak)) int
+qat_comp_dev_destroy(struct qat_pci_device *qat_pci_dev __rte_unused)
+{
+	return 0;
+}
+
 RTE_PMD_REGISTER_PCI(QAT_PCI_NAME, rte_qat_pmd);
 RTE_PMD_REGISTER_PCI_TABLE(QAT_PCI_NAME, pci_id_qat_map);
diff --git a/drivers/crypto/qat/qat_device.h b/drivers/crypto/qat/qat_device.h
index e18c8a7..0cb370c 100644
--- a/drivers/crypto/qat/qat_device.h
+++ b/drivers/crypto/qat/qat_device.h
@@ -69,10 +69,30 @@ extern struct qat_gen_hw_data qat_gen_config[];
 
 struct qat_pci_device *
 qat_pci_device_allocate(struct rte_pci_device *pci_dev);
+
 int
 qat_pci_device_release(struct rte_pci_device *pci_dev);
+
 struct qat_pci_device *
 qat_get_qat_dev_from_pci_dev(struct rte_pci_device *pci_dev);
 
+/* declaration needed for weak functions */
+int
+qat_sym_dev_create(struct qat_pci_device *qat_pci_dev __rte_unused);
+
+int
+qat_asym_dev_create(struct qat_pci_device *qat_pci_dev __rte_unused);
+
+int
+qat_sym_dev_destroy(struct qat_pci_device *qat_pci_dev __rte_unused);
+
+int
+qat_asym_dev_destroy(struct qat_pci_device *qat_pci_dev __rte_unused);
+
+int
+qat_comp_dev_create(struct qat_pci_device *qat_pci_dev __rte_unused);
+
+int
+qat_comp_dev_destroy(struct qat_pci_device *qat_pci_dev __rte_unused);
 
 #endif /* _QAT_DEVICE_H_ */
-- 
2.7.4

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dpdk-dev] [PATCH 2/4] crypto/qat: add libcrypto detection to Makefile
  2018-05-22  6:51 [dpdk-dev] [PATCH 0/4] crypto/qat: move files to drivers/common directory Tomasz Jozwiak
  2018-05-22  6:51 ` [dpdk-dev] [PATCH 1/4] crypto/qat: add weak functions Tomasz Jozwiak
@ 2018-05-22  6:51 ` Tomasz Jozwiak
  2018-05-22  6:51 ` [dpdk-dev] [PATCH 3/4] crypto/qat: move common qat files to common dir Tomasz Jozwiak
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 21+ messages in thread
From: Tomasz Jozwiak @ 2018-05-22  6:51 UTC (permalink / raw)
  To: fiona.trahe, tomaszx.jozwiak, pablo.de.lara.guarch, dev

This patch adds detection of libcrypto in qat/Makefile.
Crypto QAT PMD is build, but only when this library is installed.

Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
Acked-by: Fiona Trahe <fiona.trahe@intel.com>
---
 config/common_base               |  5 +++--
 drivers/crypto/qat/Makefile      | 32 ++++++++++++++++++++------------
 drivers/crypto/qat/meson.build   | 15 +++++++++------
 drivers/crypto/qat/qat_sym.h     |  9 +++++++++
 drivers/crypto/qat/qat_sym_pmd.h |  5 +++++
 5 files changed, 46 insertions(+), 20 deletions(-)

diff --git a/config/common_base b/config/common_base
index 3cd702e..f456f95 100644
--- a/config/common_base
+++ b/config/common_base
@@ -480,8 +480,9 @@ CONFIG_RTE_DPAA_SEC_PMD_MAX_NB_SESSIONS=2048
 
 #
 # Compile PMD for QuickAssist based devices
-#
-CONFIG_RTE_LIBRTE_PMD_QAT=n
+# This QAT flag causes crypto QAT PMD to build,
+# but only if libcrypto is installed.
+CONFIG_RTE_LIBRTE_PMD_QAT=y
 #
 # Max. number of QuickAssist devices, which can be detected and attached
 #
diff --git a/drivers/crypto/qat/Makefile b/drivers/crypto/qat/Makefile
index 64f39fd..77700b4 100644
--- a/drivers/crypto/qat/Makefile
+++ b/drivers/crypto/qat/Makefile
@@ -3,6 +3,9 @@
 
 include $(RTE_SDK)/mk/rte.vars.mk
 
+# libcrypto detection
+LIBCRYPTO := $(shell pkg-config --exists libcrypto 1>&2 2> /dev/null; echo $$?)
+
 # library name
 LIB = librte_pmd_qat.a
 
@@ -15,19 +18,24 @@ CFLAGS += -O3
 
 # external library include paths
 CFLAGS += -I$(SRCDIR)/qat_adf
-LDLIBS += -lcrypto
-LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
-LDLIBS += -lrte_cryptodev
-LDLIBS += -lrte_pci -lrte_bus_pci
 
-# library source files
-SRCS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat_sym.c
-SRCS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat_device.c
-SRCS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat_qp.c
-SRCS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat_sym_session.c
-SRCS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat_common.c
-SRCS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat_logs.c
-SRCS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat_sym_pmd.c
+# library common source files
+SRCS-y += qat_device.c
+SRCS-y += qat_common.c
+SRCS-y += qat_logs.c
+SRCS-y += qat_qp.c
+
+ifeq ($(LIBCRYPTO),0)
+	LDLIBS += -lrte_cryptodev
+	LDLIBS += -lcrypto
+	CFLAGS += -DCONFIG_LIBCRYPTO_QAT
+	SRCS-y += qat_sym.c
+	SRCS-y += qat_sym_session.c
+	SRCS-y += qat_sym_pmd.c
+endif
+
+LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool
+LDLIBS += -lrte_pci -lrte_bus_pci
 
 # export include files
 SYMLINK-y-include +=
diff --git a/drivers/crypto/qat/meson.build b/drivers/crypto/qat/meson.build
index 6d01dac..c96486a 100644
--- a/drivers/crypto/qat/meson.build
+++ b/drivers/crypto/qat/meson.build
@@ -2,15 +2,18 @@
 # Copyright(c) 2017-2018 Intel Corporation
 
 dep = dependency('libcrypto', required: false)
-if not dep.found()
-	build = false
-endif
+
 sources = files('qat_common.c',
 		'qat_qp.c',
 		'qat_device.c',
-		'qat_logs.c',
-		'qat_sym_pmd.c', 'qat_sym.c', 'qat_sym_session.c')
+		'qat_logs.c')
+
+if dep.found()
+	sources += files('qat_sym_pmd.c', 'qat_sym.c', 'qat_sym_session.c')
+	pkgconfig_extra_libs += '-lcrypto'
+	cflags += '-DCONFIG_LIBCRYPTO_QAT'
+endif
+
 includes += include_directories('qat_adf')
 deps += ['bus_pci']
 ext_deps += dep
-pkgconfig_extra_libs += '-lcrypto'
diff --git a/drivers/crypto/qat/qat_sym.h b/drivers/crypto/qat/qat_sym.h
index f9e72a6..3c8ec5b 100644
--- a/drivers/crypto/qat/qat_sym.h
+++ b/drivers/crypto/qat/qat_sym.h
@@ -7,6 +7,8 @@
 
 #include <rte_cryptodev_pmd.h>
 
+#ifdef CONFIG_LIBCRYPTO_QAT
+
 #include <openssl/evp.h>
 
 #include "qat_common.h"
@@ -153,4 +155,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 80a1987..641cc4b 100644
--- a/drivers/crypto/qat/qat_sym_pmd.h
+++ b/drivers/crypto/qat/qat_sym_pmd.h
@@ -5,6 +5,9 @@
 #ifndef _QAT_SYM_PMD_H_
 #define _QAT_SYM_PMD_H_
 
+#ifdef CONFIG_LIBCRYPTO_QAT
+
+
 #include <rte_cryptodev.h>
 
 #include "qat_sym_capabilities.h"
@@ -37,4 +40,6 @@ 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_ */
-- 
2.7.4

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dpdk-dev] [PATCH 3/4] crypto/qat: move common qat files to common dir
  2018-05-22  6:51 [dpdk-dev] [PATCH 0/4] crypto/qat: move files to drivers/common directory Tomasz Jozwiak
  2018-05-22  6:51 ` [dpdk-dev] [PATCH 1/4] crypto/qat: add weak functions Tomasz Jozwiak
  2018-05-22  6:51 ` [dpdk-dev] [PATCH 2/4] crypto/qat: add libcrypto detection to Makefile Tomasz Jozwiak
@ 2018-05-22  6:51 ` Tomasz Jozwiak
  2018-05-22  9:20   ` Bruce Richardson
  2018-05-22  6:51 ` [dpdk-dev] [PATCH 4/4] doc/qat: document libcrypto detection Tomasz Jozwiak
                   ` (4 subsequent siblings)
  7 siblings, 1 reply; 21+ messages in thread
From: Tomasz Jozwiak @ 2018-05-22  6:51 UTC (permalink / raw)
  To: fiona.trahe, tomaszx.jozwiak, pablo.de.lara.guarch, dev

  -  moved common qat files to common/qat dir.
  -  changed common/qat/Makefile, common/qat/meson.build,
     drivers/meson.build, drivers/Makefile, crypto/Makefile
     to add possibility of using new files locations
  -  added common/qat/qat dir for meson build
  -  added README file into crypto/qat to clarify where
     the build is made from

Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
Acked-by: Fiona Trahe <fiona.trahe@intel.com>
---
 drivers/Makefile                                   |  2 ++
 drivers/{crypto => common}/qat/Makefile            | 13 ++++++++----
 drivers/common/qat/meson.build                     |  8 ++++++++
 drivers/common/qat/qat/meson.build                 | 24 ++++++++++++++++++++++
 .../qat}/qat/rte_pmd_qat_version.map               |  0
 .../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/meson.build                         |  2 +-
 drivers/crypto/qat/README                          |  7 +++++++
 drivers/crypto/qat/meson.build                     | 19 -----------------
 drivers/meson.build                                |  1 +
 22 files changed, 52 insertions(+), 25 deletions(-)
 rename drivers/{crypto => common}/qat/Makefile (73%)
 create mode 100644 drivers/common/qat/meson.build
 create mode 100644 drivers/common/qat/qat/meson.build
 rename drivers/{crypto => common/qat}/qat/rte_pmd_qat_version.map (100%)
 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
 delete mode 100644 drivers/crypto/qat/meson.build

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/crypto/qat/Makefile b/drivers/common/qat/Makefile
similarity index 73%
rename from drivers/crypto/qat/Makefile
rename to drivers/common/qat/Makefile
index 77700b4..c023c34 100644
--- a/drivers/crypto/qat/Makefile
+++ b/drivers/common/qat/Makefile
@@ -16,8 +16,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
@@ -29,9 +34,9 @@ ifeq ($(LIBCRYPTO),0)
 	LDLIBS += -lrte_cryptodev
 	LDLIBS += -lcrypto
 	CFLAGS += -DCONFIG_LIBCRYPTO_QAT
-	SRCS-y += qat_sym.c
-	SRCS-y += qat_sym_session.c
-	SRCS-y += qat_sym_pmd.c
+	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
@@ -41,6 +46,6 @@ LDLIBS += -lrte_pci -lrte_bus_pci
 SYMLINK-y-include +=
 
 # versioning export map
-EXPORT_MAP := rte_pmd_qat_version.map
+EXPORT_MAP := 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..8eed6c8
--- /dev/null
+++ b/drivers/common/qat/meson.build
@@ -0,0 +1,8 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2018 Intel Corporation
+
+drivers = ['qat']
+
+std_deps = ['cryptodev'] # cryptodev pulls in all other needed deps
+config_flag_fmt = 'RTE_LIBRTE_PMD_@0@'
+driver_name_fmt = 'rte_pmd_@0@'
diff --git a/drivers/common/qat/qat/meson.build b/drivers/common/qat/qat/meson.build
new file mode 100644
index 0000000..fb1055c
--- /dev/null
+++ b/drivers/common/qat/qat/meson.build
@@ -0,0 +1,24 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2017-2018 Intel Corporation
+
+dep = dependency('libcrypto', required: false)
+
+sources = files('../qat_common.c',
+		'../qat_qp.c',
+		'../qat_device.c',
+		'../qat_logs.c')
+
+if dep.found()
+	sources += files('../../../crypto/qat/qat_sym_pmd.c',
+		'../../../crypto/qat/qat_sym.c',
+		'../../../crypto/qat/qat_sym_session.c')
+
+	pkgconfig_extra_libs += '-lcrypto'
+	cflags += '-DCONFIG_LIBCRYPTO_QAT'
+endif
+
+includes += include_directories('../')
+includes += include_directories('../qat_adf')
+includes += include_directories('../../../crypto/qat')
+deps += ['bus_pci']
+ext_deps += dep
diff --git a/drivers/crypto/qat/rte_pmd_qat_version.map b/drivers/common/qat/qat/rte_pmd_qat_version.map
similarity index 100%
rename from drivers/crypto/qat/rte_pmd_qat_version.map
rename to drivers/common/qat/qat/rte_pmd_qat_version.map
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/meson.build b/drivers/crypto/meson.build
index 7b3ec13..0d98ea1 100644
--- a/drivers/crypto/meson.build
+++ b/drivers/crypto/meson.build
@@ -2,7 +2,7 @@
 # Copyright(c) 2017 Intel Corporation
 
 drivers = ['dpaa_sec', 'dpaa2_sec', 'mvsam',
-	'null', 'openssl', 'qat', 'virtio']
+	'null', 'openssl', 'virtio']
 
 std_deps = ['cryptodev'] # cryptodev pulls in all other needed deps
 config_flag_fmt = 'RTE_LIBRTE_@0@_PMD'
diff --git a/drivers/crypto/qat/README b/drivers/crypto/qat/README
new file mode 100644
index 0000000..ae68c08
--- /dev/null
+++ b/drivers/crypto/qat/README
@@ -0,0 +1,7 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2015-2018 Intel Corporation
+
+Makefile and meson.build files for crypto QAT PMD are 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
deleted file mode 100644
index c96486a..0000000
--- a/drivers/crypto/qat/meson.build
+++ /dev/null
@@ -1,19 +0,0 @@
-# SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2017-2018 Intel Corporation
-
-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')
-	pkgconfig_extra_libs += '-lcrypto'
-	cflags += '-DCONFIG_LIBCRYPTO_QAT'
-endif
-
-includes += include_directories('qat_adf')
-deps += ['bus_pci']
-ext_deps += dep
diff --git a/drivers/meson.build b/drivers/meson.build
index ac6c972..606d11f 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -5,6 +5,7 @@
 driver_classes = ['common',
 	       'bus',
 	       'mempool', # depends on common and bus.
+	       'common/qat', # depends on bus, mempool.
 	       'net',     # depends on common, bus and mempool.
 	       'crypto',  # depends on common, bus and mempool (net in future).
 	       'compress', # depends on common, bus, mempool.
-- 
2.7.4

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dpdk-dev] [PATCH 4/4] doc/qat: document libcrypto detection
  2018-05-22  6:51 [dpdk-dev] [PATCH 0/4] crypto/qat: move files to drivers/common directory Tomasz Jozwiak
                   ` (2 preceding siblings ...)
  2018-05-22  6:51 ` [dpdk-dev] [PATCH 3/4] crypto/qat: move common qat files to common dir Tomasz Jozwiak
@ 2018-05-22  6:51 ` Tomasz Jozwiak
  2018-06-14 11:12 ` [dpdk-dev] [PATCH v2 0/3] crypto/qat: move files to drivers/common directory Tomasz Jozwiak
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 21+ messages in thread
From: Tomasz Jozwiak @ 2018-05-22  6:51 UTC (permalink / raw)
  To: fiona.trahe, tomaszx.jozwiak, pablo.de.lara.guarch, dev

Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
Acked-by: Fiona Trahe <fiona.trahe@intel.com>
---
 doc/guides/cryptodevs/qat.rst | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/doc/guides/cryptodevs/qat.rst b/doc/guides/cryptodevs/qat.rst
index 77f8362..fa23a56 100644
--- a/doc/guides/cryptodevs/qat.rst
+++ b/doc/guides/cryptodevs/qat.rst
@@ -71,7 +71,10 @@ Limitations
 Installation
 ------------
 
-To enable QAT in DPDK, follow the instructions for modifying the compile-time
+QAT PMD is enabled by default in DPDK, but depends on libcrypto. If this library is detected
+the driver will be enabled and compiled.
+
+To setup QAT in DPDK, follow the instructions for modifying the compile-time
 configuration file as described `here <http://dpdk.org/doc/guides/linux_gsg/build_dpdk.html>`_.
 
 Quick instructions are as follows:
@@ -80,9 +83,11 @@ Quick instructions are as follows:
 
 	cd to the top-level DPDK directory
 	make config T=x86_64-native-linuxapp-gcc
-	sed -i 's,\(CONFIG_RTE_LIBRTE_PMD_QAT\)=n,\1=y,' build/.config
 	make
 
+.. Note::
+    To libcrypto detection - pkg_config is needed and should be installed in the system.
+
 To use the DPDK QAT PMD an SRIOV-enabled QAT kernel driver is required. The VF
 devices exposed by this driver will be used by the QAT PMD. The devices and
 available kernel drivers and device ids are :
-- 
2.7.4

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [dpdk-dev] [PATCH 3/4] crypto/qat: move common qat files to common dir
  2018-05-22  6:51 ` [dpdk-dev] [PATCH 3/4] crypto/qat: move common qat files to common dir Tomasz Jozwiak
@ 2018-05-22  9:20   ` Bruce Richardson
  0 siblings, 0 replies; 21+ messages in thread
From: Bruce Richardson @ 2018-05-22  9:20 UTC (permalink / raw)
  To: Tomasz Jozwiak; +Cc: fiona.trahe, pablo.de.lara.guarch, dev

On Tue, May 22, 2018 at 08:51:40AM +0200, Tomasz Jozwiak wrote:
>   -  moved common qat files to common/qat dir.
>   -  changed common/qat/Makefile, common/qat/meson.build,
>      drivers/meson.build, drivers/Makefile, crypto/Makefile
>      to add possibility of using new files locations
>   -  added common/qat/qat dir for meson build
>   -  added README file into crypto/qat to clarify where
>      the build is made from
> 
> Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
> Acked-by: Fiona Trahe <fiona.trahe@intel.com>
> ---
>  drivers/Makefile                                   |  2 ++
>  drivers/{crypto => common}/qat/Makefile            | 13 ++++++++----
>  drivers/common/qat/meson.build                     |  8 ++++++++
>  drivers/common/qat/qat/meson.build                 | 24 ++++++++++++++++++++++
>  .../qat}/qat/rte_pmd_qat_version.map               |  0
>  .../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/meson.build                         |  2 +-
>  drivers/crypto/qat/README                          |  7 +++++++
>  drivers/crypto/qat/meson.build                     | 19 -----------------
>  drivers/meson.build                                |  1 +
>  22 files changed, 52 insertions(+), 25 deletions(-)
>  rename drivers/{crypto => common}/qat/Makefile (73%)
>  create mode 100644 drivers/common/qat/meson.build
>  create mode 100644 drivers/common/qat/qat/meson.build
>  rename drivers/{crypto => common/qat}/qat/rte_pmd_qat_version.map (100%)
>  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
>  delete mode 100644 drivers/crypto/qat/meson.build
> 
> 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/crypto/qat/Makefile b/drivers/common/qat/Makefile
> similarity index 73%
> rename from drivers/crypto/qat/Makefile
> rename to drivers/common/qat/Makefile
> index 77700b4..c023c34 100644
> --- a/drivers/crypto/qat/Makefile
> +++ b/drivers/common/qat/Makefile
> @@ -16,8 +16,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
> @@ -29,9 +34,9 @@ ifeq ($(LIBCRYPTO),0)
>  	LDLIBS += -lrte_cryptodev
>  	LDLIBS += -lcrypto
>  	CFLAGS += -DCONFIG_LIBCRYPTO_QAT
> -	SRCS-y += qat_sym.c
> -	SRCS-y += qat_sym_session.c
> -	SRCS-y += qat_sym_pmd.c
> +	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
> @@ -41,6 +46,6 @@ LDLIBS += -lrte_pci -lrte_bus_pci
>  SYMLINK-y-include +=
>  
>  # versioning export map
> -EXPORT_MAP := rte_pmd_qat_version.map
> +EXPORT_MAP := 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..8eed6c8
> --- /dev/null
> +++ b/drivers/common/qat/meson.build
> @@ -0,0 +1,8 @@
> +# SPDX-License-Identifier: BSD-3-Clause
> +# Copyright(c) 2018 Intel Corporation
> +
> +drivers = ['qat']
> +
> +std_deps = ['cryptodev'] # cryptodev pulls in all other needed deps
> +config_flag_fmt = 'RTE_LIBRTE_PMD_@0@'
> +driver_name_fmt = 'rte_pmd_@0@'
> diff --git a/drivers/common/qat/qat/meson.build b/drivers/common/qat/qat/meson.build
> new file mode 100644
> index 0000000..fb1055c
> --- /dev/null
> +++ b/drivers/common/qat/qat/meson.build
> @@ -0,0 +1,24 @@
> +# SPDX-License-Identifier: BSD-3-Clause
> +# Copyright(c) 2017-2018 Intel Corporation
> +
> +dep = dependency('libcrypto', required: false)
> +
> +sources = files('../qat_common.c',
> +		'../qat_qp.c',
> +		'../qat_device.c',
> +		'../qat_logs.c')
> +
> +if dep.found()
> +	sources += files('../../../crypto/qat/qat_sym_pmd.c',
> +		'../../../crypto/qat/qat_sym.c',
> +		'../../../crypto/qat/qat_sym_session.c')
> +
> +	pkgconfig_extra_libs += '-lcrypto'
> +	cflags += '-DCONFIG_LIBCRYPTO_QAT'
> +endif
> +
> +includes += include_directories('../')
> +includes += include_directories('../qat_adf')
> +includes += include_directories('../../../crypto/qat')
> +deps += ['bus_pci']
> +ext_deps += dep
> diff --git a/drivers/crypto/qat/rte_pmd_qat_version.map b/drivers/common/qat/qat/rte_pmd_qat_version.map
> similarity index 100%
> rename from drivers/crypto/qat/rte_pmd_qat_version.map
> rename to drivers/common/qat/qat/rte_pmd_qat_version.map
> 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/meson.build b/drivers/crypto/meson.build
> index 7b3ec13..0d98ea1 100644
> --- a/drivers/crypto/meson.build
> +++ b/drivers/crypto/meson.build
> @@ -2,7 +2,7 @@
>  # Copyright(c) 2017 Intel Corporation
>  
>  drivers = ['dpaa_sec', 'dpaa2_sec', 'mvsam',
> -	'null', 'openssl', 'qat', 'virtio']
> +	'null', 'openssl', 'virtio']
>  
>  std_deps = ['cryptodev'] # cryptodev pulls in all other needed deps
>  config_flag_fmt = 'RTE_LIBRTE_@0@_PMD'
> diff --git a/drivers/crypto/qat/README b/drivers/crypto/qat/README
> new file mode 100644
> index 0000000..ae68c08
> --- /dev/null
> +++ b/drivers/crypto/qat/README
> @@ -0,0 +1,7 @@
> +# SPDX-License-Identifier: BSD-3-Clause
> +# Copyright(c) 2015-2018 Intel Corporation
> +
> +Makefile and meson.build files for crypto QAT PMD are 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
> deleted file mode 100644
> index c96486a..0000000
> --- a/drivers/crypto/qat/meson.build
> +++ /dev/null
> @@ -1,19 +0,0 @@
> -# SPDX-License-Identifier: BSD-3-Clause
> -# Copyright(c) 2017-2018 Intel Corporation
> -
> -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')
> -	pkgconfig_extra_libs += '-lcrypto'
> -	cflags += '-DCONFIG_LIBCRYPTO_QAT'
> -endif
> -
> -includes += include_directories('qat_adf')
> -deps += ['bus_pci']
> -ext_deps += dep
> diff --git a/drivers/meson.build b/drivers/meson.build
> index ac6c972..606d11f 100644
> --- a/drivers/meson.build
> +++ b/drivers/meson.build
> @@ -5,6 +5,7 @@
>  driver_classes = ['common',
>  	       'bus',
>  	       'mempool', # depends on common and bus.
> +	       'common/qat', # depends on bus, mempool.
>  	       'net',     # depends on common, bus and mempool.
>  	       'crypto',  # depends on common, bus and mempool (net in future).
>  	       'compress', # depends on common, bus, mempool.
> -- 
Just on the meson parts of this patch, I dislike this approach of having a
common/qat/qat directory as though it were another device class.
Instead, I think a better solution is to build up the list of QAT files and
include paths etc. in the common and crypto directories as they are
processed, and use those to build the driver in the last QAT driver
directory processed.

/Bruce

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dpdk-dev] [PATCH v2 0/3] crypto/qat: move files to drivers/common directory
  2018-05-22  6:51 [dpdk-dev] [PATCH 0/4] crypto/qat: move files to drivers/common directory Tomasz Jozwiak
                   ` (3 preceding siblings ...)
  2018-05-22  6:51 ` [dpdk-dev] [PATCH 4/4] doc/qat: document libcrypto detection Tomasz Jozwiak
@ 2018-06-14 11:12 ` Tomasz Jozwiak
  2018-06-14 11:12   ` [dpdk-dev] [PATCH v2 1/3] crypto/qat: add weak functions Tomasz Jozwiak
                     ` (2 more replies)
  2018-06-26  8:15 ` [dpdk-dev] [PATCH v3 0/3] crypto/qat: move files to drivers/common directory Tomasz Jozwiak
                   ` (2 subsequent siblings)
  7 siblings, 3 replies; 21+ messages in thread
From: Tomasz Jozwiak @ 2018-06-14 11:12 UTC (permalink / raw)
  To: fiona.trahe, tomaszx.jozwiak, dev

This patchset depends on QAT dynamic logging patchset and should be targetig on 18.08.
Patchset refactors the PMD in order that files are split into several
places: common, crypto.
New drivers/common/qat are added and files split between locations.
Also added libcrypto detection and QAT PMD is build only if this library is installed.

Changes for v2:
  -  removed drivers/common/qat/qat 
  -  updated meson.build files 
  -  added description into qat.rst
  -  updated MAINTAINERS file

Tomasz Jozwiak (3):
  crypto/qat: add weak functions
  crypto/qat: add libcrypto detection to Makefile
  crypto/qat: move common qat files to common dir

 MAINTAINERS                                        |  1 +
 config/common_base                                 |  5 ++-
 doc/guides/cryptodevs/qat.rst                      |  9 +++-
 drivers/Makefile                                   |  2 +
 drivers/common/meson.build                         |  2 +-
 drivers/common/qat/Makefile                        | 51 ++++++++++++++++++++++
 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        | 39 ++++++++++++++++-
 drivers/{crypto => common}/qat/qat_device.h        | 20 +++++++++
 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/Makefile                        | 40 -----------------
 drivers/crypto/qat/README                          |  8 ++++
 drivers/crypto/qat/meson.build                     | 34 +++++++++------
 drivers/crypto/qat/qat_asym_pmd.c                  | 17 --------
 drivers/crypto/qat/qat_asym_pmd.h                  | 15 -------
 drivers/crypto/qat/qat_comp_pmd.c                  | 18 --------
 drivers/crypto/qat/qat_comp_pmd.h                  | 29 ------------
 drivers/crypto/qat/qat_sym.h                       |  9 ++++
 drivers/crypto/qat/qat_sym_pmd.h                   |  5 +++
 29 files changed, 178 insertions(+), 141 deletions(-)
 create mode 100644 drivers/common/qat/Makefile
 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 (88%)
 rename drivers/{crypto => common}/qat/qat_device.h (80%)
 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%)
 delete mode 100644 drivers/crypto/qat/Makefile
 create mode 100644 drivers/crypto/qat/README
 delete mode 100644 drivers/crypto/qat/qat_asym_pmd.c
 delete mode 100644 drivers/crypto/qat/qat_asym_pmd.h
 delete mode 100644 drivers/crypto/qat/qat_comp_pmd.c
 delete mode 100644 drivers/crypto/qat/qat_comp_pmd.h

-- 
2.7.4

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dpdk-dev] [PATCH v2 1/3] crypto/qat: add weak functions
  2018-06-14 11:12 ` [dpdk-dev] [PATCH v2 0/3] crypto/qat: move files to drivers/common directory Tomasz Jozwiak
@ 2018-06-14 11:12   ` Tomasz Jozwiak
  2018-06-14 11:12   ` [dpdk-dev] [PATCH v2 2/3] crypto/qat: add libcrypto detection to Makefile Tomasz Jozwiak
  2018-06-14 11:12   ` [dpdk-dev] [PATCH v2 3/3] crypto/qat: move common qat files to common dir Tomasz Jozwiak
  2 siblings, 0 replies; 21+ messages in thread
From: Tomasz Jozwiak @ 2018-06-14 11:12 UTC (permalink / raw)
  To: fiona.trahe, tomaszx.jozwiak, dev

This patch adds following weak functions to facilitate conditional
compilation of code for those services:
  -  qat_sym_dev_create
  -  qat_asym_dev_create
  -  qat_comp_dev_create
  -  qat_sym_dev_destroy
  -  qat_asym_dev_destroy
  -  qat_comp_dev_destroy
and removes unused files with empty definitions of above functions.

Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
Acked-by: Fiona Trahe <fiona.trahe@intel.com>
---
 drivers/crypto/qat/Makefile       |  2 --
 drivers/crypto/qat/meson.build    |  4 +---
 drivers/crypto/qat/qat_asym_pmd.c | 17 -----------------
 drivers/crypto/qat/qat_asym_pmd.h | 15 ---------------
 drivers/crypto/qat/qat_comp_pmd.c | 18 ------------------
 drivers/crypto/qat/qat_comp_pmd.h | 29 -----------------------------
 drivers/crypto/qat/qat_device.c   | 39 +++++++++++++++++++++++++++++++++++++--
 drivers/crypto/qat/qat_device.h   | 20 ++++++++++++++++++++
 8 files changed, 58 insertions(+), 86 deletions(-)
 delete mode 100644 drivers/crypto/qat/qat_asym_pmd.c
 delete mode 100644 drivers/crypto/qat/qat_asym_pmd.h
 delete mode 100644 drivers/crypto/qat/qat_comp_pmd.c
 delete mode 100644 drivers/crypto/qat/qat_comp_pmd.h

diff --git a/drivers/crypto/qat/Makefile b/drivers/crypto/qat/Makefile
index ef4a567..64f39fd 100644
--- a/drivers/crypto/qat/Makefile
+++ b/drivers/crypto/qat/Makefile
@@ -28,8 +28,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat_sym_session.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat_common.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat_logs.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat_sym_pmd.c
-SRCS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat_asym_pmd.c
-SRCS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat_comp_pmd.c
 
 # export include files
 SYMLINK-y-include +=
diff --git a/drivers/crypto/qat/meson.build b/drivers/crypto/qat/meson.build
index bcab16e..6d01dac 100644
--- a/drivers/crypto/qat/meson.build
+++ b/drivers/crypto/qat/meson.build
@@ -9,9 +9,7 @@ sources = files('qat_common.c',
 		'qat_qp.c',
 		'qat_device.c',
 		'qat_logs.c',
-		'qat_sym_pmd.c', 'qat_sym.c', 'qat_sym_session.c',
-		'qat_asym_pmd.c',
-		'qat_comp_pmd.c')
+		'qat_sym_pmd.c', 'qat_sym.c', 'qat_sym_session.c')
 includes += include_directories('qat_adf')
 deps += ['bus_pci']
 ext_deps += dep
diff --git a/drivers/crypto/qat/qat_asym_pmd.c b/drivers/crypto/qat/qat_asym_pmd.c
deleted file mode 100644
index 8d36300..0000000
--- a/drivers/crypto/qat/qat_asym_pmd.c
+++ /dev/null
@@ -1,17 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2018 Intel Corporation
- */
-
-#include "qat_asym_pmd.h"
-
-int
-qat_asym_dev_create(struct qat_pci_device *qat_pci_dev __rte_unused)
-{
-	return 0;
-}
-
-int
-qat_asym_dev_destroy(struct qat_pci_device *qat_pci_dev __rte_unused)
-{
-	return 0;
-}
diff --git a/drivers/crypto/qat/qat_asym_pmd.h b/drivers/crypto/qat/qat_asym_pmd.h
deleted file mode 100644
index 0465e03..0000000
--- a/drivers/crypto/qat/qat_asym_pmd.h
+++ /dev/null
@@ -1,15 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2018 Intel Corporation
- */
-
-#ifndef _QAT_ASYM_PMD_H_
-#define _QAT_ASYM_PMD_H_
-
-#include "qat_device.h"
-
-int
-qat_asym_dev_create(struct qat_pci_device *qat_pci_dev);
-
-int
-qat_asym_dev_destroy(struct qat_pci_device *qat_pci_dev);
-#endif /* _QAT_ASYM_PMD_H_ */
diff --git a/drivers/crypto/qat/qat_comp_pmd.c b/drivers/crypto/qat/qat_comp_pmd.c
deleted file mode 100644
index 547b3db..0000000
--- a/drivers/crypto/qat/qat_comp_pmd.c
+++ /dev/null
@@ -1,18 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2018 Intel Corporation
- */
-
-#include "qat_comp_pmd.h"
-
-
-int
-qat_comp_dev_create(struct qat_pci_device *qat_pci_dev __rte_unused)
-{
-	return 0;
-}
-
-int
-qat_comp_dev_destroy(struct qat_pci_device *qat_pci_dev __rte_unused)
-{
-	return 0;
-}
diff --git a/drivers/crypto/qat/qat_comp_pmd.h b/drivers/crypto/qat/qat_comp_pmd.h
deleted file mode 100644
index cc31246..0000000
--- a/drivers/crypto/qat/qat_comp_pmd.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2018 Intel Corporation
- */
-
-#ifndef _QAT_COMP_PMD_H_
-#define _QAT_COMP_PMD_H_
-
-#include "qat_device.h"
-
-
-/**< Intel(R) QAT Compression PMD device name */
-#define COMPRESSDEV_NAME_QAT_PMD	comp_qat
-
-
-/** private data structure for a QAT compression device.
- * This QAT device is a device offering only a compression service,
- * there can be one of these on each qat_pci_device (VF).
- */
-struct qat_comp_dev_private {
-	struct qat_pci_device *qat_dev;
-	/**< The qat pci device hosting the service */
-};
-
-int
-qat_comp_dev_create(struct qat_pci_device *qat_pci_dev);
-
-int
-qat_comp_dev_destroy(struct qat_pci_device *qat_pci_dev);
-#endif /* _QAT_COMP_PMD_H_ */
diff --git a/drivers/crypto/qat/qat_device.c b/drivers/crypto/qat/qat_device.c
index 4b97c84..64f236e 100644
--- a/drivers/crypto/qat/qat_device.c
+++ b/drivers/crypto/qat/qat_device.c
@@ -5,8 +5,6 @@
 #include "qat_device.h"
 #include "adf_transport_access_macros.h"
 #include "qat_sym_pmd.h"
-#include "qat_asym_pmd.h"
-#include "qat_comp_pmd.h"
 
 /* Hardware device information per generation */
 __extension__
@@ -238,5 +236,42 @@ static struct rte_pci_driver rte_qat_pmd = {
 	.probe = qat_pci_probe,
 	.remove = qat_pci_remove
 };
+
+__attribute__((weak)) int
+qat_sym_dev_create(struct qat_pci_device *qat_pci_dev __rte_unused)
+{
+	return 0;
+}
+
+__attribute__((weak)) int
+qat_asym_dev_create(struct qat_pci_device *qat_pci_dev __rte_unused)
+{
+	return 0;
+}
+
+__attribute__((weak)) int
+qat_sym_dev_destroy(struct qat_pci_device *qat_pci_dev __rte_unused)
+{
+	return 0;
+}
+
+__attribute__((weak)) int
+qat_asym_dev_destroy(struct qat_pci_device *qat_pci_dev __rte_unused)
+{
+	return 0;
+}
+
+__attribute__((weak)) int
+qat_comp_dev_create(struct qat_pci_device *qat_pci_dev __rte_unused)
+{
+	return 0;
+}
+
+__attribute__((weak)) int
+qat_comp_dev_destroy(struct qat_pci_device *qat_pci_dev __rte_unused)
+{
+	return 0;
+}
+
 RTE_PMD_REGISTER_PCI(QAT_PCI_NAME, rte_qat_pmd);
 RTE_PMD_REGISTER_PCI_TABLE(QAT_PCI_NAME, pci_id_qat_map);
diff --git a/drivers/crypto/qat/qat_device.h b/drivers/crypto/qat/qat_device.h
index e18c8a7..0cb370c 100644
--- a/drivers/crypto/qat/qat_device.h
+++ b/drivers/crypto/qat/qat_device.h
@@ -69,10 +69,30 @@ extern struct qat_gen_hw_data qat_gen_config[];
 
 struct qat_pci_device *
 qat_pci_device_allocate(struct rte_pci_device *pci_dev);
+
 int
 qat_pci_device_release(struct rte_pci_device *pci_dev);
+
 struct qat_pci_device *
 qat_get_qat_dev_from_pci_dev(struct rte_pci_device *pci_dev);
 
+/* declaration needed for weak functions */
+int
+qat_sym_dev_create(struct qat_pci_device *qat_pci_dev __rte_unused);
+
+int
+qat_asym_dev_create(struct qat_pci_device *qat_pci_dev __rte_unused);
+
+int
+qat_sym_dev_destroy(struct qat_pci_device *qat_pci_dev __rte_unused);
+
+int
+qat_asym_dev_destroy(struct qat_pci_device *qat_pci_dev __rte_unused);
+
+int
+qat_comp_dev_create(struct qat_pci_device *qat_pci_dev __rte_unused);
+
+int
+qat_comp_dev_destroy(struct qat_pci_device *qat_pci_dev __rte_unused);
 
 #endif /* _QAT_DEVICE_H_ */
-- 
2.7.4

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dpdk-dev] [PATCH v2 2/3] crypto/qat: add libcrypto detection to Makefile
  2018-06-14 11:12 ` [dpdk-dev] [PATCH v2 0/3] crypto/qat: move files to drivers/common directory Tomasz Jozwiak
  2018-06-14 11:12   ` [dpdk-dev] [PATCH v2 1/3] crypto/qat: add weak functions Tomasz Jozwiak
@ 2018-06-14 11:12   ` Tomasz Jozwiak
  2018-06-14 11:12   ` [dpdk-dev] [PATCH v2 3/3] crypto/qat: move common qat files to common dir Tomasz Jozwiak
  2 siblings, 0 replies; 21+ messages in thread
From: Tomasz Jozwiak @ 2018-06-14 11:12 UTC (permalink / raw)
  To: fiona.trahe, tomaszx.jozwiak, dev

This patch adds detection of libcrypto in qat/Makefile.
Crypto QAT PMD is build, but only when this library is installed.
Added description into qat.rst file.

Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
Acked-by: Fiona Trahe <fiona.trahe@intel.com>
---
 config/common_base               |  5 +++--
 doc/guides/cryptodevs/qat.rst    |  9 +++++++--
 drivers/crypto/qat/Makefile      | 32 ++++++++++++++++++++------------
 drivers/crypto/qat/meson.build   | 15 +++++++++------
 drivers/crypto/qat/qat_sym.h     |  9 +++++++++
 drivers/crypto/qat/qat_sym_pmd.h |  5 +++++
 6 files changed, 53 insertions(+), 22 deletions(-)

diff --git a/config/common_base b/config/common_base
index 3cd702e..f456f95 100644
--- a/config/common_base
+++ b/config/common_base
@@ -480,8 +480,9 @@ CONFIG_RTE_DPAA_SEC_PMD_MAX_NB_SESSIONS=2048
 
 #
 # Compile PMD for QuickAssist based devices
-#
-CONFIG_RTE_LIBRTE_PMD_QAT=n
+# This QAT flag causes crypto QAT PMD to build,
+# but only if libcrypto is installed.
+CONFIG_RTE_LIBRTE_PMD_QAT=y
 #
 # Max. number of QuickAssist devices, which can be detected and attached
 #
diff --git a/doc/guides/cryptodevs/qat.rst b/doc/guides/cryptodevs/qat.rst
index 77f8362..fa23a56 100644
--- a/doc/guides/cryptodevs/qat.rst
+++ b/doc/guides/cryptodevs/qat.rst
@@ -71,7 +71,10 @@ Limitations
 Installation
 ------------
 
-To enable QAT in DPDK, follow the instructions for modifying the compile-time
+QAT PMD is enabled by default in DPDK, but depends on libcrypto. If this library is detected
+the driver will be enabled and compiled.
+
+To setup QAT in DPDK, follow the instructions for modifying the compile-time
 configuration file as described `here <http://dpdk.org/doc/guides/linux_gsg/build_dpdk.html>`_.
 
 Quick instructions are as follows:
@@ -80,9 +83,11 @@ Quick instructions are as follows:
 
 	cd to the top-level DPDK directory
 	make config T=x86_64-native-linuxapp-gcc
-	sed -i 's,\(CONFIG_RTE_LIBRTE_PMD_QAT\)=n,\1=y,' build/.config
 	make
 
+.. Note::
+    To libcrypto detection - pkg_config is needed and should be installed in the system.
+
 To use the DPDK QAT PMD an SRIOV-enabled QAT kernel driver is required. The VF
 devices exposed by this driver will be used by the QAT PMD. The devices and
 available kernel drivers and device ids are :
diff --git a/drivers/crypto/qat/Makefile b/drivers/crypto/qat/Makefile
index 64f39fd..77700b4 100644
--- a/drivers/crypto/qat/Makefile
+++ b/drivers/crypto/qat/Makefile
@@ -3,6 +3,9 @@
 
 include $(RTE_SDK)/mk/rte.vars.mk
 
+# libcrypto detection
+LIBCRYPTO := $(shell pkg-config --exists libcrypto 1>&2 2> /dev/null; echo $$?)
+
 # library name
 LIB = librte_pmd_qat.a
 
@@ -15,19 +18,24 @@ CFLAGS += -O3
 
 # external library include paths
 CFLAGS += -I$(SRCDIR)/qat_adf
-LDLIBS += -lcrypto
-LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
-LDLIBS += -lrte_cryptodev
-LDLIBS += -lrte_pci -lrte_bus_pci
 
-# library source files
-SRCS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat_sym.c
-SRCS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat_device.c
-SRCS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat_qp.c
-SRCS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat_sym_session.c
-SRCS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat_common.c
-SRCS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat_logs.c
-SRCS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat_sym_pmd.c
+# library common source files
+SRCS-y += qat_device.c
+SRCS-y += qat_common.c
+SRCS-y += qat_logs.c
+SRCS-y += qat_qp.c
+
+ifeq ($(LIBCRYPTO),0)
+	LDLIBS += -lrte_cryptodev
+	LDLIBS += -lcrypto
+	CFLAGS += -DCONFIG_LIBCRYPTO_QAT
+	SRCS-y += qat_sym.c
+	SRCS-y += qat_sym_session.c
+	SRCS-y += qat_sym_pmd.c
+endif
+
+LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool
+LDLIBS += -lrte_pci -lrte_bus_pci
 
 # export include files
 SYMLINK-y-include +=
diff --git a/drivers/crypto/qat/meson.build b/drivers/crypto/qat/meson.build
index 6d01dac..c96486a 100644
--- a/drivers/crypto/qat/meson.build
+++ b/drivers/crypto/qat/meson.build
@@ -2,15 +2,18 @@
 # Copyright(c) 2017-2018 Intel Corporation
 
 dep = dependency('libcrypto', required: false)
-if not dep.found()
-	build = false
-endif
+
 sources = files('qat_common.c',
 		'qat_qp.c',
 		'qat_device.c',
-		'qat_logs.c',
-		'qat_sym_pmd.c', 'qat_sym.c', 'qat_sym_session.c')
+		'qat_logs.c')
+
+if dep.found()
+	sources += files('qat_sym_pmd.c', 'qat_sym.c', 'qat_sym_session.c')
+	pkgconfig_extra_libs += '-lcrypto'
+	cflags += '-DCONFIG_LIBCRYPTO_QAT'
+endif
+
 includes += include_directories('qat_adf')
 deps += ['bus_pci']
 ext_deps += dep
-pkgconfig_extra_libs += '-lcrypto'
diff --git a/drivers/crypto/qat/qat_sym.h b/drivers/crypto/qat/qat_sym.h
index f9e72a6..3c8ec5b 100644
--- a/drivers/crypto/qat/qat_sym.h
+++ b/drivers/crypto/qat/qat_sym.h
@@ -7,6 +7,8 @@
 
 #include <rte_cryptodev_pmd.h>
 
+#ifdef CONFIG_LIBCRYPTO_QAT
+
 #include <openssl/evp.h>
 
 #include "qat_common.h"
@@ -153,4 +155,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 80a1987..641cc4b 100644
--- a/drivers/crypto/qat/qat_sym_pmd.h
+++ b/drivers/crypto/qat/qat_sym_pmd.h
@@ -5,6 +5,9 @@
 #ifndef _QAT_SYM_PMD_H_
 #define _QAT_SYM_PMD_H_
 
+#ifdef CONFIG_LIBCRYPTO_QAT
+
+
 #include <rte_cryptodev.h>
 
 #include "qat_sym_capabilities.h"
@@ -37,4 +40,6 @@ 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_ */
-- 
2.7.4

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dpdk-dev] [PATCH v2 3/3] crypto/qat: move common qat files to common dir
  2018-06-14 11:12 ` [dpdk-dev] [PATCH v2 0/3] crypto/qat: move files to drivers/common directory Tomasz Jozwiak
  2018-06-14 11:12   ` [dpdk-dev] [PATCH v2 1/3] crypto/qat: add weak functions Tomasz Jozwiak
  2018-06-14 11:12   ` [dpdk-dev] [PATCH v2 2/3] crypto/qat: add libcrypto detection to Makefile Tomasz Jozwiak
@ 2018-06-14 11:12   ` Tomasz Jozwiak
  2 siblings, 0 replies; 21+ messages in thread
From: Tomasz Jozwiak @ 2018-06-14 11:12 UTC (permalink / raw)
  To: fiona.trahe, tomaszx.jozwiak, dev

  -  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            | 13 ++++++---
 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                     | 31 +++++++++++++---------
 20 files changed, 53 insertions(+), 19 deletions(-)
 rename drivers/{crypto => common}/qat/Makefile (72%)
 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

diff --git a/MAINTAINERS b/MAINTAINERS
index 7cc8860..aada659 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -757,6 +757,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 72%
rename from drivers/crypto/qat/Makefile
rename to drivers/common/qat/Makefile
index 77700b4..d2c1e2c 100644
--- a/drivers/crypto/qat/Makefile
+++ b/drivers/common/qat/Makefile
@@ -16,8 +16,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
@@ -29,9 +34,9 @@ ifeq ($(LIBCRYPTO),0)
 	LDLIBS += -lrte_cryptodev
 	LDLIBS += -lcrypto
 	CFLAGS += -DCONFIG_LIBCRYPTO_QAT
-	SRCS-y += qat_sym.c
-	SRCS-y += qat_sym_session.c
-	SRCS-y += qat_sym_pmd.c
+	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
@@ -41,6 +46,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..14716a4
--- /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 are 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 c96486a..e474b1d 100644
--- a/drivers/crypto/qat/meson.build
+++ b/drivers/crypto/qat/meson.build
@@ -1,19 +1,24 @@
-# SPDX-License-Identifier: BSD-3-Clause
+# 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'
-	cflags += '-DCONFIG_LIBCRYPTO_QAT'
-endif
+	qat_cflags += '-DCONFIG_LIBCRYPTO_QAT'
 
-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
-- 
2.7.4

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dpdk-dev] [PATCH v3 0/3] crypto/qat: move files to drivers/common directory
  2018-05-22  6:51 [dpdk-dev] [PATCH 0/4] crypto/qat: move files to drivers/common directory Tomasz Jozwiak
                   ` (4 preceding siblings ...)
  2018-06-14 11:12 ` [dpdk-dev] [PATCH v2 0/3] crypto/qat: move files to drivers/common directory Tomasz Jozwiak
@ 2018-06-26  8:15 ` Tomasz Jozwiak
  2018-06-26  8:17 ` Tomasz Jozwiak
  2018-07-02  9:39 ` [dpdk-dev] [PATCH v4 " Tomasz Jozwiak
  7 siblings, 0 replies; 21+ messages in thread
From: Tomasz Jozwiak @ 2018-06-26  8:15 UTC (permalink / raw)
  To: fiona.trahe, tomaszx.jozwiak, dev

This patchset depends on QAT dynamic logging patchset and should be targetig on 18.08.
Patchset refactors the PMD in order that files are split into several
places: common, crypto.
New drivers/common/qat are added and files split between locations.

Changes for v2:
  -  removed drivers/common/qat/qat
  -  updated meson.build files
  -  added description into qat.rst
  -  updated MAINTAINERS file 

Changes for v3:
  -  removed libcrypto detection from Makefile
  -  removed description about libcrypto detection from doc.
  -  renamed CONFIG_LIBCRYPTO_QAT define into BUILD_QAT_SYM

Tomasz Jozwiak (3):
  crypto/qat: add weak functions
  crypto/qat: re-organise build file content
  crypto/qat: move common qat files to common dir

 MAINTAINERS                                        |  1 +
 drivers/Makefile                                   |  2 +
 drivers/common/meson.build                         |  2 +-
 drivers/common/qat/Makefile                        | 49 ++++++++++++++++++++++
 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        | 39 ++++++++++++++++-
 drivers/{crypto => common}/qat/qat_device.h        | 20 +++++++++
 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/Makefile                        | 40 ------------------
 drivers/crypto/qat/README                          |  8 ++++
 drivers/crypto/qat/meson.build                     | 32 ++++++++------
 drivers/crypto/qat/qat_asym_pmd.c                  | 17 --------
 drivers/crypto/qat/qat_asym_pmd.h                  | 15 -------
 drivers/crypto/qat/qat_comp_pmd.c                  | 18 --------
 drivers/crypto/qat/qat_comp_pmd.h                  | 29 -------------
 drivers/crypto/qat/qat_sym.h                       |  8 ++++
 drivers/crypto/qat/qat_sym_pmd.h                   |  6 ++-
 27 files changed, 163 insertions(+), 138 deletions(-)
 create mode 100644 drivers/common/qat/Makefile
 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 (88%)
 rename drivers/{crypto => common}/qat/qat_device.h (80%)
 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%)
 delete mode 100644 drivers/crypto/qat/Makefile
 create mode 100644 drivers/crypto/qat/README
 delete mode 100644 drivers/crypto/qat/qat_asym_pmd.c
 delete mode 100644 drivers/crypto/qat/qat_asym_pmd.h
 delete mode 100644 drivers/crypto/qat/qat_comp_pmd.c
 delete mode 100644 drivers/crypto/qat/qat_comp_pmd.h

-- 
2.7.4

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dpdk-dev] [PATCH v3 0/3] crypto/qat: move files to drivers/common directory
  2018-05-22  6:51 [dpdk-dev] [PATCH 0/4] crypto/qat: move files to drivers/common directory Tomasz Jozwiak
                   ` (5 preceding siblings ...)
  2018-06-26  8:15 ` [dpdk-dev] [PATCH v3 0/3] crypto/qat: move files to drivers/common directory Tomasz Jozwiak
@ 2018-06-26  8:17 ` Tomasz Jozwiak
  2018-06-26  8:17   ` [dpdk-dev] [PATCH v3 1/3] crypto/qat: add weak functions Tomasz Jozwiak
                     ` (3 more replies)
  2018-07-02  9:39 ` [dpdk-dev] [PATCH v4 " Tomasz Jozwiak
  7 siblings, 4 replies; 21+ messages in thread
From: Tomasz Jozwiak @ 2018-06-26  8:17 UTC (permalink / raw)
  To: fiona.trahe, tomaszx.jozwiak, dev

This patchset depends on QAT dynamic logging patchset and should be targetig on 18.08.
Patchset refactors the PMD in order that files are split into several
places: common, crypto.
New drivers/common/qat are added and files split between locations.

Changes for v2:
  -  removed drivers/common/qat/qat
  -  updated meson.build files
  -  added description into qat.rst
  -  updated MAINTAINERS file 

Changes for v3:
  -  removed libcrypto detection from Makefile
  -  removed description about libcrypto detection from doc.
  -  renamed CONFIG_LIBCRYPTO_QAT define into BUILD_QAT_SYM

Tomasz Jozwiak (3):
  crypto/qat: add weak functions
  crypto/qat: re-organise build file content
  crypto/qat: move common qat files to common dir

 MAINTAINERS                                        |  1 +
 drivers/Makefile                                   |  2 +
 drivers/common/meson.build                         |  2 +-
 drivers/common/qat/Makefile                        | 49 ++++++++++++++++++++++
 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        | 39 ++++++++++++++++-
 drivers/{crypto => common}/qat/qat_device.h        | 20 +++++++++
 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/Makefile                        | 40 ------------------
 drivers/crypto/qat/README                          |  8 ++++
 drivers/crypto/qat/meson.build                     | 32 ++++++++------
 drivers/crypto/qat/qat_asym_pmd.c                  | 17 --------
 drivers/crypto/qat/qat_asym_pmd.h                  | 15 -------
 drivers/crypto/qat/qat_comp_pmd.c                  | 18 --------
 drivers/crypto/qat/qat_comp_pmd.h                  | 29 -------------
 drivers/crypto/qat/qat_sym.h                       |  8 ++++
 drivers/crypto/qat/qat_sym_pmd.h                   |  6 ++-
 27 files changed, 163 insertions(+), 138 deletions(-)
 create mode 100644 drivers/common/qat/Makefile
 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 (88%)
 rename drivers/{crypto => common}/qat/qat_device.h (80%)
 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%)
 delete mode 100644 drivers/crypto/qat/Makefile
 create mode 100644 drivers/crypto/qat/README
 delete mode 100644 drivers/crypto/qat/qat_asym_pmd.c
 delete mode 100644 drivers/crypto/qat/qat_asym_pmd.h
 delete mode 100644 drivers/crypto/qat/qat_comp_pmd.c
 delete mode 100644 drivers/crypto/qat/qat_comp_pmd.h

-- 
2.7.4

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dpdk-dev] [PATCH v3 1/3] crypto/qat: add weak functions
  2018-06-26  8:17 ` Tomasz Jozwiak
@ 2018-06-26  8:17   ` Tomasz Jozwiak
  2018-06-26  8:17   ` [dpdk-dev] [PATCH v3 2/3] crypto/qat: re-organise build file content Tomasz Jozwiak
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 21+ messages in thread
From: Tomasz Jozwiak @ 2018-06-26  8:17 UTC (permalink / raw)
  To: fiona.trahe, tomaszx.jozwiak, dev

This patch adds following weak functions to facilitate conditional
compilation of code for those services:
  -  qat_sym_dev_create
  -  qat_asym_dev_create
  -  qat_comp_dev_create
  -  qat_sym_dev_destroy
  -  qat_asym_dev_destroy
  -  qat_comp_dev_destroy
and removes unused files with empty definitions of above functions.

Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
Acked-by: Fiona Trahe <fiona.trahe@intel.com>
---
 drivers/crypto/qat/Makefile       |  2 --
 drivers/crypto/qat/meson.build    |  4 +---
 drivers/crypto/qat/qat_asym_pmd.c | 17 -----------------
 drivers/crypto/qat/qat_asym_pmd.h | 15 ---------------
 drivers/crypto/qat/qat_comp_pmd.c | 18 ------------------
 drivers/crypto/qat/qat_comp_pmd.h | 29 -----------------------------
 drivers/crypto/qat/qat_device.c   | 39 +++++++++++++++++++++++++++++++++++++--
 drivers/crypto/qat/qat_device.h   | 20 ++++++++++++++++++++
 8 files changed, 58 insertions(+), 86 deletions(-)
 delete mode 100644 drivers/crypto/qat/qat_asym_pmd.c
 delete mode 100644 drivers/crypto/qat/qat_asym_pmd.h
 delete mode 100644 drivers/crypto/qat/qat_comp_pmd.c
 delete mode 100644 drivers/crypto/qat/qat_comp_pmd.h

diff --git a/drivers/crypto/qat/Makefile b/drivers/crypto/qat/Makefile
index ef4a567..64f39fd 100644
--- a/drivers/crypto/qat/Makefile
+++ b/drivers/crypto/qat/Makefile
@@ -28,8 +28,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat_sym_session.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat_common.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat_logs.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat_sym_pmd.c
-SRCS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat_asym_pmd.c
-SRCS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat_comp_pmd.c
 
 # export include files
 SYMLINK-y-include +=
diff --git a/drivers/crypto/qat/meson.build b/drivers/crypto/qat/meson.build
index bcab16e..6d01dac 100644
--- a/drivers/crypto/qat/meson.build
+++ b/drivers/crypto/qat/meson.build
@@ -9,9 +9,7 @@ sources = files('qat_common.c',
 		'qat_qp.c',
 		'qat_device.c',
 		'qat_logs.c',
-		'qat_sym_pmd.c', 'qat_sym.c', 'qat_sym_session.c',
-		'qat_asym_pmd.c',
-		'qat_comp_pmd.c')
+		'qat_sym_pmd.c', 'qat_sym.c', 'qat_sym_session.c')
 includes += include_directories('qat_adf')
 deps += ['bus_pci']
 ext_deps += dep
diff --git a/drivers/crypto/qat/qat_asym_pmd.c b/drivers/crypto/qat/qat_asym_pmd.c
deleted file mode 100644
index 8d36300..0000000
--- a/drivers/crypto/qat/qat_asym_pmd.c
+++ /dev/null
@@ -1,17 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2018 Intel Corporation
- */
-
-#include "qat_asym_pmd.h"
-
-int
-qat_asym_dev_create(struct qat_pci_device *qat_pci_dev __rte_unused)
-{
-	return 0;
-}
-
-int
-qat_asym_dev_destroy(struct qat_pci_device *qat_pci_dev __rte_unused)
-{
-	return 0;
-}
diff --git a/drivers/crypto/qat/qat_asym_pmd.h b/drivers/crypto/qat/qat_asym_pmd.h
deleted file mode 100644
index 0465e03..0000000
--- a/drivers/crypto/qat/qat_asym_pmd.h
+++ /dev/null
@@ -1,15 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2018 Intel Corporation
- */
-
-#ifndef _QAT_ASYM_PMD_H_
-#define _QAT_ASYM_PMD_H_
-
-#include "qat_device.h"
-
-int
-qat_asym_dev_create(struct qat_pci_device *qat_pci_dev);
-
-int
-qat_asym_dev_destroy(struct qat_pci_device *qat_pci_dev);
-#endif /* _QAT_ASYM_PMD_H_ */
diff --git a/drivers/crypto/qat/qat_comp_pmd.c b/drivers/crypto/qat/qat_comp_pmd.c
deleted file mode 100644
index 547b3db..0000000
--- a/drivers/crypto/qat/qat_comp_pmd.c
+++ /dev/null
@@ -1,18 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2018 Intel Corporation
- */
-
-#include "qat_comp_pmd.h"
-
-
-int
-qat_comp_dev_create(struct qat_pci_device *qat_pci_dev __rte_unused)
-{
-	return 0;
-}
-
-int
-qat_comp_dev_destroy(struct qat_pci_device *qat_pci_dev __rte_unused)
-{
-	return 0;
-}
diff --git a/drivers/crypto/qat/qat_comp_pmd.h b/drivers/crypto/qat/qat_comp_pmd.h
deleted file mode 100644
index cc31246..0000000
--- a/drivers/crypto/qat/qat_comp_pmd.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2018 Intel Corporation
- */
-
-#ifndef _QAT_COMP_PMD_H_
-#define _QAT_COMP_PMD_H_
-
-#include "qat_device.h"
-
-
-/**< Intel(R) QAT Compression PMD device name */
-#define COMPRESSDEV_NAME_QAT_PMD	comp_qat
-
-
-/** private data structure for a QAT compression device.
- * This QAT device is a device offering only a compression service,
- * there can be one of these on each qat_pci_device (VF).
- */
-struct qat_comp_dev_private {
-	struct qat_pci_device *qat_dev;
-	/**< The qat pci device hosting the service */
-};
-
-int
-qat_comp_dev_create(struct qat_pci_device *qat_pci_dev);
-
-int
-qat_comp_dev_destroy(struct qat_pci_device *qat_pci_dev);
-#endif /* _QAT_COMP_PMD_H_ */
diff --git a/drivers/crypto/qat/qat_device.c b/drivers/crypto/qat/qat_device.c
index 4b97c84..64f236e 100644
--- a/drivers/crypto/qat/qat_device.c
+++ b/drivers/crypto/qat/qat_device.c
@@ -5,8 +5,6 @@
 #include "qat_device.h"
 #include "adf_transport_access_macros.h"
 #include "qat_sym_pmd.h"
-#include "qat_asym_pmd.h"
-#include "qat_comp_pmd.h"
 
 /* Hardware device information per generation */
 __extension__
@@ -238,5 +236,42 @@ static struct rte_pci_driver rte_qat_pmd = {
 	.probe = qat_pci_probe,
 	.remove = qat_pci_remove
 };
+
+__attribute__((weak)) int
+qat_sym_dev_create(struct qat_pci_device *qat_pci_dev __rte_unused)
+{
+	return 0;
+}
+
+__attribute__((weak)) int
+qat_asym_dev_create(struct qat_pci_device *qat_pci_dev __rte_unused)
+{
+	return 0;
+}
+
+__attribute__((weak)) int
+qat_sym_dev_destroy(struct qat_pci_device *qat_pci_dev __rte_unused)
+{
+	return 0;
+}
+
+__attribute__((weak)) int
+qat_asym_dev_destroy(struct qat_pci_device *qat_pci_dev __rte_unused)
+{
+	return 0;
+}
+
+__attribute__((weak)) int
+qat_comp_dev_create(struct qat_pci_device *qat_pci_dev __rte_unused)
+{
+	return 0;
+}
+
+__attribute__((weak)) int
+qat_comp_dev_destroy(struct qat_pci_device *qat_pci_dev __rte_unused)
+{
+	return 0;
+}
+
 RTE_PMD_REGISTER_PCI(QAT_PCI_NAME, rte_qat_pmd);
 RTE_PMD_REGISTER_PCI_TABLE(QAT_PCI_NAME, pci_id_qat_map);
diff --git a/drivers/crypto/qat/qat_device.h b/drivers/crypto/qat/qat_device.h
index e18c8a7..0cb370c 100644
--- a/drivers/crypto/qat/qat_device.h
+++ b/drivers/crypto/qat/qat_device.h
@@ -69,10 +69,30 @@ extern struct qat_gen_hw_data qat_gen_config[];
 
 struct qat_pci_device *
 qat_pci_device_allocate(struct rte_pci_device *pci_dev);
+
 int
 qat_pci_device_release(struct rte_pci_device *pci_dev);
+
 struct qat_pci_device *
 qat_get_qat_dev_from_pci_dev(struct rte_pci_device *pci_dev);
 
+/* declaration needed for weak functions */
+int
+qat_sym_dev_create(struct qat_pci_device *qat_pci_dev __rte_unused);
+
+int
+qat_asym_dev_create(struct qat_pci_device *qat_pci_dev __rte_unused);
+
+int
+qat_sym_dev_destroy(struct qat_pci_device *qat_pci_dev __rte_unused);
+
+int
+qat_asym_dev_destroy(struct qat_pci_device *qat_pci_dev __rte_unused);
+
+int
+qat_comp_dev_create(struct qat_pci_device *qat_pci_dev __rte_unused);
+
+int
+qat_comp_dev_destroy(struct qat_pci_device *qat_pci_dev __rte_unused);
 
 #endif /* _QAT_DEVICE_H_ */
-- 
2.7.4

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dpdk-dev] [PATCH v3 2/3] crypto/qat: re-organise build file content
  2018-06-26  8:17 ` Tomasz Jozwiak
  2018-06-26  8:17   ` [dpdk-dev] [PATCH v3 1/3] crypto/qat: add weak functions Tomasz Jozwiak
@ 2018-06-26  8:17   ` Tomasz Jozwiak
  2018-06-26  8:17   ` [dpdk-dev] [PATCH v3 3/3] crypto/qat: move common qat files to common dir Tomasz Jozwiak
  2018-06-27 21:13   ` [dpdk-dev] [PATCH v3 0/3] crypto/qat: move files to drivers/common directory De Lara Guarch, Pablo
  3 siblings, 0 replies; 21+ messages in thread
From: Tomasz Jozwiak @ 2018-06-26  8:17 UTC (permalink / raw)
  To: fiona.trahe, tomaszx.jozwiak, dev

This patch groups sources and related dependencies into
common and sym sections in build files.

Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
Acked-by: Fiona Trahe <fiona.trahe@intel.com>
---
 drivers/crypto/qat/Makefile      | 25 ++++++++++++++-----------
 drivers/crypto/qat/meson.build   | 14 ++++++++------
 drivers/crypto/qat/qat_sym.h     |  2 +-
 drivers/crypto/qat/qat_sym_pmd.h |  3 +--
 4 files changed, 24 insertions(+), 20 deletions(-)

diff --git a/drivers/crypto/qat/Makefile b/drivers/crypto/qat/Makefile
index 64f39fd..a939eca 100644
--- a/drivers/crypto/qat/Makefile
+++ b/drivers/crypto/qat/Makefile
@@ -15,19 +15,22 @@ CFLAGS += -O3
 
 # external library include paths
 CFLAGS += -I$(SRCDIR)/qat_adf
-LDLIBS += -lcrypto
-LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
+
+# library common source files
+SRCS-y += qat_device.c
+SRCS-y += qat_common.c
+SRCS-y += qat_logs.c
+SRCS-y += qat_qp.c
+
+# library symetric crypto source files
 LDLIBS += -lrte_cryptodev
-LDLIBS += -lrte_pci -lrte_bus_pci
+LDLIBS += -lcrypto
+SRCS-y += qat_sym.c
+SRCS-y += qat_sym_session.c
+SRCS-y += qat_sym_pmd.c
 
-# library source files
-SRCS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat_sym.c
-SRCS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat_device.c
-SRCS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat_qp.c
-SRCS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat_sym_session.c
-SRCS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat_common.c
-SRCS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat_logs.c
-SRCS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat_sym_pmd.c
+LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool
+LDLIBS += -lrte_pci -lrte_bus_pci
 
 # export include files
 SYMLINK-y-include +=
diff --git a/drivers/crypto/qat/meson.build b/drivers/crypto/qat/meson.build
index 6d01dac..db4af2c 100644
--- a/drivers/crypto/qat/meson.build
+++ b/drivers/crypto/qat/meson.build
@@ -2,15 +2,17 @@
 # Copyright(c) 2017-2018 Intel Corporation
 
 dep = dependency('libcrypto', required: false)
-if not dep.found()
-	build = false
-endif
+
 sources = files('qat_common.c',
 		'qat_qp.c',
 		'qat_device.c',
-		'qat_logs.c',
-		'qat_sym_pmd.c', 'qat_sym.c', 'qat_sym_session.c')
+		'qat_logs.c')
+
+if dep.found()
+	sources += files('qat_sym_pmd.c', 'qat_sym.c', 'qat_sym_session.c')
+	pkgconfig_extra_libs += '-lcrypto'
+endif
+
 includes += include_directories('qat_adf')
 deps += ['bus_pci']
 ext_deps += dep
-pkgconfig_extra_libs += '-lcrypto'
diff --git a/drivers/crypto/qat/qat_sym.h b/drivers/crypto/qat/qat_sym.h
index f9e72a6..126c191 100644
--- a/drivers/crypto/qat/qat_sym.h
+++ b/drivers/crypto/qat/qat_sym.h
@@ -6,7 +6,6 @@
 #define _QAT_SYM_H_
 
 #include <rte_cryptodev_pmd.h>
-
 #include <openssl/evp.h>
 
 #include "qat_common.h"
@@ -153,4 +152,5 @@ qat_sym_process_response(void **op, uint8_t *resp)
 	}
 	*op = (void *)rx_op;
 }
+
 #endif /* _QAT_SYM_H_ */
diff --git a/drivers/crypto/qat/qat_sym_pmd.h b/drivers/crypto/qat/qat_sym_pmd.h
index 80a1987..1e2344c 100644
--- a/drivers/crypto/qat/qat_sym_pmd.h
+++ b/drivers/crypto/qat/qat_sym_pmd.h
@@ -10,7 +10,6 @@
 #include "qat_sym_capabilities.h"
 #include "qat_device.h"
 
-
 /**< Intel(R) QAT Symmetric Crypto PMD device name */
 #define CRYPTODEV_NAME_QAT_SYM_PMD	crypto_qat
 #define QAT_SYM_PMD_MAX_NB_SESSIONS	2048
@@ -31,10 +30,10 @@ struct qat_sym_dev_private {
 	/* QAT device symmetric crypto capabilities */
 };
 
-
 int
 qat_sym_dev_create(struct qat_pci_device *qat_pci_dev);
 
 int
 qat_sym_dev_destroy(struct qat_pci_device *qat_pci_dev);
+
 #endif /* _QAT_SYM_PMD_H_ */
-- 
2.7.4

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dpdk-dev] [PATCH v3 3/3] crypto/qat: move common qat files to common dir
  2018-06-26  8:17 ` Tomasz Jozwiak
  2018-06-26  8:17   ` [dpdk-dev] [PATCH v3 1/3] crypto/qat: add weak functions Tomasz Jozwiak
  2018-06-26  8:17   ` [dpdk-dev] [PATCH v3 2/3] crypto/qat: re-organise build file content Tomasz Jozwiak
@ 2018-06-26  8:17   ` Tomasz Jozwiak
  2018-06-27 21:13   ` [dpdk-dev] [PATCH v3 0/3] crypto/qat: move files to drivers/common directory De Lara Guarch, Pablo
  3 siblings, 0 replies; 21+ messages in thread
From: Tomasz Jozwiak @ 2018-06-26  8:17 UTC (permalink / raw)
  To: fiona.trahe, tomaszx.jozwiak, dev

  -  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

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_ */
-- 
2.7.4

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [dpdk-dev] [PATCH v3 0/3] crypto/qat: move files to drivers/common directory
  2018-06-26  8:17 ` Tomasz Jozwiak
                     ` (2 preceding siblings ...)
  2018-06-26  8:17   ` [dpdk-dev] [PATCH v3 3/3] crypto/qat: move common qat files to common dir Tomasz Jozwiak
@ 2018-06-27 21:13   ` De Lara Guarch, Pablo
  3 siblings, 0 replies; 21+ messages in thread
From: De Lara Guarch, Pablo @ 2018-06-27 21:13 UTC (permalink / raw)
  To: Jozwiak, TomaszX, Trahe, Fiona, Jozwiak, TomaszX, dev



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Tomasz Jozwiak
> Sent: Tuesday, June 26, 2018 9:18 AM
> To: Trahe, Fiona <fiona.trahe@intel.com>; Jozwiak, TomaszX
> <tomaszx.jozwiak@intel.com>; dev@dpdk.org
> Subject: [dpdk-dev] [PATCH v3 0/3] crypto/qat: move files to drivers/common
> directory
> 
> This patchset depends on QAT dynamic logging patchset and should be targetig
> on 18.08.
> Patchset refactors the PMD in order that files are split into several
> places: common, crypto.
> New drivers/common/qat are added and files split between locations.
> 
> Changes for v2:
>   -  removed drivers/common/qat/qat
>   -  updated meson.build files
>   -  added description into qat.rst
>   -  updated MAINTAINERS file
> 
> Changes for v3:
>   -  removed libcrypto detection from Makefile
>   -  removed description about libcrypto detection from doc.
>   -  renamed CONFIG_LIBCRYPTO_QAT define into BUILD_QAT_SYM
> 

Series applied to dpdk-next-crypto.

Thanks!
Pablo

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dpdk-dev] [PATCH v4 0/3] crypto/qat: move files to drivers/common directory
  2018-05-22  6:51 [dpdk-dev] [PATCH 0/4] crypto/qat: move files to drivers/common directory Tomasz Jozwiak
                   ` (6 preceding siblings ...)
  2018-06-26  8:17 ` Tomasz Jozwiak
@ 2018-07-02  9:39 ` Tomasz Jozwiak
  2018-07-02  9:39   ` [dpdk-dev] [PATCH v4 1/3] crypto/qat: add weak functions Tomasz Jozwiak
                     ` (3 more replies)
  7 siblings, 4 replies; 21+ messages in thread
From: Tomasz Jozwiak @ 2018-07-02  9:39 UTC (permalink / raw)
  To: Fiona.trahe, pablo.de.lara.guarch, dev

This patchset depends on QAT dynamic logging patchset and should be targetig on 18.08.
Patchset refactors the PMD in order that files are split into several
places: common, crypto.
New drivers/common/qat are added and files split between locations.

Changes for v2:
  -  removed drivers/common/qat/qat
  -  updated meson.build files
  -  added description into qat.rst
  -  updated MAINTAINERS file 

Changes for v3:
  -  removed libcrypto detection from Makefile
  -  removed description about libcrypto detection from doc.
  -  renamed CONFIG_LIBCRYPTO_QAT define into BUILD_QAT_SYM

Changes for v4:
  -  fixed libcrypto dependency in 
     're-organise build file content' patch

Tomasz Jozwiak (3):
  crypto/qat: add weak functions
  crypto/qat: re-organise build file content
  crypto/qat: move common qat files to common dir

 MAINTAINERS                                        |  1 +
 drivers/Makefile                                   |  2 +
 drivers/common/meson.build                         |  2 +-
 drivers/common/qat/Makefile                        | 49 ++++++++++++++++++++++
 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        | 39 ++++++++++++++++-
 drivers/{crypto => common}/qat/qat_device.h        | 20 +++++++++
 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/Makefile                        | 40 ------------------
 drivers/crypto/qat/README                          |  8 ++++
 drivers/crypto/qat/meson.build                     | 32 ++++++++------
 drivers/crypto/qat/qat_asym_pmd.c                  | 17 --------
 drivers/crypto/qat/qat_asym_pmd.h                  | 15 -------
 drivers/crypto/qat/qat_comp_pmd.c                  | 18 --------
 drivers/crypto/qat/qat_comp_pmd.h                  | 29 -------------
 drivers/crypto/qat/qat_sym.h                       |  8 ++++
 drivers/crypto/qat/qat_sym_pmd.h                   |  6 ++-
 27 files changed, 163 insertions(+), 138 deletions(-)
 create mode 100644 drivers/common/qat/Makefile
 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 (88%)
 rename drivers/{crypto => common}/qat/qat_device.h (80%)
 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%)
 delete mode 100644 drivers/crypto/qat/Makefile
 create mode 100644 drivers/crypto/qat/README
 delete mode 100644 drivers/crypto/qat/qat_asym_pmd.c
 delete mode 100644 drivers/crypto/qat/qat_asym_pmd.h
 delete mode 100644 drivers/crypto/qat/qat_comp_pmd.c
 delete mode 100644 drivers/crypto/qat/qat_comp_pmd.h

-- 
2.7.4

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dpdk-dev] [PATCH v4 1/3] crypto/qat: add weak functions
  2018-07-02  9:39 ` [dpdk-dev] [PATCH v4 " Tomasz Jozwiak
@ 2018-07-02  9:39   ` Tomasz Jozwiak
  2018-07-02  9:39   ` [dpdk-dev] [PATCH v4 2/3] crypto/qat: re-organise build file content Tomasz Jozwiak
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 21+ messages in thread
From: Tomasz Jozwiak @ 2018-07-02  9:39 UTC (permalink / raw)
  To: Fiona.trahe, pablo.de.lara.guarch, dev

This patch adds following weak functions to facilitate conditional
compilation of code for those services:
  -  qat_sym_dev_create
  -  qat_asym_dev_create
  -  qat_comp_dev_create
  -  qat_sym_dev_destroy
  -  qat_asym_dev_destroy
  -  qat_comp_dev_destroy
and removes unused files with empty definitions of above functions.

Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
Acked-by: Fiona Trahe <fiona.trahe@intel.com>
---
 drivers/crypto/qat/Makefile       |  2 --
 drivers/crypto/qat/meson.build    |  4 +---
 drivers/crypto/qat/qat_asym_pmd.c | 17 -----------------
 drivers/crypto/qat/qat_asym_pmd.h | 15 ---------------
 drivers/crypto/qat/qat_comp_pmd.c | 18 ------------------
 drivers/crypto/qat/qat_comp_pmd.h | 29 -----------------------------
 drivers/crypto/qat/qat_device.c   | 39 +++++++++++++++++++++++++++++++++++++--
 drivers/crypto/qat/qat_device.h   | 20 ++++++++++++++++++++
 8 files changed, 58 insertions(+), 86 deletions(-)
 delete mode 100644 drivers/crypto/qat/qat_asym_pmd.c
 delete mode 100644 drivers/crypto/qat/qat_asym_pmd.h
 delete mode 100644 drivers/crypto/qat/qat_comp_pmd.c
 delete mode 100644 drivers/crypto/qat/qat_comp_pmd.h

diff --git a/drivers/crypto/qat/Makefile b/drivers/crypto/qat/Makefile
index ef4a567..64f39fd 100644
--- a/drivers/crypto/qat/Makefile
+++ b/drivers/crypto/qat/Makefile
@@ -28,8 +28,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat_sym_session.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat_common.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat_logs.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat_sym_pmd.c
-SRCS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat_asym_pmd.c
-SRCS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat_comp_pmd.c
 
 # export include files
 SYMLINK-y-include +=
diff --git a/drivers/crypto/qat/meson.build b/drivers/crypto/qat/meson.build
index bcab16e..6d01dac 100644
--- a/drivers/crypto/qat/meson.build
+++ b/drivers/crypto/qat/meson.build
@@ -9,9 +9,7 @@ sources = files('qat_common.c',
 		'qat_qp.c',
 		'qat_device.c',
 		'qat_logs.c',
-		'qat_sym_pmd.c', 'qat_sym.c', 'qat_sym_session.c',
-		'qat_asym_pmd.c',
-		'qat_comp_pmd.c')
+		'qat_sym_pmd.c', 'qat_sym.c', 'qat_sym_session.c')
 includes += include_directories('qat_adf')
 deps += ['bus_pci']
 ext_deps += dep
diff --git a/drivers/crypto/qat/qat_asym_pmd.c b/drivers/crypto/qat/qat_asym_pmd.c
deleted file mode 100644
index 8d36300..0000000
--- a/drivers/crypto/qat/qat_asym_pmd.c
+++ /dev/null
@@ -1,17 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2018 Intel Corporation
- */
-
-#include "qat_asym_pmd.h"
-
-int
-qat_asym_dev_create(struct qat_pci_device *qat_pci_dev __rte_unused)
-{
-	return 0;
-}
-
-int
-qat_asym_dev_destroy(struct qat_pci_device *qat_pci_dev __rte_unused)
-{
-	return 0;
-}
diff --git a/drivers/crypto/qat/qat_asym_pmd.h b/drivers/crypto/qat/qat_asym_pmd.h
deleted file mode 100644
index 0465e03..0000000
--- a/drivers/crypto/qat/qat_asym_pmd.h
+++ /dev/null
@@ -1,15 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2018 Intel Corporation
- */
-
-#ifndef _QAT_ASYM_PMD_H_
-#define _QAT_ASYM_PMD_H_
-
-#include "qat_device.h"
-
-int
-qat_asym_dev_create(struct qat_pci_device *qat_pci_dev);
-
-int
-qat_asym_dev_destroy(struct qat_pci_device *qat_pci_dev);
-#endif /* _QAT_ASYM_PMD_H_ */
diff --git a/drivers/crypto/qat/qat_comp_pmd.c b/drivers/crypto/qat/qat_comp_pmd.c
deleted file mode 100644
index 547b3db..0000000
--- a/drivers/crypto/qat/qat_comp_pmd.c
+++ /dev/null
@@ -1,18 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2018 Intel Corporation
- */
-
-#include "qat_comp_pmd.h"
-
-
-int
-qat_comp_dev_create(struct qat_pci_device *qat_pci_dev __rte_unused)
-{
-	return 0;
-}
-
-int
-qat_comp_dev_destroy(struct qat_pci_device *qat_pci_dev __rte_unused)
-{
-	return 0;
-}
diff --git a/drivers/crypto/qat/qat_comp_pmd.h b/drivers/crypto/qat/qat_comp_pmd.h
deleted file mode 100644
index cc31246..0000000
--- a/drivers/crypto/qat/qat_comp_pmd.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2018 Intel Corporation
- */
-
-#ifndef _QAT_COMP_PMD_H_
-#define _QAT_COMP_PMD_H_
-
-#include "qat_device.h"
-
-
-/**< Intel(R) QAT Compression PMD device name */
-#define COMPRESSDEV_NAME_QAT_PMD	comp_qat
-
-
-/** private data structure for a QAT compression device.
- * This QAT device is a device offering only a compression service,
- * there can be one of these on each qat_pci_device (VF).
- */
-struct qat_comp_dev_private {
-	struct qat_pci_device *qat_dev;
-	/**< The qat pci device hosting the service */
-};
-
-int
-qat_comp_dev_create(struct qat_pci_device *qat_pci_dev);
-
-int
-qat_comp_dev_destroy(struct qat_pci_device *qat_pci_dev);
-#endif /* _QAT_COMP_PMD_H_ */
diff --git a/drivers/crypto/qat/qat_device.c b/drivers/crypto/qat/qat_device.c
index 4b97c84..64f236e 100644
--- a/drivers/crypto/qat/qat_device.c
+++ b/drivers/crypto/qat/qat_device.c
@@ -5,8 +5,6 @@
 #include "qat_device.h"
 #include "adf_transport_access_macros.h"
 #include "qat_sym_pmd.h"
-#include "qat_asym_pmd.h"
-#include "qat_comp_pmd.h"
 
 /* Hardware device information per generation */
 __extension__
@@ -238,5 +236,42 @@ static struct rte_pci_driver rte_qat_pmd = {
 	.probe = qat_pci_probe,
 	.remove = qat_pci_remove
 };
+
+__attribute__((weak)) int
+qat_sym_dev_create(struct qat_pci_device *qat_pci_dev __rte_unused)
+{
+	return 0;
+}
+
+__attribute__((weak)) int
+qat_asym_dev_create(struct qat_pci_device *qat_pci_dev __rte_unused)
+{
+	return 0;
+}
+
+__attribute__((weak)) int
+qat_sym_dev_destroy(struct qat_pci_device *qat_pci_dev __rte_unused)
+{
+	return 0;
+}
+
+__attribute__((weak)) int
+qat_asym_dev_destroy(struct qat_pci_device *qat_pci_dev __rte_unused)
+{
+	return 0;
+}
+
+__attribute__((weak)) int
+qat_comp_dev_create(struct qat_pci_device *qat_pci_dev __rte_unused)
+{
+	return 0;
+}
+
+__attribute__((weak)) int
+qat_comp_dev_destroy(struct qat_pci_device *qat_pci_dev __rte_unused)
+{
+	return 0;
+}
+
 RTE_PMD_REGISTER_PCI(QAT_PCI_NAME, rte_qat_pmd);
 RTE_PMD_REGISTER_PCI_TABLE(QAT_PCI_NAME, pci_id_qat_map);
diff --git a/drivers/crypto/qat/qat_device.h b/drivers/crypto/qat/qat_device.h
index e18c8a7..0cb370c 100644
--- a/drivers/crypto/qat/qat_device.h
+++ b/drivers/crypto/qat/qat_device.h
@@ -69,10 +69,30 @@ extern struct qat_gen_hw_data qat_gen_config[];
 
 struct qat_pci_device *
 qat_pci_device_allocate(struct rte_pci_device *pci_dev);
+
 int
 qat_pci_device_release(struct rte_pci_device *pci_dev);
+
 struct qat_pci_device *
 qat_get_qat_dev_from_pci_dev(struct rte_pci_device *pci_dev);
 
+/* declaration needed for weak functions */
+int
+qat_sym_dev_create(struct qat_pci_device *qat_pci_dev __rte_unused);
+
+int
+qat_asym_dev_create(struct qat_pci_device *qat_pci_dev __rte_unused);
+
+int
+qat_sym_dev_destroy(struct qat_pci_device *qat_pci_dev __rte_unused);
+
+int
+qat_asym_dev_destroy(struct qat_pci_device *qat_pci_dev __rte_unused);
+
+int
+qat_comp_dev_create(struct qat_pci_device *qat_pci_dev __rte_unused);
+
+int
+qat_comp_dev_destroy(struct qat_pci_device *qat_pci_dev __rte_unused);
 
 #endif /* _QAT_DEVICE_H_ */
-- 
2.7.4

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dpdk-dev] [PATCH v4 2/3] crypto/qat: re-organise build file content
  2018-07-02  9:39 ` [dpdk-dev] [PATCH v4 " Tomasz Jozwiak
  2018-07-02  9:39   ` [dpdk-dev] [PATCH v4 1/3] crypto/qat: add weak functions Tomasz Jozwiak
@ 2018-07-02  9:39   ` Tomasz Jozwiak
  2018-07-02  9:39   ` [dpdk-dev] [PATCH v4 3/3] crypto/qat: move common qat files to common dir Tomasz Jozwiak
  2018-07-02 13:06   ` [dpdk-dev] [PATCH v4 0/3] crypto/qat: move files to drivers/common directory De Lara Guarch, Pablo
  3 siblings, 0 replies; 21+ messages in thread
From: Tomasz Jozwiak @ 2018-07-02  9:39 UTC (permalink / raw)
  To: Fiona.trahe, pablo.de.lara.guarch, dev

This patch groups sources and related dependencies into
common and sym sections in build files.

Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
Acked-by: Fiona Trahe <fiona.trahe@intel.com>
---
 drivers/crypto/qat/Makefile      | 25 ++++++++++++++-----------
 drivers/crypto/qat/meson.build   | 16 ++++++++++------
 drivers/crypto/qat/qat_sym.h     |  2 +-
 drivers/crypto/qat/qat_sym_pmd.h |  3 +--
 4 files changed, 26 insertions(+), 20 deletions(-)

diff --git a/drivers/crypto/qat/Makefile b/drivers/crypto/qat/Makefile
index 64f39fd..a939eca 100644
--- a/drivers/crypto/qat/Makefile
+++ b/drivers/crypto/qat/Makefile
@@ -15,19 +15,22 @@ CFLAGS += -O3
 
 # external library include paths
 CFLAGS += -I$(SRCDIR)/qat_adf
-LDLIBS += -lcrypto
-LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
+
+# library common source files
+SRCS-y += qat_device.c
+SRCS-y += qat_common.c
+SRCS-y += qat_logs.c
+SRCS-y += qat_qp.c
+
+# library symetric crypto source files
 LDLIBS += -lrte_cryptodev
-LDLIBS += -lrte_pci -lrte_bus_pci
+LDLIBS += -lcrypto
+SRCS-y += qat_sym.c
+SRCS-y += qat_sym_session.c
+SRCS-y += qat_sym_pmd.c
 
-# library source files
-SRCS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat_sym.c
-SRCS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat_device.c
-SRCS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat_qp.c
-SRCS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat_sym_session.c
-SRCS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat_common.c
-SRCS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat_logs.c
-SRCS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat_sym_pmd.c
+LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool
+LDLIBS += -lrte_pci -lrte_bus_pci
 
 # export include files
 SYMLINK-y-include +=
diff --git a/drivers/crypto/qat/meson.build b/drivers/crypto/qat/meson.build
index 6d01dac..0675426 100644
--- a/drivers/crypto/qat/meson.build
+++ b/drivers/crypto/qat/meson.build
@@ -2,15 +2,19 @@
 # Copyright(c) 2017-2018 Intel Corporation
 
 dep = dependency('libcrypto', required: false)
-if not dep.found()
-	build = false
-endif
+
+build = false
 sources = files('qat_common.c',
 		'qat_qp.c',
 		'qat_device.c',
-		'qat_logs.c',
-		'qat_sym_pmd.c', 'qat_sym.c', 'qat_sym_session.c')
+		'qat_logs.c')
+
+if dep.found()
+	sources += files('qat_sym_pmd.c', 'qat_sym.c', 'qat_sym_session.c')
+	pkgconfig_extra_libs += '-lcrypto'
+	build = true
+endif
+
 includes += include_directories('qat_adf')
 deps += ['bus_pci']
 ext_deps += dep
-pkgconfig_extra_libs += '-lcrypto'
diff --git a/drivers/crypto/qat/qat_sym.h b/drivers/crypto/qat/qat_sym.h
index f9e72a6..126c191 100644
--- a/drivers/crypto/qat/qat_sym.h
+++ b/drivers/crypto/qat/qat_sym.h
@@ -6,7 +6,6 @@
 #define _QAT_SYM_H_
 
 #include <rte_cryptodev_pmd.h>
-
 #include <openssl/evp.h>
 
 #include "qat_common.h"
@@ -153,4 +152,5 @@ qat_sym_process_response(void **op, uint8_t *resp)
 	}
 	*op = (void *)rx_op;
 }
+
 #endif /* _QAT_SYM_H_ */
diff --git a/drivers/crypto/qat/qat_sym_pmd.h b/drivers/crypto/qat/qat_sym_pmd.h
index 80a1987..1e2344c 100644
--- a/drivers/crypto/qat/qat_sym_pmd.h
+++ b/drivers/crypto/qat/qat_sym_pmd.h
@@ -10,7 +10,6 @@
 #include "qat_sym_capabilities.h"
 #include "qat_device.h"
 
-
 /**< Intel(R) QAT Symmetric Crypto PMD device name */
 #define CRYPTODEV_NAME_QAT_SYM_PMD	crypto_qat
 #define QAT_SYM_PMD_MAX_NB_SESSIONS	2048
@@ -31,10 +30,10 @@ struct qat_sym_dev_private {
 	/* QAT device symmetric crypto capabilities */
 };
 
-
 int
 qat_sym_dev_create(struct qat_pci_device *qat_pci_dev);
 
 int
 qat_sym_dev_destroy(struct qat_pci_device *qat_pci_dev);
+
 #endif /* _QAT_SYM_PMD_H_ */
-- 
2.7.4

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dpdk-dev] [PATCH v4 3/3] crypto/qat: move common qat files to common dir
  2018-07-02  9:39 ` [dpdk-dev] [PATCH v4 " Tomasz Jozwiak
  2018-07-02  9:39   ` [dpdk-dev] [PATCH v4 1/3] crypto/qat: add weak functions Tomasz Jozwiak
  2018-07-02  9:39   ` [dpdk-dev] [PATCH v4 2/3] crypto/qat: re-organise build file content Tomasz Jozwiak
@ 2018-07-02  9:39   ` Tomasz Jozwiak
  2018-07-02 13:06   ` [dpdk-dev] [PATCH v4 0/3] crypto/qat: move files to drivers/common directory De Lara Guarch, Pablo
  3 siblings, 0 replies; 21+ messages in thread
From: Tomasz Jozwiak @ 2018-07-02  9:39 UTC (permalink / raw)
  To: Fiona.trahe, pablo.de.lara.guarch, dev

  -  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, 67 insertions(+), 20 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

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 0675426..2873637 100644
--- a/drivers/crypto/qat/meson.build
+++ b/drivers/crypto/qat/meson.build
@@ -1,20 +1,24 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017-2018 Intel Corporation
 
-dep = dependency('libcrypto', required: false)
-
 build = false
-sources = files('qat_common.c',
-		'qat_qp.c',
-		'qat_device.c',
-		'qat_logs.c')
-
+dep = dependency('libcrypto', required: false)
 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'
+	qat_cflags += '-DBUILD_QAT_SYM'
+
+	# build the whole driver
+	sources += qat_sources
+	cflags += qat_cflags
+	deps += qat_deps
+	ext_deps += qat_ext_deps
+	includes += qat_includes
 	build = true
 endif
-
-includes += include_directories('qat_adf')
-deps += ['bus_pci']
-ext_deps += dep
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_ */
-- 
2.7.4

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [dpdk-dev] [PATCH v4 0/3] crypto/qat: move files to drivers/common directory
  2018-07-02  9:39 ` [dpdk-dev] [PATCH v4 " Tomasz Jozwiak
                     ` (2 preceding siblings ...)
  2018-07-02  9:39   ` [dpdk-dev] [PATCH v4 3/3] crypto/qat: move common qat files to common dir Tomasz Jozwiak
@ 2018-07-02 13:06   ` De Lara Guarch, Pablo
  3 siblings, 0 replies; 21+ messages in thread
From: De Lara Guarch, Pablo @ 2018-07-02 13:06 UTC (permalink / raw)
  To: Jozwiak, TomaszX, Trahe, Fiona, dev



> -----Original Message-----
> From: Jozwiak, TomaszX
> Sent: Monday, July 2, 2018 10:39 AM
> To: Trahe, Fiona <fiona.trahe@intel.com>; De Lara Guarch, Pablo
> <pablo.de.lara.guarch@intel.com>; dev@dpdk.org
> Subject: [PATCH v4 0/3] crypto/qat: move files to drivers/common directory
> 
> This patchset depends on QAT dynamic logging patchset and should be targetig
> on 18.08.
> Patchset refactors the PMD in order that files are split into several
> places: common, crypto.
> New drivers/common/qat are added and files split between locations.

Series applied to dpdk-next-crypto.

Thanks,
Pablo

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2018-07-02 13:06 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-22  6:51 [dpdk-dev] [PATCH 0/4] crypto/qat: move files to drivers/common directory Tomasz Jozwiak
2018-05-22  6:51 ` [dpdk-dev] [PATCH 1/4] crypto/qat: add weak functions Tomasz Jozwiak
2018-05-22  6:51 ` [dpdk-dev] [PATCH 2/4] crypto/qat: add libcrypto detection to Makefile Tomasz Jozwiak
2018-05-22  6:51 ` [dpdk-dev] [PATCH 3/4] crypto/qat: move common qat files to common dir Tomasz Jozwiak
2018-05-22  9:20   ` Bruce Richardson
2018-05-22  6:51 ` [dpdk-dev] [PATCH 4/4] doc/qat: document libcrypto detection Tomasz Jozwiak
2018-06-14 11:12 ` [dpdk-dev] [PATCH v2 0/3] crypto/qat: move files to drivers/common directory Tomasz Jozwiak
2018-06-14 11:12   ` [dpdk-dev] [PATCH v2 1/3] crypto/qat: add weak functions Tomasz Jozwiak
2018-06-14 11:12   ` [dpdk-dev] [PATCH v2 2/3] crypto/qat: add libcrypto detection to Makefile Tomasz Jozwiak
2018-06-14 11:12   ` [dpdk-dev] [PATCH v2 3/3] crypto/qat: move common qat files to common dir Tomasz Jozwiak
2018-06-26  8:15 ` [dpdk-dev] [PATCH v3 0/3] crypto/qat: move files to drivers/common directory Tomasz Jozwiak
2018-06-26  8:17 ` Tomasz Jozwiak
2018-06-26  8:17   ` [dpdk-dev] [PATCH v3 1/3] crypto/qat: add weak functions Tomasz Jozwiak
2018-06-26  8:17   ` [dpdk-dev] [PATCH v3 2/3] crypto/qat: re-organise build file content Tomasz Jozwiak
2018-06-26  8:17   ` [dpdk-dev] [PATCH v3 3/3] crypto/qat: move common qat files to common dir Tomasz Jozwiak
2018-06-27 21:13   ` [dpdk-dev] [PATCH v3 0/3] crypto/qat: move files to drivers/common directory De Lara Guarch, Pablo
2018-07-02  9:39 ` [dpdk-dev] [PATCH v4 " Tomasz Jozwiak
2018-07-02  9:39   ` [dpdk-dev] [PATCH v4 1/3] crypto/qat: add weak functions Tomasz Jozwiak
2018-07-02  9:39   ` [dpdk-dev] [PATCH v4 2/3] crypto/qat: re-organise build file content Tomasz Jozwiak
2018-07-02  9:39   ` [dpdk-dev] [PATCH v4 3/3] crypto/qat: move common qat files to common dir Tomasz Jozwiak
2018-07-02 13:06   ` [dpdk-dev] [PATCH v4 0/3] crypto/qat: move files to drivers/common directory De Lara Guarch, Pablo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).