提交 fce3e601 编写于 作者: Z Zhou Wang 提交者: Xie XiuQi

ACC: fix for qp full status check by qp->used

driver inclusion
category: bugfix
bugzilla: NA
CVE: NA

fix for qp full status check by qp->used.
Signed-off-by: NZhou Wang <wangzhou1@hisilicon.com>
Signed-off-by: NHao Fang <fanghao11@huawei.com>
Signed-off-by: Nlingmingqiang <lingmingqiang@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 4c7b1e35
...@@ -390,9 +390,6 @@ static void qm_sq_head_update(struct hisi_qp *qp) ...@@ -390,9 +390,6 @@ static void qm_sq_head_update(struct hisi_qp *qp)
qp->qp_status.sq_head = 0; qp->qp_status.sq_head = 0;
else else
qp->qp_status.sq_head++; 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) static void qm_cq_head_update(struct hisi_qp *qp)
...@@ -1041,7 +1038,7 @@ static void *qm_get_avail_sqe(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; struct hisi_qp_status *qp_status = &qp->qp_status;
u16 sq_tail = qp_status->sq_tail; 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 NULL;
return qp->sqe + sq_tail * qp->qm->sqe_size; return qp->sqe + sq_tail * qp->qm->sqe_size;
...@@ -1341,6 +1338,8 @@ EXPORT_SYMBOL_GPL(hisi_qm_stop_qp); ...@@ -1341,6 +1338,8 @@ EXPORT_SYMBOL_GPL(hisi_qm_stop_qp);
* *
* This function will return -EBUSY if qp is currently full, and -EAGAIN * This function will return -EBUSY if qp is currently full, and -EAGAIN
* if qp related qm is resetting. * 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) 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) ...@@ -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); qm_db(qp->qm, qp->qp_id, QM_DOORBELL_CMD_SQ, sq_tail_next, 0);
atomic_inc(&qp->qp_status.used); atomic_inc(&qp->qp_status.used);
qp_status->sq_tail = sq_tail_next; 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; return 0;
} }
......
...@@ -86,7 +86,6 @@ enum qm_state { ...@@ -86,7 +86,6 @@ enum qm_state {
enum qp_state { enum qp_state {
QP_STOP, QP_STOP,
QP_FULL,
}; };
enum qm_hw_ver { enum qm_hw_ver {
......
...@@ -244,8 +244,6 @@ static void hisi_zip_copy_data_from_buffer(struct hisi_zip_qp_ctx *qp_ctx, ...@@ -244,8 +244,6 @@ static void hisi_zip_copy_data_from_buffer(struct hisi_zip_qp_ctx *qp_ctx,
else else
qp->qp_status.sq_head++; 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, static int hisi_zip_compress_data_output(struct hisi_zip_qp_ctx *qp_ctx,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册