Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use common func wd_find_msg_in_pool to replace wd_xxx_get_msg #646

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ uadk_drivers_LTLIBRARIES=libhisi_sec.la libhisi_hpre.la libhisi_zip.la \
libisa_ce.la libisa_sve.la libhisi_dae.la

libwd_la_SOURCES=wd.c wd_mempool.c wd.h wd_alg.c wd_alg.h \
wd_sched.c wd_util.c \
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you think it is unnecessary for alg.so, you should remove it from alg_SOURCE.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

如果完全其他库Makefile删掉wd_sched.c wd_util.c,
那libwd.map 还需要export 蛮多函数的
这些函数都是其他库用到的,

/usr/bin/ld: /home/linaro/work/uadk/.libs/libwd_crypto.so: undefined reference to wd_alg_get_env_param' /usr/bin/ld: /home/linaro/work/uadk/.libs/libwd_crypto.so: undefined reference to wd_parse_async_poll_en'
/usr/bin/ld: /home/linaro/work/uadk/.libs/libwd_crypto.so: undefined reference to wd_get_msg_from_pool' /usr/bin/ld: /home/linaro/work/uadk/.libs/libwd_crypto.so: undefined reference to wd_check_ctx'
/usr/bin/ld: /home/linaro/work/uadk/.libs/libwd_crypto.so: undefined reference to wd_alg_attrs_init' /usr/bin/ld: /home/linaro/work/uadk/.libs/libwd_crypto.so: undefined reference to wd_ctx_param_init'
/usr/bin/ld: /home/linaro/work/uadk/.libs/libwd_crypto.so: undefined reference to wd_add_task_to_async_queue' /usr/bin/ld: /home/linaro/work/uadk/.libs/libwd_crypto.so: undefined reference to wd_clear_ctx_config'
/usr/bin/ld: /home/linaro/work/uadk/.libs/libwd_crypto.so: undefined reference to wd_alg_try_init' /usr/bin/ld: /home/linaro/work/uadk/.libs/libwd_crypto.so: undefined reference to wd_check_datalist'
/usr/bin/ld: /home/linaro/work/uadk/.libs/libwd_crypto.so: undefined reference to wd_check_src_dst' /usr/bin/ld: /home/linaro/work/uadk/.libs/libwd_crypto.so: undefined reference to wd_init_sched'
/usr/bin/ld: /home/linaro/work/uadk/.libs/libwd_crypto.so: undefined reference to wd_alg_uninit_driver' /usr/bin/ld: /home/linaro/work/uadk/.libs/libwd_crypto.so: undefined reference to wd_alg_drv_bind'
/usr/bin/ld: /home/linaro/work/uadk/.libs/libwd_crypto.so: undefined reference to wd_set_ctx_attr' /usr/bin/ld: /home/linaro/work/uadk/.libs/libwd_crypto.so: undefined reference to wd_alg_env_init'
/usr/bin/ld: /home/linaro/work/uadk/.libs/libwd_crypto.so: undefined reference to wd_uninit_async_request_pool' /usr/bin/ld: /home/linaro/work/uadk/.libs/libwd_crypto.so: undefined reference to wd_init_ctx_config'
/usr/bin/ld: /home/linaro/work/uadk/.libs/libwd_crypto.so: undefined reference to wd_clear_sched' /usr/bin/ld: /home/linaro/work/uadk/.libs/libwd_crypto.so: undefined reference to wd_alg_drv_unbind'
/usr/bin/ld: /home/linaro/work/uadk/.libs/libwd_crypto.so: undefined reference to wd_dlopen_drv' /usr/bin/ld: /home/linaro/work/uadk/.libs/libwd_crypto.so: undefined reference to wd_alg_env_uninit'
/usr/bin/ld: /home/linaro/work/uadk/.libs/libwd_crypto.so: undefined reference to wd_ctx_param_uninit' /usr/bin/ld: /home/linaro/work/uadk/.libs/libwd_crypto.so: undefined reference to wd_put_msg_to_pool'
/usr/bin/ld: /home/linaro/work/uadk/.libs/libwd_crypto.so: undefined reference to wd_alg_attrs_uninit' /usr/bin/ld: /home/linaro/work/uadk/.libs/libwd_crypto.so: undefined reference to wd_init_param_check'
/usr/bin/ld: /home/linaro/work/uadk/.libs/libwd_crypto.so: undefined reference to wd_handle_msg_sync' /usr/bin/ld: /home/linaro/work/uadk/.libs/libwd_crypto.so: undefined reference to wd_alg_init_driver'
/usr/bin/ld: /home/linaro/work/uadk/.libs/libwd_crypto.so: undefined reference to wd_parse_ctx_num' /usr/bin/ld: /home/linaro/work/uadk/.libs/libwd_crypto.so: undefined reference to wd_init_async_request_pool'
/usr/bin/ld: /home/linaro/work/uadk/.libs/libwd_crypto.so: undefined reference to wd_memset_zero' /usr/bin/ld: /home/linaro/work/uadk/.libs/libwd_crypto.so: undefined reference to wd_set_epoll_en'
/usr/bin/ld: /home/linaro/work/uadk/.libs/libwd_crypto.so: undefined reference to wd_get_lib_file_path' /usr/bin/ld: /home/linaro/work/uadk/.libs/libwd_crypto.so: undefined reference to wd_dlclose_drv'

  •   wd_sched_rr_instance;
    
  •   wd_sched_rr_alloc;
    
  •   wd_sched_rr_release;
    
  •   wd_find_msg_in_pool;
    

