Use 'qp_mode' to distinguish between sync and async modes of RSA and DH algs.
Signed-off-by: Zhiqi Song songzhiqi1@huawei.com --- drv/hisi_hpre.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/drv/hisi_hpre.c b/drv/hisi_hpre.c index 116097d..a232e84 100644 --- a/drv/hisi_hpre.c +++ b/drv/hisi_hpre.c @@ -334,7 +334,7 @@ static int hpre_tri_bin_transfer(struct wd_dtb *bin0, struct wd_dtb *bin1, }
static int rsa_out_transfer(struct wd_rsa_msg *msg, - struct hisi_hpre_sqe *hw_msg) + struct hisi_hpre_sqe *hw_msg, __u8 qp_mode) { struct wd_rsa_req *req = &msg->req; struct wd_rsa_kg_out *key = req->dst; @@ -345,8 +345,7 @@ static int rsa_out_transfer(struct wd_rsa_msg *msg, int ret;
if (hw_msg->alg == HW_ALG_KG_CRT || hw_msg->alg == HW_ALG_KG_STD) { - /* async */ - if (LW_U16(hw_msg->low_tag)) { + if (qp_mode == CTX_MODE_ASYNC) { data = VA_ADDR(hw_msg->hi_out, hw_msg->low_out); key = container_of(data, struct wd_rsa_kg_out, data); } else { @@ -607,7 +606,7 @@ static int rsa_recv(handle_t ctx, void *rsa_msg)
hpre_result_check(&hw_msg, &msg->result); if (!msg->result) { - ret = rsa_out_transfer(msg, &hw_msg); + ret = rsa_out_transfer(msg, &hw_msg, qp->q_info.qp_mode); if (ret) { WD_ERR("failed to transfer out rsa BD!\n"); msg->result = WD_OUT_EPARA; @@ -660,15 +659,14 @@ static int fill_dh_xp_params(struct wd_dh_msg *msg, }
static int dh_out_transfer(struct wd_dh_msg *msg, - struct hisi_hpre_sqe *hw_msg) + struct hisi_hpre_sqe *hw_msg, __u8 qp_mode) { __u16 key_bytes = (hw_msg->task_len1 + 1) * BYTE_BITS; struct wd_dh_req *req = &msg->req; void *out; int ret;
- /* async */ - if (LW_U16(hw_msg->low_tag)) + if (qp_mode == CTX_MODE_ASYNC) out = VA_ADDR(hw_msg->hi_out, hw_msg->low_out); else out = req->pri; @@ -763,7 +761,7 @@ static int dh_recv(handle_t ctx, void *dh_msg)
hpre_result_check(&hw_msg, &msg->result); if (!msg->result) { - ret = dh_out_transfer(msg, &hw_msg); + ret = dh_out_transfer(msg, &hw_msg, qp->q_info.qp_mode); if (ret) { WD_ERR("failed to transfer out dh BD!\n"); msg->result = WD_OUT_EPARA;