DPDK patches and discussions
 help / color / mirror / Atom feed
From: Raja Zidane <rzidane@nvidia.com>
To: <dev@dpdk.org>
Cc: Matan Azrad <matan@nvidia.com>
Subject: [dpdk-dev] [PATCH V2] crypto/mlx5: support 1MB data-unit
Date: Tue, 2 Nov 2021 09:32:56 +0000	[thread overview]
Message-ID: <20211102093256.35581-1-rzidane@nvidia.com> (raw)
In-Reply-To: <20211101150547.34040-1-rzidane@nvidia.com>

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.

Signed-off-by: Raja Zidane <rzidane@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 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(-)

diff --git a/doc/guides/cryptodevs/mlx5.rst b/doc/guides/cryptodevs/mlx5.rst
index 68bfdf3a83..bb50376b4c 100644
--- a/doc/guides/cryptodevs/mlx5.rst
+++ b/doc/guides/cryptodevs/mlx5.rst
@@ -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
diff --git a/drivers/crypto/mlx5/mlx5_crypto.c b/drivers/crypto/mlx5/mlx5_crypto.c
index f430d8cde0..c3a9d2d8f7 100644
--- a/drivers/crypto/mlx5/mlx5_crypto.c
+++ b/drivers/crypto/mlx5/mlx5_crypto.c
@@ -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;
diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c
index 04a3bdace2..4d9f8861af 100644
--- a/examples/l2fwd-crypto/main.c
+++ b/examples/l2fwd-crypto/main.c
@@ -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;
 				}
diff --git a/lib/cryptodev/rte_cryptodev.h b/lib/cryptodev/rte_cryptodev.h
index 56e3868ada..59ea5a54df 100644
--- a/lib/cryptodev/rte_cryptodev.h
+++ b/lib/cryptodev/rte_cryptodev.h
@@ -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


  parent reply	other threads:[~2021-11-02  9:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-01 15:05 [dpdk-dev] [PATCH] " Raja Zidane
2021-11-02  8:27 ` Matan Azrad
2021-11-02  9:32 ` Raja Zidane [this message]
2021-11-03 19:13   ` [dpdk-dev] [EXT] [PATCH V2] " Akhil Goyal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211102093256.35581-1-rzidane@nvidia.com \
    --to=rzidane@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=matan@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).