crypto: inside-secure - remove request list to improve performance
This patch main goal is to improve driver performance by moving the crypto request from a list to a RDR ring shadow. This is possible since there is one producer and one consume for this RDR request shadow and one ring descriptor is left unused. Doing this change eliminates the use of spinlock when accessing the descriptor ring and the need to dynamicaly allocate memory per crypto request. The crypto request is placed in the first RDR shadow descriptor only if there are enough descriptors, when the result handler is invoked, it fetches the first result descriptor from RDR shadow. Signed-off-by: Ofer Heifetz <oferh@marvell.com> Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
@@ -512,8 +512,7 @@ struct safexcel_desc_ring {
|
||||
void *write;
|
||||
void *read;
|
||||
|
||||
/* number of elements used in the ring */
|
||||
unsigned nr;
|
||||
/* descriptor element offset */
|
||||
unsigned offset;
|
||||
};
|
||||
|
||||
@@ -523,11 +522,6 @@ enum safexcel_alg_type {
|
||||
SAFEXCEL_ALG_TYPE_AHASH,
|
||||
};
|
||||
|
||||
struct safexcel_request {
|
||||
struct list_head list;
|
||||
struct crypto_async_request *req;
|
||||
};
|
||||
|
||||
struct safexcel_config {
|
||||
u32 pes;
|
||||
u32 rings;
|
||||
@@ -547,9 +541,7 @@ struct safexcel_work_data {
|
||||
|
||||
struct safexcel_ring {
|
||||
spinlock_t lock;
|
||||
spinlock_t egress_lock;
|
||||
|
||||
struct list_head list;
|
||||
struct workqueue_struct *workqueue;
|
||||
struct safexcel_work_data work_data;
|
||||
|
||||
@@ -557,6 +549,9 @@ struct safexcel_ring {
|
||||
struct safexcel_desc_ring cdr;
|
||||
struct safexcel_desc_ring rdr;
|
||||
|
||||
/* result ring crypto API request */
|
||||
struct crypto_async_request **rdr_req;
|
||||
|
||||
/* queue */
|
||||
struct crypto_queue queue;
|
||||
spinlock_t queue_lock;
|
||||
@@ -618,8 +613,7 @@ struct safexcel_crypto_priv {
|
||||
|
||||
struct safexcel_context {
|
||||
int (*send)(struct crypto_async_request *req, int ring,
|
||||
struct safexcel_request *request, int *commands,
|
||||
int *results);
|
||||
int *commands, int *results);
|
||||
int (*handle_result)(struct safexcel_crypto_priv *priv, int ring,
|
||||
struct crypto_async_request *req, bool *complete,
|
||||
int *ret);
|
||||
@@ -668,14 +662,14 @@ int safexcel_rdesc_check_errors(struct safexcel_crypto_priv *priv,
|
||||
void safexcel_complete(struct safexcel_crypto_priv *priv, int ring);
|
||||
int safexcel_invalidate_cache(struct crypto_async_request *async,
|
||||
struct safexcel_crypto_priv *priv,
|
||||
dma_addr_t ctxr_dma, int ring,
|
||||
struct safexcel_request *request);
|
||||
dma_addr_t ctxr_dma, int ring);
|
||||
int safexcel_init_ring_descriptors(struct safexcel_crypto_priv *priv,
|
||||
struct safexcel_desc_ring *cdr,
|
||||
struct safexcel_desc_ring *rdr);
|
||||
int safexcel_select_ring(struct safexcel_crypto_priv *priv);
|
||||
void *safexcel_ring_next_rptr(struct safexcel_crypto_priv *priv,
|
||||
struct safexcel_desc_ring *ring);
|
||||
void *safexcel_ring_first_rptr(struct safexcel_crypto_priv *priv, int ring);
|
||||
void safexcel_ring_rollback_wptr(struct safexcel_crypto_priv *priv,
|
||||
struct safexcel_desc_ring *ring);
|
||||
struct safexcel_command_desc *safexcel_add_cdesc(struct safexcel_crypto_priv *priv,
|
||||
@@ -688,6 +682,17 @@ struct safexcel_result_desc *safexcel_add_rdesc(struct safexcel_crypto_priv *pri
|
||||
int ring_id,
|
||||
bool first, bool last,
|
||||
dma_addr_t data, u32 len);
|
||||
int safexcel_ring_first_rdr_index(struct safexcel_crypto_priv *priv,
|
||||
int ring);
|
||||
int safexcel_ring_rdr_rdesc_index(struct safexcel_crypto_priv *priv,
|
||||
int ring,
|
||||
struct safexcel_result_desc *rdesc);
|
||||
void safexcel_rdr_req_set(struct safexcel_crypto_priv *priv,
|
||||
int ring,
|
||||
struct safexcel_result_desc *rdesc,
|
||||
struct crypto_async_request *req);
|
||||
inline struct crypto_async_request *
|
||||
safexcel_rdr_req_get(struct safexcel_crypto_priv *priv, int ring);
|
||||
void safexcel_inv_complete(struct crypto_async_request *req, int error);
|
||||
int safexcel_hmac_setkey(const char *alg, const u8 *key, unsigned int keylen,
|
||||
void *istate, void *ostate);
|
||||
|
Reference in New Issue
Block a user