diff --git a/drivers/crypto/hisilicon/hpre/hpre.h b/drivers/crypto/hisilicon/hpre/hpre.h index 203eb2ac1e67d826bf832f02153999faeaa71d58..14d60b48afc1fc1f0b6668f9d8d44f1b7841ba33 100644 --- a/drivers/crypto/hisilicon/hpre/hpre.h +++ b/drivers/crypto/hisilicon/hpre/hpre.h @@ -32,6 +32,7 @@ enum hpre_dfx_dbgfs_file { HPRE_SEND_BUSY_CNT, HPRE_OVER_THRHLD_CNT, HPRE_OVERTIME_THRHLD, + HPRE_INVALID_REQ_CNT, HPRE_DFX_FILE_NUM }; diff --git a/drivers/crypto/hisilicon/hpre/hpre_crypto.c b/drivers/crypto/hisilicon/hpre/hpre_crypto.c index b68b30c886adba3d0f372cd9f31411cd5effdf1a..5031d64789e68c5f3e5044d1e01df6a4dc44252b 100644 --- a/drivers/crypto/hisilicon/hpre/hpre_crypto.c +++ b/drivers/crypto/hisilicon/hpre/hpre_crypto.c @@ -414,9 +414,17 @@ static void hpre_rsa_cb(struct hpre_ctx *ctx, void *resp) static void hpre_alg_cb(struct hisi_qp *qp, void *resp) { struct hpre_ctx *ctx = qp->qp_ctx; + struct hpre_dfx *dfx = ctx->hpre->debug.dfx; struct hpre_sqe *sqe = resp; + struct hpre_asym_request *req = ctx->req_list[le16_to_cpu(sqe->tag)]; + + + if (unlikely(!req)) { + atomic64_inc(&dfx[HPRE_INVALID_REQ_CNT].value); + return; + } - ctx->req_list[le16_to_cpu(sqe->tag)]->cb(ctx, resp); + req->cb(ctx, resp); } static int hpre_ctx_init(struct hpre_ctx *ctx) diff --git a/drivers/crypto/hisilicon/hpre/hpre_main.c b/drivers/crypto/hisilicon/hpre/hpre_main.c index 22f623945b0b0b3811913afbf2b6f9632005ed13..6c5dc53c92fa637ba4961276d32ec6e443016b5b 100644 --- a/drivers/crypto/hisilicon/hpre/hpre_main.c +++ b/drivers/crypto/hisilicon/hpre/hpre_main.c @@ -178,7 +178,8 @@ static const char *hpre_dfx_files[HPRE_DFX_FILE_NUM] = { "send_fail_cnt", "send_busy_cnt", "over_thrhld_cnt", - "overtime_thrhld" + "overtime_thrhld", + "invalid_req_cnt" }; #ifdef CONFIG_CRYPTO_QM_UACCE