qat: change the session structure to be variable sized
PATCH 1/1 qat: change the session structure to be variable sized
This patch changes the qat session data structure sent to qat from a fixed size to a variable size which is dependent on the size of the chosen algorithm.
This reduces the amount of bytes which are transferred across PCIe and thus helps to increase qat performance when the accelerator is bound by PCIe.
--- drivers/crypto/qat/qat_adf/qat_algs.h | 5 +- drivers/crypto/qat/qat_adf/qat_algs_build_desc.c | 462 +++++++++-------------- drivers/crypto/qat/qat_crypto.c | 15 +- 3 files changed, 183 insertions(+), 299 deletions(-)
drivers/crypto/qat/qat_adf/qat_algs.h +4 -1
@@ -87,8 +87,10 @@ struct qat_session {enum icp_qat_hw_cipher_mode qat_mode;enum icp_qat_hw_auth_algo qat_hash_alg;struct qat_alg_cd cd; +uint8_t *cd_cur_ptr;phys_addr_t cd_paddr;struct icp_qat_fw_la_bulk_req fw_req; +uint8_t aad_len;struct qat_crypto_instance *inst;uint8_t salt[ICP_QAT_HW_AES_BLK_SZ ];rte_spinlock_t lock;/* protects this struct */
@@ -115,7 +117,8 @@ int qat_alg_aead_session_create_content_desc_auth(struct qat_session *cdesc,uint32_t digestsize, unsigned int operation); -void qat_alg_init_common_hdr (struct icp_qat_fw_comn_req_hdr *header); +void qat_alg_init_common_hdr (struct icp_qat_fw_comn_req_hdr *header, +uint16_t proto); void qat_alg_ablkcipher_init_enc(struct qat_alg_ablkcipher_cd *cd, int alg, const uint8_t *key,
drivers/crypto/qat/qat_adf/qat_algs_build_desc.c +178 -284
573 lines not on this page · raw message
drivers/crypto/qat/qat_crypto.c +1 -14
@@ -786,20 +786,9 @@ qat_write_hw_desc_entry(struct rte_crypto_op *op, uint8_t *out_msg) auth_param->auth_len >>=3 ; } auth_param->u1.aad_adr = op->sym->auth.aad.phys_addr; -/* (GCM) aad length(240 max) will be at this location after precompute */ +if (ctx->qat_hash_alg ==ICP_QAT_HW_AUTH_ALGO_GALOIS_128 || ctx->qat_hash_alg ==ICP_QAT_HW_AUTH_ALGO_GALOIS_64 ) { -struct icp_qat_hw_auth_algo_blk *hash; - -if (ctx->qat_cmd ==ICP_QAT_FW_LA_CMD_HASH_CIPHER ) - hash = (struct icp_qat_hw_auth_algo_blk *)((char *)&ctx->cd); -else - hash = (struct icp_qat_hw_auth_algo_blk *)((char *)&ctx->cd + -sizeof (struct icp_qat_hw_cipher_algo_blk )); - - auth_param->u2.aad_sz =ALIGN_POW2_ROUNDUP (hash->sha.state1[ -ICP_QAT_HW_GALOIS_128_STATE1_SZ + -ICP_QAT_HW_GALOIS_H_SZ +3 ],16 );if (op->sym->cipher.iv.length ==12 ) {/* * For GCM a 12 bit IV is allowed,
@@ -810,8 +799,6 @@ qat_write_hw_desc_entry(struct rte_crypto_op *op, uint8_t *out_msg) ICP_QAT_FW_LA_GCM_IV_LEN_12_OCTETS); } } - auth_param->hash_state_sz = (auth_param->u2.aad_sz) >>3 ; -#ifdef RTE_LIBRTE_PMD_QAT_DEBUG_TX rte_hexdump(stdout, "qat_req:", qat_req,
Signature · 1 line
2.1.0
Quoted 7 lines · John Griffin
This patch changes the qat session data structure sent to qat from a fixed size to a variable size which is dependent on the size of the chosen algorithm.
This reduces the amount of bytes which are transferred across PCIe and thus helps to increase qat performance when the accelerator is bound by PCIe.
Quoted 7 lines
Signed-off-by John Griffin <[email protected]>--- drivers/crypto/qat/qat_adf/qat_algs.h | 5 +- drivers/crypto/qat/qat_adf/qat_algs_build_desc.c | 462 +++++++++-------------- drivers/crypto/qat/qat_crypto.c | 15 +- 3 files changed, 183 insertions(+), 299 deletions(-)
Self-Nack compile issue on icc - will fix and send again.
PATCH 1/1 crypto/qat: make the session struct variable in size
In reply to John GriffinThis patch changes the qat firmware session data structure from a fixed size to a variable size which is dependent on the size of the chosen algorithm.
This reduces the amount of bytes which are transferred across PCIe and thus helps to increase qat performance when the accelerator is bound by PCIe.
---
v1:
* Fixed a compile issue with icc.
drivers/crypto/qat/qat_adf/qat_algs.h | 5 +- drivers/crypto/qat/qat_adf/qat_algs_build_desc.c | 463 +++++++++-------------- drivers/crypto/qat/qat_crypto.c | 15 +- 3 files changed, 184 insertions(+), 299 deletions(-)
drivers/crypto/qat/qat_adf/qat_algs.h +4 -1
@@ -87,8 +87,10 @@ struct qat_session {enum icp_qat_hw_cipher_mode qat_mode;enum icp_qat_hw_auth_algo qat_hash_alg;struct qat_alg_cd cd; +uint8_t *cd_cur_ptr;phys_addr_t cd_paddr;struct icp_qat_fw_la_bulk_req fw_req; +uint8_t aad_len;struct qat_crypto_instance *inst;uint8_t salt[ICP_QAT_HW_AES_BLK_SZ ];rte_spinlock_t lock;/* protects this struct */
@@ -115,7 +117,8 @@ int qat_alg_aead_session_create_content_desc_auth(struct qat_session *cdesc,uint32_t digestsize, unsigned int operation); -void qat_alg_init_common_hdr (struct icp_qat_fw_comn_req_hdr *header); +void qat_alg_init_common_hdr (struct icp_qat_fw_comn_req_hdr *header, +uint16_t proto); void qat_alg_ablkcipher_init_enc(struct qat_alg_ablkcipher_cd *cd, int alg, const uint8_t *key,
drivers/crypto/qat/qat_adf/qat_algs_build_desc.c +179 -284
574 lines not on this page · raw message
drivers/crypto/qat/qat_crypto.c +1 -14
@@ -786,20 +786,9 @@ qat_write_hw_desc_entry(struct rte_crypto_op *op, uint8_t *out_msg) auth_param->auth_len >>=3 ; } auth_param->u1.aad_adr = op->sym->auth.aad.phys_addr; -/* (GCM) aad length(240 max) will be at this location after precompute */ +if (ctx->qat_hash_alg ==ICP_QAT_HW_AUTH_ALGO_GALOIS_128 || ctx->qat_hash_alg ==ICP_QAT_HW_AUTH_ALGO_GALOIS_64 ) { -struct icp_qat_hw_auth_algo_blk *hash; - -if (ctx->qat_cmd ==ICP_QAT_FW_LA_CMD_HASH_CIPHER ) - hash = (struct icp_qat_hw_auth_algo_blk *)((char *)&ctx->cd); -else - hash = (struct icp_qat_hw_auth_algo_blk *)((char *)&ctx->cd + -sizeof (struct icp_qat_hw_cipher_algo_blk )); - - auth_param->u2.aad_sz =ALIGN_POW2_ROUNDUP (hash->sha.state1[ -ICP_QAT_HW_GALOIS_128_STATE1_SZ + -ICP_QAT_HW_GALOIS_H_SZ +3 ],16 );if (op->sym->cipher.iv.length ==12 ) {/* * For GCM a 12 bit IV is allowed,
@@ -810,8 +799,6 @@ qat_write_hw_desc_entry(struct rte_crypto_op *op, uint8_t *out_msg) ICP_QAT_FW_LA_GCM_IV_LEN_12_OCTETS); } } - auth_param->hash_state_sz = (auth_param->u2.aad_sz) >>3 ; -#ifdef RTE_LIBRTE_PMD_QAT_DEBUG_TX rte_hexdump(stdout, "qat_req:", qat_req,
Signature · 1 line
2.1.0
Re: [PATCH v1] crypto/qat: make the session struct variable in size
-----Original Message-----
From: Griffin, John
Sent: Thursday, August 4, 2016 4:46 PM
To: [email protected]
Cc: Griffin, John <[email protected]>; Trahe, Fiona <[email protected]>; Jain, Deepak K <[email protected]>; De Lara Guarch, Pablo <[email protected]>
Subject: [PATCH v1] crypto/qat: make the session struct variable in size
This patch changes the qat firmware session data structure from a fixed size to a variable size which is dependent on the size of the chosen algorithm. This reduces the amount of bytes which are transferred across PCIe and thus helps to increase qat performance when the accelerator is bound by PCIe.
---
v1:
* Fixed a compile issue with icc.
De Lara Guarch, Pablo
AppliedRe: [PATCH v1] crypto/qat: make the session struct variable in size
Quoted 25 lines
-----Original Message-----
From: Trahe, Fiona
Sent: Tuesday, August 09, 2016 6:30 AM
To: Griffin, John; [email protected]
Cc: Jain, Deepak K; De Lara Guarch, Pablo; Trahe, Fiona
Subject: RE: [PATCH v1]crypto/qat: make the session struct variable in size-----Original Message-----
From: Griffin, John
Sent: Thursday, August 4, 2016 4:46 PM
To: [email protected]
Cc: Griffin, John <[email protected]>; Trahe, Fiona <[email protected]>; Jain, Deepak K <[email protected]>; De Lara Guarch, Pablo <[email protected]>
Subject: [PATCH v1]crypto/qat: make the session struct variable in sizeThis patch changes the qat firmware session data structure from a fixed size to a variable size which is dependent on the size of the chosen algorithm. This reduces the amount of bytes which are transferred across PCIe and thus helps to increase qat performance when the accelerator is bound by PCIe.
Quoted 6 lines
Signed-off-by John Griffin <[email protected]>---
v1:
* Fixed a compile issue with icc.Acked-by Fiona Trahe <[email protected]>
Applied to dpdk-next-crypto.
Thanks,
Pablo