crypto/mlx5: support 1MB data-unit
authorRaja Zidane <rzidane@nvidia.com>
Tue, 2 Nov 2021 09:32:56 +0000 (09:32 +0000)
committerAkhil Goyal <gakhil@marvell.com>
Thu, 4 Nov 2021 18:46:27 +0000 (19:46 +0100)
Add 1MB data-unit length to the capability's bitmap.
Handle 1MB data-unit length in the mlx5 session create operation,
and expose its capability in the mlx5 capabilities.

Signed-off-by: Raja Zidane <rzidane@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
doc/guides/cryptodevs/mlx5.rst
drivers/crypto/mlx5/mlx5_crypto.c
examples/l2fwd-crypto/main.c
lib/cryptodev/rte_cryptodev.h

index 7338c0c..9bd8c6f 100644 (file)
@@ -147,9 +147,9 @@ Limitations
 -----------
 
 - AES-XTS keys provided in xform must include keytag and should be wrapped.
-- The supported data-unit lengths are 512B and 1KB. In case the `dataunit_len`
+- The supported data-unit lengths are 512B and 4KB and 1MB. In case the `dataunit_len`
   is not provided in the cipher xform, the OP length is limited to the above
-  values and 1MB.
+  values.
 
 
 Prerequisites
index 07c2a9c..368affc 100644 (file)
@@ -60,7 +60,8 @@ const struct rte_cryptodev_capabilities mlx5_crypto_caps[] = {
                                },
                                .dataunit_set =
                                RTE_CRYPTO_CIPHER_DATA_UNIT_LEN_512_BYTES |
-                               RTE_CRYPTO_CIPHER_DATA_UNIT_LEN_4096_BYTES,
+                               RTE_CRYPTO_CIPHER_DATA_UNIT_LEN_4096_BYTES |
+                               RTE_CRYPTO_CIPHER_DATA_UNIT_LEN_1_MEGABYTES,
                        }, }
                }, }
        },
@@ -222,6 +223,11 @@ mlx5_crypto_sym_session_configure(struct rte_cryptodev *dev,
                                             ((uint32_t)MLX5_BLOCK_SIZE_4096B <<
                                             MLX5_BLOCK_SIZE_OFFSET);
                break;
+       case 1048576:
+               sess_private_data->bsp_res = rte_cpu_to_be_32
+                                            ((uint32_t)MLX5_BLOCK_SIZE_1MB <<
+                                            MLX5_BLOCK_SIZE_OFFSET);
+               break;
        default:
                DRV_LOG(ERR, "Cipher data unit length is not supported.");
                return -ENOTSUP;
index 04a3bda..4d9f886 100644 (file)
@@ -2218,6 +2218,11 @@ check_capabilities(struct l2fwd_crypto_options *options, uint8_t cdev_id)
                                                RTE_CRYPTO_CIPHER_DATA_UNIT_LEN_4096_BYTES))
                                                ret = -1;
                                        break;
+                               case 1048576:
+                                       if (!(cap->sym.cipher.dataunit_set &
+                                               RTE_CRYPTO_CIPHER_DATA_UNIT_LEN_1_MEGABYTES))
+                                               ret = -1;
+                                       break;
                                default:
                                        ret = -1;
                                }
index 56e3868..59ea5a5 100644 (file)
@@ -102,6 +102,7 @@ struct rte_crypto_param_range {
  */
 #define RTE_CRYPTO_CIPHER_DATA_UNIT_LEN_512_BYTES             RTE_BIT32(0)
 #define RTE_CRYPTO_CIPHER_DATA_UNIT_LEN_4096_BYTES            RTE_BIT32(1)
+#define RTE_CRYPTO_CIPHER_DATA_UNIT_LEN_1_MEGABYTES           RTE_BIT32(2)
 
 /**
  * Symmetric Crypto Capability