From: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
To: fiona.trahe@intel.com, tomaszx.jozwiak@intel.com, dev@dpdk.org
Subject: [dpdk-dev] [PATCH v2 2/3] crypto/qat: add libcrypto detection to Makefile
Date: Thu, 14 Jun 2018 13:12:16 +0200 [thread overview]
Message-ID: <1528974737-13518-3-git-send-email-tomaszx.jozwiak@intel.com> (raw)
In-Reply-To: <1528974737-13518-1-git-send-email-tomaszx.jozwiak@intel.com>
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
next prev parent reply other threads:[~2018-06-14 11:12 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Tomasz Jozwiak [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1528974737-13518-3-git-send-email-tomaszx.jozwiak@intel.com \
--to=tomaszx.jozwiak@intel.com \
--cc=dev@dpdk.org \
--cc=fiona.trahe@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).