Re: [PATCH] crypto: hisilicon/sec2 - implement full backlog mode for sec
From: Herbert Xu
Date: Fri Jul 18 2025 - 07:13:04 EST
On Thu, Jul 10, 2025 at 08:24:57PM +0800, Chenghai Huang wrote:
> From: Wenkai Lin <linwenkai6@xxxxxxxxxxxxx>
>
> This patch introduces a hierarchical backlog mechanism to cache
> user data in high-throughput encryption/decryption scenarios,
> the implementation addresses packet loss issues when hardware
> queues overflow during peak loads.
>
> First, we use sec_alloc_req_id to obtain an exclusive resource
> from the pre-allocated resource pool of each queue, if no resource
> is allocated, perform the DMA map operation on the request memory.
>
> When the task is ready, we will attempt to send it to the hardware,
> if the hardware queue is already full, we cache the request into
> the backlog list, then return an EBUSY status to the upper layer
> and instruct the packet-sending thread to pause transmission.
> Simultaneously, when the hardware completes a task, it triggers
> the sec callback function, within this function, reattempt to send
> the requests from the backlog list and wake up the sending thread
> until the hardware queue becomes fully occupied again.
>
> In addition, it handles such exceptions like the hardware is reset
> when packets are sent, it will switch to the software computing
> and release occupied resources.
>
> Signed-off-by: Wenkai Lin <linwenkai6@xxxxxxxxxxxxx>
> Signed-off-by: Chenghai Huang <huangchenghai2@xxxxxxxxxx>
> ---
> drivers/crypto/hisilicon/sec2/sec.h | 63 ++-
> drivers/crypto/hisilicon/sec2/sec_crypto.c | 574 ++++++++++++++-------
> 2 files changed, 457 insertions(+), 180 deletions(-)
Patch applied. Thanks.
--
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt