Skip to contentSkip to conversation

Use Intel IPSec MB library in Wireless PMDs

PATCH Superseded Pablo de Lara 4 participants 21 messages Dec 11, 2019 – Jan 21, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover Use Intel IPSec MB library in Wireless PMDs

The three Intel SW Crypto PMDs supporting SNOW3G, ZUC and KASUMI link against libSSO libraries.
The Intel IPSec Multi-buffer library recently integrated the code from these libraries, in version v0.53. This library can be downloaded from https://github.com/intel/intel-ipsec-mb.

KASUMI, SNOW3G and ZUC PMDs have been modified to use this single library, which is already used in the AESNI MB and AESNI GCM PMDs, reducing the number of external dependencies in the crypto PMDs.

Pablo de Lara (3):
crypto/zuc: use IPSec library
crypto/kasumi: use IPSec library
crypto/snow3g: use IPSec library

 devtools/test-build.sh                     | 16 ++----
 doc/guides/cryptodevs/kasumi.rst           | 62 ++++++++++++----------
 doc/guides/cryptodevs/snow3g.rst           | 58 +++++++++++---------
 doc/guides/cryptodevs/zuc.rst              | 52 ++++++++++--------
 doc/guides/rel_notes/release_20_02.rst     | 17 ++++++
 drivers/crypto/kasumi/Makefile             | 26 +++++----
 drivers/crypto/kasumi/kasumi_pmd_private.h | 12 +++--
 drivers/crypto/kasumi/meson.build          | 24 ++++++---
 drivers/crypto/kasumi/rte_kasumi_pmd.c     | 79 +++++++++++++++------------
 drivers/crypto/kasumi/rte_kasumi_pmd_ops.c |  8 ++-
 drivers/crypto/snow3g/Makefile             | 29 ++++++----
 drivers/crypto/snow3g/meson.build          | 21 ++++++--
 drivers/crypto/snow3g/rte_snow3g_pmd.c     | 85 ++++++++++++++++++------------
 drivers/crypto/snow3g/rte_snow3g_pmd_ops.c |  8 ++-
 drivers/crypto/snow3g/snow3g_pmd_private.h | 14 +++--
 drivers/crypto/zuc/Makefile                | 28 ++++++----
 drivers/crypto/zuc/meson.build             | 24 ++++++---
 drivers/crypto/zuc/rte_zuc_pmd.c           | 43 ++++++++++-----
 drivers/crypto/zuc/rte_zuc_pmd_ops.c       |  2 +
 drivers/crypto/zuc/zuc_pmd_private.h       |  6 ++-
 mk/rte.app.mk                              |  6 +--
 21 files changed, 388 insertions(+), 232 deletions(-)
Signature · 1 line
2.7.5
#1 lore raw

PATCH 1/3 crypto/zuc: use IPSec library

Link against Intel IPSec Multi-buffer library, which added support for ZUC-EEA3 and ZUC-EIA3 from version v0.53, moving from libSSO ZUC library.

---
 devtools/test-build.sh                 |  6 ++--
 doc/guides/cryptodevs/zuc.rst          | 52 ++++++++++++++++++++--------------
 doc/guides/rel_notes/release_20_02.rst |  7 +++++
 drivers/crypto/zuc/Makefile            | 28 +++++++++++-------
 drivers/crypto/zuc/meson.build         | 24 ++++++++++++----
 drivers/crypto/zuc/rte_zuc_pmd.c       | 43 +++++++++++++++++++---------
 drivers/crypto/zuc/rte_zuc_pmd_ops.c   |  2 ++
 drivers/crypto/zuc/zuc_pmd_private.h   |  6 +++-
 mk/rte.app.mk                          |  2 +-
 9 files changed, 113 insertions(+), 57 deletions(-)
devtools/test-build.sh +2 -4
index be565a1..afa0748 100755
@@ -29,7 +29,6 @@ default_path=$PATH
 # - LIBMUSDK_PATH
 # - LIBSSO_SNOW3G_PATH
 # - LIBSSO_KASUMI_PATH
-# - LIBSSO_ZUC_PATH
 . $(dirname $(readlink -f $0))/load-devel-config
 
 print_usage () {
@@ -123,7 +122,6 @@ reset_env ()
 	unset LIBMUSDK_PATH
 	unset LIBSSO_SNOW3G_PATH
 	unset LIBSSO_KASUMI_PATH
-	unset LIBSSO_ZUC_PATH
 	unset PQOS_INSTALL_PATH
 }
 
@@ -183,12 +181,12 @@ config () # <directory> <target> <options>
 		sed -ri=""       's,(PMD_AESNI_MB=)n,\1y,' $1/.config
 		test "$DPDK_DEP_IPSEC_MB" != y || \
 		sed -ri=""      's,(PMD_AESNI_GCM=)n,\1y,' $1/.config
+		test "$DPDK_DEP_IPSEC_MB" != y || \
+		sed -ri=""            's,(PMD_ZUC=)n,\1y,' $1/.config
 		test -z "$LIBSSO_SNOW3G_PATH" || \
 		sed -ri=""         's,(PMD_SNOW3G=)n,\1y,' $1/.config
 		test -z "$LIBSSO_KASUMI_PATH" || \
 		sed -ri=""         's,(PMD_KASUMI=)n,\1y,' $1/.config
-		test -z "$LIBSSO_ZUC_PATH" || \
-		sed -ri=""            's,(PMD_ZUC=)n,\1y,' $1/.config
 		test "$DPDK_DEP_SSL" != y || \
 		sed -ri=""            's,(PMD_CCP=)n,\1y,' $1/.config
 		test "$DPDK_DEP_SSL" != y || \
doc/guides/cryptodevs/zuc.rst +31 -21

79 lines not on this page · raw message

doc/guides/rel_notes/release_20_02.rst +7 -0
index 0eaa45a..4216e0b 100644
@@ -56,6 +56,13 @@ New Features
      Also, make sure to start the actual text at the margin.
      =========================================================
 
+* **Updated the ZUC PMD.**
+
+  * Transistioned underlying library from libSSO ZUC to intel-ipsec-mb
+    library (minimum version required 0.53).
+  * Removed dynamic library limitation, so PMD can be built as a shared
+    object now.
+
 
 Removed Items
 -------------
drivers/crypto/zuc/Makefile +17 -11
index a01bb6e..b50883b 100644
@@ -1,14 +1,8 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2016 Intel Corporation
+# Copyright(c) 2016-2019 Intel Corporation
 
 include $(RTE_SDK)/mk/rte.vars.mk
 
-ifneq ($(MAKECMDGOALS),clean)
-ifeq ($(LIBSSO_ZUC_PATH),)
-$(error "Please define LIBSSO_ZUC_PATH environment variable")
-endif
-endif
-
 # library name
 LIB = librte_pmd_zuc.a
 
@@ -21,14 +15,26 @@ CFLAGS += -DALLOW_EXPERIMENTAL_API
 EXPORT_MAP := rte_pmd_zuc_version.map
 
 # external library dependencies
-CFLAGS += -I$(LIBSSO_ZUC_PATH)
-CFLAGS += -I$(LIBSSO_ZUC_PATH)/include
-CFLAGS += -I$(LIBSSO_ZUC_PATH)/build
-LDLIBS += -L$(LIBSSO_ZUC_PATH)/build -lsso_zuc
+LDLIBS += -lIPSec_MB
 LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
 LDLIBS += -lrte_cryptodev
 LDLIBS += -lrte_bus_vdev
 
+IMB_HDR = $(shell echo '\#include <intel-ipsec-mb.h>' | \
+	$(CC) -E $(EXTRA_CFLAGS) - | grep 'intel-ipsec-mb.h' | \
+	head -n1 | cut -d'"' -f2)
+
+# Detect library version
+IMB_VERSION = $(shell grep -e "IMB_VERSION_STR" $(IMB_HDR) | cut -d'"' -f2)
+IMB_VERSION_NUM = $(shell grep -e "IMB_VERSION_NUM" $(IMB_HDR) | cut -d' ' -f3)
+
+ifeq ($(IMB_VERSION),)
+$(error "IPSec_MB version >= 0.53 is required")
+endif
+
+ifeq ($(shell expr $(IMB_VERSION_NUM) \< 0x3400), 1)
+$(error "IPSec_MB version >= 0.53 is required")
+endif
 # library source files
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_ZUC) += rte_zuc_pmd.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_ZUC) += rte_zuc_pmd_ops.c
drivers/crypto/zuc/meson.build +18 -6
index b231de0..b7098a3 100644
@@ -1,14 +1,26 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2018 Intel Corporation
+# Copyright(c) 2018-2019 Intel Corporation
 
-lib = cc.find_library('sso_zuc', required: false)
-if not lib.found() or not cc.has_header('sso_zuc.h')
+IMB_required_ver = '0.53.0'
+lib = cc.find_library('IPSec_MB', required: false)
+if not lib.found()
 	build = false
-	reason = 'missing dependency, "libsso_zuc"'
-	subdir_done()
+	reason = 'missing dependency, "libIPSec_MB"'
+else
+	ext_deps += lib
+
+	# version comes with quotes, so we split based on " and take the middle
+	imb_ver = cc.get_define('IMB_VERSION_STR',
+		prefix : '#include<intel-ipsec-mb.h>').split('"')[1]
+
+	if (imb_ver == '') or (imb_ver.version_compare('<' + IMB_required_ver))
+		message('IPSec_MB version >= @0@ is required, found version @1@'.format(
+				IMB_required_ver, imb_ver))
+		build = false
+	endif
+
 endif
 
 allow_experimental_apis = true
-ext_deps += lib
 sources = files('rte_zuc_pmd.c', 'rte_zuc_pmd_ops.c')
 deps += ['bus_vdev']
drivers/crypto/zuc/rte_zuc_pmd.c +30 -13

116 lines not on this page · raw message

drivers/crypto/zuc/rte_zuc_pmd_ops.c +2 -0
index 62f8c6c..ddd0f92 100644
@@ -201,6 +201,7 @@ zuc_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		int socket_id)
 {
 	struct zuc_qp *qp = NULL;
+	struct zuc_private *internals = dev->data->dev_private;
 
 	/* Free memory prior to re-allocation if needed. */
 	if (dev->data->queue_pairs[qp_id] != NULL)
@@ -223,6 +224,7 @@ zuc_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 	if (qp->processed_ops == NULL)
 		goto qp_setup_cleanup;
 
+	qp->mb_mgr = internals->mb_mgr;
 	qp->sess_mp = qp_conf->mp_session;
 	qp->sess_mp_priv = qp_conf->mp_session_private;
 
drivers/crypto/zuc/zuc_pmd_private.h +5 -1
index 428efd4..47a8b08 100644
@@ -5,7 +5,7 @@
 #ifndef _ZUC_PMD_PRIVATE_H_
 #define _ZUC_PMD_PRIVATE_H_
 
-#include <sso_zuc.h>
+#include <intel-ipsec-mb.h>
 
 #define CRYPTODEV_NAME_ZUC_PMD		crypto_zuc
 /**< KASUMI PMD device name */
@@ -24,6 +24,8 @@ int zuc_logtype_driver;
 struct zuc_private {
 	unsigned max_nb_queue_pairs;
 	/**< Max number of queue pairs supported by device */
+	MB_MGR *mb_mgr;
+	/**< Multi-buffer instance */
 };
 
 /** ZUC buffer queue pair */
@@ -45,6 +47,8 @@ struct zuc_qp {
 	 * by the driver when verifying a digest provided
 	 * by the user (using authentication verify operation)
 	 */
+	MB_MGR *mb_mgr;
+	/**< Multi-buffer instance */
 } __rte_cache_aligned;
 
 enum zuc_operation {
mk/rte.app.mk +1 -1
index 05ea034..62724cc 100644
@@ -272,7 +272,7 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G)      += -L$(LIBSSO_SNOW3G_PATH)/build -l
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_KASUMI)      += -lrte_pmd_kasumi
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_KASUMI)      += -L$(LIBSSO_KASUMI_PATH)/build -lsso_kasumi
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_ZUC)         += -lrte_pmd_zuc
-_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_ZUC)         += -L$(LIBSSO_ZUC_PATH)/build -lsso_zuc
+_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_ZUC)         += -lIPSec_MB
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_ARMV8_CRYPTO)    += -lrte_pmd_armv8
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_ARMV8_CRYPTO)    += -L$(ARMV8_CRYPTO_LIB_PATH) -larmv8_crypto
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_MVSAM_CRYPTO) += -L$(LIBMUSDK_PATH)/lib -lrte_pmd_mvsam_crypto -lmusdk
Signature · 1 line
2.7.5
#2 lore raw

PATCH 2/3 crypto/kasumi: use IPSec library

In reply to Pablo de Lara

Link against Intel IPSec Multi-buffer library, which added support for KASUMI-F8 and KASUMI-F9 from version v0.53, moving from libSSO KASUMI library.

---
 devtools/test-build.sh                     |  6 +--
 doc/guides/cryptodevs/kasumi.rst           | 62 ++++++++++++-----------
 doc/guides/rel_notes/release_20_02.rst     |  5 ++
 drivers/crypto/kasumi/Makefile             | 26 ++++++----
 drivers/crypto/kasumi/kasumi_pmd_private.h | 12 +++--
 drivers/crypto/kasumi/meson.build          | 24 ++++++---
 drivers/crypto/kasumi/rte_kasumi_pmd.c     | 79 +++++++++++++++++-------------
 drivers/crypto/kasumi/rte_kasumi_pmd_ops.c |  8 ++-
 mk/rte.app.mk                              |  2 +-
 9 files changed, 134 insertions(+), 90 deletions(-)
devtools/test-build.sh +2 -4
index afa0748..56c744f 100755
@@ -28,7 +28,6 @@ default_path=$PATH
 # - FLEXRAN_SDK
 # - LIBMUSDK_PATH
 # - LIBSSO_SNOW3G_PATH
-# - LIBSSO_KASUMI_PATH
 . $(dirname $(readlink -f $0))/load-devel-config
 
 print_usage () {
@@ -121,7 +120,6 @@ reset_env ()
 	unset FLEXRAN_SDK
 	unset LIBMUSDK_PATH
 	unset LIBSSO_SNOW3G_PATH
-	unset LIBSSO_KASUMI_PATH
 	unset PQOS_INSTALL_PATH
 }
 
@@ -183,10 +181,10 @@ config () # <directory> <target> <options>
 		sed -ri=""      's,(PMD_AESNI_GCM=)n,\1y,' $1/.config
 		test "$DPDK_DEP_IPSEC_MB" != y || \
 		sed -ri=""            's,(PMD_ZUC=)n,\1y,' $1/.config
+		test "$DPDK_DEP_IPSEC_MB" != y || \
+		sed -ri=""         's,(PMD_KASUMI=)n,\1y,' $1/.config
 		test -z "$LIBSSO_SNOW3G_PATH" || \
 		sed -ri=""         's,(PMD_SNOW3G=)n,\1y,' $1/.config
-		test -z "$LIBSSO_KASUMI_PATH" || \
-		sed -ri=""         's,(PMD_KASUMI=)n,\1y,' $1/.config
 		test "$DPDK_DEP_SSL" != y || \
 		sed -ri=""            's,(PMD_CCP=)n,\1y,' $1/.config
 		test "$DPDK_DEP_SSL" != y || \
doc/guides/cryptodevs/kasumi.rst +33 -29

90 lines not on this page · raw message

doc/guides/rel_notes/release_20_02.rst +5 -0
index 4216e0b..a3f6154 100644
@@ -63,6 +63,11 @@ New Features
   * Removed dynamic library limitation, so PMD can be built as a shared
     object now.
 
+* **Updated the KASUMI PMD.**
+
+  * Transistioned underlying library from libSSO KASUMI to intel-ipsec-mb
+    library (minimum version required 0.53).
+
 
 Removed Items
 -------------
drivers/crypto/kasumi/Makefile +16 -10
index 26f5137..c94d6bd 100644
@@ -3,12 +3,6 @@
 
 include $(RTE_SDK)/mk/rte.vars.mk
 
-ifneq ($(MAKECMDGOALS),clean)
-ifeq ($(LIBSSO_KASUMI_PATH),)
-$(error "Please define LIBSSO_KASUMI_PATH environment variable")
-endif
-endif
-
 # library name
 LIB = librte_pmd_kasumi.a
 
@@ -21,14 +15,26 @@ CFLAGS += -DALLOW_EXPERIMENTAL_API
 EXPORT_MAP := rte_pmd_kasumi_version.map
 
 # external library dependencies
-CFLAGS += -I$(LIBSSO_KASUMI_PATH)
-CFLAGS += -I$(LIBSSO_KASUMI_PATH)/include
-CFLAGS += -I$(LIBSSO_KASUMI_PATH)/build
-LDLIBS += -L$(LIBSSO_KASUMI_PATH)/build -lsso_kasumi
+LDLIBS += -lIPSec_MB
 LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
 LDLIBS += -lrte_cryptodev
 LDLIBS += -lrte_bus_vdev
 
+IMB_HDR = $(shell echo '\#include <intel-ipsec-mb.h>' | \
+	$(CC) -E $(EXTRA_CFLAGS) - | grep 'intel-ipsec-mb.h' | \
+	head -n1 | cut -d'"' -f2)
+
+# Detect library version
+IMB_VERSION = $(shell grep -e "IMB_VERSION_STR" $(IMB_HDR) | cut -d'"' -f2)
+IMB_VERSION_NUM = $(shell grep -e "IMB_VERSION_NUM" $(IMB_HDR) | cut -d' ' -f3)
+
+ifeq ($(IMB_VERSION),)
+$(error "IPSec_MB version >= 0.53 is required")
+endif
+
+ifeq ($(shell expr $(IMB_VERSION_NUM) \< 0x3400), 1)
+$(error "IPSec_MB version >= 0.53 is required")
+endif
 # library source files
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_KASUMI) += rte_kasumi_pmd.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_KASUMI) += rte_kasumi_pmd_ops.c
drivers/crypto/kasumi/kasumi_pmd_private.h +8 -4
index 7ac19c5..3b3a695 100644
@@ -5,7 +5,7 @@
 #ifndef _KASUMI_PMD_PRIVATE_H_
 #define _KASUMI_PMD_PRIVATE_H_
 
-#include <sso_kasumi.h>
+#include <intel-ipsec-mb.h>
 
 #define CRYPTODEV_NAME_KASUMI_PMD	crypto_kasumi
 /**< KASUMI PMD device name */
@@ -24,6 +24,8 @@ int kasumi_logtype_driver;
 struct kasumi_private {
 	unsigned max_nb_queue_pairs;
 	/**< Max number of queue pairs supported by device */
+	MB_MGR *mgr;
+	/**< Multi-buffer instance */
 };
 
 /** KASUMI buffer queue pair */
