From patchwork Wed Dec 11 14:20:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "De Lara Guarch, Pablo" X-Patchwork-Id: 63758 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id F17FCA04F6; Wed, 11 Dec 2019 15:21:23 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 3460B1BF6D; Wed, 11 Dec 2019 15:21:08 +0100 (CET) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 4873E1BF6D for ; Wed, 11 Dec 2019 15:21:06 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Dec 2019 06:21:05 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,301,1571727600"; d="scan'208";a="363625705" Received: from silpixa00399593.ir.intel.com (HELO silpixa00399593.ger.corp.intel.com) ([10.237.223.21]) by orsmga004.jf.intel.com with ESMTP; 11 Dec 2019 06:21:03 -0800 From: Pablo de Lara To: akhil.goyal@nxp.com, declan.doherty@intel.com Cc: dev@dpdk.org, Pablo de Lara Date: Wed, 11 Dec 2019 14:20:44 +0000 Message-Id: <1576074044-250855-4-git-send-email-pablo.de.lara.guarch@intel.com> X-Mailer: git-send-email 2.7.5 In-Reply-To: <1576074044-250855-1-git-send-email-pablo.de.lara.guarch@intel.com> References: <1576074044-250855-1-git-send-email-pablo.de.lara.guarch@intel.com> Subject: [dpdk-dev] [PATCH 3/3] crypto/snow3g: use IPSec library X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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. Signed-off-by: Pablo de Lara --- 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(-) diff --git a/devtools/test-build.sh b/devtools/test-build.sh index 56c744f..7bdd35e 100755 --- a/devtools/test-build.sh +++ b/devtools/test-build.sh @@ -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 () # 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 diff --git a/doc/guides/cryptodevs/snow3g.rst b/doc/guides/cryptodevs/snow3g.rst index 7cba712..d45bcad 100644 --- a/doc/guides/cryptodevs/snow3g.rst +++ b/doc/guides/cryptodevs/snow3g.rst @@ -1,12 +1,12 @@ .. SPDX-License-Identifier: BSD-3-Clause - Copyright(c) 2016 Intel Corporation. + Copyright(c) 2016-2019 Intel Corporation. SNOW 3G Crypto Poll Mode Driver =============================== -The SNOW 3G PMD (**librte_pmd_snow3g**) provides poll mode crypto driver -support for utilizing Intel Libsso library, which implements F8 and F9 functions -for SNOW 3G UEA2 cipher and UIA2 hash algorithms. +The SNOW3G PMD (**librte_snow3g_zuc**) provides poll mode crypto driver support for +utilizing `Intel IPSec Multi-buffer library `_ +which implements F8 and F8 functions for SNOW 3G UEA2 cipher and UIA2 hash algorithms. Features -------- @@ -32,26 +32,33 @@ Limitations Installation ------------ -To build DPDK with the SNOW3G_PMD the user is required to download -the export controlled ``libsso_snow3g`` library, by registering in -`Intel Resource & Design Center `_. -Once approval has been granted, the user needs to search for -*Snow3G F8 F9 3GPP cryptographic algorithms Software Library* to download the -library or directly through this `link `_. +To build DPDK with the SNOW3G_PMD the user is required to download the multi-buffer +library from `here `_ +and compile it on their user system before building DPDK. +The latest version of the library supported by this PMD is v0.53, which +can be downloaded from ``_. + After downloading the library, the user needs to unpack and compile it -on their system before building DPDK:: +on their system before building DPDK: + +.. code-block:: console + + make + make install - make snow3G +As a reference, the following table shows a mapping between the past DPDK versions +and the external crypto libraries supported by them: -**Note**: When encrypting with SNOW3G UEA2, by default the library -encrypts blocks of 4 bytes, regardless the number of bytes to -be encrypted provided (which leads to a possible buffer overflow). -To avoid this situation, it is necessary not to pass -3GPP_SAFE_BUFFERS as a compilation flag. -For this, in the Makefile of the library, make sure that this flag -is commented out.:: +.. _table_zuc_versions: - #EXTRA_CFLAGS += -D_3GPP_SAFE_BUFFERS +.. table:: DPDK and external crypto library version compatibility + + ============= ================================ + DPDK version Crypto library version + ============= ================================ + 16.04 - 19.11 LibSSO SNOW3G + 20.02+ Multi-buffer library 0.53 + ============= ================================ Initialization @@ -59,12 +66,15 @@ Initialization In order to enable this virtual crypto PMD, user must: -* Export the environmental variable LIBSSO_SNOW3G_PATH with the path where - the library was extracted (snow3g folder). +* Build the multi buffer library (explained in Installation section). + +* Build DPDK as follows: -* Build the LIBSSO_SNOW3G library (explained in Installation section). +.. code-block:: console -* Set CONFIG_RTE_LIBRTE_PMD_SNOW3G=y in config/common_base. + make config T=x86_64-native-linux-gcc + sed -i 's,\(CONFIG_RTE_LIBRTE_PMD_SNOW3G\)=n,\1=y,' build/.config + make To use the PMD in an application, user must: diff --git a/doc/guides/rel_notes/release_20_02.rst b/doc/guides/rel_notes/release_20_02.rst index a3f6154..2532b21 100644 --- a/doc/guides/rel_notes/release_20_02.rst +++ b/doc/guides/rel_notes/release_20_02.rst @@ -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 ------------- diff --git a/drivers/crypto/snow3g/Makefile b/drivers/crypto/snow3g/Makefile index 4086c57..438119c 100644 --- a/drivers/crypto/snow3g/Makefile +++ b/drivers/crypto/snow3g/Makefile @@ -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 ' | \ + $(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 diff --git a/drivers/crypto/snow3g/meson.build b/drivers/crypto/snow3g/meson.build index 0e8742a..e9497bd 100644 --- a/drivers/crypto/snow3g/meson.build +++ b/drivers/crypto/snow3g/meson.build @@ -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').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 diff --git a/drivers/crypto/snow3g/rte_snow3g_pmd.c b/drivers/crypto/snow3g/rte_snow3g_pmd.c index 9d07e1a..d72112b 100644 --- a/drivers/crypto/snow3g/rte_snow3g_pmd.c +++ b/drivers/crypto/snow3g/rte_snow3g_pmd.c @@ -53,7 +53,7 @@ snow3g_get_mode(const struct rte_crypto_sym_xform *xform) /** Parse crypto xform chain and set private session parameters. */ 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) { const struct rte_crypto_sym_xform *auth_xform = NULL; @@ -84,8 +84,6 @@ snow3g_set_session_parameters(struct snow3g_session *sess, } if (cipher_xform) { - uint8_t cipher_key[SNOW3G_MAX_KEY_SIZE]; - /* Only SNOW 3G UEA2 supported */ if (cipher_xform->cipher.algo != RTE_CRYPTO_CIPHER_SNOW3G_UEA2) return -ENOTSUP; @@ -102,14 +100,11 @@ snow3g_set_session_parameters(struct snow3g_session *sess, sess->cipher_iv_offset = cipher_xform->cipher.iv.offset; /* Initialize key */ - memcpy(cipher_key, cipher_xform->cipher.key.data, - cipher_xform->cipher.key.length); - sso_snow3g_init_key_sched(cipher_key, &sess->pKeySched_cipher); + IMB_SNOW3G_INIT_KEY_SCHED(mgr, cipher_xform->cipher.key.data, + &sess->pKeySched_cipher); } if (auth_xform) { - uint8_t auth_key[SNOW3G_MAX_KEY_SIZE]; - /* Only SNOW 3G UIA2 supported */ if (auth_xform->auth.algo != RTE_CRYPTO_AUTH_SNOW3G_UIA2) return -ENOTSUP; @@ -132,12 +127,10 @@ snow3g_set_session_parameters(struct snow3g_session *sess, sess->auth_iv_offset = auth_xform->auth.iv.offset; /* Initialize key */ - memcpy(auth_key, auth_xform->auth.key.data, - auth_xform->auth.key.length); - sso_snow3g_init_key_sched(auth_key, &sess->pKeySched_hash); + IMB_SNOW3G_INIT_KEY_SCHED(mgr, auth_xform->auth.key.data, + &sess->pKeySched_hash); } - sess->op = mode; return 0; @@ -168,7 +161,7 @@ snow3g_get_session(struct snow3g_qp *qp, struct rte_crypto_op *op) sess = (struct snow3g_session *)_sess_private_data; - if (unlikely(snow3g_set_session_parameters(sess, + if (unlikely(snow3g_set_session_parameters(qp->mgr, sess, op->sym->xform) != 0)) { rte_mempool_put(qp->sess_mp, _sess); rte_mempool_put(qp->sess_mp_priv, _sess_private_data); @@ -188,14 +181,15 @@ snow3g_get_session(struct snow3g_qp *qp, struct rte_crypto_op *op) /** Encrypt/decrypt mbufs with same cipher key. */ static uint8_t -process_snow3g_cipher_op(struct rte_crypto_op **ops, +process_snow3g_cipher_op(struct snow3g_qp *qp, struct rte_crypto_op **ops, struct snow3g_session *session, uint8_t num_ops) { unsigned i; uint8_t processed_ops = 0; - uint8_t *src[SNOW3G_MAX_BURST], *dst[SNOW3G_MAX_BURST]; - uint8_t *iv[SNOW3G_MAX_BURST]; + const void *src[SNOW3G_MAX_BURST]; + void *dst[SNOW3G_MAX_BURST]; + const void *iv[SNOW3G_MAX_BURST]; uint32_t num_bytes[SNOW3G_MAX_BURST]; for (i = 0; i < num_ops; i++) { @@ -213,15 +207,16 @@ process_snow3g_cipher_op(struct rte_crypto_op **ops, processed_ops++; } - sso_snow3g_f8_n_buffer(&session->pKeySched_cipher, iv, src, dst, - num_bytes, processed_ops); + IMB_SNOW3G_F8_N_BUFFER(qp->mgr, &session->pKeySched_cipher, iv, + src, dst, num_bytes, processed_ops); return processed_ops; } /** Encrypt/decrypt mbuf (bit level function). */ static uint8_t -process_snow3g_cipher_op_bit(struct rte_crypto_op *op, +process_snow3g_cipher_op_bit(struct snow3g_qp *qp, + struct rte_crypto_op *op, struct snow3g_session *session) { uint8_t *src, *dst; @@ -240,7 +235,7 @@ process_snow3g_cipher_op_bit(struct rte_crypto_op *op, session->cipher_iv_offset); length_in_bits = op->sym->cipher.data.length; - sso_snow3g_f8_1_buffer_bit(&session->pKeySched_cipher, iv, + IMB_SNOW3G_F8_1_BUFFER_BIT(qp->mgr, &session->pKeySched_cipher, iv, src, dst, length_in_bits, offset_in_bits); return 1; @@ -276,9 +271,9 @@ process_snow3g_hash_op(struct snow3g_qp *qp, struct rte_crypto_op **ops, if (session->auth_op == RTE_CRYPTO_AUTH_OP_VERIFY) { dst = qp->temp_digest; - sso_snow3g_f9_1_buffer(&session->pKeySched_hash, - iv, src, - length_in_bits, dst); + IMB_SNOW3G_F9_1_BUFFER(qp->mgr, + &session->pKeySched_hash, + iv, src, length_in_bits, dst); /* Verify digest. */ if (memcmp(dst, ops[i]->sym->auth.digest.data, SNOW3G_DIGEST_LENGTH) != 0) @@ -286,9 +281,9 @@ process_snow3g_hash_op(struct snow3g_qp *qp, struct rte_crypto_op **ops, } else { dst = ops[i]->sym->auth.digest.data; - sso_snow3g_f9_1_buffer(&session->pKeySched_hash, - iv, src, - length_in_bits, dst); + IMB_SNOW3G_F9_1_BUFFER(qp->mgr, + &session->pKeySched_hash, + iv, src, length_in_bits, dst); } processed_ops++; } @@ -322,7 +317,7 @@ process_ops(struct rte_crypto_op **ops, struct snow3g_session *session, switch (session->op) { case SNOW3G_OP_ONLY_CIPHER: - processed_ops = process_snow3g_cipher_op(ops, + processed_ops = process_snow3g_cipher_op(qp, ops, session, num_ops); break; case SNOW3G_OP_ONLY_AUTH: @@ -330,14 +325,14 @@ process_ops(struct rte_crypto_op **ops, struct snow3g_session *session, num_ops); break; case SNOW3G_OP_CIPHER_AUTH: - processed_ops = process_snow3g_cipher_op(ops, session, + processed_ops = process_snow3g_cipher_op(qp, ops, session, num_ops); process_snow3g_hash_op(qp, ops, session, processed_ops); break; case SNOW3G_OP_AUTH_CIPHER: processed_ops = process_snow3g_hash_op(qp, ops, session, num_ops); - process_snow3g_cipher_op(ops, session, processed_ops); + process_snow3g_cipher_op(qp, ops, session, processed_ops); break; default: /* Operation not supported. */ @@ -380,21 +375,21 @@ process_op_bit(struct rte_crypto_op *op, struct snow3g_session *session, switch (session->op) { case SNOW3G_OP_ONLY_CIPHER: - processed_op = process_snow3g_cipher_op_bit(op, + processed_op = process_snow3g_cipher_op_bit(qp, op, session); break; case SNOW3G_OP_ONLY_AUTH: processed_op = process_snow3g_hash_op(qp, &op, session, 1); break; case SNOW3G_OP_CIPHER_AUTH: - processed_op = process_snow3g_cipher_op_bit(op, session); + processed_op = process_snow3g_cipher_op_bit(qp, op, session); if (processed_op == 1) process_snow3g_hash_op(qp, &op, session, 1); break; case SNOW3G_OP_AUTH_CIPHER: processed_op = process_snow3g_hash_op(qp, &op, session, 1); if (processed_op == 1) - process_snow3g_cipher_op_bit(op, session); + process_snow3g_cipher_op_bit(qp, op, session); break; default: /* Operation not supported. */ @@ -550,7 +545,7 @@ cryptodev_snow3g_create(const char *name, { struct rte_cryptodev *dev; struct snow3g_private *internals; - uint64_t cpu_flags = RTE_CRYPTODEV_FF_CPU_SSE; + MB_MGR *mgr; dev = rte_cryptodev_pmd_create(name, &vdev->device, init_params); if (dev == NULL) { @@ -566,10 +561,25 @@ cryptodev_snow3g_create(const char *name, dev->enqueue_burst = snow3g_pmd_enqueue_burst; dev->feature_flags = RTE_CRYPTODEV_FF_SYMMETRIC_CRYPTO | - RTE_CRYPTODEV_FF_SYM_OPERATION_CHAINING | - cpu_flags; + RTE_CRYPTODEV_FF_SYM_OPERATION_CHAINING; + + mgr = alloc_mb_mgr(0); + if (mgr == NULL) + return -ENOMEM; + + if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX2)) { + dev->feature_flags |= RTE_CRYPTODEV_FF_CPU_AVX2; + init_mb_mgr_avx2(mgr); + } else if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX)) { + dev->feature_flags |= RTE_CRYPTODEV_FF_CPU_AVX; + init_mb_mgr_avx(mgr); + } else { + dev->feature_flags |= RTE_CRYPTODEV_FF_CPU_SSE; + init_mb_mgr_sse(mgr); + } internals = dev->data->dev_private; + internals->mgr = mgr; internals->max_nb_queue_pairs = init_params->max_nb_queue_pairs; @@ -609,6 +619,7 @@ cryptodev_snow3g_remove(struct rte_vdev_device *vdev) { struct rte_cryptodev *cryptodev; const char *name; + struct snow3g_private *internals; name = rte_vdev_device_name(vdev); if (name == NULL) @@ -618,6 +629,10 @@ cryptodev_snow3g_remove(struct rte_vdev_device *vdev) if (cryptodev == NULL) return -ENODEV; + internals = cryptodev->data->dev_private; + + free_mb_mgr(internals->mgr); + return rte_cryptodev_pmd_destroy(cryptodev); } diff --git a/drivers/crypto/snow3g/rte_snow3g_pmd_ops.c b/drivers/crypto/snow3g/rte_snow3g_pmd_ops.c index 8778f28..ea76637 100644 --- a/drivers/crypto/snow3g/rte_snow3g_pmd_ops.c +++ b/drivers/crypto/snow3g/rte_snow3g_pmd_ops.c @@ -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"); diff --git a/drivers/crypto/snow3g/snow3g_pmd_private.h b/drivers/crypto/snow3g/snow3g_pmd_private.h index 1fe05eb..2074f3d 100644 --- a/drivers/crypto/snow3g/snow3g_pmd_private.h +++ b/drivers/crypto/snow3g/snow3g_pmd_private.h @@ -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 +#include #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); diff --git a/mk/rte.app.mk b/mk/rte.app.mk index a8163f1..8bf6b3d 100644 --- a/mk/rte.app.mk +++ b/mk/rte.app.mk @@ -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