Skip to contentSkip to conversation

Unifying IPsec MB

PATCH Superseded Brian Dooley 3 participants 7 messages Jun 5, 2024 – Jun 26, 2024 Crypto API

lore
Share & tools
lore
#0 lore raw

cover Unifying IPsec MB

Unifying some PMDs in the ipsec_mb crypto driver
As discussed previously on the mailing list:
https://patches.dpdk.org/project/dpdk/patch/[email protected]/

Brian Dooley (1):
crypto/ipsec_mb: unify some IPsec MB PMDs

 doc/guides/rel_notes/release_24_07.rst        |   3 +
 drivers/crypto/ipsec_mb/pmd_aesni_mb.c        |  10 +-
 drivers/crypto/ipsec_mb/pmd_aesni_mb_priv.h   |  15 +-
 drivers/crypto/ipsec_mb/pmd_chacha_poly.c     | 340 +--------------
 .../crypto/ipsec_mb/pmd_chacha_poly_priv.h    |  28 --
 drivers/crypto/ipsec_mb/pmd_kasumi.c          | 409 +-----------------
 drivers/crypto/ipsec_mb/pmd_kasumi_priv.h     |  20 -
 7 files changed, 32 insertions(+), 793 deletions(-)
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/1 crypto/ipsec_mb: unify some IPsec MB PMDs

Currently IPsec MB provides both the JOB API and direct API. AESNI_MB PMD is using the JOB API codepath while KASUMI and CHACHA20_POLY1305 are using the direct API.
Instead of using the direct API for these PMDs, they should now make use of the JOB API codepath. This would remove all use of the IPsec MB direct API for these PMDs.

---
 doc/guides/rel_notes/release_24_07.rst        |   3 +
 drivers/crypto/ipsec_mb/pmd_aesni_mb.c        |  10 +-
 drivers/crypto/ipsec_mb/pmd_aesni_mb_priv.h   |  15 +-
 drivers/crypto/ipsec_mb/pmd_chacha_poly.c     | 340 +--------------
 .../crypto/ipsec_mb/pmd_chacha_poly_priv.h    |  28 --
 drivers/crypto/ipsec_mb/pmd_kasumi.c          | 409 +-----------------
 drivers/crypto/ipsec_mb/pmd_kasumi_priv.h     |  20 -
 7 files changed, 32 insertions(+), 793 deletions(-)
doc/guides/rel_notes/release_24_07.rst +3 -0
index a69f24cf99..76b7658714 100644
@@ -54,7 +54,10 @@ New Features
      This section is a comment. Do not overwrite or remove it.
      Also, make sure to start the actual text at the margin.
      =======================================================
+* **Updated ipsec_mb crypto driver.**
 
+  * Kasumi and ChaChaPoly PMDs now share the job API codepath
+    with AESNI_MB PMD.
 
 Removed Items
 -------------
drivers/crypto/ipsec_mb/pmd_aesni_mb.c +6 -4
index b3fdea02ff..d74946c180 100644
@@ -8,6 +8,8 @@
 
 RTE_DEFINE_PER_LCORE(pid_t, pid);
 
+uint8_t pmd_driver_id_aesni_mb;
+
 struct aesni_mb_op_buf_data {
 	struct rte_mbuf *m;
 	uint32_t offset;
@@ -793,7 +795,7 @@ aesni_mb_set_session_aead_parameters(const IMB_MGR *mb_mgr,
 }
 
 /** Configure a aesni multi-buffer session from a crypto xform chain */
-static int
+int
 aesni_mb_session_configure(IMB_MGR *mb_mgr,
 		void *priv_sess,
 		const struct rte_crypto_sym_xform *xform)
@@ -2163,7 +2165,7 @@ set_job_null_op(IMB_JOB *job, struct rte_crypto_op *op)
 }
 
 #if IMB_VERSION(1, 2, 0) < IMB_VERSION_NUM