@@ -45,6 +47,8 @@ struct kasumi_qp {
 	 * by the driver when verifying a digest provided
 	 * by the user (using authentication verify operation)
 	 */
+	MB_MGR *mgr;
+	/**< Multi-buffer instance */
 } __rte_cache_aligned;
 
 enum kasumi_operation {
@@ -58,8 +62,8 @@ enum kasumi_operation {
 /** KASUMI private session structure */
 struct kasumi_session {
 	/* Keys have to be 16-byte aligned */
-	sso_kasumi_key_sched_t pKeySched_cipher;
-	sso_kasumi_key_sched_t pKeySched_hash;
+	kasumi_key_sched_t pKeySched_cipher;
+	kasumi_key_sched_t pKeySched_hash;
 	enum kasumi_operation op;
 	enum rte_crypto_auth_operation auth_op;
 	uint16_t cipher_iv_offset;
@@ -67,7 +71,7 @@ struct kasumi_session {
 
 
 int
-kasumi_set_session_parameters(struct kasumi_session *sess,
+kasumi_set_session_parameters(MB_MGR *mgr, struct kasumi_session *sess,
 		const struct rte_crypto_sym_xform *xform);
 
 
drivers/crypto/kasumi/meson.build +18 -6
index 90a3c4f..9639aaf 100644
@@ -1,14 +1,26 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2018 Intel Corporation
+# Copyright(c) 2018-2019 Intel Corporation
 
-lib = cc.find_library('sso_kasumi', required: false)
-if not lib.found() or not cc.has_header('sso_kasumi.h')
+IMB_required_ver = '0.53.0'
+lib = cc.find_library('IPSec_MB', required: false)
+if not lib.found()
 	build = false
-	reason = 'missing dependency, "libsso_kasumi"'
-	subdir_done()
+	reason = 'missing dependency, "libIPSec_MB"'
+else
+	ext_deps += lib
+
+	# version comes with quotes, so we split based on " and take the middle
+	imb_ver = cc.get_define('IMB_VERSION_STR',
+		prefix : '#include<intel-ipsec-mb.h>').split('"')[1]
+
+	if (imb_ver == '') or (imb_ver.version_compare('<' + IMB_required_ver))
+		message('IPSec_MB version >= @0@ is required, found version @1@'.format(
+				IMB_required_ver, imb_ver))
+		build = false
+	endif
+
 endif
 
 allow_experimental_apis = true
-ext_deps += lib
 sources = files('rte_kasumi_pmd.c', 'rte_kasumi_pmd_ops.c')
 deps += ['bus_vdev']
drivers/crypto/kasumi/rte_kasumi_pmd.c +45 -34

217 lines not on this page · raw message

drivers/crypto/kasumi/rte_kasumi_pmd_ops.c +6 -2
index 5ce4953..55fbe00 100644
@@ -195,6 +195,7 @@ kasumi_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		int socket_id)
 {
 	struct kasumi_qp *qp = NULL;
+	struct kasumi_private *internals = dev->data->dev_private;
 
 	/* Free memory prior to re-allocation if needed. */
 	if (dev->data->queue_pairs[qp_id] != NULL)
@@ -217,6 +218,7 @@ kasumi_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 	if (qp->processed_ops == NULL)
 		goto qp_setup_cleanup;
 
+	qp->mgr = internals->mgr;
 	qp->sess_mp = qp_conf->mp_session;
 	qp->sess_mp_priv = qp_conf->mp_session_private;
 
@@ -246,13 +248,14 @@ kasumi_pmd_sym_session_get_size(struct rte_cryptodev *dev __rte_unused)
 
 /** Configure a KASUMI session from a crypto xform chain */
 static int
-kasumi_pmd_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
+kasumi_pmd_sym_session_configure(struct rte_cryptodev *dev,
 		struct rte_crypto_sym_xform *xform,
 		struct rte_cryptodev_sym_session *sess,
 		struct rte_mempool *mempool)
 {
 	void *sess_private_data;
 	int ret;
+	struct kasumi_private *internals = dev->data->dev_private;
 
 	if (unlikely(sess == NULL)) {
 		KASUMI_LOG(ERR, "invalid session struct");
@@ -265,7 +268,8 @@ kasumi_pmd_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
 		return -ENOMEM;
 	}
 
-	ret = kasumi_set_session_parameters(sess_private_data, xform);
+	ret = kasumi_set_session_parameters(internals->mgr,
+					sess_private_data, xform);
 	if (ret != 0) {
 		KASUMI_LOG(ERR, "failed configure session parameters");
 
mk/rte.app.mk +1 -1
index 62724cc..a8163f1 100644
@@ -270,7 +270,7 @@ endif # CONFIG_RTE_LIBRTE_PMD_QAT
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G)      += -lrte_pmd_snow3g
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G)      += -L$(LIBSSO_SNOW3G_PATH)/build -lsso_snow3g
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_KASUMI)      += -lrte_pmd_kasumi
-_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_KASUMI)      += -L$(LIBSSO_KASUMI_PATH)/build -lsso_kasumi
+_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_KASUMI)      += -lIPSec_MB
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_ZUC)         += -lrte_pmd_zuc
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_ZUC)         += -lIPSec_MB
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_ARMV8_CRYPTO)    += -lrte_pmd_armv8
Signature · 1 line
2.7.5
#3 lore raw

PATCH 3/3 crypto/snow3g: use IPSec library

In reply to Pablo de Lara

Link against Intel IPSec Multi-buffer library, which added support for SNOW3G-UEA2 and SNOW3G-UIA2 from version v0.53, moving from libSSO SNOW3G library.

---
 devtools/test-build.sh                     |  4 +-
 doc/guides/cryptodevs/snow3g.rst           | 58 +++++++++++---------
 doc/guides/rel_notes/release_20_02.rst     |  5 ++
 drivers/crypto/snow3g/Makefile             | 29 ++++++----
 drivers/crypto/snow3g/meson.build          | 21 ++++++--
 drivers/crypto/snow3g/rte_snow3g_pmd.c     | 85 ++++++++++++++++++------------
 drivers/crypto/snow3g/rte_snow3g_pmd_ops.c |  8 ++-
 drivers/crypto/snow3g/snow3g_pmd_private.h | 14 +++--
 mk/rte.app.mk                              |  2 +-
 9 files changed, 141 insertions(+), 85 deletions(-)
devtools/test-build.sh +1 -3
index 56c744f..7bdd35e 100755
@@ -27,7 +27,6 @@ default_path=$PATH
 # - DPDK_NOTIFY (notify-send)
 # - FLEXRAN_SDK
 # - LIBMUSDK_PATH
-# - LIBSSO_SNOW3G_PATH
 . $(dirname $(readlink -f $0))/load-devel-config
 
 print_usage () {
@@ -119,7 +118,6 @@ reset_env ()
 	unset ARMV8_CRYPTO_LIB_PATH
 	unset FLEXRAN_SDK
 	unset LIBMUSDK_PATH
-	unset LIBSSO_SNOW3G_PATH
 	unset PQOS_INSTALL_PATH
 }
 
@@ -183,7 +181,7 @@ config () # <directory> <target> <options>
 		sed -ri=""            's,(PMD_ZUC=)n,\1y,' $1/.config
 		test "$DPDK_DEP_IPSEC_MB" != y || \
 		sed -ri=""         's,(PMD_KASUMI=)n,\1y,' $1/.config
-		test -z "$LIBSSO_SNOW3G_PATH" || \
+		test "$DPDK_DEP_IPSEC_MB" != y || \
 		sed -ri=""         's,(PMD_SNOW3G=)n,\1y,' $1/.config
 		test "$DPDK_DEP_SSL" != y || \
 		sed -ri=""            's,(PMD_CCP=)n,\1y,' $1/.config
doc/guides/cryptodevs/snow3g.rst +34 -24

84 lines not on this page · raw message

doc/guides/rel_notes/release_20_02.rst +5 -0
index a3f6154..2532b21 100644
@@ -68,6 +68,11 @@ New Features
   * Transistioned underlying library from libSSO KASUMI to intel-ipsec-mb
     library (minimum version required 0.53).
 
+* **Updated the SNOW3G PMD.**
+
+  * Transistioned underlying library from libSSO SNOW3G to intel-ipsec-mb
+    library (minimum version required 0.53).
+
 
 Removed Items
 -------------
drivers/crypto/snow3g/Makefile +18 -11
index 4086c57..438119c 100644
@@ -1,14 +1,8 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2016 Intel Corporation
+# Copyright(c) 2016-2019 Intel Corporation
 
 include $(RTE_SDK)/mk/rte.vars.mk
 
-ifneq ($(MAKECMDGOALS),clean)
-ifeq ($(LIBSSO_SNOW3G_PATH),)
-$(error "Please define LIBSSO_SNOW3G_PATH environment variable")
-endif
-endif
-
 # library name
 LIB = librte_pmd_snow3g.a
 
@@ -21,14 +15,27 @@ CFLAGS += -DALLOW_EXPERIMENTAL_API
 EXPORT_MAP := rte_pmd_snow3g_version.map
 
 # external library dependencies
-CFLAGS += -I$(LIBSSO_SNOW3G_PATH)
-CFLAGS += -I$(LIBSSO_SNOW3G_PATH)/include
-CFLAGS += -I$(LIBSSO_SNOW3G_PATH)/build
-LDLIBS += -L$(LIBSSO_SNOW3G_PATH)/build -lsso_snow3g
+LDLIBS += -lIPSec_MB
 LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
 LDLIBS += -lrte_cryptodev
 LDLIBS += -lrte_bus_vdev
 
+IMB_HDR = $(shell echo '\#include <intel-ipsec-mb.h>' | \
+	$(CC) -E $(EXTRA_CFLAGS) - | grep 'intel-ipsec-mb.h' | \
+	head -n1 | cut -d'"' -f2)
+
+# Detect library version
+IMB_VERSION = $(shell grep -e "IMB_VERSION_STR" $(IMB_HDR) | cut -d'"' -f2)
+IMB_VERSION_NUM = $(shell grep -e "IMB_VERSION_NUM" $(IMB_HDR) | cut -d' ' -f3)
+
+ifeq ($(IMB_VERSION),)
+$(error "IPSec_MB version >= 0.53 is required")
+endif
+
+ifeq ($(shell expr $(IMB_VERSION_NUM) \< 0x3400), 1)
+$(error "IPSec_MB version >= 0.53 is required")
+endif
+
 # library source files
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G) += rte_snow3g_pmd.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G) += rte_snow3g_pmd_ops.c
drivers/crypto/snow3g/meson.build +17 -4
index 0e8742a..e9497bd 100644
@@ -1,11 +1,24 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2019 Intel Corporation
 
-lib = cc.find_library('sso_snow3g', required: false)
-if not lib.found() or not cc.has_header('sso_snow3g.h')
+IMB_required_ver = '0.53.0'
+lib = cc.find_library('IPSec_MB', required: false)
+if not lib.found()
 	build = false
-	reason = 'missing dependency, "libsso_snow3g"'
-	subdir_done()
+	reason = 'missing dependency, "libIPSec_MB"'
+else
+	ext_deps += lib
+
+	# version comes with quotes, so we split based on " and take the middle
+	imb_ver = cc.get_define('IMB_VERSION_STR',
+		prefix : '#include<intel-ipsec-mb.h>').split('"')[1]
+
+	if (imb_ver == '') or (imb_ver.version_compare('<' + IMB_required_ver))
+		message('IPSec_MB version >= @0@ is required, found version @1@'.format(
+				IMB_required_ver, imb_ver))
+		build = false
+	endif
+
 endif
 
 allow_experimental_apis = true
drivers/crypto/snow3g/rte_snow3g_pmd.c +50 -35

223 lines not on this page · raw message

drivers/crypto/snow3g/rte_snow3g_pmd_ops.c +6 -2
index 8778f28..ea76637 100644
@@ -201,6 +201,7 @@ snow3g_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		int socket_id)
 {
 	struct snow3g_qp *qp = NULL;
+	struct snow3g_private *internals = dev->data->dev_private;
 
 	/* Free memory prior to re-allocation if needed. */
 	if (dev->data->queue_pairs[qp_id] != NULL)
@@ -223,6 +224,7 @@ snow3g_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 	if (qp->processed_ops == NULL)
 		goto qp_setup_cleanup;
 
+	qp->mgr = internals->mgr;
 	qp->sess_mp = qp_conf->mp_session;
 	qp->sess_mp_priv = qp_conf->mp_session_private;
 
@@ -253,13 +255,14 @@ snow3g_pmd_sym_session_get_size(struct rte_cryptodev *dev __rte_unused)
 
 /** Configure a SNOW 3G session from a crypto xform chain */
 static int
-snow3g_pmd_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
+snow3g_pmd_sym_session_configure(struct rte_cryptodev *dev,
 		struct rte_crypto_sym_xform *xform,
 		struct rte_cryptodev_sym_session *sess,
 		struct rte_mempool *mempool)
 {
 	void *sess_private_data;
 	int ret;
+	struct snow3g_private *internals = dev->data->dev_private;
 
 	if (unlikely(sess == NULL)) {
 		SNOW3G_LOG(ERR, "invalid session struct");
@@ -272,7 +275,8 @@ snow3g_pmd_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
 		return -ENOMEM;
 	}
 
-	ret = snow3g_set_session_parameters(sess_private_data, xform);
+	ret = snow3g_set_session_parameters(internals->mgr,
+					sess_private_data, xform);
 	if (ret != 0) {
 		SNOW3G_LOG(ERR, "failed configure session parameters");
 
drivers/crypto/snow3g/snow3g_pmd_private.h +9 -5
index 1fe05eb..2074f3d 100644
@@ -1,11 +1,11 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2016-2018 Intel Corporation
+ * Copyright(c) 2016-2019 Intel Corporation
  */
 
 #ifndef _SNOW3G_PMD_PRIVATE_H_
 #define _SNOW3G_PMD_PRIVATE_H_
 
-#include <sso_snow3g.h>
+#include <intel-ipsec-mb.h>
 
 #define CRYPTODEV_NAME_SNOW3G_PMD	crypto_snow3g
 /**< SNOW 3G PMD device name */
@@ -25,6 +25,8 @@ int snow3g_logtype_driver;
 struct snow3g_private {
 	unsigned max_nb_queue_pairs;
 	/**< Max number of queue pairs supported by device */
+	MB_MGR *mgr;
+	/**< Multi-buffer instance */
 };
 
 /** SNOW 3G buffer queue pair */
@@ -46,6 +48,8 @@ struct snow3g_qp {
 	 * by the driver when verifying a digest provided
 	 * by the user (using authentication verify operation)
 	 */
+	MB_MGR *mgr;
+	/**< Multi-buffer instance */
 } __rte_cache_aligned;
 
 enum snow3g_operation {
@@ -60,15 +64,15 @@ enum snow3g_operation {
 struct snow3g_session {
 	enum snow3g_operation op;
 	enum rte_crypto_auth_operation auth_op;
-	sso_snow3g_key_schedule_t pKeySched_cipher;
-	sso_snow3g_key_schedule_t pKeySched_hash;
+	snow3g_key_schedule_t pKeySched_cipher;
+	snow3g_key_schedule_t pKeySched_hash;
 	uint16_t cipher_iv_offset;
 	uint16_t auth_iv_offset;
 } __rte_cache_aligned;
 
 
 extern int
-snow3g_set_session_parameters(struct snow3g_session *sess,
+snow3g_set_session_parameters(MB_MGR *mgr, struct snow3g_session *sess,
 		const struct rte_crypto_sym_xform *xform);
 
 
mk/rte.app.mk +1 -1
index a8163f1..8bf6b3d 100644
@@ -268,7 +268,7 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_QAT_SYM)     += -lrte_pmd_qat -lcrypto
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_QAT_ASYM)    += -lrte_pmd_qat -lcrypto
 endif # CONFIG_RTE_LIBRTE_PMD_QAT
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G)      += -lrte_pmd_snow3g
-_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G)      += -L$(LIBSSO_SNOW3G_PATH)/build -lsso_snow3g
+_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G)      += -lIPSec_MB
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_KASUMI)      += -lrte_pmd_kasumi
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_KASUMI)      += -lIPSec_MB
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_ZUC)         += -lrte_pmd_zuc
Signature · 1 line
2.7.5
#4 lore raw

v2 cover Use Intel IPSec MB library in Wireless PMDs

In reply to Pablo de Lara

The three Intel SW Crypto PMDs supporting SNOW3G, ZUC and KASUMI link against libSSO libraries. The Intel IPSec Multi-buffer library recently integrated the code from these libraries, in version v0.53. This library can be downloaded from https://github.com/intel/intel-ipsec-mb.

KASUMI, SNOW3G and ZUC PMDs have been modified to use this single library, which is already used in the AESNI MB and AESNI GCM PMDs, reducing the number of external dependencies in the crypto PMDs.

Changes in v2:
- Updated ZUC PMD to support future AVX512 and AVX2 implementations.

Pablo de Lara (3):
crypto/zuc: use IPSec library
crypto/kasumi: use IPSec library
crypto/snow3g: use IPSec library

 devtools/test-build.sh                     | 16 ++----
 doc/guides/cryptodevs/kasumi.rst           | 62 ++++++++++++----------
 doc/guides/cryptodevs/snow3g.rst           | 58 +++++++++++---------
 doc/guides/cryptodevs/zuc.rst              | 52 ++++++++++--------
 doc/guides/rel_notes/release_20_02.rst     | 17 ++++++
 drivers/crypto/kasumi/Makefile             | 26 +++++----
 drivers/crypto/kasumi/kasumi_pmd_private.h | 12 +++--
 drivers/crypto/kasumi/meson.build          | 24 ++++++---
 drivers/crypto/kasumi/rte_kasumi_pmd.c     | 79 +++++++++++++++------------
 drivers/crypto/kasumi/rte_kasumi_pmd_ops.c |  8 ++-
 drivers/crypto/snow3g/Makefile             | 29 ++++++----
 drivers/crypto/snow3g/meson.build          | 21 ++++++--
 drivers/crypto/snow3g/rte_snow3g_pmd.c     | 85 ++++++++++++++++++------------
 drivers/crypto/snow3g/rte_snow3g_pmd_ops.c |  8 ++-
 drivers/crypto/snow3g/snow3g_pmd_private.h | 14 +++--
 drivers/crypto/zuc/Makefile                | 28 ++++++----
 drivers/crypto/zuc/meson.build             | 24 ++++++---
 drivers/crypto/zuc/rte_zuc_pmd.c           | 51 +++++++++++++-----
 drivers/crypto/zuc/rte_zuc_pmd_ops.c       |  2 +
 drivers/crypto/zuc/zuc_pmd_private.h       |  6 ++-
 mk/rte.app.mk                              |  6 +--
 21 files changed, 395 insertions(+), 233 deletions(-)
Signature · 1 line
2.7.5
#5 lore raw

PATCH v2 1/3 crypto/zuc: use IPSec library

Link against Intel IPSec Multi-buffer library, which added support for ZUC-EEA3 and ZUC-EIA3 from version v0.53, moving from libSSO ZUC library.

---
 devtools/test-build.sh                 |  6 ++--
 doc/guides/cryptodevs/zuc.rst          | 52 ++++++++++++++++++++--------------
 doc/guides/rel_notes/release_20_02.rst |  7 +++++
 drivers/crypto/zuc/Makefile            | 28 +++++++++++-------
 drivers/crypto/zuc/meson.build         | 24 ++++++++++++----
 drivers/crypto/zuc/rte_zuc_pmd.c       | 51 ++++++++++++++++++++++++---------
 drivers/crypto/zuc/rte_zuc_pmd_ops.c   |  2 ++
 drivers/crypto/zuc/zuc_pmd_private.h   |  6 +++-
 mk/rte.app.mk                          |  2 +-
 9 files changed, 120 insertions(+), 58 deletions(-)
devtools/test-build.sh +2 -4
index be565a1..afa0748 100755
@@ -29,7 +29,6 @@ default_path=$PATH
 # - LIBMUSDK_PATH
 # - LIBSSO_SNOW3G_PATH
 # - LIBSSO_KASUMI_PATH
