From: Matan Azrad Date: Mon, 4 Oct 2021 06:36:38 +0000 (+0300) Subject: cryptodev: extend data-unit length field X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=cab0c8f3c09ee9fd8fdd9bb73d24ea50df61698d;p=dpdk.git cryptodev: extend data-unit length field As described in [1] and as announced in [2], The field ``dataunit_len`` of the ``struct rte_crypto_cipher_xform`` moved to the end of the structure and extended to ``uint32_t``. In this way, sizes bigger than 64K bytes can be supported for data-unit lengths. [1] commit d014dddb2d69 ("cryptodev: support multiple cipher data-units") [2] commit 9a5c09211b3a ("doc: announce extension of crypto data-unit length") Signed-off-by: Matan Azrad Acked-by: Akhil Goyal --- diff --git a/app/test/test_cryptodev_blockcipher.h b/app/test/test_cryptodev_blockcipher.h index dcaa08ae22..84f5d57787 100644 --- a/app/test/test_cryptodev_blockcipher.h +++ b/app/test/test_cryptodev_blockcipher.h @@ -97,7 +97,7 @@ struct blockcipher_test_data { unsigned int cipher_offset; unsigned int auth_offset; - uint16_t xts_dataunit_len; + uint32_t xts_dataunit_len; bool wrapped_key; }; diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst index c59dd5ca98..5183d05804 100644 --- a/doc/guides/rel_notes/deprecation.rst +++ b/doc/guides/rel_notes/deprecation.rst @@ -185,10 +185,6 @@ Deprecation Notices and ``rte_vhost_driver_set_protocol_features`` functions will be removed and the API functions will be made stable in DPDK 21.11. -* cryptodev: The field ``dataunit_len`` of the ``struct rte_crypto_cipher_xform`` - has a limited size ``uint16_t``. - It will be moved and extended as ``uint32_t`` in DPDK 21.11. - * cryptodev: The structure ``rte_crypto_sym_vec`` would be updated to add ``dest_sgl`` to support out of place processing. This field will be null for inplace processing. diff --git a/doc/guides/rel_notes/release_21_11.rst b/doc/guides/rel_notes/release_21_11.rst index bdaefd236d..d85690047d 100644 --- a/doc/guides/rel_notes/release_21_11.rst +++ b/doc/guides/rel_notes/release_21_11.rst @@ -258,6 +258,9 @@ API Changes the crypto/security operation. This field will be used to communicate events such as soft expiry with IPsec in lookaside mode. +* cryptodev: The field ``dataunit_len`` of the ``struct rte_crypto_cipher_xform`` + moved to the end of the structure and extended to ``uint32_t``. + ABI Changes ----------- diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c index 83bbea89c7..256a29bdf0 100644 --- a/examples/l2fwd-crypto/main.c +++ b/examples/l2fwd-crypto/main.c @@ -181,7 +181,7 @@ struct l2fwd_crypto_params { unsigned digest_length; unsigned block_size; - uint16_t cipher_dataunit_len; + uint32_t cipher_dataunit_len; struct l2fwd_iv cipher_iv; struct l2fwd_iv auth_iv; @@ -1268,9 +1268,9 @@ l2fwd_crypto_parse_args_long_options(struct l2fwd_crypto_options *options, else if (strcmp(lgopts[option_index].name, "cipher_dataunit_len") == 0) { retval = parse_size(&val, optarg); - if (retval == 0 && val >= 0 && val <= UINT16_MAX) { + if (retval == 0 && val >= 0) { options->cipher_xform.cipher.dataunit_len = - (uint16_t)val; + (uint32_t)val; return 0; } else return -1; diff --git a/lib/cryptodev/rte_crypto_sym.h b/lib/cryptodev/rte_crypto_sym.h index 58c0724743..1106ad6201 100644 --- a/lib/cryptodev/rte_crypto_sym.h +++ b/lib/cryptodev/rte_crypto_sym.h @@ -195,9 +195,6 @@ struct rte_crypto_cipher_xform { enum rte_crypto_cipher_algorithm algo; /**< Cipher algorithm */ - RTE_STD_C11 - union { /* temporary anonymous union for ABI compatibility */ - struct { const uint8_t *data; /**< pointer to key data */ uint16_t length; /**< key length in bytes */ @@ -233,27 +230,6 @@ 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. **/ - - RTE_STD_C11 - struct { /* temporary anonymous struct for ABI compatibility */ - const uint8_t *_key_data; /* reserved for key.data union */ - uint16_t _key_length; /* reserved for key.length union */ - /* next field can fill the padding hole */ - - uint16_t dataunit_len; - /**< When RTE_CRYPTODEV_FF_CIPHER_MULTIPLE_DATA_UNITS is enabled, - * this is the data-unit length of the algorithm, - * otherwise or when the value is 0, use the operation length. - * The value should be in the range defined by the dataunit_set field - * in the cipher capability. - * - * - For AES-XTS it is the size of data-unit, from IEEE Std 1619-2007. - * For-each data-unit in the operation, the tweak (IV) value is - * assigned consecutively starting from the operation assigned IV. - */ - - }; }; /* temporary struct nested in union for ABI compatibility */ - struct { uint16_t offset; /**< Starting point for Initialisation Vector or Counter, @@ -297,6 +273,18 @@ struct rte_crypto_cipher_xform { * which can be in the range 7 to 13 inclusive. */ } iv; /**< Initialisation vector parameters */ + + uint32_t dataunit_len; + /**< When RTE_CRYPTODEV_FF_CIPHER_MULTIPLE_DATA_UNITS is enabled, + * this is the data-unit length of the algorithm, + * otherwise or when the value is 0, use the operation length. + * The value should be in the range defined by the dataunit_set field + * in the cipher capability. + * + * - For AES-XTS it is the size of data-unit, from IEEE Std 1619-2007. + * For-each data-unit in the operation, the tweak (IV) value is + * assigned consecutively starting from the operation assigned IV. + */ }; /** Symmetric Authentication / Hash Algorithms