From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 01C162E8D for ; Thu, 10 Mar 2016 16:49:58 +0100 (CET) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga101.fm.intel.com with ESMTP; 10 Mar 2016 07:49:58 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,316,1455004800"; d="scan'208";a="63614447" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by fmsmga004.fm.intel.com with ESMTP; 10 Mar 2016 07:49:57 -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 u2AFnuQl030544; Thu, 10 Mar 2016 15:49:56 GMT Received: by linux.site (Postfix, from userid 11342333) id 2F52FE3BC4; Thu, 10 Mar 2016 15:41:28 +0000 (GMT) From: Fiona Trahe To: dev@dpdk.org Date: Thu, 10 Mar 2016 15:41:11 +0000 Message-Id: <1457624473-11138-4-git-send-email-fiona.trahe@intel.com> X-Mailer: git-send-email 1.7.0.7 In-Reply-To: <1457617381-8296-1-git-send-email-fiona.trahe@intel.com> References: <1457617381-8296-1-git-send-email-fiona.trahe@intel.com> Subject: [dpdk-dev] [PATCH v9 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: , X-List-Received-Date: Thu, 10 Mar 2016 15:49:59 -0000 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 -- 2.5.0