-# - LIBSSO_ZUC_PATH
 . $(dirname $(readlink -f $0))/load-devel-config
 
 print_usage () {
@@ -123,7 +122,6 @@ reset_env ()
 	unset LIBMUSDK_PATH
 	unset LIBSSO_SNOW3G_PATH
 	unset LIBSSO_KASUMI_PATH
-	unset LIBSSO_ZUC_PATH
 	unset PQOS_INSTALL_PATH
 }
 
@@ -183,12 +181,12 @@ config () # <directory> <target> <options>
 		sed -ri=""       's,(PMD_AESNI_MB=)n,\1y,' $1/.config
 		test "$DPDK_DEP_IPSEC_MB" != y || \
 		sed -ri=""      's,(PMD_AESNI_GCM=)n,\1y,' $1/.config
+		test "$DPDK_DEP_IPSEC_MB" != y || \
+		sed -ri=""            's,(PMD_ZUC=)n,\1y,' $1/.config
 		test -z "$LIBSSO_SNOW3G_PATH" || \
 		sed -ri=""         's,(PMD_SNOW3G=)n,\1y,' $1/.config
 		test -z "$LIBSSO_KASUMI_PATH" || \
 		sed -ri=""         's,(PMD_KASUMI=)n,\1y,' $1/.config
-		test -z "$LIBSSO_ZUC_PATH" || \
-		sed -ri=""            's,(PMD_ZUC=)n,\1y,' $1/.config
 		test "$DPDK_DEP_SSL" != y || \
 		sed -ri=""            's,(PMD_CCP=)n,\1y,' $1/.config
 		test "$DPDK_DEP_SSL" != y || \
doc/guides/cryptodevs/zuc.rst +31 -21

79 lines not on this page · raw message

doc/guides/rel_notes/release_20_02.rst +7 -0
index 0eaa45a..4216e0b 100644
@@ -56,6 +56,13 @@ New Features
      Also, make sure to start the actual text at the margin.
      =========================================================
 
+* **Updated the ZUC PMD.**
+
+  * Transistioned underlying library from libSSO ZUC to intel-ipsec-mb
+    library (minimum version required 0.53).
+  * Removed dynamic library limitation, so PMD can be built as a shared
+    object now.
+
 
 Removed Items
 -------------
drivers/crypto/zuc/Makefile +17 -11
index a01bb6e..b50883b 100644
@@ -1,14 +1,8 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2016 Intel Corporation
+# Copyright(c) 2016-2019 Intel Corporation
 
 include $(RTE_SDK)/mk/rte.vars.mk
 
-ifneq ($(MAKECMDGOALS),clean)
-ifeq ($(LIBSSO_ZUC_PATH),)
-$(error "Please define LIBSSO_ZUC_PATH environment variable")
-endif
-endif
-
 # library name
 LIB = librte_pmd_zuc.a
 
@@ -21,14 +15,26 @@ CFLAGS += -DALLOW_EXPERIMENTAL_API
 EXPORT_MAP := rte_pmd_zuc_version.map
 
 # external library dependencies
-CFLAGS += -I$(LIBSSO_ZUC_PATH)
-CFLAGS += -I$(LIBSSO_ZUC_PATH)/include
-CFLAGS += -I$(LIBSSO_ZUC_PATH)/build
-LDLIBS += -L$(LIBSSO_ZUC_PATH)/build -lsso_zuc
+LDLIBS += -lIPSec_MB
 LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
 LDLIBS += -lrte_cryptodev
 LDLIBS += -lrte_bus_vdev
 
+IMB_HDR = $(shell echo '\#include <intel-ipsec-mb.h>' | \
+	$(CC) -E $(EXTRA_CFLAGS) - | grep 'intel-ipsec-mb.h' | \
+	head -n1 | cut -d'"' -f2)
+
+# Detect library version
+IMB_VERSION = $(shell grep -e "IMB_VERSION_STR" $(IMB_HDR) | cut -d'"' -f2)
+IMB_VERSION_NUM = $(shell grep -e "IMB_VERSION_NUM" $(IMB_HDR) | cut -d' ' -f3)
+
+ifeq ($(IMB_VERSION),)
+$(error "IPSec_MB version >= 0.53 is required")
+endif
+
+ifeq ($(shell expr $(IMB_VERSION_NUM) \< 0x3400), 1)
+$(error "IPSec_MB version >= 0.53 is required")
+endif
 # library source files
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_ZUC) += rte_zuc_pmd.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_ZUC) += rte_zuc_pmd_ops.c
drivers/crypto/zuc/meson.build +18 -6
index b231de0..b7098a3 100644
@@ -1,14 +1,26 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2018 Intel Corporation
+# Copyright(c) 2018-2019 Intel Corporation
 
-lib = cc.find_library('sso_zuc', required: false)
-if not lib.found() or not cc.has_header('sso_zuc.h')
+IMB_required_ver = '0.53.0'
+lib = cc.find_library('IPSec_MB', required: false)
+if not lib.found()
 	build = false
-	reason = 'missing dependency, "libsso_zuc"'
-	subdir_done()
+	reason = 'missing dependency, "libIPSec_MB"'
+else
+	ext_deps += lib
+
+	# version comes with quotes, so we split based on " and take the middle
+	imb_ver = cc.get_define('IMB_VERSION_STR',
+		prefix : '#include<intel-ipsec-mb.h>').split('"')[1]
+
+	if (imb_ver == '') or (imb_ver.version_compare('<' + IMB_required_ver))
+		message('IPSec_MB version >= @0@ is required, found version @1@'.format(
+				IMB_required_ver, imb_ver))
+		build = false
+	endif
+
 endif
 
 allow_experimental_apis = true
-ext_deps += lib
 sources = files('rte_zuc_pmd.c', 'rte_zuc_pmd_ops.c')
 deps += ['bus_vdev']
drivers/crypto/zuc/rte_zuc_pmd.c +37 -14

130 lines not on this page · raw message

drivers/crypto/zuc/rte_zuc_pmd_ops.c +2 -0
index 62f8c6c..ddd0f92 100644
@@ -201,6 +201,7 @@ zuc_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		int socket_id)
 {
 	struct zuc_qp *qp = NULL;
+	struct zuc_private *internals = dev->data->dev_private;
 
 	/* Free memory prior to re-allocation if needed. */
 	if (dev->data->queue_pairs[qp_id] != NULL)
@@ -223,6 +224,7 @@ zuc_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 	if (qp->processed_ops == NULL)
 		goto qp_setup_cleanup;
 
+	qp->mb_mgr = internals->mb_mgr;
 	qp->sess_mp = qp_conf->mp_session;
 	qp->sess_mp_priv = qp_conf->mp_session_private;
 
drivers/crypto/zuc/zuc_pmd_private.h +5 -1
index 428efd4..47a8b08 100644
@@ -5,7 +5,7 @@
 #ifndef _ZUC_PMD_PRIVATE_H_
 #define _ZUC_PMD_PRIVATE_H_
 
-#include <sso_zuc.h>
+#include <intel-ipsec-mb.h>
 
 #define CRYPTODEV_NAME_ZUC_PMD		crypto_zuc
 /**< KASUMI PMD device name */
@@ -24,6 +24,8 @@ int zuc_logtype_driver;
 struct zuc_private {
 	unsigned max_nb_queue_pairs;
 	/**< Max number of queue pairs supported by device */
+	MB_MGR *mb_mgr;
+	/**< Multi-buffer instance */
 };
 
 /** ZUC buffer queue pair */
@@ -45,6 +47,8 @@ struct zuc_qp {
 	 * by the driver when verifying a digest provided
 	 * by the user (using authentication verify operation)
 	 */
+	MB_MGR *mb_mgr;
+	/**< Multi-buffer instance */
 } __rte_cache_aligned;
 
 enum zuc_operation {
mk/rte.app.mk +1 -1
index 05ea034..62724cc 100644
@@ -272,7 +272,7 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G)      += -L$(LIBSSO_SNOW3G_PATH)/build -l
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_KASUMI)      += -lrte_pmd_kasumi
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_KASUMI)      += -L$(LIBSSO_KASUMI_PATH)/build -lsso_kasumi
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_ZUC)         += -lrte_pmd_zuc
-_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_ZUC)         += -L$(LIBSSO_ZUC_PATH)/build -lsso_zuc
+_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_ZUC)         += -lIPSec_MB
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_ARMV8_CRYPTO)    += -lrte_pmd_armv8
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_ARMV8_CRYPTO)    += -L$(ARMV8_CRYPTO_LIB_PATH) -larmv8_crypto
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_MVSAM_CRYPTO) += -L$(LIBMUSDK_PATH)/lib -lrte_pmd_mvsam_crypto -lmusdk
Signature · 1 line
2.7.5
#6 lore raw

Re: [dpdk-dev] [PATCH v2 1/3] crypto/zuc: use IPSec library

Quoted 17 lines · Pablo de Lara

Link against Intel IPSec Multi-buffer library, which added support for ZUC-EEA3 and ZUC-EIA3 from version v0.53, moving from libSSO ZUC library.

---
 devtools/test-build.sh                 |  6 ++--
 doc/guides/cryptodevs/zuc.rst          | 52 ++++++++++++++++++++--------------
 doc/guides/rel_notes/release_20_02.rst |  7 +++++
 drivers/crypto/zuc/Makefile            | 28 +++++++++++-------
 drivers/crypto/zuc/meson.build         | 24 ++++++++++++----
 drivers/crypto/zuc/rte_zuc_pmd.c       | 51 ++++++++++++++++++++++++---------
 drivers/crypto/zuc/rte_zuc_pmd_ops.c   |  2 ++
 drivers/crypto/zuc/zuc_pmd_private.h   |  6 +++-
 mk/rte.app.mk                          |  2 +-
 9 files changed, 120 insertions(+), 58 deletions(-)

<snip>

Quoted 19 lines
drivers/crypto/zuc/meson.build +6 -5
index b231de0..b7098a3 100644
@@ -1,14 +1,26 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2018 Intel Corporation
+# Copyright(c) 2018-2019 Intel Corporation
 
-lib = cc.find_library('sso_zuc', required: false)
-if not lib.found() or not cc.has_header('sso_zuc.h')
+IMB_required_ver = '0.53.0'
+lib = cc.find_library('IPSec_MB', required: false)
+if not lib.found()
 	build = false
-	reason = 'missing dependency, "libsso_zuc"'
-	subdir_done()
+	reason = 'missing dependency, "libIPSec_MB"'
+else

drivers/crypto/zuc/meson.build line 19

Quoted 10 lines
drivers/crypto/zuc/meson.build +10 -0
+	ext_deps += lib
+
+	# version comes with quotes, so we split based on " and take the middle
+	imb_ver = cc.get_define('IMB_VERSION_STR',
+		prefix : '#include<intel-ipsec-mb.h>').split('"')[1]
+
+	if (imb_ver == '') or (imb_ver.version_compare('<' + IMB_required_ver))
+		message('IPSec_MB version >= @0@ is required, found version @1@'.format(
+				IMB_required_ver, imb_ver))
+		build = false

Rather than/As well as printing a message here, you also need to provide a reason when setting build = false, so the summary at the end can report why the driver is not being built.

drivers/crypto/zuc/meson.build line 12

Quoted 6 lines
drivers/crypto/zuc/meson.build +2 -1
+	endif
+
 endif
 
 allow_experimental_apis = true
-ext_deps += lib

If you drop the line after the else above, you can keep this line and shrink the diff by 2 lines. :-)

/Bruce

#7 lore raw

Re: [dpdk-dev] [PATCH v2 1/3] crypto/zuc: use IPSec library

Quoted 59 lines · Bruce Richardson
Quoted 17 lines · Pablo de Lara

Link against Intel IPSec Multi-buffer library, which added support for ZUC-EEA3 and ZUC-EIA3 from version v0.53, moving from libSSO ZUC library.

---
 devtools/test-build.sh                 |  6 ++--
 doc/guides/cryptodevs/zuc.rst          | 52 ++++++++++++++++++++--------------
 doc/guides/rel_notes/release_20_02.rst |  7 +++++
 drivers/crypto/zuc/Makefile            | 28 +++++++++++-------
 drivers/crypto/zuc/meson.build         | 24 ++++++++++++----
 drivers/crypto/zuc/rte_zuc_pmd.c       | 51 ++++++++++++++++++++++++---------
 drivers/crypto/zuc/rte_zuc_pmd_ops.c   |  2 ++
 drivers/crypto/zuc/zuc_pmd_private.h   |  6 +++-
 mk/rte.app.mk                          |  2 +-
 9 files changed, 120 insertions(+), 58 deletions(-)

<snip>

Quoted 19 lines
drivers/crypto/zuc/meson.build +6 -5
index b231de0..b7098a3 100644
@@ -1,14 +1,26 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2018 Intel Corporation
+# Copyright(c) 2018-2019 Intel Corporation
 
-lib = cc.find_library('sso_zuc', required: false)
-if not lib.found() or not cc.has_header('sso_zuc.h')
+IMB_required_ver = '0.53.0'
+lib = cc.find_library('IPSec_MB', required: false)
+if not lib.found()
 	build = false
-	reason = 'missing dependency, "libsso_zuc"'
-	subdir_done()
+	reason = 'missing dependency, "libIPSec_MB"'
+else

drivers/crypto/zuc/meson.build line 19

Quoted 10 lines
drivers/crypto/zuc/meson.build +10 -0
+	ext_deps += lib
+
+	# version comes with quotes, so we split based on " and take the middle
+	imb_ver = cc.get_define('IMB_VERSION_STR',
+		prefix : '#include<intel-ipsec-mb.h>').split('"')[1]
+
+	if (imb_ver == '') or (imb_ver.version_compare('<' + IMB_required_ver))
+		message('IPSec_MB version >= @0@ is required, found version @1@'.format(
+				IMB_required_ver, imb_ver))
+		build = false

Rather than/As well as printing a message here, you also need to provide a reason when setting build = false, so the summary at the end can report why the driver is not being built.

Quoted 4 lines
drivers/crypto/zuc/meson.build +2 -0
+	endif
+
 endif
 
Quoted 7 lines

drivers/crypto/zuc/meson.build line 12

Quoted 2 lines
drivers/crypto/zuc/meson.build +0 -1
 allow_experimental_apis = true
-ext_deps += lib

If you drop the line after the else above, you can keep this line and shrink the diff by 2 lines. :-)

/Bruce

BTW: Same comments apply to other two patches in the set.

/Bruce

#8 lore raw

PATCH v2 2/3 crypto/kasumi: use IPSec library

In reply to Pablo de Lara

Link against Intel IPSec Multi-buffer library, which added support for KASUMI-F8 and KASUMI-F9 from version v0.53, moving from libSSO KASUMI library.

---
 devtools/test-build.sh                     |  6 +--
 doc/guides/cryptodevs/kasumi.rst           | 62 ++++++++++++-----------
 doc/guides/rel_notes/release_20_02.rst     |  5 ++
 drivers/crypto/kasumi/Makefile             | 26 ++++++----
 drivers/crypto/kasumi/kasumi_pmd_private.h | 12 +++--
 drivers/crypto/kasumi/meson.build          | 24 ++++++---
 drivers/crypto/kasumi/rte_kasumi_pmd.c     | 79 +++++++++++++++++-------------
 drivers/crypto/kasumi/rte_kasumi_pmd_ops.c |  8 ++-
 mk/rte.app.mk                              |  2 +-
 9 files changed, 134 insertions(+), 90 deletions(-)
devtools/test-build.sh +2 -4
index afa0748..56c744f 100755
@@ -28,7 +28,6 @@ default_path=$PATH
 # - FLEXRAN_SDK
 # - LIBMUSDK_PATH
 # - LIBSSO_SNOW3G_PATH
-# - LIBSSO_KASUMI_PATH
 . $(dirname $(readlink -f $0))/load-devel-config
 
 print_usage () {
@@ -121,7 +120,6 @@ reset_env ()
 	unset FLEXRAN_SDK
 	unset LIBMUSDK_PATH
 	unset LIBSSO_SNOW3G_PATH
-	unset LIBSSO_KASUMI_PATH
 	unset PQOS_INSTALL_PATH
 }
 
@@ -183,10 +181,10 @@ config () # <directory> <target> <options>
 		sed -ri=""      's,(PMD_AESNI_GCM=)n,\1y,' $1/.config
 		test "$DPDK_DEP_IPSEC_MB" != y || \
 		sed -ri=""            's,(PMD_ZUC=)n,\1y,' $1/.config
+		test "$DPDK_DEP_IPSEC_MB" != y || \
+		sed -ri=""         's,(PMD_KASUMI=)n,\1y,' $1/.config
 		test -z "$LIBSSO_SNOW3G_PATH" || \
 		sed -ri=""         's,(PMD_SNOW3G=)n,\1y,' $1/.config
-		test -z "$LIBSSO_KASUMI_PATH" || \
-		sed -ri=""         's,(PMD_KASUMI=)n,\1y,' $1/.config
 		test "$DPDK_DEP_SSL" != y || \
 		sed -ri=""            's,(PMD_CCP=)n,\1y,' $1/.config
 		test "$DPDK_DEP_SSL" != y || \
doc/guides/cryptodevs/kasumi.rst +33 -29

90 lines not on this page · raw message

doc/guides/rel_notes/release_20_02.rst +5 -0
index 4216e0b..a3f6154 100644
@@ -63,6 +63,11 @@ New Features
   * Removed dynamic library limitation, so PMD can be built as a shared
     object now.
 
+* **Updated the KASUMI PMD.**
+
+  * Transistioned underlying library from libSSO KASUMI to intel-ipsec-mb
+    library (minimum version required 0.53).
+
 
 Removed Items
 -------------
drivers/crypto/kasumi/Makefile +16 -10
index 26f5137..c94d6bd 100644
@@ -3,12 +3,6 @@
 
 include $(RTE_SDK)/mk/rte.vars.mk
 
-ifneq ($(MAKECMDGOALS),clean)
-ifeq ($(LIBSSO_KASUMI_PATH),)
-$(error "Please define LIBSSO_KASUMI_PATH environment variable")
-endif
-endif
-
 # library name
 LIB = librte_pmd_kasumi.a
 
@@ -21,14 +15,26 @@ CFLAGS += -DALLOW_EXPERIMENTAL_API
 EXPORT_MAP := rte_pmd_kasumi_version.map
 
 # external library dependencies
-CFLAGS += -I$(LIBSSO_KASUMI_PATH)
-CFLAGS += -I$(LIBSSO_KASUMI_PATH)/include
-CFLAGS += -I$(LIBSSO_KASUMI_PATH)/build
-LDLIBS += -L$(LIBSSO_KASUMI_PATH)/build -lsso_kasumi
+LDLIBS += -lIPSec_MB
 LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
 LDLIBS += -lrte_cryptodev
 LDLIBS += -lrte_bus_vdev
 
