cryptodev: remove unused field
authorFiona Trahe <fiona.trahe@intel.com>
Thu, 10 Mar 2016 15:41:11 +0000 (15:41 +0000)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Thu, 10 Mar 2016 16:12:41 +0000 (17:12 +0100)
Remove unused phys_addr field from key in crypto_xform,
simplify struct and fix knock-on impacts in l2fwd-crypto app

Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Deepak Kumar Jain <deepak.k.jain@intel.com>
examples/l2fwd-crypto/main.c
lib/librte_cryptodev/rte_crypto_sym.h

index ee519e7..9b6b7ef 100644 (file)
@@ -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;
        }
index de6c701..270510e 100644 (file)
@@ -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