-static uint16_t
+uint16_t
 aesni_mb_dequeue_burst(void *queue_pair, struct rte_crypto_op **ops,
 		uint16_t nb_ops)
 {
@@ -2353,7 +2355,7 @@ flush_mb_mgr(struct ipsec_mb_qp *qp, IMB_MGR *mb_mgr,
 	return processed_ops;
 }
 
-static uint16_t
+uint16_t
 aesni_mb_dequeue_burst(void *queue_pair, struct rte_crypto_op **ops,
 		uint16_t nb_ops)
 {
@@ -2488,7 +2490,7 @@ verify_sync_dgst(struct rte_crypto_sym_vec *vec,
 	return k;
 }
 
-static uint32_t
+uint32_t
 aesni_mb_process_bulk(struct rte_cryptodev *dev __rte_unused,
 	struct rte_cryptodev_sym_session *sess, union rte_crypto_sym_ofs sofs,
 	struct rte_crypto_sym_vec *vec)
drivers/crypto/ipsec_mb/pmd_aesni_mb_priv.h +13 -2
index eec893126e..d6af2d4ded 100644
@@ -21,6 +21,19 @@
 #define MAX_NUM_SEGS 16
 #endif
 
+int
+aesni_mb_session_configure(IMB_MGR * m __rte_unused, void *priv_sess,
+		const struct rte_crypto_sym_xform *xform);
+
+uint16_t
+aesni_mb_dequeue_burst(void *queue_pair, struct rte_crypto_op **ops,
+		uint16_t nb_ops);
+
+uint32_t
+aesni_mb_process_bulk(struct rte_cryptodev *dev __rte_unused,
+	struct rte_cryptodev_sym_session *sess, union rte_crypto_sym_ofs sofs,
+	struct rte_crypto_sym_vec *vec);
+
 static const struct rte_cryptodev_capabilities aesni_mb_capabilities[] = {
 	{	/* MD5 HMAC */
 		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
@@ -722,8 +735,6 @@ static const struct rte_cryptodev_capabilities aesni_mb_capabilities[] = {
 	RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST()
 };
 
-uint8_t pmd_driver_id_aesni_mb;
-
 struct aesni_mb_qp_data {
 	uint8_t temp_digests[IMB_MAX_JOBS][DIGEST_LENGTH_MAX];
 	/* *< Buffers used to store the digest generated
drivers/crypto/ipsec_mb/pmd_chacha_poly.c +5 -335

356 lines not on this page · raw message

drivers/crypto/ipsec_mb/pmd_chacha_poly_priv.h +0 -28
index 0eca63ca47..e668bfe07f 100644
@@ -7,9 +7,7 @@
 
 #include "ipsec_mb_private.h"
 
-#define CHACHA20_POLY1305_IV_LENGTH 12
 #define CHACHA20_POLY1305_DIGEST_LENGTH 16
-#define CHACHA20_POLY1305_KEY_SIZE  32
 
 static const
 struct rte_cryptodev_capabilities chacha20_poly1305_capabilities[] = {
@@ -45,30 +43,4 @@ struct rte_cryptodev_capabilities chacha20_poly1305_capabilities[] = {
 
 uint8_t pmd_driver_id_chacha20_poly1305;
 
-/** CHACHA20 POLY1305 private session structure */
-struct __rte_cache_aligned chacha20_poly1305_session {
-	struct {
-		uint16_t length;
-		uint16_t offset;
-	} iv;
-	/**< IV parameters */
-	uint16_t aad_length;
-	/**< AAD length */
-	uint16_t req_digest_length;
-	/**< Requested digest length */
-	uint16_t gen_digest_length;
-	/**< Generated digest length */
-	uint8_t key[CHACHA20_POLY1305_KEY_SIZE];
-	enum ipsec_mb_operation op;
-};
-
-struct chacha20_poly1305_qp_data {
-	struct chacha20_poly1305_context_data chacha20_poly1305_ctx_data;
-	uint8_t temp_digest[CHACHA20_POLY1305_DIGEST_LENGTH];
-	/**< Buffer used to store the digest generated
-	 * by the driver when verifying a digest provided
-	 * by the user (using authentication verify operation)
-	 */
-};
-
 #endif /* _PMD_CHACHA_POLY_PRIV_H_ */
drivers/crypto/ipsec_mb/pmd_kasumi.c +5 -404

425 lines not on this page · raw message

drivers/crypto/ipsec_mb/pmd_kasumi_priv.h +0 -20
index c2e28eaeda..3223cf1a14 100644
@@ -9,8 +9,6 @@
 
 #define KASUMI_KEY_LENGTH 16
 #define KASUMI_IV_LENGTH 8
-#define KASUMI_MAX_BURST 4
-#define BYTE_LEN 8
 #define KASUMI_DIGEST_LENGTH 4
 
 uint8_t pmd_driver_id_kasumi;
@@ -60,22 +58,4 @@ static const struct rte_cryptodev_capabilities kasumi_capabilities[] = {
 	RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST()
 };
 
-/** KASUMI private session structure */
-struct __rte_cache_aligned kasumi_session {
-	/* Keys have to be 16-byte aligned */
-	kasumi_key_sched_t pKeySched_cipher;
-	kasumi_key_sched_t pKeySched_hash;
-	enum ipsec_mb_operation op;
-	enum rte_crypto_auth_operation auth_op;
-	uint16_t cipher_iv_offset;
-};
-
-struct kasumi_qp_data {
-	uint8_t temp_digest[KASUMI_DIGEST_LENGTH];
-	/* *< Buffers used to store the digest generated
-	 * by the driver when verifying a digest provided
-	 * by the user (using authentication verify operation)
-	 */
-};
-
 #endif /* _PMD_KASUMI_PRIV_H_ */
Signature · 1 line
2.25.1
#2 lore raw

v2 cover Unifying IPsec MB

Unifying some PMDs in the ipsec_mb crypto driver
As discussed previously on the mailing list:
https://patches.dpdk.org/project/dpdk/patch/[email protected]/

v2:
* fix doc indentation

Brian Dooley (1):
crypto/ipsec_mb: unify some IPsec MB PMDs

 doc/guides/rel_notes/release_24_07.rst        |   5 +
 drivers/crypto/ipsec_mb/pmd_aesni_mb.c        |  10 +-
 drivers/crypto/ipsec_mb/pmd_aesni_mb_priv.h   |  15 +-
 drivers/crypto/ipsec_mb/pmd_chacha_poly.c     | 340 +--------------
 .../crypto/ipsec_mb/pmd_chacha_poly_priv.h    |  28 --
 drivers/crypto/ipsec_mb/pmd_kasumi.c          | 409 +-----------------
 drivers/crypto/ipsec_mb/pmd_kasumi_priv.h     |  20 -
 7 files changed, 34 insertions(+), 793 deletions(-)
Signature · 1 line
2.25.1
#3 lore raw

PATCH v2 1/1 crypto/ipsec_mb: unify some IPsec MB PMDs

Currently IPsec MB provides both the JOB API and direct API. AESNI_MB PMD is using the JOB API codepath while KASUMI and CHACHA20_POLY1305 are using the direct API.
Instead of using the direct API for these PMDs, they should now make use of the JOB API codepath. This would remove all use of the IPsec MB direct API for these PMDs.

---
v2:
* fix doc indentation

---
 doc/guides/rel_notes/release_24_07.rst        |   5 +
 drivers/crypto/ipsec_mb/pmd_aesni_mb.c        |  10 +-
 drivers/crypto/ipsec_mb/pmd_aesni_mb_priv.h   |  15 +-
 drivers/crypto/ipsec_mb/pmd_chacha_poly.c     | 340 +--------------
 .../crypto/ipsec_mb/pmd_chacha_poly_priv.h    |  28 --
 drivers/crypto/ipsec_mb/pmd_kasumi.c          | 409 +-----------------
 drivers/crypto/ipsec_mb/pmd_kasumi_priv.h     |  20 -
 7 files changed, 34 insertions(+), 793 deletions(-)
doc/guides/rel_notes/release_24_07.rst +5 -0
index 9e06dcab17..4f62cdb8e5 100644
@@ -64,6 +64,11 @@ New Features
 
   Added a new crypto driver for AMD Pensando hardware accelerators.
 
+* **Updated ipsec_mb crypto driver.**
+
+  * Kasumi and ChaChaPoly PMDs now share the job API codepath
+    with AESNI_MB PMD.
+
 
 Removed Items
 -------------
drivers/crypto/ipsec_mb/pmd_aesni_mb.c +6 -4
index 69a546697b..ebadfe2264 100644
@@ -8,6 +8,8 @@
 
 RTE_DEFINE_PER_LCORE(pid_t, pid);
 
+uint8_t pmd_driver_id_aesni_mb;
+
 struct aesni_mb_op_buf_data {
 	struct rte_mbuf *m;
 	uint32_t offset;
@@ -761,7 +763,7 @@ aesni_mb_set_session_aead_parameters(const IMB_MGR *mb_mgr,
 }
 
 /** Configure a aesni multi-buffer session from a crypto xform chain */
-static int
+int
 aesni_mb_session_configure(IMB_MGR *mb_mgr,
 		void *priv_sess,
 		const struct rte_crypto_sym_xform *xform)
@@ -2131,7 +2133,7 @@ set_job_null_op(IMB_JOB *job, struct rte_crypto_op *op)
 }
 
 #if IMB_VERSION(1, 2, 0) < IMB_VERSION_NUM
-static uint16_t
+uint16_t
 aesni_mb_dequeue_burst(void *queue_pair, struct rte_crypto_op **ops,
 		uint16_t nb_ops)
 {
@@ -2321,7 +2323,7 @@ flush_mb_mgr(struct ipsec_mb_qp *qp, IMB_MGR *mb_mgr,
 	return processed_ops;
 }
 
-static uint16_t
+uint16_t
 aesni_mb_dequeue_burst(void *queue_pair, struct rte_crypto_op **ops,
 		uint16_t nb_ops)
 {
@@ -2456,7 +2458,7 @@ verify_sync_dgst(struct rte_crypto_sym_vec *vec,
 	return k;
 }
 
-static uint32_t
+uint32_t
 aesni_mb_process_bulk(struct rte_cryptodev *dev __rte_unused,
 	struct rte_cryptodev_sym_session *sess, union rte_crypto_sym_ofs sofs,
 	struct rte_crypto_sym_vec *vec)
drivers/crypto/ipsec_mb/pmd_aesni_mb_priv.h +13 -2
index eec893126e..d6af2d4ded 100644
@@ -21,6 +21,19 @@
 #define MAX_NUM_SEGS 16
 #endif
 
+int
+aesni_mb_session_configure(IMB_MGR * m __rte_unused, void *priv_sess,
+		const struct rte_crypto_sym_xform *xform);
+
+uint16_t
+aesni_mb_dequeue_burst(void *queue_pair, struct rte_crypto_op **ops,
+		uint16_t nb_ops);
+
+uint32_t
+aesni_mb_process_bulk(struct rte_cryptodev *dev __rte_unused,
+	struct rte_cryptodev_sym_session *sess, union rte_crypto_sym_ofs sofs,
+	struct rte_crypto_sym_vec *vec);
+
 static const struct rte_cryptodev_capabilities aesni_mb_capabilities[] = {
 	{	/* MD5 HMAC */
 		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
@@ -722,8 +735,6 @@ static const struct rte_cryptodev_capabilities aesni_mb_capabilities[] = {
 	RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST()
 };
 
-uint8_t pmd_driver_id_aesni_mb;
-
 struct aesni_mb_qp_data {
 	uint8_t temp_digests[IMB_MAX_JOBS][DIGEST_LENGTH_MAX];
 	/* *< Buffers used to store the digest generated
drivers/crypto/ipsec_mb/pmd_chacha_poly.c +5 -335

356 lines not on this page · raw message

drivers/crypto/ipsec_mb/pmd_chacha_poly_priv.h +0 -28
index 0eca63ca47..e668bfe07f 100644
@@ -7,9 +7,7 @@
 
 #include "ipsec_mb_private.h"
 
-#define CHACHA20_POLY1305_IV_LENGTH 12
 #define CHACHA20_POLY1305_DIGEST_LENGTH 16
-#define CHACHA20_POLY1305_KEY_SIZE  32
 
 static const
 struct rte_cryptodev_capabilities chacha20_poly1305_capabilities[] = {
@@ -45,30 +43,4 @@ struct rte_cryptodev_capabilities chacha20_poly1305_capabilities[] = {
 
 uint8_t pmd_driver_id_chacha20_poly1305;
 
-/** CHACHA20 POLY1305 private session structure */
-struct __rte_cache_aligned chacha20_poly1305_session {
-	struct {
-		uint16_t length;
-		uint16_t offset;
-	} iv;
-	/**< IV parameters */
-	uint16_t aad_length;
-	/**< AAD length */
-	uint16_t req_digest_length;
-	/**< Requested digest length */
-	uint16_t gen_digest_length;
-	/**< Generated digest length */
-	uint8_t key[CHACHA20_POLY1305_KEY_SIZE];
-	enum ipsec_mb_operation op;
-};
-
-struct chacha20_poly1305_qp_data {
-	struct chacha20_poly1305_context_data chacha20_poly1305_ctx_data;
-	uint8_t temp_digest[CHACHA20_POLY1305_DIGEST_LENGTH];
-	/**< Buffer used to store the digest generated
-	 * by the driver when verifying a digest provided
-	 * by the user (using authentication verify operation)
-	 */
-};
-
 #endif /* _PMD_CHACHA_POLY_PRIV_H_ */
drivers/crypto/ipsec_mb/pmd_kasumi.c +5 -404

425 lines not on this page · raw message

drivers/crypto/ipsec_mb/pmd_kasumi_priv.h +0 -20
index c2e28eaeda..3223cf1a14 100644
@@ -9,8 +9,6 @@
 
 #define KASUMI_KEY_LENGTH 16
 #define KASUMI_IV_LENGTH 8
-#define KASUMI_MAX_BURST 4
-#define BYTE_LEN 8
 #define KASUMI_DIGEST_LENGTH 4
 
 uint8_t pmd_driver_id_kasumi;
@@ -60,22 +58,4 @@ static const struct rte_cryptodev_capabilities kasumi_capabilities[] = {
 	RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST()
 };
 
-/** KASUMI private session structure */
-struct __rte_cache_aligned kasumi_session {
-	/* Keys have to be 16-byte aligned */
-	kasumi_key_sched_t pKeySched_cipher;
-	kasumi_key_sched_t pKeySched_hash;
-	enum ipsec_mb_operation op;
-	enum rte_crypto_auth_operation auth_op;
-	uint16_t cipher_iv_offset;
-};
-
-struct kasumi_qp_data {
-	uint8_t temp_digest[KASUMI_DIGEST_LENGTH];
-	/* *< Buffers used to store the digest generated
-	 * by the driver when verifying a digest provided
-	 * by the user (using authentication verify operation)
-	 */
-};
-
 #endif /* _PMD_KASUMI_PRIV_H_ */
Signature · 1 line
2.25.1
Applied
#4 lore raw

RE: [EXTERNAL] [PATCH v2 1/1] crypto/ipsec_mb: unify some IPsec MB PMDs

Quoted 8 lines

Currently IPsec MB provides both the JOB API and direct API. AESNI_MB PMD is using the JOB API codepath while KASUMI and CHACHA20_POLY1305 are using the direct API.
Instead of using the direct API for these PMDs, they should now make use of the JOB API codepath. This would remove all use of the IPsec MB direct API for these PMDs.

Applied to dpdk-next-crypto
Pablo's ack taken from v1.

Wathsala, I hope this is tested for ARM repo.

Acked-by on v1 1/1
#5 lore raw

RE: [PATCH v1 1/1] crypto/ipsec_mb: unify some IPsec MB PMDs

In reply to Brian Dooley
Quoted 18 lines

-----Original Message-----
From: Dooley, Brian <[email protected]>
Sent: Wednesday, June 5, 2024 10:54 AM
To: Ji, Kai <[email protected]>; De Lara Guarch, Pablo <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; Dooley, Brian <[email protected]>
Subject: [PATCH v1 1/1] crypto/ipsec_mb: unify some IPsec MB PMDs

Currently IPsec MB provides both the JOB API and direct API. AESNI_MB PMD is using the JOB API codepath while KASUMI and CHACHA20_POLY1305 are using the direct API.
Instead of using the direct API for these PMDs, they should now make use of the JOB API codepath. This would remove all use of the IPsec MB direct API for these PMDs.

Quoted 2 lines

---

#6 lore raw

RE: [PATCH v1 1/1] crypto/ipsec_mb: unify some IPsec MB PMDs

Hi Pablo,

Quoted 9 lines
Quoted 9 lines

Subject: [PATCH v1 1/1] crypto/ipsec_mb: unify some IPsec MB PMDs

Currently IPsec MB provides both the JOB API and direct API. AESNI_MB PMD is using the JOB API codepath while KASUMI and CHACHA20_POLY1305 are using the direct API.
Instead of using the direct API for these PMDs, they should now make use of the JOB API codepath. This would remove all use of the IPsec MB direct API for these PMDs.

Quoted 4 lines
Quoted 2 lines

---

V2 is sent for this patch. Please check that too.
https://patches.dpdk.org/project/dpdk/patch/[email protected]/