+IMB_HDR = $(shell echo '\#include <intel-ipsec-mb.h>' | \
+	$(CC) -E $(EXTRA_CFLAGS) - | grep 'intel-ipsec-mb.h' | \
+	head -n1 | cut -d'"' -f2)
+
+# Detect library version
+IMB_VERSION = $(shell grep -e "IMB_VERSION_STR" $(IMB_HDR) | cut -d'"' -f2)
+IMB_VERSION_NUM = $(shell grep -e "IMB_VERSION_NUM" $(IMB_HDR) | cut -d' ' -f3)
+
+ifeq ($(IMB_VERSION),)
+$(error "IPSec_MB version >= 0.53 is required")
+endif
+
+ifeq ($(shell expr $(IMB_VERSION_NUM) \< 0x3400), 1)
+$(error "IPSec_MB version >= 0.53 is required")
+endif
 # library source files
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_KASUMI) += rte_kasumi_pmd.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_KASUMI) += rte_kasumi_pmd_ops.c
drivers/crypto/kasumi/kasumi_pmd_private.h +8 -4
index 7ac19c5..3b3a695 100644
@@ -5,7 +5,7 @@
 #ifndef _KASUMI_PMD_PRIVATE_H_
 #define _KASUMI_PMD_PRIVATE_H_
 
-#include <sso_kasumi.h>
+#include <intel-ipsec-mb.h>
 
 #define CRYPTODEV_NAME_KASUMI_PMD	crypto_kasumi
 /**< KASUMI PMD device name */
@@ -24,6 +24,8 @@ int kasumi_logtype_driver;
 struct kasumi_private {
 	unsigned max_nb_queue_pairs;
 	/**< Max number of queue pairs supported by device */
+	MB_MGR *mgr;
+	/**< Multi-buffer instance */
 };
 
 /** KASUMI buffer queue pair */
@@ -45,6 +47,8 @@ struct kasumi_qp {
 	 * by the driver when verifying a digest provided
 	 * by the user (using authentication verify operation)
 	 */
+	MB_MGR *mgr;
+	/**< Multi-buffer instance */
 } __rte_cache_aligned;
 
 enum kasumi_operation {
@@ -58,8 +62,8 @@ enum kasumi_operation {
 /** KASUMI private session structure */
 struct kasumi_session {
 	/* Keys have to be 16-byte aligned */
-	sso_kasumi_key_sched_t pKeySched_cipher;
-	sso_kasumi_key_sched_t pKeySched_hash;
+	kasumi_key_sched_t pKeySched_cipher;
+	kasumi_key_sched_t pKeySched_hash;
 	enum kasumi_operation op;
 	enum rte_crypto_auth_operation auth_op;
 	uint16_t cipher_iv_offset;
@@ -67,7 +71,7 @@ struct kasumi_session {
 
 
 int
-kasumi_set_session_parameters(struct kasumi_session *sess,
+kasumi_set_session_parameters(MB_MGR *mgr, struct kasumi_session *sess,
 		const struct rte_crypto_sym_xform *xform);
 
 
drivers/crypto/kasumi/meson.build +18 -6
index 90a3c4f..9639aaf 100644
@@ -1,14 +1,26 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2018 Intel Corporation
+# Copyright(c) 2018-2019 Intel Corporation
 
-lib = cc.find_library('sso_kasumi', required: false)
-if not lib.found() or not cc.has_header('sso_kasumi.h')
+IMB_required_ver = '0.53.0'
+lib = cc.find_library('IPSec_MB', required: false)
+if not lib.found()
 	build = false
-	reason = 'missing dependency, "libsso_kasumi"'
-	subdir_done()
+	reason = 'missing dependency, "libIPSec_MB"'
+else
+	ext_deps += lib
+
+	# version comes with quotes, so we split based on " and take the middle
+	imb_ver = cc.get_define('IMB_VERSION_STR',
+		prefix : '#include<intel-ipsec-mb.h>').split('"')[1]
+
+	if (imb_ver == '') or (imb_ver.version_compare('<' + IMB_required_ver))
+		message('IPSec_MB version >= @0@ is required, found version @1@'.format(
+				IMB_required_ver, imb_ver))
+		build = false
+	endif
+
 endif
 
 allow_experimental_apis = true
-ext_deps += lib
 sources = files('rte_kasumi_pmd.c', 'rte_kasumi_pmd_ops.c')
 deps += ['bus_vdev']
drivers/crypto/kasumi/rte_kasumi_pmd.c +45 -34

217 lines not on this page · raw message

drivers/crypto/kasumi/rte_kasumi_pmd_ops.c +6 -2
index 5ce4953..55fbe00 100644
@@ -195,6 +195,7 @@ kasumi_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		int socket_id)
 {
 	struct kasumi_qp *qp = NULL;
+	struct kasumi_private *internals = dev->data->dev_private;
 
 	/* Free memory prior to re-allocation if needed. */
 	if (dev->data->queue_pairs[qp_id] != NULL)
@@ -217,6 +218,7 @@ kasumi_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 	if (qp->processed_ops == NULL)
 		goto qp_setup_cleanup;
 
+	qp->mgr = internals->mgr;
 	qp->sess_mp = qp_conf->mp_session;
 	qp->sess_mp_priv = qp_conf->mp_session_private;
 
@@ -246,13 +248,14 @@ kasumi_pmd_sym_session_get_size(struct rte_cryptodev *dev __rte_unused)
 
 /** Configure a KASUMI session from a crypto xform chain */
 static int
-kasumi_pmd_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
+kasumi_pmd_sym_session_configure(struct rte_cryptodev *dev,
 		struct rte_crypto_sym_xform *xform,
 		struct rte_cryptodev_sym_session *sess,
 		struct rte_mempool *mempool)
 {
 	void *sess_private_data;
 	int ret;
+	struct kasumi_private *internals = dev->data->dev_private;
 
 	if (unlikely(sess == NULL)) {
 		KASUMI_LOG(ERR, "invalid session struct");
@@ -265,7 +268,8 @@ kasumi_pmd_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
 		return -ENOMEM;
 	}
 
-	ret = kasumi_set_session_parameters(sess_private_data, xform);
+	ret = kasumi_set_session_parameters(internals->mgr,
+					sess_private_data, xform);
 	if (ret != 0) {
 		KASUMI_LOG(ERR, "failed configure session parameters");
 
mk/rte.app.mk +1 -1
index 62724cc..a8163f1 100644
@@ -270,7 +270,7 @@ endif # CONFIG_RTE_LIBRTE_PMD_QAT
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G)      += -lrte_pmd_snow3g
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G)      += -L$(LIBSSO_SNOW3G_PATH)/build -lsso_snow3g
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_KASUMI)      += -lrte_pmd_kasumi
-_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_KASUMI)      += -L$(LIBSSO_KASUMI_PATH)/build -lsso_kasumi
+_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_KASUMI)      += -lIPSec_MB
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_ZUC)         += -lrte_pmd_zuc
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_ZUC)         += -lIPSec_MB
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_ARMV8_CRYPTO)    += -lrte_pmd_armv8
Signature · 1 line
2.7.5
#9 lore raw

PATCH v2 3/3 crypto/snow3g: use IPSec library

In reply to Pablo de Lara

Link against Intel IPSec Multi-buffer library, which added support for SNOW3G-UEA2 and SNOW3G-UIA2 from version v0.53, moving from libSSO SNOW3G library.

---
 devtools/test-build.sh                     |  4 +-
 doc/guides/cryptodevs/snow3g.rst           | 58 +++++++++++---------
 doc/guides/rel_notes/release_20_02.rst     |  5 ++
 drivers/crypto/snow3g/Makefile             | 29 ++++++----
 drivers/crypto/snow3g/meson.build          | 21 ++++++--
 drivers/crypto/snow3g/rte_snow3g_pmd.c     | 85 ++++++++++++++++++------------
 drivers/crypto/snow3g/rte_snow3g_pmd_ops.c |  8 ++-
 drivers/crypto/snow3g/snow3g_pmd_private.h | 14 +++--
 mk/rte.app.mk                              |  2 +-
 9 files changed, 141 insertions(+), 85 deletions(-)
devtools/test-build.sh +1 -3
index 56c744f..7bdd35e 100755
@@ -27,7 +27,6 @@ default_path=$PATH
 # - DPDK_NOTIFY (notify-send)
 # - FLEXRAN_SDK
 # - LIBMUSDK_PATH
-# - LIBSSO_SNOW3G_PATH
 . $(dirname $(readlink -f $0))/load-devel-config
 
 print_usage () {
@@ -119,7 +118,6 @@ reset_env ()
 	unset ARMV8_CRYPTO_LIB_PATH
 	unset FLEXRAN_SDK
 	unset LIBMUSDK_PATH
-	unset LIBSSO_SNOW3G_PATH
 	unset PQOS_INSTALL_PATH
 }
 
@@ -183,7 +181,7 @@ config () # <directory> <target> <options>
 		sed -ri=""            's,(PMD_ZUC=)n,\1y,' $1/.config
 		test "$DPDK_DEP_IPSEC_MB" != y || \
 		sed -ri=""         's,(PMD_KASUMI=)n,\1y,' $1/.config
-		test -z "$LIBSSO_SNOW3G_PATH" || \
+		test "$DPDK_DEP_IPSEC_MB" != y || \
 		sed -ri=""         's,(PMD_SNOW3G=)n,\1y,' $1/.config
 		test "$DPDK_DEP_SSL" != y || \
 		sed -ri=""            's,(PMD_CCP=)n,\1y,' $1/.config
doc/guides/cryptodevs/snow3g.rst +34 -24

84 lines not on this page · raw message

doc/guides/rel_notes/release_20_02.rst +5 -0
index a3f6154..2532b21 100644
@@ -68,6 +68,11 @@ New Features
   * Transistioned underlying library from libSSO KASUMI to intel-ipsec-mb
     library (minimum version required 0.53).
 
+* **Updated the SNOW3G PMD.**
+
+  * Transistioned underlying library from libSSO SNOW3G to intel-ipsec-mb
+    library (minimum version required 0.53).
+
 
 Removed Items
 -------------
drivers/crypto/snow3g/Makefile +18 -11
index 4086c57..438119c 100644
@@ -1,14 +1,8 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2016 Intel Corporation
+# Copyright(c) 2016-2019 Intel Corporation
 
 include $(RTE_SDK)/mk/rte.vars.mk
 
-ifneq ($(MAKECMDGOALS),clean)
-ifeq ($(LIBSSO_SNOW3G_PATH),)
-$(error "Please define LIBSSO_SNOW3G_PATH environment variable")
-endif
-endif
-
 # library name
 LIB = librte_pmd_snow3g.a
 
@@ -21,14 +15,27 @@ CFLAGS += -DALLOW_EXPERIMENTAL_API
 EXPORT_MAP := rte_pmd_snow3g_version.map
 
 # external library dependencies
-CFLAGS += -I$(LIBSSO_SNOW3G_PATH)
-CFLAGS += -I$(LIBSSO_SNOW3G_PATH)/include
-CFLAGS += -I$(LIBSSO_SNOW3G_PATH)/build
-LDLIBS += -L$(LIBSSO_SNOW3G_PATH)/build -lsso_snow3g
+LDLIBS += -lIPSec_MB
 LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
 LDLIBS += -lrte_cryptodev
 LDLIBS += -lrte_bus_vdev
 
+IMB_HDR = $(shell echo '\#include <intel-ipsec-mb.h>' | \
+	$(CC) -E $(EXTRA_CFLAGS) - | grep 'intel-ipsec-mb.h' | \
+	head -n1 | cut -d'"' -f2)
+
+# Detect library version
+IMB_VERSION = $(shell grep -e "IMB_VERSION_STR" $(IMB_HDR) | cut -d'"' -f2)
+IMB_VERSION_NUM = $(shell grep -e "IMB_VERSION_NUM" $(IMB_HDR) | cut -d' ' -f3)
+
+ifeq ($(IMB_VERSION),)
+$(error "IPSec_MB version >= 0.53 is required")
+endif
+
+ifeq ($(shell expr $(IMB_VERSION_NUM) \< 0x3400), 1)
+$(error "IPSec_MB version >= 0.53 is required")
+endif
+
 # library source files
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G) += rte_snow3g_pmd.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G) += rte_snow3g_pmd_ops.c
drivers/crypto/snow3g/meson.build +17 -4
index 0e8742a..e9497bd 100644
@@ -1,11 +1,24 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2019 Intel Corporation
 
-lib = cc.find_library('sso_snow3g', required: false)
-if not lib.found() or not cc.has_header('sso_snow3g.h')
+IMB_required_ver = '0.53.0'
+lib = cc.find_library('IPSec_MB', required: false)
+if not lib.found()
 	build = false
-	reason = 'missing dependency, "libsso_snow3g"'
-	subdir_done()
+	reason = 'missing dependency, "libIPSec_MB"'
+else
+	ext_deps += lib
+
+	# version comes with quotes, so we split based on " and take the middle
+	imb_ver = cc.get_define('IMB_VERSION_STR',
+		prefix : '#include<intel-ipsec-mb.h>').split('"')[1]
+
+	if (imb_ver == '') or (imb_ver.version_compare('<' + IMB_required_ver))
+		message('IPSec_MB version >= @0@ is required, found version @1@'.format(
+				IMB_required_ver, imb_ver))
+		build = false
+	endif
+
 endif
 
 allow_experimental_apis = true
drivers/crypto/snow3g/rte_snow3g_pmd.c +50 -35

223 lines not on this page · raw message

drivers/crypto/snow3g/rte_snow3g_pmd_ops.c +6 -2
index 8778f28..ea76637 100644
@@ -201,6 +201,7 @@ snow3g_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		int socket_id)
 {
 	struct snow3g_qp *qp = NULL;
+	struct snow3g_private *internals = dev->data->dev_private;
 
 	/* Free memory prior to re-allocation if needed. */
 	if (dev->data->queue_pairs[qp_id] != NULL)
@@ -223,6 +224,7 @@ snow3g_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 	if (qp->processed_ops == NULL)
 		goto qp_setup_cleanup;
 
+	qp->mgr = internals->mgr;
 	qp->sess_mp = qp_conf->mp_session;
 	qp->sess_mp_priv = qp_conf->mp_session_private;
 
@@ -253,13 +255,14 @@ snow3g_pmd_sym_session_get_size(struct rte_cryptodev *dev __rte_unused)
 
 /** Configure a SNOW 3G session from a crypto xform chain */
 static int
-snow3g_pmd_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
+snow3g_pmd_sym_session_configure(struct rte_cryptodev *dev,
 		struct rte_crypto_sym_xform *xform,
 		struct rte_cryptodev_sym_session *sess,
 		struct rte_mempool *mempool)
 {
 	void *sess_private_data;
 	int ret;
+	struct snow3g_private *internals = dev->data->dev_private;
 
 	if (unlikely(sess == NULL)) {
 		SNOW3G_LOG(ERR, "invalid session struct");
@@ -272,7 +275,8 @@ snow3g_pmd_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
 		return -ENOMEM;
 	}
 
-	ret = snow3g_set_session_parameters(sess_private_data, xform);
+	ret = snow3g_set_session_parameters(internals->mgr,
+					sess_private_data, xform);
 	if (ret != 0) {
 		SNOW3G_LOG(ERR, "failed configure session parameters");
 
drivers/crypto/snow3g/snow3g_pmd_private.h +9 -5
index 1fe05eb..2074f3d 100644
@@ -1,11 +1,11 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2016-2018 Intel Corporation
+ * Copyright(c) 2016-2019 Intel Corporation
  */
 
 #ifndef _SNOW3G_PMD_PRIVATE_H_
 #define _SNOW3G_PMD_PRIVATE_H_
 
-#include <sso_snow3g.h>
+#include <intel-ipsec-mb.h>
 
 #define CRYPTODEV_NAME_SNOW3G_PMD	crypto_snow3g
 /**< SNOW 3G PMD device name */
@@ -25,6 +25,8 @@ int snow3g_logtype_driver;
 struct snow3g_private {
 	unsigned max_nb_queue_pairs;
 	/**< Max number of queue pairs supported by device */
+	MB_MGR *mgr;
+	/**< Multi-buffer instance */
 };
 
 /** SNOW 3G buffer queue pair */
@@ -46,6 +48,8 @@ struct snow3g_qp {
 	 * by the driver when verifying a digest provided
 	 * by the user (using authentication verify operation)
 	 */
+	MB_MGR *mgr;
+	/**< Multi-buffer instance */
 } __rte_cache_aligned;
 
 enum snow3g_operation {
@@ -60,15 +64,15 @@ enum snow3g_operation {
 struct snow3g_session {
 	enum snow3g_operation op;
 	enum rte_crypto_auth_operation auth_op;
-	sso_snow3g_key_schedule_t pKeySched_cipher;
-	sso_snow3g_key_schedule_t pKeySched_hash;
+	snow3g_key_schedule_t pKeySched_cipher;
+	snow3g_key_schedule_t pKeySched_hash;
 	uint16_t cipher_iv_offset;
 	uint16_t auth_iv_offset;
 } __rte_cache_aligned;
 
 
 extern int
-snow3g_set_session_parameters(struct snow3g_session *sess,
+snow3g_set_session_parameters(MB_MGR *mgr, struct snow3g_session *sess,
 		const struct rte_crypto_sym_xform *xform);
 
 
mk/rte.app.mk +1 -1
index a8163f1..8bf6b3d 100644
@@ -268,7 +268,7 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_QAT_SYM)     += -lrte_pmd_qat -lcrypto
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_QAT_ASYM)    += -lrte_pmd_qat -lcrypto
 endif # CONFIG_RTE_LIBRTE_PMD_QAT
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G)      += -lrte_pmd_snow3g
-_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G)      += -L$(LIBSSO_SNOW3G_PATH)/build -lsso_snow3g
+_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G)      += -lIPSec_MB
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_KASUMI)      += -lrte_pmd_kasumi
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_KASUMI)      += -lIPSec_MB
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_ZUC)         += -lrte_pmd_zuc
Signature · 1 line
2.7.5
#10 lore raw
In reply to Pablo de Lara

Hi,

Quoted 8 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Pablo de Lara
Sent: Monday, January 13, 2020 1:40 PM
To: [email protected]; [email protected]
Cc: [email protected]; Pablo de Lara <[email protected]>
Subject: [dpdk-dev] [PATCH v2 0/3] Use Intel IPSec MB library in Wireless PMDs

Quoted 5 lines

The three Intel SW Crypto PMDs supporting SNOW3G, ZUC and KASUMI link against libSSO libraries.
The Intel IPSec Multi-buffer library recently integrated the code from these libraries, in version v0.53.
This library can be downloaded from

<removed>

Quoted 38 lines

KASUMI, SNOW3G and ZUC PMDs have been modified to use this single library, which is already used in the AESNI MB and AESNI GCM PMDs, reducing the number of external dependencies in the crypto PMDs.

Changes in v2:
- Updated ZUC PMD to support future AVX512 and AVX2 implementations.

Pablo de Lara (3):
crypto/zuc: use IPSec library
crypto/kasumi: use IPSec library
crypto/snow3g: use IPSec library

 devtools/test-build.sh                     | 16 ++----
 doc/guides/cryptodevs/kasumi.rst           | 62 ++++++++++++----------
 doc/guides/cryptodevs/snow3g.rst           | 58 +++++++++++---------
 doc/guides/cryptodevs/zuc.rst              | 52 ++++++++++--------
 doc/guides/rel_notes/release_20_02.rst     | 17 ++++++
 drivers/crypto/kasumi/Makefile             | 26 +++++----
 drivers/crypto/kasumi/kasumi_pmd_private.h | 12 +++--
 drivers/crypto/kasumi/meson.build          | 24 ++++++---
 drivers/crypto/kasumi/rte_kasumi_pmd.c     | 79 +++++++++++++++---------
