From patchwork Thu Mar 10 13:42:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fiona Trahe X-Patchwork-Id: 11405 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 68F3C47D0; Thu, 10 Mar 2016 14:52:27 +0100 (CET) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 4ECA2378B for ; Thu, 10 Mar 2016 14:52:25 +0100 (CET) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 10 Mar 2016 05:52:24 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,316,1455004800"; d="scan'208";a="933847798" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by fmsmga002.fm.intel.com with ESMTP; 10 Mar 2016 05:52:23 -0800 Received: from linux.site (sisvmlab045.ir.intel.com [10.237.216.57]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id u2ADqM9S020177; Thu, 10 Mar 2016 13:52:22 GMT Received: by linux.site (Postfix, from userid 11342333) id 7BC61E3BC3; Thu, 10 Mar 2016 13:43:54 +0000 (GMT) From: Fiona Trahe To: dev@dpdk.org Date: Thu, 10 Mar 2016 13:42:59 +0000 Message-Id: <1457617381-8296-4-git-send-email-fiona.trahe@intel.com> X-Mailer: git-send-email 1.7.0.7 In-Reply-To: <1457351422-7617-1-git-send-email-fiona.trahe@intel.com> References: <1457351422-7617-1-git-send-email-fiona.trahe@intel.com> Subject: [dpdk-dev] [PATCH v8 3/5] cryptodev: remove unused phys_addr field from key X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Remove unused phys_addr field from key in crypto_xform, simplifiy struct and fix knock-on impacts in l2fwd-crypto app Signed-off-by: Fiona Trahe --- examples/l2fwd-crypto/main.c | 42 ++++++++++++++++++++++++++--------- lib/librte_cryptodev/rte_crypto_sym.h | 16 ++++++------- 2 files changed, 39 insertions(+), 19 deletions(-) diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c index ee519e7..9b6b7ef 100644 --- a/examples/l2fwd-crypto/main.c +++ b/examples/l2fwd-crypto/main.c @@ -112,6 +112,12 @@ enum l2fwd_crypto_xform_chain { L2FWD_CRYPTO_HASH_CIPHER }; +struct l2fwd_key { + uint8_t *data; + uint32_t length; + phys_addr_t phys_addr; +}; + /** l2fwd crypto application command line options */ struct l2fwd_crypto_options { unsigned portmask; @@ -127,7 +133,7 @@ struct l2fwd_crypto_options { struct rte_crypto_sym_xform cipher_xform; uint8_t ckey_data[32]; - struct rte_crypto_key iv_key; + struct l2fwd_key iv_key; uint8_t ivkey_data[16]; struct rte_crypto_sym_xform auth_xform; @@ -141,7 +147,7 @@ struct l2fwd_crypto_params { unsigned digest_length; unsigned block_size; - struct rte_crypto_key iv_key; + struct l2fwd_key iv_key; struct rte_cryptodev_sym_session *session; }; @@ -744,7 +750,7 @@ parse_cipher_op(enum rte_crypto_cipher_operation *op, char *optarg) /** Parse crypto key command line argument */ static int -parse_key(struct rte_crypto_key *key __rte_unused, +parse_key(struct l2fwd_key *key __rte_unused, unsigned length __rte_unused, char *arg __rte_unused) { printf("Currently an unsupported argument!\n"); @@ -820,11 +826,18 @@ l2fwd_crypto_parse_args_long_options(struct l2fwd_crypto_options *options, return parse_cipher_op(&options->cipher_xform.cipher.op, optarg); - else if (strcmp(lgopts[option_index].name, "cipher_key") == 0) - return parse_key(&options->cipher_xform.cipher.key, - sizeof(options->ckey_data), optarg); + else if (strcmp(lgopts[option_index].name, "cipher_key") == 0) { + struct l2fwd_key key = { 0 }; + int retval = 0; + + retval = parse_key(&key, sizeof(options->ckey_data), optarg); + + options->cipher_xform.cipher.key.data = key.data; + options->cipher_xform.cipher.key.length = key.length; - else if (strcmp(lgopts[option_index].name, "iv") == 0) + return retval; + + } else if (strcmp(lgopts[option_index].name, "iv") == 0) return parse_key(&options->iv_key, sizeof(options->ivkey_data), optarg); @@ -837,11 +850,18 @@ l2fwd_crypto_parse_args_long_options(struct l2fwd_crypto_options *options, return parse_auth_op(&options->auth_xform.auth.op, optarg); - else if (strcmp(lgopts[option_index].name, "auth_key") == 0) - return parse_key(&options->auth_xform.auth.key, - sizeof(options->akey_data), optarg); + else if (strcmp(lgopts[option_index].name, "auth_key") == 0) { + struct l2fwd_key key = { 0 }; + int retval = 0; + + retval = parse_key(&key, sizeof(options->akey_data), optarg); + + options->auth_xform.auth.key.data = key.data; + options->auth_xform.auth.key.length = key.length; + + return retval; - else if (strcmp(lgopts[option_index].name, "sessionless") == 0) { + } else if (strcmp(lgopts[option_index].name, "sessionless") == 0) { options->sessionless = 1; return 0; } diff --git a/lib/librte_cryptodev/rte_crypto_sym.h b/lib/librte_cryptodev/rte_crypto_sym.h index de6c701..270510e 100644 --- a/lib/librte_cryptodev/rte_crypto_sym.h +++ b/lib/librte_cryptodev/rte_crypto_sym.h @@ -111,12 +111,6 @@ enum rte_crypto_cipher_operation { /**< Decrypt cipher operation */ }; -/** Crypto key structure */ -struct rte_crypto_key { - uint8_t *data; /**< pointer to key data */ - phys_addr_t phys_addr; - size_t length; /**< key length in bytes */ -}; /** * Symmetric Cipher Setup Data. @@ -133,7 +127,10 @@ struct rte_crypto_cipher_xform { enum rte_crypto_cipher_algorithm algo; /**< Cipher algorithm */ - struct rte_crypto_key key; + struct { + uint8_t *data; /**< pointer to key data */ + size_t length; /**< key length in bytes */ + } key; /**< Cipher key * * For the RTE_CRYPTO_CIPHER_AES_F8 mode of operation, key.data will @@ -257,7 +254,10 @@ struct rte_crypto_auth_xform { enum rte_crypto_auth_algorithm algo; /**< Authentication algorithm selection */ - struct rte_crypto_key key; + struct { + uint8_t *data; /**< pointer to key data */ + size_t length; /**< key length in bytes */ + } 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