From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id 3F6A81B8D1 for ; Thu, 10 Jan 2019 15:50:41 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Jan 2019 06:50:40 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,461,1539673200"; d="scan'208";a="126595086" Received: from silpixa00398673.ir.intel.com (HELO silpixa00398673.ger.corp.intel.com) ([10.237.223.54]) by orsmga001.jf.intel.com with ESMTP; 10 Jan 2019 06:50:39 -0800 From: Fan Zhang To: dev@dpdk.org Cc: akhil.goyal@nxp.com, pablo.de.lara.guarch@intel.com, fiona.trahe@intel.com Date: Thu, 10 Jan 2019 14:50:18 +0000 Message-Id: <20190110145022.42883-9-roy.fan.zhang@intel.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20190110145022.42883-1-roy.fan.zhang@intel.com> References: <20190109225609.20590-1-roy.fan.zhang@intel.com> <20190110145022.42883-1-roy.fan.zhang@intel.com> Subject: [dpdk-dev] [PATCH v5 08/12] cryptodev: add sym session header size API 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: , X-List-Received-Date: Thu, 10 Jan 2019 14:50:41 -0000 This patch adds a new API in Cryptodev Framework. The API is used to get the header size for the created symmetric Cryptodev session. Signed-off-by: Fan Zhang Acked-by: Fiona Trahe --- drivers/crypto/aesni_gcm/Makefile | 1 + drivers/crypto/aesni_gcm/aesni_gcm_pmd.c | 3 ++- drivers/crypto/aesni_gcm/meson.build | 1 + drivers/crypto/aesni_mb/Makefile | 1 + drivers/crypto/aesni_mb/meson.build | 2 ++ drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 3 ++- drivers/crypto/armv8/Makefile | 1 + drivers/crypto/armv8/rte_armv8_pmd.c | 3 ++- drivers/crypto/kasumi/Makefile | 1 + drivers/crypto/kasumi/meson.build | 1 + drivers/crypto/kasumi/rte_kasumi_pmd.c | 3 ++- drivers/crypto/openssl/Makefile | 1 + drivers/crypto/openssl/meson.build | 1 + drivers/crypto/openssl/rte_openssl_pmd.c | 3 ++- drivers/crypto/snow3g/Makefile | 1 + drivers/crypto/snow3g/rte_snow3g_pmd.c | 3 ++- drivers/crypto/zuc/Makefile | 1 + drivers/crypto/zuc/meson.build | 1 + drivers/crypto/zuc/rte_zuc_pmd.c | 3 ++- lib/librte_cryptodev/Makefile | 1 + lib/librte_cryptodev/meson.build | 1 + lib/librte_cryptodev/rte_cryptodev.c | 10 ++++++++++ lib/librte_cryptodev/rte_cryptodev.h | 15 +++++++++++++++ lib/librte_cryptodev/rte_cryptodev_version.map | 1 + 24 files changed, 55 insertions(+), 7 deletions(-) diff --git a/drivers/crypto/aesni_gcm/Makefile b/drivers/crypto/aesni_gcm/Makefile index 0a5c1a872..9241ad762 100644 --- a/drivers/crypto/aesni_gcm/Makefile +++ b/drivers/crypto/aesni_gcm/Makefile @@ -8,6 +8,7 @@ LIB = librte_pmd_aesni_gcm.a # build flags CFLAGS += -O3 +CFLAGS += -DALLOW_EXPERIMENTAL_API CFLAGS += $(WERROR_FLAGS) # library version diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c index abc7a6d5f..948ff0763 100644 --- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c +++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c @@ -419,7 +419,8 @@ handle_completed_gcm_crypto_op(struct aesni_gcm_qp *qp, if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) { memset(sess, 0, sizeof(struct aesni_gcm_session)); memset(op->sym->session, 0, - rte_cryptodev_sym_get_header_session_size()); + rte_cryptodev_sym_get_existing_header_session_size( + op->sym->session)); rte_mempool_put(qp->sess_mp_priv, sess); rte_mempool_put(qp->sess_mp, op->sym->session); op->sym->session = NULL; diff --git a/drivers/crypto/aesni_gcm/meson.build b/drivers/crypto/aesni_gcm/meson.build index a02da1ef5..70f57ad73 100644 --- a/drivers/crypto/aesni_gcm/meson.build +++ b/drivers/crypto/aesni_gcm/meson.build @@ -8,5 +8,6 @@ else ext_deps += lib endif +allow_experimental_apis = true sources = files('aesni_gcm_pmd.c', 'aesni_gcm_pmd_ops.c') deps += ['bus_vdev'] diff --git a/drivers/crypto/aesni_mb/Makefile b/drivers/crypto/aesni_mb/Makefile index 806a95eb8..a6fa071ec 100644 --- a/drivers/crypto/aesni_mb/Makefile +++ b/drivers/crypto/aesni_mb/Makefile @@ -9,6 +9,7 @@ LIB = librte_pmd_aesni_mb.a # build flags CFLAGS += -O3 CFLAGS += $(WERROR_FLAGS) +CFLAGS += -DALLOW_EXPERIMENTAL_API # library version LIBABIVER := 1 diff --git a/drivers/crypto/aesni_mb/meson.build b/drivers/crypto/aesni_mb/meson.build index aae0995e5..145c3d984 100644 --- a/drivers/crypto/aesni_mb/meson.build +++ b/drivers/crypto/aesni_mb/meson.build @@ -9,4 +9,6 @@ else endif sources = files('rte_aesni_mb_pmd.c', 'rte_aesni_mb_pmd_ops.c') +allow_experimental_apis = true + deps += ['bus_vdev'] diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c index b0f5c4d67..f3b270d09 100644 --- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c +++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c @@ -951,7 +951,8 @@ post_process_mb_job(struct aesni_mb_qp *qp, JOB_AES_HMAC *job) if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) { memset(sess, 0, sizeof(struct aesni_mb_session)); memset(op->sym->session, 0, - rte_cryptodev_sym_get_header_session_size()); + rte_cryptodev_sym_get_existing_header_session_size( + op->sym->session)); rte_mempool_put(qp->sess_mp_priv, sess); rte_mempool_put(qp->sess_mp, op->sym->session); op->sym->session = NULL; diff --git a/drivers/crypto/armv8/Makefile b/drivers/crypto/armv8/Makefile index e862af72e..f71f6b14a 100644 --- a/drivers/crypto/armv8/Makefile +++ b/drivers/crypto/armv8/Makefile @@ -28,6 +28,7 @@ EXPORT_MAP := rte_pmd_armv8_version.map # external library dependencies CFLAGS += -I$(ARMV8_CRYPTO_LIB_PATH) CFLAGS += -I$(ARMV8_CRYPTO_LIB_PATH)/asm/include +CFLAGS += -DALLOW_EXPERIMENTAL_API LDLIBS += -L$(ARMV8_CRYPTO_LIB_PATH) -larmv8_crypto LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring LDLIBS += -lrte_cryptodev diff --git a/drivers/crypto/armv8/rte_armv8_pmd.c b/drivers/crypto/armv8/rte_armv8_pmd.c index 3b2d7fb2f..0d4649adc 100644 --- a/drivers/crypto/armv8/rte_armv8_pmd.c +++ b/drivers/crypto/armv8/rte_armv8_pmd.c @@ -655,7 +655,8 @@ process_op(struct armv8_crypto_qp *qp, struct rte_crypto_op *op, if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) { memset(sess, 0, sizeof(struct armv8_crypto_session)); memset(op->sym->session, 0, - rte_cryptodev_sym_get_header_session_size()); + rte_cryptodev_sym_get_existing_header_session_size( + op->sym->session)); rte_mempool_put(qp->sess_mp, sess); rte_mempool_put(qp->sess_mp_priv, op->sym->session); op->sym->session = NULL; diff --git a/drivers/crypto/kasumi/Makefile b/drivers/crypto/kasumi/Makefile index cafe94986..3de2f97ed 100644 --- a/drivers/crypto/kasumi/Makefile +++ b/drivers/crypto/kasumi/Makefile @@ -15,6 +15,7 @@ LIB = librte_pmd_kasumi.a # build flags CFLAGS += -O3 CFLAGS += $(WERROR_FLAGS) +CFLAGS += -DALLOW_EXPERIMENTAL_API # library version LIBABIVER := 1 diff --git a/drivers/crypto/kasumi/meson.build b/drivers/crypto/kasumi/meson.build index a09b0e251..80f13cd24 100644 --- a/drivers/crypto/kasumi/meson.build +++ b/drivers/crypto/kasumi/meson.build @@ -8,5 +8,6 @@ else ext_deps += lib endif +allow_experimental_apis = true sources = files('rte_kasumi_pmd.c', 'rte_kasumi_pmd_ops.c') deps += ['bus_vdev'] diff --git a/drivers/crypto/kasumi/rte_kasumi_pmd.c b/drivers/crypto/kasumi/rte_kasumi_pmd.c index 6df645a23..3abdb01a9 100644 --- a/drivers/crypto/kasumi/rte_kasumi_pmd.c +++ b/drivers/crypto/kasumi/rte_kasumi_pmd.c @@ -325,7 +325,8 @@ process_ops(struct rte_crypto_op **ops, struct kasumi_session *session, if (ops[i]->sess_type == RTE_CRYPTO_OP_SESSIONLESS) { memset(session, 0, sizeof(struct kasumi_session)); memset(ops[i]->sym->session, 0, - rte_cryptodev_sym_get_header_session_size()); + rte_cryptodev_sym_get_existing_header_session_size( + ops[i]->sym->session)); rte_mempool_put(qp->sess_mp_priv, session); rte_mempool_put(qp->sess_mp, ops[i]->sym->session); ops[i]->sym->session = NULL; diff --git a/drivers/crypto/openssl/Makefile b/drivers/crypto/openssl/Makefile index 8fe086b90..ae6c3bcac 100644 --- a/drivers/crypto/openssl/Makefile +++ b/drivers/crypto/openssl/Makefile @@ -9,6 +9,7 @@ LIB = librte_pmd_openssl.a # build flags CFLAGS += -O3 CFLAGS += $(WERROR_FLAGS) +CFLAGS += -DALLOW_EXPERIMENTAL_API # library version LIBABIVER := 1 diff --git a/drivers/crypto/openssl/meson.build b/drivers/crypto/openssl/meson.build index c2a0dd8ba..77a6596d7 100644 --- a/drivers/crypto/openssl/meson.build +++ b/drivers/crypto/openssl/meson.build @@ -5,6 +5,7 @@ dep = dependency('libcrypto', required: false) if not dep.found() build = false endif +allow_experimental_apis = true deps += 'bus_vdev' sources = files('rte_openssl_pmd.c', 'rte_openssl_pmd_ops.c') ext_deps += dep diff --git a/drivers/crypto/openssl/rte_openssl_pmd.c b/drivers/crypto/openssl/rte_openssl_pmd.c index a193af642..ea5aac69e 100644 --- a/drivers/crypto/openssl/rte_openssl_pmd.c +++ b/drivers/crypto/openssl/rte_openssl_pmd.c @@ -2020,7 +2020,8 @@ process_op(struct openssl_qp *qp, struct rte_crypto_op *op, openssl_reset_session(sess); memset(sess, 0, sizeof(struct openssl_session)); memset(op->sym->session, 0, - rte_cryptodev_sym_get_header_session_size()); + rte_cryptodev_sym_get_existing_header_session_size( + op->sym->session)); rte_mempool_put(qp->sess_mp_priv, sess); rte_mempool_put(qp->sess_mp, op->sym->session); op->sym->session = NULL; diff --git a/drivers/crypto/snow3g/Makefile b/drivers/crypto/snow3g/Makefile index ee5027d0c..37f77dbf8 100644 --- a/drivers/crypto/snow3g/Makefile +++ b/drivers/crypto/snow3g/Makefile @@ -15,6 +15,7 @@ LIB = librte_pmd_snow3g.a # build flags CFLAGS += -O3 CFLAGS += $(WERROR_FLAGS) +CFLAGS += -DALLOW_EXPERIMENTAL_API # library version LIBABIVER := 1 diff --git a/drivers/crypto/snow3g/rte_snow3g_pmd.c b/drivers/crypto/snow3g/rte_snow3g_pmd.c index 7d131f780..5fd94b686 100644 --- a/drivers/crypto/snow3g/rte_snow3g_pmd.c +++ b/drivers/crypto/snow3g/rte_snow3g_pmd.c @@ -340,7 +340,8 @@ process_ops(struct rte_crypto_op **ops, struct snow3g_session *session, if (ops[i]->sess_type == RTE_CRYPTO_OP_SESSIONLESS) { memset(session, 0, sizeof(struct snow3g_session)); memset(ops[i]->sym->session, 0, - rte_cryptodev_sym_get_header_session_size()); + rte_cryptodev_sym_get_existing_header_session_size( + ops[i]->sym->session)); rte_mempool_put(qp->sess_mp_priv, session); rte_mempool_put(qp->sess_mp, ops[i]->sym->session); ops[i]->sym->session = NULL; diff --git a/drivers/crypto/zuc/Makefile b/drivers/crypto/zuc/Makefile index 68d84eebc..8d625aa01 100644 --- a/drivers/crypto/zuc/Makefile +++ b/drivers/crypto/zuc/Makefile @@ -15,6 +15,7 @@ LIB = librte_pmd_zuc.a # build flags CFLAGS += -O3 CFLAGS += $(WERROR_FLAGS) +CFLAGS += -DALLOW_EXPERIMENTAL_API # library version LIBABIVER := 1 diff --git a/drivers/crypto/zuc/meson.build b/drivers/crypto/zuc/meson.build index b8ca7107e..63f2a5298 100644 --- a/drivers/crypto/zuc/meson.build +++ b/drivers/crypto/zuc/meson.build @@ -8,5 +8,6 @@ else ext_deps += lib endif +allow_experimental_apis = true sources = files('rte_zuc_pmd.c', 'rte_zuc_pmd_ops.c') deps += ['bus_vdev'] diff --git a/drivers/crypto/zuc/rte_zuc_pmd.c b/drivers/crypto/zuc/rte_zuc_pmd.c index 997c2092f..637994dfd 100644 --- a/drivers/crypto/zuc/rte_zuc_pmd.c +++ b/drivers/crypto/zuc/rte_zuc_pmd.c @@ -327,7 +327,8 @@ process_ops(struct rte_crypto_op **ops, enum zuc_operation op_type, if (ops[i]->sess_type == RTE_CRYPTO_OP_SESSIONLESS) { memset(sessions[i], 0, sizeof(struct zuc_session)); memset(ops[i]->sym->session, 0, - rte_cryptodev_sym_get_header_session_size()); + rte_cryptodev_sym_get_existing_header_session_size( + ops[i]->sym->session)); rte_mempool_put(qp->sess_mp_priv, sessions[i]); rte_mempool_put(qp->sess_mp, ops[i]->sym->session); ops[i]->sym->session = NULL; diff --git a/lib/librte_cryptodev/Makefile b/lib/librte_cryptodev/Makefile index e38018183..859c4f0f1 100644 --- a/lib/librte_cryptodev/Makefile +++ b/lib/librte_cryptodev/Makefile @@ -12,6 +12,7 @@ LIBABIVER := 6 # build flags CFLAGS += -O3 CFLAGS += $(WERROR_FLAGS) +CFLAGS += -DALLOW_EXPERIMENTAL_API LDLIBS += -lrte_eal -lrte_mempool -lrte_ring -lrte_mbuf LDLIBS += -lrte_kvargs diff --git a/lib/librte_cryptodev/meson.build b/lib/librte_cryptodev/meson.build index 44bd83212..bcd969437 100644 --- a/lib/librte_cryptodev/meson.build +++ b/lib/librte_cryptodev/meson.build @@ -2,6 +2,7 @@ # Copyright(c) 2017-2019 Intel Corporation version = 6 +allow_experimental_apis = true sources = files('rte_cryptodev.c', 'rte_cryptodev_pmd.c') headers = files('rte_cryptodev.h', 'rte_cryptodev_pmd.h', diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c index ccc4c2132..4a105b08d 100644 --- a/lib/librte_cryptodev/rte_cryptodev.c +++ b/lib/librte_cryptodev/rte_cryptodev.c @@ -1408,6 +1408,16 @@ rte_cryptodev_sym_get_header_session_size(void) } unsigned int __rte_experimental +rte_cryptodev_sym_get_existing_header_session_size( + struct rte_cryptodev_sym_session *sess) +{ + if (!sess) + return 0; + else + return rte_cryptodev_sym_get_header_session_size(); +} + +unsigned int __rte_experimental rte_cryptodev_asym_get_header_session_size(void) { /* diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h index 052213e1f..39e3bfffb 100644 --- a/lib/librte_cryptodev/rte_cryptodev.h +++ b/lib/librte_cryptodev/rte_cryptodev.h @@ -1137,6 +1137,21 @@ unsigned int rte_cryptodev_sym_get_header_session_size(void); /** + * Get the size of the header session from created session. + * + * @param sess + * The sym cryptodev session pointer + * + * @return + * - If sess is not NULL, return the size of the header session including + * the private data size defined within sess. + * - If sess is NULL, return 0. + */ +unsigned int __rte_experimental +rte_cryptodev_sym_get_existing_header_session_size( + struct rte_cryptodev_sym_session *sess); + +/** * Get the size of the asymmetric session header, for all registered drivers. * * @return diff --git a/lib/librte_cryptodev/rte_cryptodev_version.map b/lib/librte_cryptodev/rte_cryptodev_version.map index 5609da04b..3deb265ac 100644 --- a/lib/librte_cryptodev/rte_cryptodev_version.map +++ b/lib/librte_cryptodev/rte_cryptodev_version.map @@ -101,6 +101,7 @@ EXPERIMENTAL { rte_cryptodev_asym_session_init; rte_cryptodev_asym_xform_capability_check_modlen; rte_cryptodev_asym_xform_capability_check_optype; + rte_cryptodev_sym_get_existing_header_session_size; rte_cryptodev_sym_session_get_user_data; rte_cryptodev_sym_session_pool_create; rte_cryptodev_sym_session_set_user_data; -- 2.13.6