---
 drivers/crypto/kasumi/rte_kasumi_pmd_ops.c |  8 ++-
 drivers/crypto/snow3g/Makefile             | 29 ++++++----
 drivers/crypto/snow3g/meson.build          | 21 ++++++--
 drivers/crypto/snow3g/rte_snow3g_pmd.c     | 85 ++++++++++++++++++---
---------
 drivers/crypto/snow3g/rte_snow3g_pmd_ops.c |  8 ++-
drivers/crypto/snow3g/snow3g_pmd_private.h | 14 +++--
 drivers/crypto/zuc/Makefile                | 28 ++++++----
 drivers/crypto/zuc/meson.build             | 24 ++++++---
 drivers/crypto/zuc/rte_zuc_pmd.c           | 51 +++++++++++++-----
 drivers/crypto/zuc/rte_zuc_pmd_ops.c       |  2 +
 drivers/crypto/zuc/zuc_pmd_private.h       |  6 ++-
 mk/rte.app.mk                              |  6 +--
 21 files changed, 395 insertions(+), 233 deletions(-)
Quoted 2 lines

--
2.7.5

I see the following build failure when applying the patchset:
"""
../../root/dpdk/drivers/crypto/zuc/rte_zuc_pmd.c:225:51: error: cast from 'uint8_t **' (aka 'unsigned char **') to 'const void **' must have all intermediate pointers const qualified to be safe [-Werror,-Wcast-qual]

        IMB_ZUC_EEA3_N_BUFFER(qp->mb_mgr, (const void **)cipher_keys,
                                                         ^
../../root/dpdk/drivers/crypto/zuc/rte_zuc_pmd.c:226:19: error: cast from 'uint8_t **' (aka 'unsigned char **') to 'const void **' must have all intermediate pointers const qualified to be safe [-Werror,-Wcast-qual]
                        (const void **)iv, (const void **)src, (void **)dst,
                                       ^
../../root/dpdk/drivers/crypto/zuc/rte_zuc_pmd.c:226:38: error: cast from 'uint8_t **' (aka 'unsigned char **') to 'const void **' must have all intermediate pointers const qualified to be safe [-Werror,-Wcast-qual]
                        (const void **)iv, (const void **)src, (void **)dst,
                                                          ^

3 errors generated.
"""

It reproduces with meson on Fedora 31 and clang (version 9.0.0). I'm using intel-ipsec-mb version 0.53.

Regards,
Ali

#11 lore raw

Hi,

Quoted 83 lines

-----Original Message-----
From: Ali Alnubani <[email protected]>
Sent: Monday, January 13, 2020 2:18 PM
To: De Lara Guarch, Pablo <[email protected]>; [email protected]; Doherty, Declan <[email protected]>
Cc: [email protected]
Subject: RE: [dpdk-dev] [PATCH v2 0/3] Use Intel IPSec MB library in Wireless PMDs

Hi,

Quoted 8 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Pablo de Lara
Sent: Monday, January 13, 2020 1:40 PM
To: [email protected]; [email protected]
Cc: [email protected]; Pablo de Lara <[email protected]>
Subject: [dpdk-dev] [PATCH v2 0/3] Use Intel IPSec MB library in Wireless PMDs

Quoted 5 lines

The three Intel SW Crypto PMDs supporting SNOW3G, ZUC and KASUMI link against libSSO libraries.
The Intel IPSec Multi-buffer library recently integrated the code from these libraries, in version v0.53.
This library can be downloaded from

<removed>

Quoted 38 lines

KASUMI, SNOW3G and ZUC PMDs have been modified to use this single library, which is already used in the AESNI MB and AESNI GCM PMDs, reducing the number of external dependencies in the crypto PMDs.

Changes in v2:
- Updated ZUC PMD to support future AVX512 and AVX2 implementations.

Pablo de Lara (3):
crypto/zuc: use IPSec library
crypto/kasumi: use IPSec library
crypto/snow3g: use IPSec library

 devtools/test-build.sh                     | 16 ++----
 doc/guides/cryptodevs/kasumi.rst           | 62 ++++++++++++----------
 doc/guides/cryptodevs/snow3g.rst           | 58 +++++++++++---------
 doc/guides/cryptodevs/zuc.rst              | 52 ++++++++++--------
 doc/guides/rel_notes/release_20_02.rst     | 17 ++++++
 drivers/crypto/kasumi/Makefile             | 26 +++++----
 drivers/crypto/kasumi/kasumi_pmd_private.h | 12 +++--
 drivers/crypto/kasumi/meson.build          | 24 ++++++---
 drivers/crypto/kasumi/rte_kasumi_pmd.c     | 79 +++++++++++++++---------
---
 drivers/crypto/kasumi/rte_kasumi_pmd_ops.c |  8 ++-
 drivers/crypto/snow3g/Makefile             | 29 ++++++----
 drivers/crypto/snow3g/meson.build          | 21 ++++++--
 drivers/crypto/snow3g/rte_snow3g_pmd.c     | 85 ++++++++++++++++++---
---------
 drivers/crypto/snow3g/rte_snow3g_pmd_ops.c |  8 ++-
drivers/crypto/snow3g/snow3g_pmd_private.h | 14 +++--
 drivers/crypto/zuc/Makefile                | 28 ++++++----
 drivers/crypto/zuc/meson.build             | 24 ++++++---
 drivers/crypto/zuc/rte_zuc_pmd.c           | 51 +++++++++++++-----
 drivers/crypto/zuc/rte_zuc_pmd_ops.c       |  2 +
 drivers/crypto/zuc/zuc_pmd_private.h       |  6 ++-
 mk/rte.app.mk                              |  6 +--
 21 files changed, 395 insertions(+), 233 deletions(-)
Quoted 2 lines

--
2.7.5

I see the following build failure when applying the patchset:
"""
../../root/dpdk/drivers/crypto/zuc/rte_zuc_pmd.c:225:51: error: cast from 'uint8_t **' (aka 'unsigned char **') to 'const void **' must have all intermediate pointers const qualified to be safe [-Werror,-Wcast-qual]

        IMB_ZUC_EEA3_N_BUFFER(qp->mb_mgr, (const void **)cipher_keys,
                                                         ^
../../root/dpdk/drivers/crypto/zuc/rte_zuc_pmd.c:226:19: error: cast from
'uint8_t **' (aka 'unsigned char **') to 'const void **' must have all intermediate
pointers const qualified to be safe [-Werror,-Wcast-qual]
                        (const void **)iv, (const void **)src, (void **)dst,
                                       ^
../../root/dpdk/drivers/crypto/zuc/rte_zuc_pmd.c:226:38: error: cast from
'uint8_t **' (aka 'unsigned char **') to 'const void **' must have all intermediate
pointers const qualified to be safe [-Werror,-Wcast-qual]
                        (const void **)iv, (const void **)src, (void **)dst,
                                                          ^
Quoted 5 lines

3 errors generated.
"""

It reproduces with meson on Fedora 31 and clang (version 9.0.0). I'm using intel-ipsec-mb version 0.53.

Thanks for reporting this issue. By the time I sent the patchset, I saw no compilation errors. Will send a v3 fixing this and addressing Bruce's comments.

Thanks,
Pablo

Quoted 3 lines

Regards,
Ali

#12 lore raw

v3 cover Use Intel IPSec MB library in Wireless PMDs

In reply to Pablo de Lara

The three Intel SW Crypto PMDs supporting SNOW3G, ZUC and KASUMI link against libSSO libraries. The Intel IPSec Multi-buffer library recently integrated the code from these libraries, in version v0.53. This library can be downloaded from https://github.com/intel/intel-ipsec-mb.

KASUMI, SNOW3G and ZUC PMDs have been modified to use this single library, which is already used in the AESNI MB and AESNI GCM PMDs, reducing the number of external dependencies in the crypto PMDs.

Changes in v3:
- Fixed clang compilation
- Added reason field in meson config files

Changes in v2:
- Updated ZUC PMD to support future AVX512 and AVX2 implementations.

Pablo de Lara (3):
crypto/zuc: use IPSec library
crypto/kasumi: use IPSec library
crypto/snow3g: use IPSec library

 devtools/test-build.sh                     | 16 ++----
 doc/guides/cryptodevs/kasumi.rst           | 62 ++++++++++++----------
 doc/guides/cryptodevs/snow3g.rst           | 58 +++++++++++---------
 doc/guides/cryptodevs/zuc.rst              | 52 ++++++++++--------
 doc/guides/rel_notes/release_20_02.rst     | 17 ++++++
 drivers/crypto/kasumi/Makefile             | 26 +++++----
 drivers/crypto/kasumi/kasumi_pmd_private.h | 12 +++--
 drivers/crypto/kasumi/meson.build          | 21 ++++++--
 drivers/crypto/kasumi/rte_kasumi_pmd.c     | 79 +++++++++++++++------------
 drivers/crypto/kasumi/rte_kasumi_pmd_ops.c |  8 ++-
 drivers/crypto/snow3g/Makefile             | 29 ++++++----
 drivers/crypto/snow3g/meson.build          | 21 ++++++--
 drivers/crypto/snow3g/rte_snow3g_pmd.c     | 85 ++++++++++++++++++------------
 drivers/crypto/snow3g/rte_snow3g_pmd_ops.c |  8 ++-
 drivers/crypto/snow3g/snow3g_pmd_private.h | 14 +++--
 drivers/crypto/zuc/Makefile                | 28 ++++++----
 drivers/crypto/zuc/meson.build             | 21 ++++++--
 drivers/crypto/zuc/rte_zuc_pmd.c           | 58 ++++++++++++++------
 drivers/crypto/zuc/rte_zuc_pmd_ops.c       |  2 +
 drivers/crypto/zuc/zuc_pmd_private.h       |  6 ++-
 mk/rte.app.mk                              |  6 +--
 21 files changed, 394 insertions(+), 235 deletions(-)
Signature · 1 line
2.7.5
#13 lore raw

PATCH v3 1/3 crypto/zuc: use IPSec library

Link against Intel IPSec Multi-buffer library, which added support for ZUC-EEA3 and ZUC-EIA3 from version v0.53, moving from libSSO ZUC library.

---
 devtools/test-build.sh                 |  6 ++--
 doc/guides/cryptodevs/zuc.rst          | 52 ++++++++++++++++++------------
 doc/guides/rel_notes/release_20_02.rst |  7 ++++
 drivers/crypto/zuc/Makefile            | 28 +++++++++-------
 drivers/crypto/zuc/meson.build         | 21 +++++++++---
 drivers/crypto/zuc/rte_zuc_pmd.c       | 58 ++++++++++++++++++++++++----------
 drivers/crypto/zuc/rte_zuc_pmd_ops.c   |  2 ++
 drivers/crypto/zuc/zuc_pmd_private.h   |  6 +++-
 mk/rte.app.mk                          |  2 +-
 9 files changed, 122 insertions(+), 60 deletions(-)
devtools/test-build.sh +2 -4
index be565a1..afa0748 100755
@@ -29,7 +29,6 @@ default_path=$PATH
 # - LIBMUSDK_PATH
 # - LIBSSO_SNOW3G_PATH
 # - LIBSSO_KASUMI_PATH
-# - LIBSSO_ZUC_PATH
 . $(dirname $(readlink -f $0))/load-devel-config
 
 print_usage () {
@@ -123,7 +122,6 @@ reset_env ()
 	unset LIBMUSDK_PATH
 	unset LIBSSO_SNOW3G_PATH
 	unset LIBSSO_KASUMI_PATH
-	unset LIBSSO_ZUC_PATH
 	unset PQOS_INSTALL_PATH
 }
 
@@ -183,12 +181,12 @@ config () # <directory> <target> <options>
 		sed -ri=""       's,(PMD_AESNI_MB=)n,\1y,' $1/.config
 		test "$DPDK_DEP_IPSEC_MB" != y || \
 		sed -ri=""      's,(PMD_AESNI_GCM=)n,\1y,' $1/.config
+		test "$DPDK_DEP_IPSEC_MB" != y || \
+		sed -ri=""            's,(PMD_ZUC=)n,\1y,' $1/.config
 		test -z "$LIBSSO_SNOW3G_PATH" || \
 		sed -ri=""         's,(PMD_SNOW3G=)n,\1y,' $1/.config
 		test -z "$LIBSSO_KASUMI_PATH" || \
 		sed -ri=""         's,(PMD_KASUMI=)n,\1y,' $1/.config
-		test -z "$LIBSSO_ZUC_PATH" || \
-		sed -ri=""            's,(PMD_ZUC=)n,\1y,' $1/.config
 		test "$DPDK_DEP_SSL" != y || \
 		sed -ri=""            's,(PMD_CCP=)n,\1y,' $1/.config
 		test "$DPDK_DEP_SSL" != y || \
doc/guides/cryptodevs/zuc.rst +31 -21

79 lines not on this page · raw message

doc/guides/rel_notes/release_20_02.rst +7 -0
index 0eaa45a..4216e0b 100644
@@ -56,6 +56,13 @@ New Features
      Also, make sure to start the actual text at the margin.
      =========================================================
 
+* **Updated the ZUC PMD.**
+
+  * Transistioned underlying library from libSSO ZUC to intel-ipsec-mb
+    library (minimum version required 0.53).
+  * Removed dynamic library limitation, so PMD can be built as a shared
+    object now.
+
 
 Removed Items
 -------------
drivers/crypto/zuc/Makefile +17 -11
index a01bb6e..b50883b 100644
@@ -1,14 +1,8 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2016 Intel Corporation
+# Copyright(c) 2016-2019 Intel Corporation
 
 include $(RTE_SDK)/mk/rte.vars.mk
 
-ifneq ($(MAKECMDGOALS),clean)
-ifeq ($(LIBSSO_ZUC_PATH),)
-$(error "Please define LIBSSO_ZUC_PATH environment variable")
-endif
-endif
-
 # library name
 LIB = librte_pmd_zuc.a
 
@@ -21,14 +15,26 @@ CFLAGS += -DALLOW_EXPERIMENTAL_API
 EXPORT_MAP := rte_pmd_zuc_version.map
 
 # external library dependencies
-CFLAGS += -I$(LIBSSO_ZUC_PATH)
-CFLAGS += -I$(LIBSSO_ZUC_PATH)/include
-CFLAGS += -I$(LIBSSO_ZUC_PATH)/build
-LDLIBS += -L$(LIBSSO_ZUC_PATH)/build -lsso_zuc
+LDLIBS += -lIPSec_MB
 LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
 LDLIBS += -lrte_cryptodev
 LDLIBS += -lrte_bus_vdev
 
+IMB_HDR = $(shell echo '\#include <intel-ipsec-mb.h>' | \
+	$(CC) -E $(EXTRA_CFLAGS) - | grep 'intel-ipsec-mb.h' | \
+	head -n1 | cut -d'"' -f2)
+
+# Detect library version
+IMB_VERSION = $(shell grep -e "IMB_VERSION_STR" $(IMB_HDR) | cut -d'"' -f2)
+IMB_VERSION_NUM = $(shell grep -e "IMB_VERSION_NUM" $(IMB_HDR) | cut -d' ' -f3)
+
+ifeq ($(IMB_VERSION),)
+$(error "IPSec_MB version >= 0.53 is required")
+endif
+
+ifeq ($(shell expr $(IMB_VERSION_NUM) \< 0x3400), 1)
+$(error "IPSec_MB version >= 0.53 is required")
+endif
 # library source files
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_ZUC) += rte_zuc_pmd.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_ZUC) += rte_zuc_pmd_ops.c
drivers/crypto/zuc/meson.build +16 -5
index b231de0..be3824c 100644
@@ -1,11 +1,22 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2018 Intel Corporation
+# Copyright(c) 2018-2020 Intel Corporation
 
-lib = cc.find_library('sso_zuc', required: false)
-if not lib.found() or not cc.has_header('sso_zuc.h')
+IMB_required_ver = '0.53.0'
+lib = cc.find_library('IPSec_MB', required: false)
+if not lib.found()
 	build = false
-	reason = 'missing dependency, "libsso_zuc"'
-	subdir_done()
+	reason = 'missing dependency, "libIPSec_MB"'
+else
+	# version comes with quotes, so we split based on " and take the middle
+	imb_ver = cc.get_define('IMB_VERSION_STR',
+		prefix : '#include<intel-ipsec-mb.h>').split('"')[1]
+
+	if (imb_ver == '') or (imb_ver.version_compare('<' + IMB_required_ver))
+		reason = 'IPSec_MB version >= @0@ is required, found version @1@'.format(
+				IMB_required_ver, imb_ver)
+		build = false
+	endif
+
 endif
 
 allow_experimental_apis = true
drivers/crypto/zuc/rte_zuc_pmd.c +41 -17

143 lines not on this page · raw message

drivers/crypto/zuc/rte_zuc_pmd_ops.c +2 -0
index 62f8c6c..ddd0f92 100644
@@ -201,6 +201,7 @@ zuc_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		int socket_id)
 {
 	struct zuc_qp *qp = NULL;
+	struct zuc_private *internals = dev->data->dev_private;
 
 	/* Free memory prior to re-allocation if needed. */
 	if (dev->data->queue_pairs[qp_id] != NULL)
@@ -223,6 +224,7 @@ zuc_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 	if (qp->processed_ops == NULL)
 		goto qp_setup_cleanup;
 
+	qp->mb_mgr = internals->mb_mgr;
 	qp->sess_mp = qp_conf->mp_session;
 	qp->sess_mp_priv = qp_conf->mp_session_private;
 
drivers/crypto/zuc/zuc_pmd_private.h +5 -1
index 428efd4..47a8b08 100644
@@ -5,7 +5,7 @@
 #ifndef _ZUC_PMD_PRIVATE_H_
 #define _ZUC_PMD_PRIVATE_H_
 
-#include <sso_zuc.h>
+#include <intel-ipsec-mb.h>
 
 #define CRYPTODEV_NAME_ZUC_PMD		crypto_zuc
 /**< KASUMI PMD device name */
@@ -24,6 +24,8 @@ int zuc_logtype_driver;
 struct zuc_private {
 	unsigned max_nb_queue_pairs;
 	/**< Max number of queue pairs supported by device */
+	MB_MGR *mb_mgr;
+	/**< Multi-buffer instance */
 };
 
 /** ZUC buffer queue pair */
@@ -45,6 +47,8 @@ struct zuc_qp {
 	 * by the driver when verifying a digest provided
 	 * by the user (using authentication verify operation)
 	 */
+	MB_MGR *mb_mgr;
+	/**< Multi-buffer instance */
 } __rte_cache_aligned;
 
 enum zuc_operation {
mk/rte.app.mk +1 -1
index 05ea034..62724cc 100644
@@ -272,7 +272,7 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G)      += -L$(LIBSSO_SNOW3G_PATH)/build -l
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_KASUMI)      += -lrte_pmd_kasumi
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_KASUMI)      += -L$(LIBSSO_KASUMI_PATH)/build -lsso_kasumi
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_ZUC)         += -lrte_pmd_zuc
-_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_ZUC)         += -L$(LIBSSO_ZUC_PATH)/build -lsso_zuc
+_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_ZUC)         += -lIPSec_MB
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_ARMV8_CRYPTO)    += -lrte_pmd_armv8
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_ARMV8_CRYPTO)    += -L$(ARMV8_CRYPTO_LIB_PATH) -larmv8_crypto
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_MVSAM_CRYPTO) += -L$(LIBMUSDK_PATH)/lib -lrte_pmd_mvsam_crypto -lmusdk
Signature · 1 line
2.7.5
#14 lore raw

