optimization for crypto request processing
cover optimization for crypto request processing
Hi,
This patch optimizes for crypto request processing in crypto engine by reducing the number of source BDs for Broadcom FlexSparc device.
The patch has been tested on FlexSparc device.
Regards,
Vikas
Vikas Gupta (1):
crypto/bcmfs: optimize crypto request processing
drivers/crypto/bcmfs/bcmfs_sym_defs.h | 5 + drivers/crypto/bcmfs/bcmfs_sym_engine.c | 220 +++++++++++++----------- drivers/crypto/bcmfs/bcmfs_sym_pmd.c | 6 +- drivers/crypto/bcmfs/bcmfs_sym_req.h | 29 ++-- 4 files changed, 138 insertions(+), 122 deletions(-)
Signature · 1 line
2.17.1
PATCH 1/1 crypto/bcmfs: optimize crypto request processing
Reduce number of source BDs to submit a request to crypto engine. This improves the performance as crypto engine fetches all the BDs in single cycle. Adjust optional metadata (OMD) in continuation of fixed meta data (FMD).
--- drivers/crypto/bcmfs/bcmfs_sym_defs.h | 5 + drivers/crypto/bcmfs/bcmfs_sym_engine.c | 220 +++++++++++++----------- drivers/crypto/bcmfs/bcmfs_sym_pmd.c | 6 +- drivers/crypto/bcmfs/bcmfs_sym_req.h | 29 ++-- 4 files changed, 138 insertions(+), 122 deletions(-)
drivers/crypto/bcmfs/bcmfs_sym_defs.h +5 -0
@@ -27,6 +27,11 @@ struct bcmfs_sym_request;/** Crypot Request processing hash tag check error. */ #define BCMFS_SYM_RESPONSE_HASH_TAG_ERROR (3) +/** Maximum threshold length to adjust AAD in continuation +* with source BD of (FMD + OMD) +*/ +#define BCMFS_AAD_THRESH_LEN 64 + int bcmfs_process_sym_crypto_op(struct rte_crypto_op *op, struct bcmfs_sym_session *sess,
drivers/crypto/bcmfs/bcmfs_sym_engine.c +115 -105
389 lines not on this page · raw message
drivers/crypto/bcmfs/bcmfs_sym_pmd.c +2 -4
@@ -132,10 +132,8 @@ static void spu_req_init(struct bcmfs_sym_request *sr, rte_iova_t iova __rte_unused) { memset(sr, 0, sizeof(*sr)); - sr->fptr = iova; - sr->cptr = iova + offsetof(struct bcmfs_sym_request , cipher_key); - sr->aptr = iova + offsetof(struct bcmfs_sym_request , auth_key); - sr->iptr = iova + offsetof(struct bcmfs_sym_request , iv); + sr->fptr = iova + offsetof(struct bcmfs_sym_request , fmd); + sr->optr = iova + offsetof(struct bcmfs_sym_request , omd); sr->dptr = iova + offsetof(struct bcmfs_sym_request , digest); sr->rptr = iova + offsetof(struct bcmfs_sym_request , resp); }
drivers/crypto/bcmfs/bcmfs_sym_req.h +16 -13
@@ -11,6 +11,14 @@#include "bcmfs_dev_msg.h" #include "bcmfs_sym_defs.h" +/** Max variable length. Since we adjust AAD +* in same BD if it is less than BCMFS_AAD_THRESH_LEN +* so we add it here. +*/ +#define BCMFS_MAX_OMDMD_LEN ((2 * (BCMFS_MAX_KEY_SIZE)) + \ + (2 * (BCMFS_MAX_IV_SIZE)) + \ + (BCMFS_AAD_THRESH_LEN)) +/* Fixed SPU2 Metadata */ struct spu2_fmd {uint64_t ctrl0;
@@ -24,14 +32,14 @@ struct spu2_fmd {* rte_crypto_op */ struct bcmfs_sym_request { +/* +* Only single BD for metadata so +* FMD + OMD must be in continuation +*/ /* spu2 engine related data */ struct spu2_fmd fmd; -/* cipher key */ -uint8_t cipher_key[BCMFS_MAX_KEY_SIZE ]; -/* auth key */ -uint8_t auth_key[BCMFS_MAX_KEY_SIZE ]; -/* iv key */ -uint8_t iv[BCMFS_MAX_IV_SIZE ]; +/* variable metadata in continuation with fmd */ +uint8_t omd[BCMFS_MAX_OMDMD_LEN ];/* digest data output from crypto h/w */ uint8_t digest[BCMFS_MAX_DIGEST_SIZE ];/* 2-Bytes response from crypto h/w */
@@ -42,17 +50,12 @@ struct bcmfs_sym_request {*/ /* iova for fmd */ rte_iova_t fptr; -/* iova for cipher key */ -rte_iova_t cptr; -/* iova for auth key */ -rte_iova_t aptr; -/* iova for iv key */ -rte_iova_t iptr; +/* iova for omd */ +rte_iova_t optr;/* iova for digest */ rte_iova_t dptr;/* iova for response */ rte_iova_t rptr; -/* bcmfs qp message for h/w queues to process */ struct bcmfs_qp_message msgs;/* crypto op */
Signature · 1 line
2.17.1
v2 cover optimization for crypto request processing
In reply to Vikas GuptaHi,
This patch optimizes for crypto request processing in crypto engine by reducing the number of source BDs for Broadcom FlexSparc device.
The patch has been tested on FlexSparc device.
Regards,
Vikas
Changes from: v1->v2
Rebase the patch with latest dpdk-next-crypto
Vikas Gupta (1):
crypto/bcmfs: optimize crypto request processing
drivers/crypto/bcmfs/bcmfs_sym_defs.h | 5 + drivers/crypto/bcmfs/bcmfs_sym_engine.c | 220 +++++++++++++----------- drivers/crypto/bcmfs/bcmfs_sym_pmd.c | 6 +- drivers/crypto/bcmfs/bcmfs_sym_req.h | 29 ++-- 4 files changed, 138 insertions(+), 122 deletions(-)
Signature · 1 line
2.17.1
PATCH v2 1/1 crypto/bcmfs: optimize crypto request processing
Reduce number of source BDs to submit a request to crypto engine. This improves the performance as crypto engine fetches all the BDs in single cycle. Adjust optional metadata (OMD) in continuation of fixed meta data (FMD).
--- drivers/crypto/bcmfs/bcmfs_sym_defs.h | 5 + drivers/crypto/bcmfs/bcmfs_sym_engine.c | 220 +++++++++++++----------- drivers/crypto/bcmfs/bcmfs_sym_pmd.c | 6 +- drivers/crypto/bcmfs/bcmfs_sym_req.h | 29 ++-- 4 files changed, 138 insertions(+), 122 deletions(-)
drivers/crypto/bcmfs/bcmfs_sym_defs.h +5 -0
@@ -27,6 +27,11 @@ struct bcmfs_sym_request;/** Crypot Request processing hash tag check error. */ #define BCMFS_SYM_RESPONSE_HASH_TAG_ERROR (3) +/** Maximum threshold length to adjust AAD in continuation +* with source BD of (FMD + OMD) +*/ +#define BCMFS_AAD_THRESH_LEN 64 + int bcmfs_process_sym_crypto_op(struct rte_crypto_op *op, struct bcmfs_sym_session *sess,
drivers/crypto/bcmfs/bcmfs_sym_engine.c +115 -105
389 lines not on this page · raw message
drivers/crypto/bcmfs/bcmfs_sym_pmd.c +2 -4
@@ -132,10 +132,8 @@ static void spu_req_init(struct bcmfs_sym_request *sr, rte_iova_t iova __rte_unused) { memset(sr, 0, sizeof(*sr)); - sr->fptr = iova; - sr->cptr = iova + offsetof(struct bcmfs_sym_request , cipher_key); - sr->aptr = iova + offsetof(struct bcmfs_sym_request , auth_key); - sr->iptr = iova + offsetof(struct bcmfs_sym_request , iv); + sr->fptr = iova + offsetof(struct bcmfs_sym_request , fmd); + sr->optr = iova + offsetof(struct bcmfs_sym_request , omd); sr->dptr = iova + offsetof(struct bcmfs_sym_request , digest); sr->rptr = iova + offsetof(struct bcmfs_sym_request , resp); }
drivers/crypto/bcmfs/bcmfs_sym_req.h +16 -13
@@ -11,6 +11,14 @@#include "bcmfs_dev_msg.h" #include "bcmfs_sym_defs.h" +/** Max variable length. Since we adjust AAD +* in same BD if it is less than BCMFS_AAD_THRESH_LEN +* so we add it here. +*/ +#define BCMFS_MAX_OMDMD_LEN ((2 * (BCMFS_MAX_KEY_SIZE)) + \ + (2 * (BCMFS_MAX_IV_SIZE)) + \ + (BCMFS_AAD_THRESH_LEN)) +/* Fixed SPU2 Metadata */ struct spu2_fmd {uint64_t ctrl0;
@@ -24,14 +32,14 @@ struct spu2_fmd {* rte_crypto_op */ struct bcmfs_sym_request { +/* +* Only single BD for metadata so +* FMD + OMD must be in continuation +*/ /* spu2 engine related data */ struct spu2_fmd fmd; -/* cipher key */ -uint8_t cipher_key[BCMFS_MAX_KEY_SIZE ]; -/* auth key */ -uint8_t auth_key[BCMFS_MAX_KEY_SIZE ]; -/* iv key */ -uint8_t iv[BCMFS_MAX_IV_SIZE ]; +/* variable metadata in continuation with fmd */ +uint8_t omd[BCMFS_MAX_OMDMD_LEN ];/* digest data output from crypto h/w */ uint8_t digest[BCMFS_MAX_DIGEST_SIZE ];/* 2-Bytes response from crypto h/w */
@@ -42,17 +50,12 @@ struct bcmfs_sym_request {*/ /* iova for fmd */ rte_iova_t fptr; -/* iova for cipher key */ -rte_iova_t cptr; -/* iova for auth key */ -rte_iova_t aptr; -/* iova for iv key */ -rte_iova_t iptr; +/* iova for omd */ +rte_iova_t optr;/* iova for digest */ rte_iova_t dptr;/* iova for response */ rte_iova_t rptr; -/* bcmfs qp message for h/w queues to process */ struct bcmfs_qp_message msgs;/* crypto op */
Signature · 1 line
2.17.1
Akhil Goyal
AppliedRe: [dpdk-dev] [PATCH v2 1/1] crypto/bcmfs: optimize crypto request processing
Quoted 9 lines
Reduce number of source BDs to submit a request to crypto engine. This improves the performance as crypto engine fetches all the BDs in single cycle. Adjust optional metadata (OMD) in continuation of fixed meta data (FMD).
Signed-off-by Vikas Gupta <[email protected]>Signed-off-by Raveendra Padasalagi <[email protected]>Reviewed-by Ajit Khaparde <[email protected]>
Applied to dpdk-next-crypto
Thanks.