Re: [PATCH v2 06/10] crypto: caam - refactor caam_jr_enqueue

From: Horia Geanta
Date: Wed Jan 08 2020 - 11:59:58 EST


On 1/3/2020 3:04 AM, Iuliana Prodan wrote:
> Added a new struct - caam_{skcipher, akcipher, ahash, aead}_request_entry,
> to keep each request information. This has a specific crypto request and
> a bool to check if the request has backlog flag or not.
> This struct is passed to CAAM, via enqueue function - caam_jr_enqueue.
>
> This is done for later use, on backlogging support in CAAM.
[...]
> diff --git a/drivers/crypto/caam/caamalg.c b/drivers/crypto/caam/caamalg.c
> index 21b6172..34662b4 100644
> --- a/drivers/crypto/caam/caamalg.c
> +++ b/drivers/crypto/caam/caamalg.c
> @@ -871,6 +871,17 @@ static int xts_skcipher_setkey(struct crypto_skcipher *skcipher, const u8 *key,
> }
>
> /*
> + * caam_aead_request_entry - storage for tracking each aead request
> + * that is processed by a ring
> + * @base: common attributes for aead requests
> + * @bklog: stored to determine if the request needs backlog
> + */
> +struct caam_aead_request_entry {
> + struct aead_request *base;
> + bool bklog;
> +};
> +
> +/*
> * aead_edesc - s/w-extended aead descriptor
> * @src_nents: number of segments in input s/w scatterlist
> * @dst_nents: number of segments in output s/w scatterlist
> @@ -878,6 +889,7 @@ static int xts_skcipher_setkey(struct crypto_skcipher *skcipher, const u8 *key,
> * @mapped_dst_nents: number of segments in output h/w link table
> * @sec4_sg_bytes: length of dma mapped sec4_sg space
> * @sec4_sg_dma: bus physical mapped address of h/w link table
> + * @jrentry: information about the current request that is processed by a ring
> * @sec4_sg: pointer to h/w link table
> * @hw_desc: the h/w job descriptor followed by any referenced link tables
> */
> @@ -888,11 +900,23 @@ struct aead_edesc {
> int mapped_dst_nents;
> int sec4_sg_bytes;
> dma_addr_t sec4_sg_dma;
> + struct caam_aead_request_entry jrentry;
> struct sec4_sg_entry *sec4_sg;
> u32 hw_desc[];
> };
>
Now that most of the backlogging logic moved from the backend (jr.c)
to frontends (caamalg.c, caamhash.c etc.), it looks like there's no need for
all the *_request_entry structures.
Instead, bklog flag could be added directly into the corresponding
*_edesc structure.

Horia