PATCH v3 2/3 crypto/kasumi: use IPSec library

In reply to Pablo de Lara

Link against Intel IPSec Multi-buffer library, which added support for KASUMI-F8 and KASUMI-F9 from version v0.53, moving from libSSO KASUMI library.

---
 devtools/test-build.sh                     |  6 +--
 doc/guides/cryptodevs/kasumi.rst           | 62 ++++++++++++-----------
 doc/guides/rel_notes/release_20_02.rst     |  5 ++
 drivers/crypto/kasumi/Makefile             | 26 ++++++----
 drivers/crypto/kasumi/kasumi_pmd_private.h | 12 +++--
 drivers/crypto/kasumi/meson.build          | 21 ++++++--
 drivers/crypto/kasumi/rte_kasumi_pmd.c     | 79 +++++++++++++++++-------------
 drivers/crypto/kasumi/rte_kasumi_pmd_ops.c |  8 ++-
 mk/rte.app.mk                              |  2 +-
 9 files changed, 132 insertions(+), 89 deletions(-)
devtools/test-build.sh +2 -4
index afa0748..56c744f 100755
@@ -28,7 +28,6 @@ default_path=$PATH
 # - FLEXRAN_SDK
 # - LIBMUSDK_PATH
 # - LIBSSO_SNOW3G_PATH
-# - LIBSSO_KASUMI_PATH
 . $(dirname $(readlink -f $0))/load-devel-config
 
 print_usage () {
@@ -121,7 +120,6 @@ reset_env ()
 	unset FLEXRAN_SDK
 	unset LIBMUSDK_PATH
 	unset LIBSSO_SNOW3G_PATH
-	unset LIBSSO_KASUMI_PATH
 	unset PQOS_INSTALL_PATH
 }
 
@@ -183,10 +181,10 @@ config () # <directory> <target> <options>
 		sed -ri=""      's,(PMD_AESNI_GCM=)n,\1y,' $1/.config
 		test "$DPDK_DEP_IPSEC_MB" != y || \
 		sed -ri=""            's,(PMD_ZUC=)n,\1y,' $1/.config
+		test "$DPDK_DEP_IPSEC_MB" != y || \
+		sed -ri=""         's,(PMD_KASUMI=)n,\1y,' $1/.config
 		test -z "$LIBSSO_SNOW3G_PATH" || \
 		sed -ri=""         's,(PMD_SNOW3G=)n,\1y,' $1/.config
-		test -z "$LIBSSO_KASUMI_PATH" || \
-		sed -ri=""         's,(PMD_KASUMI=)n,\1y,' $1/.config
 		test "$DPDK_DEP_SSL" != y || \
 		sed -ri=""            's,(PMD_CCP=)n,\1y,' $1/.config
 		test "$DPDK_DEP_SSL" != y || \
doc/guides/cryptodevs/kasumi.rst +33 -29

90 lines not on this page · raw message

doc/guides/rel_notes/release_20_02.rst +5 -0
index 4216e0b..a3f6154 100644
@@ -63,6 +63,11 @@ New Features
   * Removed dynamic library limitation, so PMD can be built as a shared
     object now.
 
+* **Updated the KASUMI PMD.**
+
+  * Transistioned underlying library from libSSO KASUMI to intel-ipsec-mb
+    library (minimum version required 0.53).
+
 
 Removed Items
 -------------
drivers/crypto/kasumi/Makefile +16 -10
index 26f5137..c94d6bd 100644
@@ -3,12 +3,6 @@
 
 include $(RTE_SDK)/mk/rte.vars.mk
 
-ifneq ($(MAKECMDGOALS),clean)
-ifeq ($(LIBSSO_KASUMI_PATH),)
-$(error "Please define LIBSSO_KASUMI_PATH environment variable")
-endif
-endif
-
 # library name
 LIB = librte_pmd_kasumi.a
 
@@ -21,14 +15,26 @@ CFLAGS += -DALLOW_EXPERIMENTAL_API
 EXPORT_MAP := rte_pmd_kasumi_version.map
 
 # external library dependencies
-CFLAGS += -I$(LIBSSO_KASUMI_PATH)
-CFLAGS += -I$(LIBSSO_KASUMI_PATH)/include
-CFLAGS += -I$(LIBSSO_KASUMI_PATH)/build
-LDLIBS += -L$(LIBSSO_KASUMI_PATH)/build -lsso_kasumi
+LDLIBS += -lIPSec_MB
 LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
 LDLIBS += -lrte_cryptodev
 LDLIBS += -lrte_bus_vdev
 
+IMB_HDR = $(shell echo '\#include <intel-ipsec-mb.h>' | \
+	$(CC) -E $(EXTRA_CFLAGS) - | grep 'intel-ipsec-mb.h' | \
+	head -n1 | cut -d'"' -f2)
+
+# Detect library version
+IMB_VERSION = $(shell grep -e "IMB_VERSION_STR" $(IMB_HDR) | cut -d'"' -f2)
+IMB_VERSION_NUM = $(shell grep -e "IMB_VERSION_NUM" $(IMB_HDR) | cut -d' ' -f3)
+
+ifeq ($(IMB_VERSION),)
+$(error "IPSec_MB version >= 0.53 is required")
+endif
+
+ifeq ($(shell expr $(IMB_VERSION_NUM) \< 0x3400), 1)
+$(error "IPSec_MB version >= 0.53 is required")
+endif
 # library source files
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_KASUMI) += rte_kasumi_pmd.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_KASUMI) += rte_kasumi_pmd_ops.c
drivers/crypto/kasumi/kasumi_pmd_private.h +8 -4
index 7ac19c5..3b3a695 100644
@@ -5,7 +5,7 @@
 #ifndef _KASUMI_PMD_PRIVATE_H_
 #define _KASUMI_PMD_PRIVATE_H_
 
-#include <sso_kasumi.h>
+#include <intel-ipsec-mb.h>
 
 #define CRYPTODEV_NAME_KASUMI_PMD	crypto_kasumi
 /**< KASUMI PMD device name */
@@ -24,6 +24,8 @@ int kasumi_logtype_driver;
 struct kasumi_private {
 	unsigned max_nb_queue_pairs;
 	/**< Max number of queue pairs supported by device */
+	MB_MGR *mgr;
+	/**< Multi-buffer instance */
 };
 
 /** KASUMI buffer queue pair */
@@ -45,6 +47,8 @@ struct kasumi_qp {
 	 * by the driver when verifying a digest provided
 	 * by the user (using authentication verify operation)
 	 */
+	MB_MGR *mgr;
+	/**< Multi-buffer instance */
 } __rte_cache_aligned;
 
 enum kasumi_operation {
@@ -58,8 +62,8 @@ enum kasumi_operation {
 /** KASUMI private session structure */
 struct kasumi_session {
 	/* Keys have to be 16-byte aligned */
-	sso_kasumi_key_sched_t pKeySched_cipher;
-	sso_kasumi_key_sched_t pKeySched_hash;
+	kasumi_key_sched_t pKeySched_cipher;
+	kasumi_key_sched_t pKeySched_hash;
 	enum kasumi_operation op;
 	enum rte_crypto_auth_operation auth_op;
 	uint16_t cipher_iv_offset;
@@ -67,7 +71,7 @@ struct kasumi_session {
 
 
 int
-kasumi_set_session_parameters(struct kasumi_session *sess,
+kasumi_set_session_parameters(MB_MGR *mgr, struct kasumi_session *sess,
 		const struct rte_crypto_sym_xform *xform);
 
 
drivers/crypto/kasumi/meson.build +16 -5
index 90a3c4f..7350f41 100644
@@ -1,11 +1,22 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2018 Intel Corporation
+# Copyright(c) 2018-2020 Intel Corporation
 
-lib = cc.find_library('sso_kasumi', required: false)
-if not lib.found() or not cc.has_header('sso_kasumi.h')
+IMB_required_ver = '0.53.0'
+lib = cc.find_library('IPSec_MB', required: false)
+if not lib.found()
 	build = false
-	reason = 'missing dependency, "libsso_kasumi"'
-	subdir_done()
+	reason = 'missing dependency, "libIPSec_MB"'
+else
+	# version comes with quotes, so we split based on " and take the middle
+	imb_ver = cc.get_define('IMB_VERSION_STR',
+		prefix : '#include<intel-ipsec-mb.h>').split('"')[1]
+
+	if (imb_ver == '') or (imb_ver.version_compare('<' + IMB_required_ver))
+		reason = 'IPSec_MB version >= @0@ is required, found version @1@'.format(
+				IMB_required_ver, imb_ver)
+		build = false
+	endif
+
 endif
 
 allow_experimental_apis = true
drivers/crypto/kasumi/rte_kasumi_pmd.c +45 -34

217 lines not on this page · raw message

drivers/crypto/kasumi/rte_kasumi_pmd_ops.c +6 -2
index 5ce4953..55fbe00 100644
@@ -195,6 +195,7 @@ kasumi_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		int socket_id)
 {
 	struct kasumi_qp *qp = NULL;
+	struct kasumi_private *internals = dev->data->dev_private;
 
 	/* Free memory prior to re-allocation if needed. */
 	if (dev->data->queue_pairs[qp_id] != NULL)
@@ -217,6 +218,7 @@ kasumi_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 	if (qp->processed_ops == NULL)
 		goto qp_setup_cleanup;
 
+	qp->mgr = internals->mgr;
 	qp->sess_mp = qp_conf->mp_session;
 	qp->sess_mp_priv = qp_conf->mp_session_private;
 
@@ -246,13 +248,14 @@ kasumi_pmd_sym_session_get_size(struct rte_cryptodev *dev __rte_unused)
 
 /** Configure a KASUMI session from a crypto xform chain */
 static int
-kasumi_pmd_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
+kasumi_pmd_sym_session_configure(struct rte_cryptodev *dev,
 		struct rte_crypto_sym_xform *xform,
 		struct rte_cryptodev_sym_session *sess,
 		struct rte_mempool *mempool)
 {
 	void *sess_private_data;
 	int ret;
+	struct kasumi_private *internals = dev->data->dev_private;
 
 	if (unlikely(sess == NULL)) {
 		KASUMI_LOG(ERR, "invalid session struct");
@@ -265,7 +268,8 @@ kasumi_pmd_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
 		return -ENOMEM;
 	}
 
-	ret = kasumi_set_session_parameters(sess_private_data, xform);
+	ret = kasumi_set_session_parameters(internals->mgr,
+					sess_private_data, xform);
 	if (ret != 0) {
 		KASUMI_LOG(ERR, "failed configure session parameters");
 
mk/rte.app.mk +1 -1
index 62724cc..a8163f1 100644
@@ -270,7 +270,7 @@ endif # CONFIG_RTE_LIBRTE_PMD_QAT
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G)      += -lrte_pmd_snow3g
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G)      += -L$(LIBSSO_SNOW3G_PATH)/build -lsso_snow3g
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_KASUMI)      += -lrte_pmd_kasumi
-_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_KASUMI)      += -L$(LIBSSO_KASUMI_PATH)/build -lsso_kasumi
+_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_KASUMI)      += -lIPSec_MB
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_ZUC)         += -lrte_pmd_zuc
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_ZUC)         += -lIPSec_MB
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_ARMV8_CRYPTO)    += -lrte_pmd_armv8
Signature · 1 line
2.7.5
#15 lore raw

PATCH v3 3/3 crypto/snow3g: use IPSec library

In reply to Pablo de Lara

Link against Intel IPSec Multi-buffer library, which added support for SNOW3G-UEA2 and SNOW3G-UIA2 from version v0.53, moving from libSSO SNOW3G library.

---
 devtools/test-build.sh                     |  4 +-
 doc/guides/cryptodevs/snow3g.rst           | 58 +++++++++++---------
 doc/guides/rel_notes/release_20_02.rst     |  5 ++
 drivers/crypto/snow3g/Makefile             | 29 ++++++----
 drivers/crypto/snow3g/meson.build          | 21 ++++++--
 drivers/crypto/snow3g/rte_snow3g_pmd.c     | 85 ++++++++++++++++++------------
 drivers/crypto/snow3g/rte_snow3g_pmd_ops.c |  8 ++-
 drivers/crypto/snow3g/snow3g_pmd_private.h | 14 +++--
 mk/rte.app.mk                              |  2 +-
 9 files changed, 140 insertions(+), 86 deletions(-)
devtools/test-build.sh +1 -3
index 56c744f..7bdd35e 100755
@@ -27,7 +27,6 @@ default_path=$PATH
 # - DPDK_NOTIFY (notify-send)
 # - FLEXRAN_SDK
 # - LIBMUSDK_PATH
-# - LIBSSO_SNOW3G_PATH
 . $(dirname $(readlink -f $0))/load-devel-config
 
 print_usage () {
@@ -119,7 +118,6 @@ reset_env ()
 	unset ARMV8_CRYPTO_LIB_PATH
 	unset FLEXRAN_SDK
 	unset LIBMUSDK_PATH
-	unset LIBSSO_SNOW3G_PATH
 	unset PQOS_INSTALL_PATH
 }
 
@@ -183,7 +181,7 @@ config () # <directory> <target> <options>
 		sed -ri=""            's,(PMD_ZUC=)n,\1y,' $1/.config
 		test "$DPDK_DEP_IPSEC_MB" != y || \
 		sed -ri=""         's,(PMD_KASUMI=)n,\1y,' $1/.config
-		test -z "$LIBSSO_SNOW3G_PATH" || \
+		test "$DPDK_DEP_IPSEC_MB" != y || \
 		sed -ri=""         's,(PMD_SNOW3G=)n,\1y,' $1/.config
 		test "$DPDK_DEP_SSL" != y || \
 		sed -ri=""            's,(PMD_CCP=)n,\1y,' $1/.config
doc/guides/cryptodevs/snow3g.rst +34 -24

84 lines not on this page · raw message

doc/guides/rel_notes/release_20_02.rst +5 -0
index a3f6154..2532b21 100644
@@ -68,6 +68,11 @@ New Features
   * Transistioned underlying library from libSSO KASUMI to intel-ipsec-mb
     library (minimum version required 0.53).
 
+* **Updated the SNOW3G PMD.**
+
+  * Transistioned underlying library from libSSO SNOW3G to intel-ipsec-mb
+    library (minimum version required 0.53).
+
 
 Removed Items
 -------------
drivers/crypto/snow3g/Makefile +18 -11
index 4086c57..438119c 100644
@@ -1,14 +1,8 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2016 Intel Corporation
+# Copyright(c) 2016-2019 Intel Corporation
 
 include $(RTE_SDK)/mk/rte.vars.mk
 
-ifneq ($(MAKECMDGOALS),clean)
-ifeq ($(LIBSSO_SNOW3G_PATH),)
-$(error "Please define LIBSSO_SNOW3G_PATH environment variable")
-endif
-endif
-
 # library name
 LIB = librte_pmd_snow3g.a
 
@@ -21,14 +15,27 @@ CFLAGS += -DALLOW_EXPERIMENTAL_API
 EXPORT_MAP := rte_pmd_snow3g_version.map
 
 # external library dependencies
-CFLAGS += -I$(LIBSSO_SNOW3G_PATH)
-CFLAGS += -I$(LIBSSO_SNOW3G_PATH)/include
-CFLAGS += -I$(LIBSSO_SNOW3G_PATH)/build
-LDLIBS += -L$(LIBSSO_SNOW3G_PATH)/build -lsso_snow3g
+LDLIBS += -lIPSec_MB
 LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
 LDLIBS += -lrte_cryptodev
 LDLIBS += -lrte_bus_vdev
 
+IMB_HDR = $(shell echo '\#include <intel-ipsec-mb.h>' | \
+	$(CC) -E $(EXTRA_CFLAGS) - | grep 'intel-ipsec-mb.h' | \
+	head -n1 | cut -d'"' -f2)
+
+# Detect library version
+IMB_VERSION = $(shell grep -e "IMB_VERSION_STR" $(IMB_HDR) | cut -d'"' -f2)
+IMB_VERSION_NUM = $(shell grep -e "IMB_VERSION_NUM" $(IMB_HDR) | cut -d' ' -f3)
+
+ifeq ($(IMB_VERSION),)
+$(error "IPSec_MB version >= 0.53 is required")
+endif
+
+ifeq ($(shell expr $(IMB_VERSION_NUM) \< 0x3400), 1)
+$(error "IPSec_MB version >= 0.53 is required")
+endif
+
 # library source files
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G) += rte_snow3g_pmd.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G) += rte_snow3g_pmd_ops.c
drivers/crypto/snow3g/meson.build +16 -5
index 0e8742a..9d93cbe 100644
@@ -1,11 +1,22 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2019 Intel Corporation
+# Copyright(c) 2019-2020 Intel Corporation
 
-lib = cc.find_library('sso_snow3g', required: false)
-if not lib.found() or not cc.has_header('sso_snow3g.h')
+IMB_required_ver = '0.53.0'
+lib = cc.find_library('IPSec_MB', required: false)
+if not lib.found()
 	build = false
-	reason = 'missing dependency, "libsso_snow3g"'
-	subdir_done()
+	reason = 'missing dependency, "libIPSec_MB"'
+else
+	# version comes with quotes, so we split based on " and take the middle
+	imb_ver = cc.get_define('IMB_VERSION_STR',
+		prefix : '#include<intel-ipsec-mb.h>').split('"')[1]
+
+	if (imb_ver == '') or (imb_ver.version_compare('<' + IMB_required_ver))
+                reason = 'IPSec_MB version >= @0@ is required, found version @1@'.format(
+				IMB_required_ver, imb_ver)
+		build = false
+	endif
+
 endif
 
 allow_experimental_apis = true
drivers/crypto/snow3g/rte_snow3g_pmd.c +50 -35

223 lines not on this page · raw message

