From patchwork Tue Nov 5 18:41:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ananyev, Konstantin" X-Patchwork-Id: 62490 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 CCEC5A04A2; Tue, 5 Nov 2019 19:42:03 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8D1521BEF1; Tue, 5 Nov 2019 19:42:03 +0100 (CET) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id B462C1BEF1; Tue, 5 Nov 2019 19:42:01 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Nov 2019 10:41:57 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,271,1569308400"; d="scan'208";a="403454515" Received: from sivswdev08.ir.intel.com ([10.237.217.47]) by fmsmga006.fm.intel.com with ESMTP; 05 Nov 2019 10:41:54 -0800 From: Konstantin Ananyev To: dev@dpdk.org, techboard@dpdk.org Cc: roy.fan.zhang@intel.com, declan.doherty@intel.com, akhil.goyal@nxp.com, Konstantin Ananyev Date: Tue, 5 Nov 2019 18:41:19 +0000 Message-Id: <20191105184122.15172-2-konstantin.ananyev@intel.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20191105184122.15172-1-konstantin.ananyev@intel.com> References: <20191105184122.15172-1-konstantin.ananyev@intel.com> Subject: [dpdk-dev] [RFC 1/4] cpu-crypto: Introduce basic data structures 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" Introduce basic data strucure to be used with cpu-crypto data-path. Signed-off-by: Konstantin Ananyev --- lib/librte_cryptodev/rte_crypto_sym.h | 52 +++++++++++++++++++++++++-- lib/librte_security/rte_security.h | 6 +++- 2 files changed, 54 insertions(+), 4 deletions(-) diff --git a/lib/librte_cryptodev/rte_crypto_sym.h b/lib/librte_cryptodev/rte_crypto_sym.h index ffa038dc4..d8d9e9514 100644 --- a/lib/librte_cryptodev/rte_crypto_sym.h +++ b/lib/librte_cryptodev/rte_crypto_sym.h @@ -25,6 +25,30 @@ extern "C" { #include #include +/** + * Crypto IO Vector (in analogy with struct iovec) + * Supposed be used to pass input/output data buffers for crypto data-path + * functions. + */ +struct rte_crypto_vec { + /** virtual address of the data buffer */ + void *base; + /** IOVA of the data buffer */ + rte_iova_t *iova; + /** length of the data buffer */ + uint32_t len; +}; + +struct rte_crypto_sym_vec { + /** array of SGL vectors */ + struct rte_crypto_vec *vec; + /** array of pointers to IV */ + void **iv; + /** array of pointers to AAD */ + void **aad; + /** array of pointers to digest */ + void **digest; +}; /** Symmetric Cipher Algorithms */ enum rte_crypto_cipher_algorithm { @@ -116,7 +140,8 @@ struct rte_crypto_cipher_xform { struct { const uint8_t *data; /**< pointer to key data */ uint16_t length; /**< key length in bytes */ - } key; + } __attribute__((__packed__)) key; + /**< Cipher key * * For the RTE_CRYPTO_CIPHER_AES_F8 mode of operation, key.data will @@ -140,6 +165,16 @@ struct rte_crypto_cipher_xform { * - Each key can be either 128 bits (16 bytes) or 256 bits (32 bytes). * - Both keys must have the same size. **/ + + struct { + /** + * offset for cipher to start within user provided data buffer. + */ + uint16_t offset; + } cpu_crypto; + + uint8_t reserved[4]; + struct { uint16_t offset; /**< Starting point for Initialisation Vector or Counter, @@ -284,7 +319,7 @@ struct rte_crypto_auth_xform { struct { const uint8_t *data; /**< pointer to key data */ uint16_t length; /**< key length in bytes */ - } key; + } __attribute__((__packed__)) key; /**< Authentication key data. * The authentication key length MUST be less than or equal to the * block size of the algorithm. It is the callers responsibility to @@ -292,6 +327,8 @@ struct rte_crypto_auth_xform { * (for example RFC 2104, FIPS 198a). */ + uint8_t reserved[6]; + struct { uint16_t offset; /**< Starting point for Initialisation Vector or Counter, @@ -376,7 +413,16 @@ struct rte_crypto_aead_xform { struct { const uint8_t *data; /**< pointer to key data */ uint16_t length; /**< key length in bytes */ - } key; + } __attribute__((__packed__)) key; + + struct { + /** + * offset for cipher to start within user provided data buffer. + */ + uint16_t offset; + } cpu_crypto; + + uint8_t reserved[4]; struct { uint16_t offset; diff --git a/lib/librte_security/rte_security.h b/lib/librte_security/rte_security.h index aaafdfcd7..fed67ab39 100644 --- a/lib/librte_security/rte_security.h +++ b/lib/librte_security/rte_security.h @@ -303,10 +303,14 @@ enum rte_security_session_action_type { /**< All security protocol processing is performed inline during * transmission */ - RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL + RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL, /**< All security protocol processing including crypto is performed * on a lookaside accelerator */ + RTE_SECURITY_ACTION_TYPE_CPU_CRYPTO, + /**< Crypto processing for security protocol is processed by CPU + * synchronously + */ }; /** Security session protocol definition */