Skip to contentSkip to conversation

crypto/mlx5: support 1MB data-unit

PATCH Superseded Raja Zidane 3 participants 4 messages Nov 1, 2021 – Nov 3, 2021 Crypto API

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 crypto/mlx5: support 1MB data-unit

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.

---
 doc/guides/cryptodevs/mlx5.rst    | 2 +-
 drivers/crypto/mlx5/mlx5_crypto.c | 8 +++++++-
 examples/l2fwd-crypto/main.c      | 5 +++++
 lib/cryptodev/rte_cryptodev.h     | 1 +
 4 files changed, 14 insertions(+), 2 deletions(-)
doc/guides/cryptodevs/mlx5.rst +1 -1
index 68bfdf3a83..bc6ae82d40 100644
@@ -147,7 +147,7 @@ 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. In case the `dataunit_len`
   is not provided in the cipher xform, the OP length is limited to the above
   values and 1MB.
 
drivers/crypto/mlx5/mlx5_crypto.c +7 -1
index f430d8cde0..c3a9d2d8f7 100644
@@ -59,7 +59,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,
 			}, }
 		}, }
 	},
@@ -221,6 +222,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;
examples/l2fwd-crypto/main.c +5 -0
index 04a3bdace2..4d9f8861af 100644
@@ -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;
 				}
lib/cryptodev/rte_cryptodev.h +1 -0
index 56e3868ada..59ea5a54df 100644
@@ -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
Signature · 1 line
2.17.1
#1 lore raw

From: Raja Zidane

Quoted 18 lines

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.

---
 doc/guides/cryptodevs/mlx5.rst    | 2 +-
 drivers/crypto/mlx5/mlx5_crypto.c | 8 +++++++-
 examples/l2fwd-crypto/main.c      | 5 +++++
 lib/cryptodev/rte_cryptodev.h     | 1 +
 4 files changed, 14 insertions(+), 2 deletions(-)
doc/guides/cryptodevs/mlx5.rst +0 -0
index 68bfdf3a83..bc6ae82d40 100644

doc/guides/cryptodevs/mlx5.rst Limitations · line 151

Quoted 6 lines
doc/guides/cryptodevs/mlx5.rst +2 -1
@@ -147,7 +147,7 @@ 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. In case the
+`dataunit_len`

Probably typo caused eventually wrong change in the doc. We need to add 1M as supported from xform conf in this sentence.

Quoted 74 lines
doc/guides/cryptodevs/mlx5.rst +0 -0
   is not provided in the cipher xform, the OP length is limited to the above
   values and 1MB.
drivers/crypto/mlx5/mlx5_crypto.c +1 -1
index f430d8cde0..c3a9d2d8f7 100644
@@ -59,7 +59,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,

drivers/crypto/mlx5/mlx5_crypto.c +0 -0
 			}, }
 		}, }
 	},
@@ -221,6 +222,11 @@ mlx5_crypto_sym_session_configure(struct
 rte_cryptodev *dev,
 

((uint32_t)MLX5_BLOCK_SIZE_4096B <<

drivers/crypto/mlx5/mlx5_crypto.c +3 -0
 					     MLX5_BLOCK_SIZE_OFFSET);
 		break;
+	case 1048576:
+		sess_private_data->bsp_res = rte_cpu_to_be_32
+					     ((uint32_t)MLX5_BLOCK_SIZE_1MB

<<

drivers/crypto/mlx5/mlx5_crypto.c +2 -0
+					     MLX5_BLOCK_SIZE_OFFSET);
+		break;
 	default:
 		DRV_LOG(ERR, "Cipher data unit length is not supported.");
 		return -ENOTSUP;
examples/l2fwd-crypto/main.c +5 -0
index 04a3bdace2..4d9f8861af 100644
@@ -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;
examples/l2fwd-crypto/main.c +0 -0
 				default:
 					ret = -1;
 				}
lib/cryptodev/rte_cryptodev.h index renamed from lib/cryptodev/rte_cryptodev.h +0 -0

56e3868ada..59ea5a54df 100644

lib/cryptodev/rte_cryptodev.h +1 -0
@@ -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
--
2.17.1

#2 lore raw

PATCH v2 1/1 crypto/mlx5: support 1MB data-unit

In reply to Raja Zidane

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.
V2: fix doc.

---
 doc/guides/cryptodevs/mlx5.rst    | 4 ++--
 drivers/crypto/mlx5/mlx5_crypto.c | 8 +++++++-
 examples/l2fwd-crypto/main.c      | 5 +++++
 lib/cryptodev/rte_cryptodev.h     | 1 +
 4 files changed, 15 insertions(+), 3 deletions(-)
doc/guides/cryptodevs/mlx5.rst +2 -2
index 68bfdf3a83..bb50376b4c 100644
@@ -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
drivers/crypto/mlx5/mlx5_crypto.c +7 -1
index f430d8cde0..c3a9d2d8f7 100644
@@ -59,7 +59,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,
 			}, }
 		}, }
 	},
@@ -221,6 +222,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;
examples/l2fwd-crypto/main.c +5 -0
index 04a3bdace2..4d9f8861af 100644
@@ -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;
 				}
lib/cryptodev/rte_cryptodev.h +1 -0
index 56e3868ada..59ea5a54df 100644
@@ -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
Signature · 1 line
2.17.1