diff mbox series

[v2,1/3] crypto/qat: add weak functions

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

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation fail apply issues

Commit Message

Tomasz Jozwiak June 14, 2018, 11:12 a.m. UTC
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 mbox series

Patch

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