这几个函数是app 或者是驱动用到的。

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

那这样的逻辑下你无法删除原有的引用,反而要在libwd中新增了wd_sched和wd_util,它的目的在于什么地方呢?如果说你把所有接口全部整改那这个逻辑我理解是成立的,所有公共部分全部放到libwd中,alg对公共的依赖由libwd提供就好。但是现在的修改方案既不能保证alg和公共文件的解耦,由让libwd和公共文件耦合,无法理解它的好处。

v1/wd.c v1/wd.h v1/wd_adapter.c v1/wd_adapter.h \
v1/wd_rng.c v1/wd_rng.h \
v1/wd_rsa.c v1/wd_rsa.h \
Expand Down
9 changes: 5 additions & 4 deletions drv/hisi_comp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1003,9 +1003,10 @@ static void get_ctx_buf(struct hisi_zip_sqe *sqe,
}
}

static int parse_zip_sqe(struct hisi_qp *qp, struct hisi_zip_sqe *sqe,
struct wd_comp_msg *msg)
static int parse_zip_sqe(struct wd_alg_driver *drv, struct hisi_qp *qp,
struct hisi_zip_sqe *sqe, struct wd_comp_msg *msg)
{
struct hisi_zip_ctx *priv = (struct hisi_zip_ctx *)drv->priv;
__u32 buf_type = (sqe->dw9 & HZ_BUF_TYPE_MASK) >> BUF_TYPE_SHIFT;
__u16 ctx_st = sqe->ctx_dw0 & HZ_CTX_ST_MASK;
__u16 lstblk = sqe->dw3 & HZ_LSTBLK_MASK;
Expand All @@ -1030,7 +1031,7 @@ static int parse_zip_sqe(struct hisi_qp *qp, struct hisi_zip_sqe *sqe,
recv_msg->tag = tag;

if (qp->q_info.qp_mode == CTX_MODE_ASYNC) {
recv_msg = wd_comp_get_msg(qp->q_info.idx, tag);
recv_msg = wd_find_msg_in_pool(priv->config.pool, qp->q_info.idx, tag);
if (unlikely(!recv_msg)) {
WD_ERR("failed to get send msg! idx = %u, tag = %u!\n",
qp->q_info.idx, tag);
Expand Down Expand Up @@ -1091,7 +1092,7 @@ static int hisi_zip_comp_recv(struct wd_alg_driver *drv, handle_t ctx, void *com
if (unlikely(ret < 0))
return ret;

return parse_zip_sqe(qp, &sqe, recv_msg);
return parse_zip_sqe(drv, qp, &sqe, recv_msg);
}

#define GEN_ZIP_ALG_DRIVER(zip_alg_name) \
Expand Down
3 changes: 2 additions & 1 deletion drv/hisi_dae.c
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,7 @@ static void fill_hashagg_msg_task_err(struct dae_sqe *sqe, struct wd_agg_msg *ms

static int hashagg_recv(struct wd_alg_driver *drv, handle_t ctx, void *hashagg_msg)
{
struct hisi_dae_ctx *priv = (struct hisi_dae_ctx *)drv->priv;
handle_t h_qp = (handle_t)wd_ctx_get_priv(ctx);
struct hisi_qp *qp = (struct hisi_qp *)h_qp;
struct dae_extend_addr *ext_addr = qp->priv;
Expand All @@ -673,7 +674,7 @@ static int hashagg_recv(struct wd_alg_driver *drv, handle_t ctx, void *hashagg_m

msg->tag = sqe.low_tag;
if (qp->q_info.qp_mode == CTX_MODE_ASYNC) {
temp_msg = wd_agg_get_msg(qp->q_info.idx, msg->tag);
temp_msg = wd_find_msg_in_pool(priv->config.pool, qp->q_info.idx, msg->tag);
if (!temp_msg) {
msg->result = WD_AGG_IN_EPARA;
WD_ERR("failed to get send msg! idx = %u, tag = %u.\n",
Expand Down
38 changes: 20 additions & 18 deletions drv/hisi_hpre.c
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,7 @@ static void hpre_result_check(struct hisi_hpre_sqe *hw_msg,

static int rsa_recv(struct wd_alg_driver *drv, handle_t ctx, void *rsa_msg)
{
struct hisi_hpre_ctx *priv = (struct hisi_hpre_ctx *)drv->priv;
handle_t h_qp = (handle_t)wd_ctx_get_priv(ctx);
struct hisi_qp *qp = (struct hisi_qp *)h_qp;
struct hisi_hpre_sqe hw_msg = {0};
Expand All @@ -677,7 +678,7 @@ static int rsa_recv(struct wd_alg_driver *drv, handle_t ctx, void *rsa_msg)

msg->tag = LW_U16(hw_msg.low_tag);
if (qp->q_info.qp_mode == CTX_MODE_ASYNC) {
temp_msg = wd_rsa_get_msg(qp->q_info.idx, msg->tag);
temp_msg = wd_find_msg_in_pool(priv->config.pool, qp->q_info.idx, msg->tag);
if (!temp_msg) {
WD_ERR("failed to get send msg! idx = %u, tag = %u.\n",
qp->q_info.idx, msg->tag);
Expand Down Expand Up @@ -802,6 +803,7 @@ static int dh_send(struct wd_alg_driver *drv, handle_t ctx, void *dh_msg)

static int dh_recv(struct wd_alg_driver *drv, handle_t ctx, void *dh_msg)
{
struct hisi_hpre_ctx *priv = (struct hisi_hpre_ctx *)drv->priv;
handle_t h_qp = (handle_t)wd_ctx_get_priv(ctx);
struct hisi_qp *qp = (struct hisi_qp *)h_qp;
struct wd_dh_msg *msg = dh_msg;
Expand All @@ -820,7 +822,7 @@ static int dh_recv(struct wd_alg_driver *drv, handle_t ctx, void *dh_msg)

msg->tag = LW_U16(hw_msg.low_tag);
if (qp->q_info.qp_mode == CTX_MODE_ASYNC) {
temp_msg = wd_dh_get_msg(qp->q_info.idx, msg->tag);
temp_msg = wd_find_msg_in_pool(priv->config.pool, qp->q_info.idx, msg->tag);
if (!temp_msg) {
WD_ERR("failed to get send msg! idx = %u, tag = %u.\n",
qp->q_info.idx, msg->tag);
Expand Down Expand Up @@ -2037,7 +2039,6 @@ static int ecc_out_transfer(struct wd_ecc_msg *msg,
return ret;
}


static __u32 get_hash_bytes(__u8 type)
{
__u32 val = 0;
Expand Down Expand Up @@ -2303,15 +2304,16 @@ static int sm2_convert_dec_out(struct wd_ecc_msg *src,
return ret;
}

static int ecc_sqe_parse(struct hisi_qp *qp, struct wd_ecc_msg *msg,
struct hisi_hpre_sqe *hw_msg)
static int ecc_sqe_parse(struct wd_alg_driver *drv, struct hisi_qp *qp,
struct wd_ecc_msg *msg, struct hisi_hpre_sqe *hw_msg)
{
struct hisi_hpre_ctx *priv = (struct hisi_hpre_ctx *)drv->priv;
struct wd_ecc_msg *temp_msg;
int ret;

msg->tag = LW_U16(hw_msg->low_tag);
if (qp->q_info.qp_mode == CTX_MODE_ASYNC) {
temp_msg = wd_ecc_get_msg(qp->q_info.idx, msg->tag);
temp_msg = wd_find_msg_in_pool(priv->config.pool, qp->q_info.idx, msg->tag);
if (!temp_msg) {
WD_ERR("failed to get send msg! idx = %u, tag = %u.\n",
qp->q_info.idx, msg->tag);
Expand Down Expand Up @@ -2342,7 +2344,7 @@ static int ecc_sqe_parse(struct hisi_qp *qp, struct wd_ecc_msg *msg,
return ret;
}

static int parse_second_sqe(handle_t h_qp,
static int parse_second_sqe(struct wd_alg_driver *drv, handle_t h_qp,
struct wd_ecc_msg *msg,
struct wd_ecc_msg **second)
{
Expand Down Expand Up @@ -2371,15 +2373,15 @@ static int parse_second_sqe(handle_t h_qp,
hsz = (hw_msg.task_len1 + 1) * BYTE_BITS;
dst = *(struct wd_ecc_msg **)((uintptr_t)data +
hsz * ECDH_OUT_PARAM_NUM);
ret = ecc_sqe_parse((struct hisi_qp *)h_qp, dst, &hw_msg);
ret = ecc_sqe_parse(drv, (struct hisi_qp *)h_qp, dst, &hw_msg);
msg->result = dst->result;
*second = dst;

return ret;
}

static int sm2_enc_parse(handle_t h_qp, struct wd_ecc_msg *msg,
struct hisi_hpre_sqe *hw_msg)
static int sm2_enc_parse(struct wd_alg_driver *drv, handle_t h_qp,
struct wd_ecc_msg *msg, struct hisi_hpre_sqe *hw_msg)
{
__u16 tag = LW_U16(hw_msg->low_tag);
struct wd_ecc_msg *second = NULL;
Expand All @@ -2397,14 +2399,14 @@ static int sm2_enc_parse(handle_t h_qp, struct wd_ecc_msg *msg,
memcpy(&src, first + 1, sizeof(src));

/* parse first sqe */
ret = ecc_sqe_parse((struct hisi_qp *)h_qp, first, hw_msg);
ret = ecc_sqe_parse(drv, (struct hisi_qp *)h_qp, first, hw_msg);
if (ret) {
WD_ERR("failed to parse first BD, ret = %d!\n", ret);
goto free_first;
}

/* parse second sqe */
ret = parse_second_sqe(h_qp, msg, &second);
ret = parse_second_sqe(drv, h_qp, msg, &second);
if (unlikely(ret)) {
WD_ERR("failed to parse second BD, ret = %d!\n", ret);
goto free_first;
Expand All @@ -2424,8 +2426,8 @@ static int sm2_enc_parse(handle_t h_qp, struct wd_ecc_msg *msg,
return ret;
}

static int sm2_dec_parse(handle_t ctx, struct wd_ecc_msg *msg,
struct hisi_hpre_sqe *hw_msg)
static int sm2_dec_parse(struct wd_alg_driver *drv, handle_t ctx,
struct wd_ecc_msg *msg, struct hisi_hpre_sqe *hw_msg)
{
__u16 tag = LW_U16(hw_msg->low_tag);
struct wd_ecc_msg *dst;
Expand All @@ -2441,7 +2443,7 @@ static int sm2_dec_parse(handle_t ctx, struct wd_ecc_msg *msg,
memcpy(&src, dst + 1, sizeof(src));

/* parse first sqe */
ret = ecc_sqe_parse((struct hisi_qp *)ctx, dst, hw_msg);
ret = ecc_sqe_parse(drv, (struct hisi_qp *)ctx, dst, hw_msg);
if (ret) {
WD_ERR("failed to parse decode BD, ret = %d!\n", ret);
goto fail;
Expand Down Expand Up @@ -2480,12 +2482,12 @@ static int ecc_recv(struct wd_alg_driver *drv, handle_t ctx, void *ecc_msg)

if (hw_msg.alg == HPRE_ALG_ECDH_MULTIPLY &&
hw_msg.sm2_mlen == HPRE_SM2_ENC)
return sm2_enc_parse(h_qp, msg, &hw_msg);
return sm2_enc_parse(drv, h_qp, msg, &hw_msg);
else if (hw_msg.alg == HPRE_ALG_ECDH_MULTIPLY &&
hw_msg.sm2_mlen == HPRE_SM2_DEC)
return sm2_dec_parse(h_qp, msg, &hw_msg);
return sm2_dec_parse(drv, h_qp, msg, &hw_msg);

return ecc_sqe_parse((struct hisi_qp *)h_qp, msg, &hw_msg);
return ecc_sqe_parse(drv, (struct hisi_qp *)h_qp, msg, &hw_msg);
}

static int hpre_get_usage(void *param)
Expand Down
54 changes: 30 additions & 24 deletions drv/hisi_sec.c
Original file line number Diff line number Diff line change
Expand Up @@ -920,9 +920,10 @@ static void fill_cipher_bd2_addr(struct wd_cipher_msg *msg,
sqe->type2.c_key_addr = (__u64)(uintptr_t)msg->key;
}

static void parse_cipher_bd2(struct hisi_qp *qp, struct hisi_sec_sqe *sqe,
struct wd_cipher_msg *recv_msg)
static void parse_cipher_bd2(struct wd_alg_driver *drv, struct hisi_qp *qp,
struct hisi_sec_sqe *sqe, struct wd_cipher_msg *recv_msg)
{
struct hisi_sec_ctx *priv = (struct hisi_sec_ctx *)drv->priv;
struct wd_cipher_msg *temp_msg;
__u16 done;
__u32 tag;
Expand All @@ -944,7 +945,7 @@ static void parse_cipher_bd2(struct hisi_qp *qp, struct hisi_sec_sqe *sqe,
recv_msg->data_fmt = get_data_fmt_v2(sqe->sds_sa_type);
recv_msg->in = (__u8 *)(uintptr_t)sqe->type2.data_src_addr;
recv_msg->out = (__u8 *)(uintptr_t)sqe->type2.data_dst_addr;
temp_msg = wd_cipher_get_msg(qp->q_info.idx, tag);
temp_msg = wd_find_msg_in_pool(priv->config.pool, qp->q_info.idx, tag);
if (!temp_msg) {
recv_msg->result = WD_IN_EPARA;
WD_ERR("failed to get send msg! idx = %u, tag = %u.\n",
Expand Down Expand Up @@ -1218,7 +1219,7 @@ static int hisi_sec_cipher_recv(struct wd_alg_driver *drv, handle_t ctx, void *w
if (ret)
return ret;

parse_cipher_bd2((struct hisi_qp *)h_qp, &sqe, recv_msg);
parse_cipher_bd2(drv, (struct hisi_qp *)h_qp, &sqe, recv_msg);

if (recv_msg->data_fmt == WD_SGL_BUF)
hisi_sec_put_sgl(h_qp, recv_msg->alg_type, recv_msg->in,
Expand Down Expand Up @@ -1405,9 +1406,10 @@ static int hisi_sec_cipher_send_v3(struct wd_alg_driver *drv, handle_t ctx, void
return 0;
}

static void parse_cipher_bd3(struct hisi_qp *qp, struct hisi_sec_sqe3 *sqe,
struct wd_cipher_msg *recv_msg)
static void parse_cipher_bd3(struct wd_alg_driver *drv, struct hisi_qp *qp,
struct hisi_sec_sqe3 *sqe, struct wd_cipher_msg *recv_msg)
{
struct hisi_sec_ctx *priv = (struct hisi_sec_ctx *)drv->priv;
struct wd_cipher_msg *temp_msg;
__u16 done;
__u32 tag;
Expand All @@ -1429,7 +1431,7 @@ static void parse_cipher_bd3(struct hisi_qp *qp, struct hisi_sec_sqe3 *sqe,
recv_msg->data_fmt = get_data_fmt_v3(sqe->bd_param);
recv_msg->in = (__u8 *)(uintptr_t)sqe->data_src_addr;
recv_msg->out = (__u8 *)(uintptr_t)sqe->data_dst_addr;
temp_msg = wd_cipher_get_msg(qp->q_info.idx, tag);
temp_msg = wd_find_msg_in_pool(priv->config.pool, qp->q_info.idx, tag);
if (!temp_msg) {
recv_msg->result = WD_IN_EPARA;
WD_ERR("failed to get send msg! idx = %u, tag = %u.\n",
Expand Down Expand Up @@ -1466,7 +1468,7 @@ static int hisi_sec_cipher_recv_v3(struct wd_alg_driver *drv, handle_t ctx, void
if (ret)
return ret;

parse_cipher_bd3((struct hisi_qp *)h_qp, &sqe, recv_msg);
parse_cipher_bd3(drv, (struct hisi_qp *)h_qp, &sqe, recv_msg);

if (recv_msg->data_fmt == WD_SGL_BUF)
hisi_sec_put_sgl(h_qp, recv_msg->alg_type, recv_msg->in,
Expand Down Expand Up @@ -1576,9 +1578,10 @@ static int fill_digest_long_hash(handle_t h_qp, struct wd_digest_msg *msg,
return 0;
}

static void parse_digest_bd2(struct hisi_qp *qp, struct hisi_sec_sqe *sqe,
struct wd_digest_msg *recv_msg)
static void parse_digest_bd2(struct wd_alg_driver *drv, struct hisi_qp *qp,
struct hisi_sec_sqe *sqe, struct wd_digest_msg *recv_msg)
{
struct hisi_sec_ctx *priv = (struct hisi_sec_ctx *)drv->priv;
struct wd_digest_msg *temp_msg;
__u16 done;

Expand All @@ -1597,7 +1600,7 @@ static void parse_digest_bd2(struct hisi_qp *qp, struct hisi_sec_sqe *sqe,
recv_msg->alg_type = WD_DIGEST;
recv_msg->data_fmt = get_data_fmt_v2(sqe->sds_sa_type);
recv_msg->in = (__u8 *)(uintptr_t)sqe->type2.data_src_addr;
temp_msg = wd_digest_get_msg(qp->q_info.idx, recv_msg->tag);
temp_msg = wd_find_msg_in_pool(priv->config.pool, qp->q_info.idx, recv_msg->tag);
if (!temp_msg) {
recv_msg->result = WD_IN_EPARA;
WD_ERR("failed to get send msg! idx = %u, tag = %u.\n",
Expand Down Expand Up @@ -1787,7 +1790,7 @@ static int hisi_sec_digest_recv(struct wd_alg_driver *drv, handle_t ctx, void *w
if (ret)
return ret;

parse_digest_bd2((struct hisi_qp *)h_qp, &sqe, recv_msg);
parse_digest_bd2(drv, (struct hisi_qp *)h_qp, &sqe, recv_msg);

if (recv_msg->data_fmt == WD_SGL_BUF)
hisi_sec_put_sgl(h_qp, recv_msg->alg_type, recv_msg->in,
Expand Down Expand Up @@ -2010,9 +2013,10 @@ static int hisi_sec_digest_send_v3(struct wd_alg_driver *drv, handle_t ctx, void
return ret;
}

static void parse_digest_bd3(struct hisi_qp *qp, struct hisi_sec_sqe3 *sqe,
struct wd_digest_msg *recv_msg)
static void parse_digest_bd3(struct wd_alg_driver *drv, struct hisi_qp *qp,
struct hisi_sec_sqe3 *sqe, struct wd_digest_msg *recv_msg)
{
struct hisi_sec_ctx *priv = (struct hisi_sec_ctx *)drv->priv;
struct wd_digest_msg *temp_msg;
__u16 done;

Expand All @@ -2031,7 +2035,7 @@ static void parse_digest_bd3(struct hisi_qp *qp, struct hisi_sec_sqe3 *sqe,
recv_msg->alg_type = WD_DIGEST;
recv_msg->data_fmt = get_data_fmt_v3(sqe->bd_param);
recv_msg->in = (__u8 *)(uintptr_t)sqe->data_src_addr;
temp_msg = wd_digest_get_msg(qp->q_info.idx, recv_msg->tag);
temp_msg = wd_find_msg_in_pool(priv->config.pool, qp->q_info.idx, recv_msg->tag);
if (!temp_msg) {
recv_msg->result = WD_IN_EPARA;
WD_ERR("failed to get send msg! idx = %u, tag = %u.\n",
Expand Down Expand Up @@ -2063,7 +2067,7 @@ static int hisi_sec_digest_recv_v3(struct wd_alg_driver *drv, handle_t ctx, void
if (ret)
return ret;

parse_digest_bd3((struct hisi_qp *)h_qp, &sqe, recv_msg);
parse_digest_bd3(drv, (struct hisi_qp *)h_qp, &sqe, recv_msg);

if (recv_msg->data_fmt == WD_SGL_BUF)
hisi_sec_put_sgl(h_qp, recv_msg->alg_type, recv_msg->in,
Expand Down Expand Up @@ -2618,9 +2622,10 @@ static void update_stream_counter(struct wd_aead_msg *recv_msg)
}
}

static void parse_aead_bd2(struct hisi_qp *qp, struct hisi_sec_sqe *sqe,
struct wd_aead_msg *recv_msg)
static void parse_aead_bd2(struct wd_alg_driver *drv, struct hisi_qp *qp,
struct hisi_sec_sqe *sqe, struct wd_aead_msg *recv_msg)
{
struct hisi_sec_ctx *priv = (struct hisi_sec_ctx *)drv->priv;
struct wd_aead_msg *temp_msg;
__u16 done, icv;

Expand All @@ -2642,7 +2647,7 @@ static void parse_aead_bd2(struct hisi_qp *qp, struct hisi_sec_sqe *sqe,
recv_msg->data_fmt = get_data_fmt_v2(sqe->sds_sa_type);
recv_msg->in = (__u8 *)(uintptr_t)sqe->type2.data_src_addr;
recv_msg->out = (__u8 *)(uintptr_t)sqe->type2.data_dst_addr;
temp_msg = wd_aead_get_msg(qp->q_info.idx, recv_msg->tag);
temp_msg = wd_find_msg_in_pool(priv->config.pool, qp->q_info.idx, recv_msg->tag);
if (!temp_msg) {
recv_msg->result = WD_IN_EPARA;
WD_ERR("failed to get send msg! idx = %u, tag = %u.\n",
Expand Down Expand Up @@ -2697,7 +2702,7 @@ static int hisi_sec_aead_recv(struct wd_alg_driver *drv, handle_t ctx, void *wd_
if (ret)
return ret;

parse_aead_bd2((struct hisi_qp *)h_qp, &sqe, recv_msg);
parse_aead_bd2(drv, (struct hisi_qp *)h_qp, &sqe, recv_msg);

if (recv_msg->data_fmt == WD_SGL_BUF)
hisi_sec_put_sgl(h_qp, recv_msg->alg_type, recv_msg->in,
Expand Down Expand Up @@ -3006,9 +3011,10 @@ static int hisi_sec_aead_send_v3(struct wd_alg_driver *drv, handle_t ctx, void *
return ret;
}

static void parse_aead_bd3(struct hisi_qp *qp, struct hisi_sec_sqe3 *sqe,
struct wd_aead_msg *recv_msg)
static void parse_aead_bd3(struct wd_alg_driver *drv, struct hisi_qp *qp,
struct hisi_sec_sqe3 *sqe, struct wd_aead_msg *recv_msg)
{
struct hisi_sec_ctx *priv = (struct hisi_sec_ctx *)drv->priv;
struct wd_aead_msg *temp_msg;
__u16 done, icv;

Expand All @@ -3031,7 +3037,7 @@ static void parse_aead_bd3(struct hisi_qp *qp, struct hisi_sec_sqe3 *sqe,
recv_msg->data_fmt = get_data_fmt_v3(sqe->bd_param);
recv_msg->in = (__u8 *)(uintptr_t)sqe->data_src_addr;
recv_msg->out = (__u8 *)(uintptr_t)sqe->data_dst_addr;
temp_msg = wd_aead_get_msg(qp->q_info.idx, recv_msg->tag);
temp_msg = wd_find_msg_in_pool(priv->config.pool, qp->q_info.idx, recv_msg->tag);
if (!temp_msg) {
recv_msg->result = WD_IN_EPARA;
WD_ERR("failed to get send msg! idx = %u, tag = %u.\n",
Expand Down Expand Up @@ -3068,7 +3074,7 @@ static int hisi_sec_aead_recv_v3(struct wd_alg_driver *drv, handle_t ctx, void *
if (ret)
return ret;

parse_aead_bd3((struct hisi_qp *)h_qp, &sqe, recv_msg);
parse_aead_bd3(drv, (struct hisi_qp *)h_qp, &sqe, recv_msg);

if (recv_msg->data_fmt == WD_SGL_BUF)
hisi_sec_put_sgl(h_qp, recv_msg->alg_type,
Expand Down
2 changes: 0 additions & 2 deletions include/drv/wd_aead_drv.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,6 @@ struct wd_aead_msg {
enum wd_aead_msg_state msg_state;
};

struct wd_aead_msg *wd_aead_get_msg(__u32 idx, __u32 tag);

#ifdef __cplusplus
}
#endif
Expand Down
Loading