drivers/crypto/snow3g/rte_snow3g_pmd_ops.c +6 -2
index 8778f28..ea76637 100644
@@ -201,6 +201,7 @@ snow3g_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		int socket_id)
 {
 	struct snow3g_qp *qp = NULL;
+	struct snow3g_private *internals = dev->data->dev_private;
 
 	/* Free memory prior to re-allocation if needed. */
 	if (dev->data->queue_pairs[qp_id] != NULL)
@@ -223,6 +224,7 @@ snow3g_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 	if (qp->processed_ops == NULL)
 		goto qp_setup_cleanup;
 
+	qp->mgr = internals->mgr;
 	qp->sess_mp = qp_conf->mp_session;
 	qp->sess_mp_priv = qp_conf->mp_session_private;
 
@@ -253,13 +255,14 @@ snow3g_pmd_sym_session_get_size(struct rte_cryptodev *dev __rte_unused)
 
 /** Configure a SNOW 3G session from a crypto xform chain */
 static int
-snow3g_pmd_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
+snow3g_pmd_sym_session_configure(struct rte_cryptodev *dev,
 		struct rte_crypto_sym_xform *xform,
 		struct rte_cryptodev_sym_session *sess,
 		struct rte_mempool *mempool)
 {
 	void *sess_private_data;
 	int ret;
+	struct snow3g_private *internals = dev->data->dev_private;
 
 	if (unlikely(sess == NULL)) {
 		SNOW3G_LOG(ERR, "invalid session struct");
@@ -272,7 +275,8 @@ snow3g_pmd_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
 		return -ENOMEM;
 	}
 
-	ret = snow3g_set_session_parameters(sess_private_data, xform);
+	ret = snow3g_set_session_parameters(internals->mgr,
+					sess_private_data, xform);
 	if (ret != 0) {
 		SNOW3G_LOG(ERR, "failed configure session parameters");
 
drivers/crypto/snow3g/snow3g_pmd_private.h +9 -5
index 1fe05eb..2074f3d 100644
@@ -1,11 +1,11 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2016-2018 Intel Corporation
+ * Copyright(c) 2016-2019 Intel Corporation
  */
 
 #ifndef _SNOW3G_PMD_PRIVATE_H_
 #define _SNOW3G_PMD_PRIVATE_H_
 
-#include <sso_snow3g.h>
+#include <intel-ipsec-mb.h>
 
 #define CRYPTODEV_NAME_SNOW3G_PMD	crypto_snow3g
 /**< SNOW 3G PMD device name */
@@ -25,6 +25,8 @@ int snow3g_logtype_driver;
 struct snow3g_private {
 	unsigned max_nb_queue_pairs;
 	/**< Max number of queue pairs supported by device */
+	MB_MGR *mgr;
+	/**< Multi-buffer instance */
 };
 
 /** SNOW 3G buffer queue pair */
@@ -46,6 +48,8 @@ struct snow3g_qp {
 	 * by the driver when verifying a digest provided
 	 * by the user (using authentication verify operation)
 	 */
+	MB_MGR *mgr;
+	/**< Multi-buffer instance */
 } __rte_cache_aligned;
 
 enum snow3g_operation {
@@ -60,15 +64,15 @@ enum snow3g_operation {
 struct snow3g_session {
 	enum snow3g_operation op;
 	enum rte_crypto_auth_operation auth_op;
-	sso_snow3g_key_schedule_t pKeySched_cipher;
-	sso_snow3g_key_schedule_t pKeySched_hash;
+	snow3g_key_schedule_t pKeySched_cipher;
+	snow3g_key_schedule_t pKeySched_hash;
 	uint16_t cipher_iv_offset;
 	uint16_t auth_iv_offset;
 } __rte_cache_aligned;
 
 
 extern int
-snow3g_set_session_parameters(struct snow3g_session *sess,
+snow3g_set_session_parameters(MB_MGR *mgr, struct snow3g_session *sess,
 		const struct rte_crypto_sym_xform *xform);
 
 
mk/rte.app.mk +1 -1
index a8163f1..8bf6b3d 100644
@@ -268,7 +268,7 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_QAT_SYM)     += -lrte_pmd_qat -lcrypto
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_QAT_ASYM)    += -lrte_pmd_qat -lcrypto
 endif # CONFIG_RTE_LIBRTE_PMD_QAT
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G)      += -lrte_pmd_snow3g
-_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G)      += -L$(LIBSSO_SNOW3G_PATH)/build -lsso_snow3g
+_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G)      += -lIPSec_MB
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_KASUMI)      += -lrte_pmd_kasumi
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_KASUMI)      += -lIPSec_MB
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_ZUC)         += -lrte_pmd_zuc
Signature · 1 line
2.7.5
#16 lore raw

v4 cover Use Intel IPSec MB library in Wireless PMDs

In reply to Pablo de Lara

The three Intel SW Crypto PMDs supporting SNOW3G, ZUC and KASUMI link against libSSO libraries. The Intel IPSec Multi-buffer library recently integrated the code from these libraries, in version v0.53. This library can be downloaded from https://github.com/intel/intel-ipsec-mb.

KASUMI, SNOW3G and ZUC PMDs have been modified to use this single library, which is already used in the AESNI MB and AESNI GCM PMDs, reducing the number of external dependencies in the crypto PMDs.

Changes in v4:
- Rebased against latest dpdk-next-crypto

Changes in v3:
- Fixed clang compilation
- Added reason field in meson config files

Changes in v2:
- Updated ZUC PMD to support future AVX512 and AVX2 implementations.

Pablo de Lara (3):
crypto/zuc: use IPSec library
crypto/kasumi: use IPSec library
crypto/snow3g: use IPSec library

 devtools/test-build.sh                     | 16 ++----
 doc/guides/cryptodevs/kasumi.rst           | 62 ++++++++++++----------
 doc/guides/cryptodevs/snow3g.rst           | 58 +++++++++++---------
 doc/guides/cryptodevs/zuc.rst              | 52 ++++++++++--------
 doc/guides/rel_notes/release_20_02.rst     | 17 ++++++
 drivers/crypto/kasumi/Makefile             | 26 +++++----
 drivers/crypto/kasumi/kasumi_pmd_private.h | 12 +++--
 drivers/crypto/kasumi/meson.build          | 21 ++++++--
 drivers/crypto/kasumi/rte_kasumi_pmd.c     | 79 +++++++++++++++------------
 drivers/crypto/kasumi/rte_kasumi_pmd_ops.c |  8 ++-
 drivers/crypto/snow3g/Makefile             | 29 ++++++----
 drivers/crypto/snow3g/meson.build          | 21 ++++++--
 drivers/crypto/snow3g/rte_snow3g_pmd.c     | 85 ++++++++++++++++++------------
 drivers/crypto/snow3g/rte_snow3g_pmd_ops.c |  8 ++-
 drivers/crypto/snow3g/snow3g_pmd_private.h | 14 +++--
 drivers/crypto/zuc/Makefile                | 28 ++++++----
 drivers/crypto/zuc/meson.build             | 21 ++++++--
 drivers/crypto/zuc/rte_zuc_pmd.c           | 58 ++++++++++++++------
 drivers/crypto/zuc/rte_zuc_pmd_ops.c       |  2 +
 drivers/crypto/zuc/zuc_pmd_private.h       |  6 ++-
 mk/rte.app.mk                              |  6 +--
 21 files changed, 394 insertions(+), 235 deletions(-)
Signature · 1 line
2.7.5
#17 lore raw

PATCH v4 1/3 crypto/zuc: use IPSec library

Link against Intel IPSec Multi-buffer library, which added support for ZUC-EEA3 and ZUC-EIA3 from version v0.53, moving from libSSO ZUC library.

---
 devtools/test-build.sh                 |  6 ++--
 doc/guides/cryptodevs/zuc.rst          | 52 ++++++++++++++++++------------
 doc/guides/rel_notes/release_20_02.rst |  7 ++++
 drivers/crypto/zuc/Makefile            | 28 +++++++++-------
 drivers/crypto/zuc/meson.build         | 21 +++++++++---
 drivers/crypto/zuc/rte_zuc_pmd.c       | 58 ++++++++++++++++++++++++----------
 drivers/crypto/zuc/rte_zuc_pmd_ops.c   |  2 ++
 drivers/crypto/zuc/zuc_pmd_private.h   |  6 +++-
 mk/rte.app.mk                          |  2 +-
 9 files changed, 122 insertions(+), 60 deletions(-)
devtools/test-build.sh +2 -4
index 52305fb..8135528 100755
@@ -29,7 +29,6 @@ default_path=$PATH
 # - LIBMUSDK_PATH
 # - LIBSSO_SNOW3G_PATH
 # - LIBSSO_KASUMI_PATH
-# - LIBSSO_ZUC_PATH
 . $(dirname $(readlink -f $0))/load-devel-config
 
 print_usage () {
@@ -123,7 +122,6 @@ reset_env ()
 	unset LIBMUSDK_PATH
 	unset LIBSSO_SNOW3G_PATH
 	unset LIBSSO_KASUMI_PATH
-	unset LIBSSO_ZUC_PATH
 	unset PQOS_INSTALL_PATH
 }
 
@@ -183,12 +181,12 @@ config () # <directory> <target> <options>
 		sed -ri=""       's,(PMD_AESNI_MB=)n,\1y,' $1/.config
 		test "$DPDK_DEP_IPSEC_MB" != y || \
 		sed -ri=""      's,(PMD_AESNI_GCM=)n,\1y,' $1/.config
+		test "$DPDK_DEP_IPSEC_MB" != y || \
+		sed -ri=""            's,(PMD_ZUC=)n,\1y,' $1/.config
 		test -z "$LIBSSO_SNOW3G_PATH" || \
 		sed -ri=""         's,(PMD_SNOW3G=)n,\1y,' $1/.config
 		test -z "$LIBSSO_KASUMI_PATH" || \
 		sed -ri=""         's,(PMD_KASUMI=)n,\1y,' $1/.config
-		test -z "$LIBSSO_ZUC_PATH" || \
-		sed -ri=""            's,(PMD_ZUC=)n,\1y,' $1/.config
 		test "$DPDK_DEP_SSL" != y || \
 		sed -ri=""            's,(PMD_CCP=)n,\1y,' $1/.config
 		test "$DPDK_DEP_SSL" != y || \
doc/guides/cryptodevs/zuc.rst +31 -21

79 lines not on this page · raw message

doc/guides/rel_notes/release_20_02.rst +7 -0
index a7a8288..ef4d968 100644
@@ -132,6 +132,13 @@ New Features
 
   Added Chacha20-Poly1305 AEAD algorithm.
 
+* **Updated the ZUC PMD.**
+
+  * Transistioned underlying library from libSSO ZUC to intel-ipsec-mb
+    library (minimum version required 0.53).
+  * Removed dynamic library limitation, so PMD can be built as a shared
+    object now.
+
 
 Removed Items
 -------------
drivers/crypto/zuc/Makefile +17 -11
index a01bb6e..b50883b 100644
@@ -1,14 +1,8 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2016 Intel Corporation
+# Copyright(c) 2016-2019 Intel Corporation
 
 include $(RTE_SDK)/mk/rte.vars.mk
 
-ifneq ($(MAKECMDGOALS),clean)
-ifeq ($(LIBSSO_ZUC_PATH),)
-$(error "Please define LIBSSO_ZUC_PATH environment variable")
-endif
-endif
-
 # library name
 LIB = librte_pmd_zuc.a
 
@@ -21,14 +15,26 @@ CFLAGS += -DALLOW_EXPERIMENTAL_API
 EXPORT_MAP := rte_pmd_zuc_version.map
 
 # external library dependencies
-CFLAGS += -I$(LIBSSO_ZUC_PATH)
-CFLAGS += -I$(LIBSSO_ZUC_PATH)/include
-CFLAGS += -I$(LIBSSO_ZUC_PATH)/build
-LDLIBS += -L$(LIBSSO_ZUC_PATH)/build -lsso_zuc
+LDLIBS += -lIPSec_MB
 LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
 LDLIBS += -lrte_cryptodev
 LDLIBS += -lrte_bus_vdev
 
+IMB_HDR = $(shell echo '\#include <intel-ipsec-mb.h>' | \
+	$(CC) -E $(EXTRA_CFLAGS) - | grep 'intel-ipsec-mb.h' | \
+	head -n1 | cut -d'"' -f2)
+
+# Detect library version
+IMB_VERSION = $(shell grep -e "IMB_VERSION_STR" $(IMB_HDR) | cut -d'"' -f2)
+IMB_VERSION_NUM = $(shell grep -e "IMB_VERSION_NUM" $(IMB_HDR) | cut -d' ' -f3)
+
+ifeq ($(IMB_VERSION),)
+$(error "IPSec_MB version >= 0.53 is required")
+endif
+
+ifeq ($(shell expr $(IMB_VERSION_NUM) \< 0x3400), 1)
+$(error "IPSec_MB version >= 0.53 is required")
+endif
 # library source files
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_ZUC) += rte_zuc_pmd.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_ZUC) += rte_zuc_pmd_ops.c
drivers/crypto/zuc/meson.build +16 -5
index b231de0..be3824c 100644
@@ -1,11 +1,22 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2018 Intel Corporation
+# Copyright(c) 2018-2020 Intel Corporation
 
-lib = cc.find_library('sso_zuc', required: false)
-if not lib.found() or not cc.has_header('sso_zuc.h')
+IMB_required_ver = '0.53.0'
+lib = cc.find_library('IPSec_MB', required: false)
+if not lib.found()
 	build = false
-	reason = 'missing dependency, "libsso_zuc"'
-	subdir_done()
+	reason = 'missing dependency, "libIPSec_MB"'
+else
+	# version comes with quotes, so we split based on " and take the middle
+	imb_ver = cc.get_define('IMB_VERSION_STR',
+		prefix : '#include<intel-ipsec-mb.h>').split('"')[1]
+
+	if (imb_ver == '') or (imb_ver.version_compare('<' + IMB_required_ver))
+		reason = 'IPSec_MB version >= @0@ is required, found version @1@'.format(
+				IMB_required_ver, imb_ver)
+		build = false
+	endif
+
 endif
 
 allow_experimental_apis = true
drivers/crypto/zuc/rte_zuc_pmd.c +41 -17

143 lines not on this page · raw message

drivers/crypto/zuc/rte_zuc_pmd_ops.c +2 -0
index 62f8c6c..ddd0f92 100644
@@ -201,6 +201,7 @@ zuc_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		int socket_id)
 {
 	struct zuc_qp *qp = NULL;
+	struct zuc_private *internals = dev->data->dev_private;
 
 	/* Free memory prior to re-allocation if needed. */
 	if (dev->data->queue_pairs[qp_id] != NULL)
@@ -223,6 +224,7 @@ zuc_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 	if (qp->processed_ops == NULL)
 		goto qp_setup_cleanup;
 
+	qp->mb_mgr = internals->mb_mgr;
 	qp->sess_mp = qp_conf->mp_session;
 	qp->sess_mp_priv = qp_conf->mp_session_private;
 
drivers/crypto/zuc/zuc_pmd_private.h +5 -1
index 428efd4..47a8b08 100644
@@ -5,7 +5,7 @@
 #ifndef _ZUC_PMD_PRIVATE_H_
 #define _ZUC_PMD_PRIVATE_H_
 
-#include <sso_zuc.h>
+#include <intel-ipsec-mb.h>
 
 #define CRYPTODEV_NAME_ZUC_PMD		crypto_zuc
 /**< KASUMI PMD device name */
@@ -24,6 +24,8 @@ int zuc_logtype_driver;
 struct zuc_private {
 	unsigned max_nb_queue_pairs;
 	/**< Max number of queue pairs supported by device */
+	MB_MGR *mb_mgr;
+	/**< Multi-buffer instance */
 };
 
 /** ZUC buffer queue pair */
@@ -45,6 +47,8 @@ struct zuc_qp {
 	 * by the driver when verifying a digest provided
 	 * by the user (using authentication verify operation)
 	 */
+	MB_MGR *mb_mgr;
+	/**< Multi-buffer instance */
 } __rte_cache_aligned;
 
 enum zuc_operation {
mk/rte.app.mk +1 -1
index 597d6f6..b1c1dbd 100644
@@ -276,7 +276,7 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G)      += -L$(LIBSSO_SNOW3G_PATH)/build -l
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_KASUMI)      += -lrte_pmd_kasumi
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_KASUMI)      += -L$(LIBSSO_KASUMI_PATH)/build -lsso_kasumi
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_ZUC)         += -lrte_pmd_zuc
-_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_ZUC)         += -L$(LIBSSO_ZUC_PATH)/build -lsso_zuc
+_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_ZUC)         += -lIPSec_MB
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_ARMV8_CRYPTO)    += -lrte_pmd_armv8
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_ARMV8_CRYPTO)    += -L$(ARMV8_CRYPTO_LIB_PATH) -larmv8_crypto
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_MVSAM_CRYPTO) += -L$(LIBMUSDK_PATH)/lib -lrte_pmd_mvsam_crypto -lmusdk
Signature · 1 line
2.7.5
#18 lore raw

PATCH v4 2/3 crypto/kasumi: use IPSec library

In reply to Pablo de Lara

Link against Intel IPSec Multi-buffer library, which added support for KASUMI-F8 and KASUMI-F9 from version v0.53, moving from libSSO KASUMI library.

---
 devtools/test-build.sh                     |  6 +--
 doc/guides/cryptodevs/kasumi.rst           | 62 ++++++++++++-----------
 doc/guides/rel_notes/release_20_02.rst     |  5 ++
 drivers/crypto/kasumi/Makefile             | 26 ++++++----
 drivers/crypto/kasumi/kasumi_pmd_private.h | 12 +++--
 drivers/crypto/kasumi/meson.build          | 21 ++++++--
 drivers/crypto/kasumi/rte_kasumi_pmd.c     | 79 +++++++++++++++++-------------
 drivers/crypto/kasumi/rte_kasumi_pmd_ops.c |  8 ++-
 mk/rte.app.mk                              |  2 +-
 9 files changed, 132 insertions(+), 89 deletions(-)
devtools/test-build.sh +2 -4
index 8135528..bfbc88b 100755
@@ -28,7 +28,6 @@ default_path=$PATH
 # - FLEXRAN_SDK
 # - LIBMUSDK_PATH
 # - LIBSSO_SNOW3G_PATH
-# - LIBSSO_KASUMI_PATH
 . $(dirname $(readlink -f $0))/load-devel-config
 
 print_usage () {
@@ -121,7 +120,6 @@ reset_env ()
 	unset FLEXRAN_SDK
 	unset LIBMUSDK_PATH
 	unset LIBSSO_SNOW3G_PATH
-	unset LIBSSO_KASUMI_PATH
 	unset PQOS_INSTALL_PATH
 }
 
@@ -183,10 +181,10 @@ config () # <directory> <target> <options>
 		sed -ri=""      's,(PMD_AESNI_GCM=)n,\1y,' $1/.config
 		test "$DPDK_DEP_IPSEC_MB" != y || \
 		sed -ri=""            's,(PMD_ZUC=)n,\1y,' $1/.config
+		test "$DPDK_DEP_IPSEC_MB" != y || \
+		sed -ri=""         's,(PMD_KASUMI=)n,\1y,' $1/.config
 		test -z "$LIBSSO_SNOW3G_PATH" || \
 		sed -ri=""         's,(PMD_SNOW3G=)n,\1y,' $1/.config
-		test -z "$LIBSSO_KASUMI_PATH" || \
-		sed -ri=""         's,(PMD_KASUMI=)n,\1y,' $1/.config
 		test "$DPDK_DEP_SSL" != y || \
 		sed -ri=""            's,(PMD_CCP=)n,\1y,' $1/.config
 		test "$DPDK_DEP_SSL" != y || \
doc/guides/cryptodevs/kasumi.rst +33 -29

90 lines not on this page · raw message

doc/guides/rel_notes/release_20_02.rst +5 -0
index ef4d968..9db5818 100644
@@ -139,6 +139,11 @@ New Features
   * Removed dynamic library limitation, so PMD can be built as a shared
     object now.
 
+* **Updated the KASUMI PMD.**
+
+  * Transistioned underlying library from libSSO KASUMI to intel-ipsec-mb
+    library (minimum version required 0.53).
+
 
 Removed Items
 -------------
drivers/crypto/kasumi/Makefile +16 -10
index 26f5137..c94d6bd 100644
@@ -3,12 +3,6 @@
 
 include $(RTE_SDK)/mk/rte.vars.mk
 
-ifneq ($(MAKECMDGOALS),clean)
-ifeq ($(LIBSSO_KASUMI_PATH),)
-$(error "Please define LIBSSO_KASUMI_PATH environment variable")
-endif
-endif
-
 # library name
 LIB = librte_pmd_kasumi.a
 
@@ -21,14 +15,26 @@ CFLAGS += -DALLOW_EXPERIMENTAL_API
 EXPORT_MAP := rte_pmd_kasumi_version.map
 
 # external library dependencies
