qat: addition of optimized content descriptor for AES128-SHA1-HMAC
PATCH 1/1 qat: addition of optimized content descriptor for AES128-SHA1-HMAC
Adding an optimized content descriptor for AES128-SHA1-HMAC to improve thoughput performance.
--- drivers/crypto/qat/qat_adf/qat_algs.h | 7 ++ drivers/crypto/qat/qat_adf/qat_algs_build_desc.c | 91 ++++++++++++++++++++++++ drivers/crypto/qat/qat_crypto.c | 64 +++++++++++++---- drivers/crypto/qat/qat_crypto.h | 4 ++ 4 files changed, 154 insertions(+), 12 deletions(-)
drivers/crypto/qat/qat_adf/qat_algs.h +7 -0
@@ -127,4 +127,11 @@ void qat_alg_ablkcipher_init_dec(struct qat_alg_ablkcipher_cd *cd,int qat_alg_validate_aes_key (int key_len,enum icp_qat_hw_cipher_algo *alg);int qat_alg_validate_snow3g_key (int key_len,enum icp_qat_hw_cipher_algo *alg); +int qat_crypto_sym_use_optimized_alg (struct qat_session *session); +int qat_crypto_create_optimzed_session (struct qat_session *session, +uint8_t *cipherkey, +uint32_t cipherkeylen, +uint8_t *authkey, +uint32_t authkeylen, +uint32_t digestsize);#endif
drivers/crypto/qat/qat_adf/qat_algs_build_desc.c +91 -0
103 lines not on this page · raw message
drivers/crypto/qat/qat_crypto.c +52 -12
104 lines not on this page · raw message
drivers/crypto/qat/qat_crypto.h +4 -0
@@ -120,6 +120,10 @@ void * qat_crypto_sym_configure_session_cipher(struct rte_cryptodev *dev, struct rte_crypto_sym_xform *xform, void *session_private); +struct qat_session * +qat_crypto_sym_configure_optimized_session (struct rte_cryptodev *dev, +struct rte_crypto_sym_xform *xform, +struct qat_session *session);extern void qat_crypto_sym_clear_session (struct rte_cryptodev *dev,void *session);
Signature · 1 line
2.1.0
Hi,
I'm not used to review crypto patches but I think this patch can be improved.
2016-06-21 13:55, John Griffin:
Quoted 2 lines
Adding an optimized content descriptor for AES128-SHA1-HMAC to improve thoughput performance.
Maybe you can explain how it improves the performance.
Quoted 5 lines
drivers/crypto/qat/qat_adf/qat_algs_build_desc.c +5
-0+/* +* Function which will return if it's possible to use the +* optimised content descriptor. +*/ +int qat_crypto_sym_use_optimized_alg (struct qat_session *session)
[...]
drivers/crypto/qat/qat_adf/qat_algs_build_desc.c int qat_alg_aead_session_create_content_desc_auth(struct qat_session *cdesc, · line 767
Quoted 4 lines
drivers/crypto/qat/qat_adf/qat_algs_build_desc.c +4
-0+/* +* Function to create an optimised content descriptor for AES128 SHA1. +*/ +int qat_crypto_create_optimzed_session(struct qat_session *session,
These function are very specific with a generic name. Maybe that CBC AES128 SHA1 or something like that must be part of the function name.
Otherwise you will come with yet another crypto refactoring patch in few weeks.
Quoted 24 lines
drivers/crypto/qat/qat_crypto.c +12
-6case ICP_QAT_FW_LA_CMD_CIPHER : - session =qat_crypto_sym_configure_session_cipher (dev, xform, session); + session =qat_crypto_sym_configure_session_cipher (dev, xform, + session);break ;case ICP_QAT_FW_LA_CMD_AUTH : - session =qat_crypto_sym_configure_session_auth (dev, xform, session); + session =qat_crypto_sym_configure_session_auth (dev, xform, + session);break ;case ICP_QAT_FW_LA_CMD_CIPHER_HASH : - session =qat_crypto_sym_configure_session_cipher (dev, xform, session); - session =qat_crypto_sym_configure_session_auth (dev, xform, session); -break ; + session =qat_crypto_sym_configure_session_cipher (dev, xform, + session); + session =qat_crypto_sym_configure_session_auth (dev, xform, + session); +if (qat_crypto_sym_use_optimized_alg (session)) +qat_crypto_sym_configure_optimized_session (dev, xform, + session); +break ;case ICP_QAT_FW_LA_CMD_HASH_CIPHER : - session =qat_crypto_sym_configure_session_auth (dev, xform, session);
drivers/crypto/qat/qat_crypto.c qat_crypto_sym_configure_session(struct rte_cryptodev *dev, · line 485
Quoted 10 lines
drivers/crypto/qat/qat_crypto.c +8
-2- session =qat_crypto_sym_configure_session_cipher (dev, xform, session); -break ; + session =qat_crypto_sym_configure_session_auth (dev, xform, + session); + session =qat_crypto_sym_configure_session_cipher (dev, xform, + session); +if (qat_crypto_sym_use_optimized_alg (session)) +qat_crypto_sym_configure_optimized_session (dev, xform, + session); +break ;
There is a lot of indent fixing mixed with the addition here. 2 patches would make things easier to understand.
drivers/crypto/qat/qat_crypto.c qat_crypto_sym_configure_session_auth(struct rte_cryptodev *dev, · line 599
Quoted 11 lines
drivers/crypto/qat/qat_crypto.c +1
-1@@ -551,11 +591,11 @@ qat_crypto_sym_configure_session_auth(struct rte_cryptodev *dev, auth_xform->algo); goto error_out; } - cipher_xform =qat_get_cipher_xform (xform);if ((session->qat_hash_alg ==ICP_QAT_HW_AUTH_ALGO_GALOIS_128 ) || (session->qat_hash_alg ==ICP_QAT_HW_AUTH_ALGO_GALOIS_64 )) { + cipher_xform =qat_get_cipher_xform (xform); if (qat_alg_aead_session_create_content_desc_auth(session,
How this move is related to the patch?
Hi Thomas,
Quoted 11 lines
-----Original Message-----
From: Thomas Monjalon [mailto:[email protected]]
Sent: Tuesday, June 21, 2016 2:50 PM
To: Griffin, John <[email protected]>
Cc: [email protected]; Jain, Deepak K <[email protected]>; De Lara Guarch, Pablo <[email protected]>
Subject: Re: [dpdk-dev] [PATCH] qat: addition of optimized content descriptor for AES128-SHA1-HMACHi,
Quoted 8 lines
I'm not used to review crypto patches but I think this patch can be improved.
2016-06-21 13:55, John Griffin:
Quoted 1 line
Adding an optimized content descriptor for AES128-SHA1-HMAC to
improve
Quoted 1 line
thoughput performance.
Maybe you can explain how it improves the performance.
[JFG] Can add some text- it's though a reduction in the amount of the session information which DMA'ed to the device - helps to reduce PCIe b/w. I'll add some text.
Quoted 7 lines
Quoted 6 lines
drivers/crypto/qat/qat_adf/qat_algs_build_desc.c +5
-0+/* +* Function which will return if it's possible to use the +* optimised content descriptor. +*/ +int qat_crypto_sym_use_optimized_alg (struct qat_session *session)[...]
Quoted 10 lines
drivers/crypto/qat/qat_adf/qat_algs_build_desc.c int qat_alg_aead_session_create_content_desc_auth(struct qat_session *cdesc, · line 767
Quoted 4 lines
drivers/crypto/qat/qat_adf/qat_algs_build_desc.c +4
-0+/* +* Function to create an optimised content descriptor for AES128 SHA1. +*/ +int qat_crypto_create_optimzed_session(struct qat_session *session,These function are very specific with a generic name.
Maybe that CBC AES128 SHA1 or something like that must be part of the function name.
Otherwise you will come with yet another crypto refactoring patch in few weeks.
[JFG]
[JFG] Ok - I might not rename, but I'll make the implementation more generic to all it cope better with the potential addition of other algorithms.
Quoted 47 lines
Review
Quoted 3 lines
(quoted diff) +0
-1case ICP_QAT_FW_LA_CMD_CIPHER: - session = qat_crypto_sym_configure_session_cipher(dev, xform,session);
Review
Quoted 1 line
(quoted diff) +1
-0+ session = qat_crypto_sym_configure_session_cipher(dev,xform,
drivers/crypto/qat/qat_crypto.c qat_crypto_sym_configure_session(struct rte_cryptodev *dev,
Quoted 4 lines
drivers/crypto/qat/qat_crypto.c +1
-1+ session);break ;case ICP_QAT_FW_LA_CMD_AUTH : - session = qat_crypto_sym_configure_session_auth(dev, xform,session);
Review
Quoted 1 line
(quoted diff) +1
-0+ session = qat_crypto_sym_configure_session_auth(dev,xform,
drivers/crypto/qat/qat_crypto.c qat_crypto_sym_configure_session(struct rte_cryptodev *dev,
Quoted 4 lines
drivers/crypto/qat/qat_crypto.c +1
-1+ session);break ;case ICP_QAT_FW_LA_CMD_CIPHER_HASH : - session = qat_crypto_sym_configure_session_cipher(dev, xform,session);
Review
Quoted 1 line
(quoted diff) +0
-1- session = qat_crypto_sym_configure_session_auth(dev, xform,session);
Review
Quoted 2 lines
(quoted diff) +1
-1- break; + session = qat_crypto_sym_configure_session_cipher(dev,xform,
Review
Quoted 2 lines
(quoted diff) +2
-0+ session); + session = qat_crypto_sym_configure_session_auth(dev,xform,
drivers/crypto/qat/qat_crypto.c qat_crypto_sym_configure_session(struct rte_cryptodev *dev,
Quoted 3 lines
drivers/crypto/qat/qat_crypto.c +3
-0+ session); +if (qat_crypto_sym_use_optimized_alg (session)) + qat_crypto_sym_configure_optimized_session(dev,xform,
drivers/crypto/qat/qat_crypto.c qat_crypto_sym_configure_session(struct rte_cryptodev *dev,
Quoted 4 lines
drivers/crypto/qat/qat_crypto.c +2
-1+ session); +break ;case ICP_QAT_FW_LA_CMD_HASH_CIPHER : - session = qat_crypto_sym_configure_session_auth(dev, xform,session);
Review
Quoted 1 line
(quoted diff) +0
-1- session = qat_crypto_sym_configure_session_cipher(dev, xform,session);
Review
Quoted 2 lines
(quoted diff) +1
-1- break; + session = qat_crypto_sym_configure_session_auth(dev,xform,
Review
Quoted 2 lines
(quoted diff) +2
-0+ session); + session = qat_crypto_sym_configure_session_cipher(dev,xform,
drivers/crypto/qat/qat_crypto.c qat_crypto_sym_configure_session(struct rte_cryptodev *dev,
Quoted 3 lines
drivers/crypto/qat/qat_crypto.c +3
-0+ session); +if (qat_crypto_sym_use_optimized_alg (session)) + qat_crypto_sym_configure_optimized_session(dev,xform,
Quoted 5 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ session); + break;There is a lot of indent fixing mixed with the addition here. 2 patches would make things easier to understand.
[JFG]
[JFG] Ok let me remove from this patch.
Quoted 10 lines
Review qat_crypto_sym_configure_session_auth(struct
Quoted 2 lines
(quoted diff) +0
-0@@ -551,11 +591,11 @@ qat_crypto_sym_configure_session_auth(struct
rte_cryptodev*dev,drivers/crypto/qat/qat_crypto.c qat_crypto_sym_configure_session_auth(struct rte_cryptodev *dev,
Quoted 6 lines
drivers/crypto/qat/qat_crypto.c +0
-1auth_xform->algo); goto error_out; } - cipher_xform =qat_get_cipher_xform (xform); if ((session->qat_hash_alg ==
ICP_QAT_HW_AUTH_ALGO_GALOIS_128) ||
Quoted 7 lines
drivers/crypto/qat/qat_crypto.c qat_crypto_sym_configure_session_auth(struct rte_cryptodev *dev,
Quoted 4 lines
drivers/crypto/qat/qat_crypto.c +1
-0(session->qat_hash_alg == ICP_QAT_HW_AUTH_ALGO_GALOIS_64)) { + cipher_xform =qat_get_cipher_xform (xform); if(qat_alg_aead_session_create_content_desc_auth(session,
How this move is related to the patch?
[JFG] It's not tbh - I'll remove from this patch.