diff --git a/drivers/crypto/hisilicon/qm.c b/drivers/crypto/hisilicon/qm.c index 36ea341aa5d5e6412cef228e4031ccb9efaf52d5..6355e3880e6b02b5731b2b9ad5acf300e2978024 100644 --- a/drivers/crypto/hisilicon/qm.c +++ b/drivers/crypto/hisilicon/qm.c @@ -390,9 +390,6 @@ static void qm_sq_head_update(struct hisi_qp *qp) qp->qp_status.sq_head = 0; else qp->qp_status.sq_head++; - - if (unlikely(test_bit(QP_FULL, &qp->qp_status.flags))) - clear_bit(QP_FULL, &qp->qp_status.flags); } static void qm_cq_head_update(struct hisi_qp *qp) @@ -1041,7 +1038,7 @@ static void *qm_get_avail_sqe(struct hisi_qp *qp) struct hisi_qp_status *qp_status = &qp->qp_status; u16 sq_tail = qp_status->sq_tail; - if (unlikely(test_bit(QP_FULL, &qp->qp_status.flags))) + if (unlikely(atomic_read(&qp->qp_status.used) == QM_Q_DEPTH)) return NULL; return qp->sqe + sq_tail * qp->qm->sqe_size; @@ -1341,6 +1338,8 @@ EXPORT_SYMBOL_GPL(hisi_qm_stop_qp); * * This function will return -EBUSY if qp is currently full, and -EAGAIN * if qp related qm is resetting. + * + * Note: Do not support concurrent call of this function. */ int hisi_qp_send(struct hisi_qp *qp, const void *msg) { @@ -1362,10 +1361,7 @@ int hisi_qp_send(struct hisi_qp *qp, const void *msg) qm_db(qp->qm, qp->qp_id, QM_DOORBELL_CMD_SQ, sq_tail_next, 0); atomic_inc(&qp->qp_status.used); - qp_status->sq_tail = sq_tail_next; - if (qp_status->sq_tail == qp_status->sq_head) - set_bit(QP_FULL, &qp->qp_status.flags); return 0; } diff --git a/drivers/crypto/hisilicon/qm.h b/drivers/crypto/hisilicon/qm.h index 42f76dbb3b24c7b3b332d26b3c2799cba6f82eea..643eb3d91d3fa66121866ca31535d7b507f7cb93 100644 --- a/drivers/crypto/hisilicon/qm.h +++ b/drivers/crypto/hisilicon/qm.h @@ -86,7 +86,6 @@ enum qm_state { enum qp_state { QP_STOP, - QP_FULL, }; enum qm_hw_ver { diff --git a/drivers/crypto/hisilicon/zip/zip_crypto.c b/drivers/crypto/hisilicon/zip/zip_crypto.c index 797b97f8e0c4923e569f44b0ff562ea276ec5741..f84b3b608a4166839d3513ecec7b57e66a9d1b77 100644 --- a/drivers/crypto/hisilicon/zip/zip_crypto.c +++ b/drivers/crypto/hisilicon/zip/zip_crypto.c @@ -244,8 +244,6 @@ static void hisi_zip_copy_data_from_buffer(struct hisi_zip_qp_ctx *qp_ctx, else qp->qp_status.sq_head++; - if (unlikely(test_bit(QP_FULL, &qp->qp_status.flags))) - clear_bit(QP_FULL, &qp->qp_status.flags); } static int hisi_zip_compress_data_output(struct hisi_zip_qp_ctx *qp_ctx,