-CFLAGS += -I$(LIBSSO_KASUMI_PATH)
-CFLAGS += -I$(LIBSSO_KASUMI_PATH)/include
-CFLAGS += -I$(LIBSSO_KASUMI_PATH)/build
-LDLIBS += -L$(LIBSSO_KASUMI_PATH)/build -lsso_kasumi
+LDLIBS += -lIPSec_MB
 LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
 LDLIBS += -lrte_cryptodev
 LDLIBS += -lrte_bus_vdev
 
+IMB_HDR = $(shell echo '\#include <intel-ipsec-mb.h>' | \
+	$(CC) -E $(EXTRA_CFLAGS) - | grep 'intel-ipsec-mb.h' | \
+	head -n1 | cut -d'"' -f2)
+
+# Detect library version
+IMB_VERSION = $(shell grep -e "IMB_VERSION_STR" $(IMB_HDR) | cut -d'"' -f2)
+IMB_VERSION_NUM = $(shell grep -e "IMB_VERSION_NUM" $(IMB_HDR) | cut -d' ' -f3)
+
+ifeq ($(IMB_VERSION),)
+$(error "IPSec_MB version >= 0.53 is required")
+endif
+
+ifeq ($(shell expr $(IMB_VERSION_NUM) \< 0x3400), 1)
+$(error "IPSec_MB version >= 0.53 is required")
+endif
 # library source files
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_KASUMI) += rte_kasumi_pmd.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_KASUMI) += rte_kasumi_pmd_ops.c
drivers/crypto/kasumi/kasumi_pmd_private.h +8 -4
index 7ac19c5..3b3a695 100644
@@ -5,7 +5,7 @@
 #ifndef _KASUMI_PMD_PRIVATE_H_
 #define _KASUMI_PMD_PRIVATE_H_
 
-#include <sso_kasumi.h>
+#include <intel-ipsec-mb.h>
 
 #define CRYPTODEV_NAME_KASUMI_PMD	crypto_kasumi
 /**< KASUMI PMD device name */
@@ -24,6 +24,8 @@ int kasumi_logtype_driver;
 struct kasumi_private {
 	unsigned max_nb_queue_pairs;
 	/**< Max number of queue pairs supported by device */
+	MB_MGR *mgr;
+	/**< Multi-buffer instance */
 };
 
 /** KASUMI buffer queue pair */
@@ -45,6 +47,8 @@ struct kasumi_qp {
 	 * by the driver when verifying a digest provided
 	 * by the user (using authentication verify operation)
 	 */
+	MB_MGR *mgr;
+	/**< Multi-buffer instance */
 } __rte_cache_aligned;
 
 enum kasumi_operation {
@@ -58,8 +62,8 @@ enum kasumi_operation {
 /** KASUMI private session structure */
 struct kasumi_session {
 	/* Keys have to be 16-byte aligned */
-	sso_kasumi_key_sched_t pKeySched_cipher;
-	sso_kasumi_key_sched_t pKeySched_hash;
+	kasumi_key_sched_t pKeySched_cipher;
+	kasumi_key_sched_t pKeySched_hash;
 	enum kasumi_operation op;
 	enum rte_crypto_auth_operation auth_op;
 	uint16_t cipher_iv_offset;
@@ -67,7 +71,7 @@ struct kasumi_session {
 
 
 int
-kasumi_set_session_parameters(struct kasumi_session *sess,
+kasumi_set_session_parameters(MB_MGR *mgr, struct kasumi_session *sess,
 		const struct rte_crypto_sym_xform *xform);
 
 
drivers/crypto/kasumi/meson.build +16 -5
index 90a3c4f..7350f41 100644
@@ -1,11 +1,22 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2018 Intel Corporation
+# Copyright(c) 2018-2020 Intel Corporation
 
-lib = cc.find_library('sso_kasumi', required: false)
-if not lib.found() or not cc.has_header('sso_kasumi.h')
+IMB_required_ver = '0.53.0'
+lib = cc.find_library('IPSec_MB', required: false)
+if not lib.found()
 	build = false
-	reason = 'missing dependency, "libsso_kasumi"'
-	subdir_done()
+	reason = 'missing dependency, "libIPSec_MB"'
+else
+	# version comes with quotes, so we split based on " and take the middle
+	imb_ver = cc.get_define('IMB_VERSION_STR',
+		prefix : '#include<intel-ipsec-mb.h>').split('"')[1]
+
+	if (imb_ver == '') or (imb_ver.version_compare('<' + IMB_required_ver))
+		reason = 'IPSec_MB version >= @0@ is required, found version @1@'.format(
+				IMB_required_ver, imb_ver)
+		build = false
+	endif
+
 endif
 
 allow_experimental_apis = true
drivers/crypto/kasumi/rte_kasumi_pmd.c +45 -34

217 lines not on this page · raw message

drivers/crypto/kasumi/rte_kasumi_pmd_ops.c +6 -2
index 5ce4953..55fbe00 100644
@@ -195,6 +195,7 @@ kasumi_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		int socket_id)
 {
 	struct kasumi_qp *qp = NULL;
+	struct kasumi_private *internals = dev->data->dev_private;
 
 	/* Free memory prior to re-allocation if needed. */
 	if (dev->data->queue_pairs[qp_id] != NULL)
@@ -217,6 +218,7 @@ kasumi_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 	if (qp->processed_ops == NULL)
 		goto qp_setup_cleanup;
 
+	qp->mgr = internals->mgr;
 	qp->sess_mp = qp_conf->mp_session;
 	qp->sess_mp_priv = qp_conf->mp_session_private;
 
@@ -246,13 +248,14 @@ kasumi_pmd_sym_session_get_size(struct rte_cryptodev *dev __rte_unused)
 
 /** Configure a KASUMI session from a crypto xform chain */
 static int
-kasumi_pmd_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
+kasumi_pmd_sym_session_configure(struct rte_cryptodev *dev,
 		struct rte_crypto_sym_xform *xform,
 		struct rte_cryptodev_sym_session *sess,
 		struct rte_mempool *mempool)
 {
 	void *sess_private_data;
 	int ret;
+	struct kasumi_private *internals = dev->data->dev_private;
 
 	if (unlikely(sess == NULL)) {
 		KASUMI_LOG(ERR, "invalid session struct");
@@ -265,7 +268,8 @@ kasumi_pmd_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
 		return -ENOMEM;
 	}
 
-	ret = kasumi_set_session_parameters(sess_private_data, xform);
+	ret = kasumi_set_session_parameters(internals->mgr,
+					sess_private_data, xform);
 	if (ret != 0) {
 		KASUMI_LOG(ERR, "failed configure session parameters");
 
mk/rte.app.mk +1 -1
index b1c1dbd..494d26d 100644
@@ -274,7 +274,7 @@ endif # CONFIG_RTE_LIBRTE_PMD_QAT
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G)      += -lrte_pmd_snow3g
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G)      += -L$(LIBSSO_SNOW3G_PATH)/build -lsso_snow3g
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_KASUMI)      += -lrte_pmd_kasumi
-_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_KASUMI)      += -L$(LIBSSO_KASUMI_PATH)/build -lsso_kasumi
+_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_KASUMI)      += -lIPSec_MB
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_ZUC)         += -lrte_pmd_zuc
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_ZUC)         += -lIPSec_MB
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_ARMV8_CRYPTO)    += -lrte_pmd_armv8
Signature · 1 line
2.7.5
#19 lore raw

PATCH v4 3/3 crypto/snow3g: use IPSec library

In reply to Pablo de Lara

Link against Intel IPSec Multi-buffer library, which added support for SNOW3G-UEA2 and SNOW3G-UIA2 from version v0.53, moving from libSSO SNOW3G library.

---
 devtools/test-build.sh                     |  4 +-
 doc/guides/cryptodevs/snow3g.rst           | 58 +++++++++++---------
 doc/guides/rel_notes/release_20_02.rst     |  5 ++
 drivers/crypto/snow3g/Makefile             | 29 ++++++----
 drivers/crypto/snow3g/meson.build          | 21 ++++++--
 drivers/crypto/snow3g/rte_snow3g_pmd.c     | 85 ++++++++++++++++++------------
 drivers/crypto/snow3g/rte_snow3g_pmd_ops.c |  8 ++-
 drivers/crypto/snow3g/snow3g_pmd_private.h | 14 +++--
 mk/rte.app.mk                              |  2 +-
 9 files changed, 140 insertions(+), 86 deletions(-)
devtools/test-build.sh +1 -3
index bfbc88b..dd72dd6 100755
@@ -27,7 +27,6 @@ default_path=$PATH
 # - DPDK_NOTIFY (notify-send)
 # - FLEXRAN_SDK
 # - LIBMUSDK_PATH
-# - LIBSSO_SNOW3G_PATH
 . $(dirname $(readlink -f $0))/load-devel-config
 
 print_usage () {
@@ -119,7 +118,6 @@ reset_env ()
 	unset ARMV8_CRYPTO_LIB_PATH
 	unset FLEXRAN_SDK
 	unset LIBMUSDK_PATH
-	unset LIBSSO_SNOW3G_PATH
 	unset PQOS_INSTALL_PATH
 }
 
@@ -183,7 +181,7 @@ config () # <directory> <target> <options>
 		sed -ri=""            's,(PMD_ZUC=)n,\1y,' $1/.config
 		test "$DPDK_DEP_IPSEC_MB" != y || \
 		sed -ri=""         's,(PMD_KASUMI=)n,\1y,' $1/.config
-		test -z "$LIBSSO_SNOW3G_PATH" || \
+		test "$DPDK_DEP_IPSEC_MB" != y || \
 		sed -ri=""         's,(PMD_SNOW3G=)n,\1y,' $1/.config
 		test "$DPDK_DEP_SSL" != y || \
 		sed -ri=""            's,(PMD_CCP=)n,\1y,' $1/.config
doc/guides/cryptodevs/snow3g.rst +34 -24

84 lines not on this page · raw message

doc/guides/rel_notes/release_20_02.rst +5 -0
index 9db5818..b9d024d 100644
@@ -144,6 +144,11 @@ New Features
   * Transistioned underlying library from libSSO KASUMI to intel-ipsec-mb
     library (minimum version required 0.53).
 
+* **Updated the SNOW3G PMD.**
+
+  * Transistioned underlying library from libSSO SNOW3G to intel-ipsec-mb
+    library (minimum version required 0.53).
+
 
 Removed Items
 -------------
drivers/crypto/snow3g/Makefile +18 -11
index 4086c57..438119c 100644
@@ -1,14 +1,8 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2016 Intel Corporation
+# Copyright(c) 2016-2019 Intel Corporation
 
 include $(RTE_SDK)/mk/rte.vars.mk
 
-ifneq ($(MAKECMDGOALS),clean)
-ifeq ($(LIBSSO_SNOW3G_PATH),)
-$(error "Please define LIBSSO_SNOW3G_PATH environment variable")
-endif
-endif
-
 # library name
 LIB = librte_pmd_snow3g.a
 
@@ -21,14 +15,27 @@ CFLAGS += -DALLOW_EXPERIMENTAL_API
 EXPORT_MAP := rte_pmd_snow3g_version.map
 
 # external library dependencies
-CFLAGS += -I$(LIBSSO_SNOW3G_PATH)
-CFLAGS += -I$(LIBSSO_SNOW3G_PATH)/include
-CFLAGS += -I$(LIBSSO_SNOW3G_PATH)/build
-LDLIBS += -L$(LIBSSO_SNOW3G_PATH)/build -lsso_snow3g
+LDLIBS += -lIPSec_MB
 LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
 LDLIBS += -lrte_cryptodev
 LDLIBS += -lrte_bus_vdev
 
+IMB_HDR = $(shell echo '\#include <intel-ipsec-mb.h>' | \
+	$(CC) -E $(EXTRA_CFLAGS) - | grep 'intel-ipsec-mb.h' | \
+	head -n1 | cut -d'"' -f2)
+
+# Detect library version
+IMB_VERSION = $(shell grep -e "IMB_VERSION_STR" $(IMB_HDR) | cut -d'"' -f2)
+IMB_VERSION_NUM = $(shell grep -e "IMB_VERSION_NUM" $(IMB_HDR) | cut -d' ' -f3)
+
+ifeq ($(IMB_VERSION),)
+$(error "IPSec_MB version >= 0.53 is required")
+endif
+
+ifeq ($(shell expr $(IMB_VERSION_NUM) \< 0x3400), 1)
+$(error "IPSec_MB version >= 0.53 is required")
+endif
+
 # library source files
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G) += rte_snow3g_pmd.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G) += rte_snow3g_pmd_ops.c
drivers/crypto/snow3g/meson.build +16 -5
index 0e8742a..9d93cbe 100644
@@ -1,11 +1,22 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2019 Intel Corporation
+# Copyright(c) 2019-2020 Intel Corporation
 
-lib = cc.find_library('sso_snow3g', required: false)
-if not lib.found() or not cc.has_header('sso_snow3g.h')
+IMB_required_ver = '0.53.0'
+lib = cc.find_library('IPSec_MB', required: false)
+if not lib.found()
 	build = false
-	reason = 'missing dependency, "libsso_snow3g"'
-	subdir_done()
+	reason = 'missing dependency, "libIPSec_MB"'
+else
+	# version comes with quotes, so we split based on " and take the middle
+	imb_ver = cc.get_define('IMB_VERSION_STR',
+		prefix : '#include<intel-ipsec-mb.h>').split('"')[1]
+
+	if (imb_ver == '') or (imb_ver.version_compare('<' + IMB_required_ver))
+                reason = 'IPSec_MB version >= @0@ is required, found version @1@'.format(
+				IMB_required_ver, imb_ver)
+		build = false
+	endif
+
 endif
 
 allow_experimental_apis = true
drivers/crypto/snow3g/rte_snow3g_pmd.c +50 -35

223 lines not on this page · raw message

drivers/crypto/snow3g/rte_snow3g_pmd_ops.c +6 -2
index 8778f28..ea76637 100644
@@ -201,6 +201,7 @@ snow3g_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		int socket_id)
 {
 	struct snow3g_qp *qp = NULL;
+	struct snow3g_private *internals = dev->data->dev_private;
 
 	/* Free memory prior to re-allocation if needed. */
 	if (dev->data->queue_pairs[qp_id] != NULL)
@@ -223,6 +224,7 @@ snow3g_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 	if (qp->processed_ops == NULL)
 		goto qp_setup_cleanup;
 
+	qp->mgr = internals->mgr;
 	qp->sess_mp = qp_conf->mp_session;
 	qp->sess_mp_priv = qp_conf->mp_session_private;
 
@@ -253,13 +255,14 @@ snow3g_pmd_sym_session_get_size(struct rte_cryptodev *dev __rte_unused)
 
 /** Configure a SNOW 3G session from a crypto xform chain */
 static int
-snow3g_pmd_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
+snow3g_pmd_sym_session_configure(struct rte_cryptodev *dev,
 		struct rte_crypto_sym_xform *xform,
 		struct rte_cryptodev_sym_session *sess,
 		struct rte_mempool *mempool)
 {
 	void *sess_private_data;
 	int ret;
+	struct snow3g_private *internals = dev->data->dev_private;
 
 	if (unlikely(sess == NULL)) {
 		SNOW3G_LOG(ERR, "invalid session struct");
@@ -272,7 +275,8 @@ snow3g_pmd_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
 		return -ENOMEM;
 	}
 
-	ret = snow3g_set_session_parameters(sess_private_data, xform);
+	ret = snow3g_set_session_parameters(internals->mgr,
+					sess_private_data, xform);
 	if (ret != 0) {
 		SNOW3G_LOG(ERR, "failed configure session parameters");
 
drivers/crypto/snow3g/snow3g_pmd_private.h +9 -5
index 1fe05eb..2074f3d 100644
@@ -1,11 +1,11 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2016-2018 Intel Corporation
+ * Copyright(c) 2016-2019 Intel Corporation
  */
 
 #ifndef _SNOW3G_PMD_PRIVATE_H_
 #define _SNOW3G_PMD_PRIVATE_H_
 
-#include <sso_snow3g.h>
+#include <intel-ipsec-mb.h>
 
 #define CRYPTODEV_NAME_SNOW3G_PMD	crypto_snow3g
 /**< SNOW 3G PMD device name */
@@ -25,6 +25,8 @@ int snow3g_logtype_driver;
 struct snow3g_private {
 	unsigned max_nb_queue_pairs;
 	/**< Max number of queue pairs supported by device */
+	MB_MGR *mgr;
+	/**< Multi-buffer instance */
 };
 
 /** SNOW 3G buffer queue pair */
@@ -46,6 +48,8 @@ struct snow3g_qp {
 	 * by the driver when verifying a digest provided
 	 * by the user (using authentication verify operation)
 	 */
+	MB_MGR *mgr;
+	/**< Multi-buffer instance */
 } __rte_cache_aligned;
 
 enum snow3g_operation {
@@ -60,15 +64,15 @@ enum snow3g_operation {
 struct snow3g_session {
 	enum snow3g_operation op;
 	enum rte_crypto_auth_operation auth_op;
-	sso_snow3g_key_schedule_t pKeySched_cipher;
-	sso_snow3g_key_schedule_t pKeySched_hash;
+	snow3g_key_schedule_t pKeySched_cipher;
+	snow3g_key_schedule_t pKeySched_hash;
 	uint16_t cipher_iv_offset;
 	uint16_t auth_iv_offset;
 } __rte_cache_aligned;
 
 
 extern int
-snow3g_set_session_parameters(struct snow3g_session *sess,
+snow3g_set_session_parameters(MB_MGR *mgr, struct snow3g_session *sess,
 		const struct rte_crypto_sym_xform *xform);
 
 
mk/rte.app.mk +1 -1
index 494d26d..20c17b1 100644
@@ -272,7 +272,7 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_QAT_SYM)     += -lrte_pmd_qat -lcrypto
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_QAT_ASYM)    += -lrte_pmd_qat -lcrypto
 endif # CONFIG_RTE_LIBRTE_PMD_QAT
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G)      += -lrte_pmd_snow3g
-_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G)      += -L$(LIBSSO_SNOW3G_PATH)/build -lsso_snow3g
+_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G)      += -lIPSec_MB
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_KASUMI)      += -lrte_pmd_kasumi
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_KASUMI)      += -lIPSec_MB
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_ZUC)         += -lrte_pmd_zuc
Signature · 1 line
2.7.5
Acked-by on the v4 series Applied
#20 lore raw
In reply to Pablo de Lara
Quoted 12 lines

The three Intel SW Crypto PMDs supporting SNOW3G, ZUC and KASUMI link against libSSO libraries.
The Intel IPSec Multi-buffer library recently integrated the code from these libraries, in version v0.53.
This library can be downloaded from
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.co
m%2Fintel%2Fintel-ipsec- mb&amp;data=02%7C01%7Cakhil.goyal%40nxp.com%7C5ffd94496dc54ff2320a 08d79d9e9c28%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C637151 176851109882&amp;sdata=FtTqorVaqtV89FBjDasUeK5lq%2B0Z8jj42iGzoIyVOG w%3D&amp;reserved=0.

Quoted 7 lines

KASUMI, SNOW3G and ZUC PMDs have been modified to use this single library, which is already used in the AESNI MB and AESNI GCM PMDs, reducing the number of external dependencies in the crypto PMDs.

Changes in v4:
- Rebased against latest dpdk-next-crypto

Series

Applied to dpdk-next-crypto

Thanks.