diff --git a/Makefile.am b/Makefile.am index d671d09d..c0bdc865 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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 \ 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 \ diff --git a/drv/hisi_comp.c b/drv/hisi_comp.c index 07d87548..d30da966 100644 --- a/drv/hisi_comp.c +++ b/drv/hisi_comp.c @@ -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; @@ -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); @@ -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) \ diff --git a/drv/hisi_dae.c b/drv/hisi_dae.c index 864d21ba..aa5da907 100644 --- a/drv/hisi_dae.c +++ b/drv/hisi_dae.c @@ -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; @@ -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", diff --git a/drv/hisi_hpre.c b/drv/hisi_hpre.c index 313cdcc8..e9d07757 100644 --- a/drv/hisi_hpre.c +++ b/drv/hisi_hpre.c @@ -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}; @@ -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); @@ -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; @@ -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); @@ -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; @@ -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); @@ -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) { @@ -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; @@ -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; @@ -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; @@ -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; @@ -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) diff --git a/drv/hisi_sec.c b/drv/hisi_sec.c index 10db124b..d422a4a3 100644 --- a/drv/hisi_sec.c +++ b/drv/hisi_sec.c @@ -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; @@ -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", @@ -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, @@ -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; @@ -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", @@ -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, @@ -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; @@ -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", @@ -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, @@ -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; @@ -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", @@ -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, @@ -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; @@ -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", @@ -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, @@ -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; @@ -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", @@ -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, diff --git a/include/drv/wd_aead_drv.h b/include/drv/wd_aead_drv.h index a9c0e7c0..18696e23 100644 --- a/include/drv/wd_aead_drv.h +++ b/include/drv/wd_aead_drv.h @@ -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 diff --git a/include/drv/wd_agg_drv.h b/include/drv/wd_agg_drv.h index 3d26eeb3..ea713439 100644 --- a/include/drv/wd_agg_drv.h +++ b/include/drv/wd_agg_drv.h @@ -48,8 +48,6 @@ struct wd_agg_ops { int (*hash_table_init)(struct wd_dae_hash_table *hash_table, void *priv); }; -struct wd_agg_msg *wd_agg_get_msg(__u32 idx, __u32 tag); - #ifdef __cplusplus } #endif diff --git a/include/drv/wd_cipher_drv.h b/include/drv/wd_cipher_drv.h index c6d8ddfb..15529e19 100644 --- a/include/drv/wd_cipher_drv.h +++ b/include/drv/wd_cipher_drv.h @@ -50,8 +50,6 @@ struct wd_cipher_msg { __u8 *out; }; -struct wd_cipher_msg *wd_cipher_get_msg(__u32 idx, __u32 tag); - #ifdef __cplusplus } #endif diff --git a/include/drv/wd_comp_drv.h b/include/drv/wd_comp_drv.h index 213cf2d5..3628ae69 100644 --- a/include/drv/wd_comp_drv.h +++ b/include/drv/wd_comp_drv.h @@ -55,8 +55,6 @@ struct wd_comp_msg { __u32 tag; }; -struct wd_comp_msg *wd_comp_get_msg(__u32 idx, __u32 tag); - #ifdef __cplusplus } #endif diff --git a/include/drv/wd_dh_drv.h b/include/drv/wd_dh_drv.h index d205dc45..de8b0683 100644 --- a/include/drv/wd_dh_drv.h +++ b/include/drv/wd_dh_drv.h @@ -24,8 +24,6 @@ struct wd_dh_msg { __u8 result; /* Data format, denoted by WD error code */ }; -struct wd_dh_msg *wd_dh_get_msg(__u32 idx, __u32 tag); - #ifdef __cplusplus } #endif diff --git a/include/drv/wd_digest_drv.h b/include/drv/wd_digest_drv.h index a55ef5bb..4cea1cf7 100644 --- a/include/drv/wd_digest_drv.h +++ b/include/drv/wd_digest_drv.h @@ -80,8 +80,6 @@ static inline enum hash_block_type get_hash_block_type(struct wd_digest_msg *msg return HASH_SINGLE_BLOCK; } -struct wd_digest_msg *wd_digest_get_msg(__u32 idx, __u32 tag); - #ifdef __cplusplus } #endif diff --git a/include/drv/wd_ecc_drv.h b/include/drv/wd_ecc_drv.h index f5805cdc..e9624ef9 100644 --- a/include/drv/wd_ecc_drv.h +++ b/include/drv/wd_ecc_drv.h @@ -175,8 +175,6 @@ struct wd_ecc_out { char data[]; }; -struct wd_ecc_msg *wd_ecc_get_msg(__u32 idx, __u32 tag); - #ifdef __cplusplus } #endif diff --git a/include/drv/wd_rsa_drv.h b/include/drv/wd_rsa_drv.h index d231ecfb..77406fc6 100644 --- a/include/drv/wd_rsa_drv.h +++ b/include/drv/wd_rsa_drv.h @@ -49,8 +49,6 @@ struct wd_rsa_msg { __u8 *key; /* Input key VA pointer, should be DMA buffer */ }; -struct wd_rsa_msg *wd_rsa_get_msg(__u32 idx, __u32 tag); - #ifdef __cplusplus } #endif diff --git a/include/wd_alg_common.h b/include/wd_alg_common.h index fd774269..e1c2bfb2 100644 --- a/include/wd_alg_common.h +++ b/include/wd_alg_common.h @@ -151,6 +151,7 @@ struct wd_ctx_config_internal { void *priv; bool epoll_en; unsigned long *msg_cnt; + struct wd_async_msg_pool *pool; }; /* diff --git a/libwd.map b/libwd.map index 5522ec07..132fd044 100644 --- a/libwd.map +++ b/libwd.map @@ -49,5 +49,10 @@ global: wd_enable_drv; wd_disable_drv; wd_get_alg_head; + + wd_sched_rr_instance; + wd_sched_rr_alloc; + wd_sched_rr_release; + wd_find_msg_in_pool; local: *; }; diff --git a/libwd_comp.map b/libwd_comp.map index 6b1f8c25..33683198 100644 --- a/libwd_comp.map +++ b/libwd_comp.map @@ -20,13 +20,8 @@ global: wd_comp_get_env_param; wd_comp_set_driver; wd_comp_get_driver; - wd_comp_get_msg; wd_comp_reset_sess; - wd_sched_rr_instance; - wd_sched_rr_alloc; - wd_sched_rr_release; - wd_deflate_init; wd_deflate; wd_deflate_reset; @@ -36,6 +31,5 @@ global: wd_inflate; wd_inflate_reset; wd_inflate_end; - local: *; }; diff --git a/libwd_crypto.map b/libwd_crypto.map index e8555c98..33de0bf7 100644 --- a/libwd_crypto.map +++ b/libwd_crypto.map @@ -19,7 +19,6 @@ global: wd_cipher_get_env_param; wd_cipher_set_driver; wd_cipher_get_driver; - wd_cipher_get_msg; wd_aead_init; wd_aead_uninit; @@ -44,7 +43,6 @@ global: wd_aead_get_env_param; wd_aead_set_driver; wd_aead_get_driver; - wd_aead_get_msg; wd_digest_init; wd_digest_uninit; @@ -65,7 +63,6 @@ global: wd_digest_get_env_param; wd_digest_set_driver; wd_digest_get_driver; - wd_digest_get_msg; wd_rsa_is_crt; wd_rsa_get_key_bits; @@ -107,7 +104,6 @@ global: wd_rsa_get_env_param; wd_rsa_set_driver; wd_rsa_get_driver; - wd_rsa_get_msg; wd_dh_get_mode; wd_dh_key_bits; @@ -131,7 +127,6 @@ global: wd_dh_get_env_param; wd_dh_set_driver; wd_dh_get_driver; - wd_dh_get_msg; wd_ecc_get_key_bits; wd_ecc_get_key; @@ -148,7 +143,6 @@ global: wd_ecxdh_get_out_params; wd_ecc_set_driver; wd_ecc_get_driver; - wd_ecc_get_msg; wd_sm2_new_sign_in; wd_sm2_new_verf_in; @@ -183,9 +177,5 @@ global: wd_ecc_ctx_num_init; wd_ecc_ctx_num_uninit; wd_ecc_get_env_param; - - wd_sched_rr_instance; - wd_sched_rr_alloc; - wd_sched_rr_release; local: *; }; diff --git a/libwd_dae.map b/libwd_dae.map index 4c51b856..1243c061 100644 --- a/libwd_dae.map +++ b/libwd_dae.map @@ -11,11 +11,6 @@ global: wd_agg_get_output_sync; wd_agg_get_output_async; wd_agg_rehash_sync; - wd_agg_get_msg; wd_agg_poll; - - wd_sched_rr_instance; - wd_sched_rr_alloc; - wd_sched_rr_release; local: *; }; diff --git a/wd_aead.c b/wd_aead.c index 608f0e6d..8157e198 100644 --- a/wd_aead.c +++ b/wd_aead.c @@ -464,6 +464,8 @@ static int wd_aead_init_nolock(struct wd_ctx_config *config, struct wd_sched *sc if (ret < 0) goto out_clear_sched; + wd_aead_setting.config.pool = &wd_aead_setting.pool; + ret = wd_alg_init_driver(&wd_aead_setting.config, wd_aead_setting.driver); if (ret) @@ -831,11 +833,6 @@ int wd_do_aead_async(handle_t h_sess, struct wd_aead_req *req) return ret; } -struct wd_aead_msg *wd_aead_get_msg(__u32 idx, __u32 tag) -{ - return wd_find_msg_in_pool(&wd_aead_setting.pool, idx, tag); -} - int wd_aead_poll_ctx(__u32 idx, __u32 expt, __u32 *count) { struct wd_ctx_config_internal *config = &wd_aead_setting.config; diff --git a/wd_agg.c b/wd_agg.c index b536efe5..faafafb1 100644 --- a/wd_agg.c +++ b/wd_agg.c @@ -592,6 +592,8 @@ static int wd_agg_alg_init(struct wd_ctx_config *config, struct wd_sched *sched) if (ret < 0) goto out_clear_sched; + wd_agg_setting.config.pool = &wd_agg_setting.pool; + ret = wd_alg_init_driver(&wd_agg_setting.config, wd_agg_setting.driver); if (ret) goto out_clear_pool; @@ -1504,11 +1506,6 @@ int wd_agg_rehash_sync(handle_t h_sess, struct wd_agg_req *req) return WD_SUCCESS; } -struct wd_agg_msg *wd_agg_get_msg(__u32 idx, __u32 tag) -{ - return wd_find_msg_in_pool(&wd_agg_setting.pool, idx, tag); -} - static int wd_agg_poll_ctx(__u32 idx, __u32 expt, __u32 *count) { struct wd_ctx_config_internal *config = &wd_agg_setting.config; diff --git a/wd_cipher.c b/wd_cipher.c index ec6fb156..996f867a 100644 --- a/wd_cipher.c +++ b/wd_cipher.c @@ -345,6 +345,8 @@ static int wd_cipher_common_init(struct wd_ctx_config *config, if (ret < 0) goto out_clear_sched; + wd_cipher_setting.config.pool = &wd_cipher_setting.pool; + ret = wd_alg_init_driver(&wd_cipher_setting.config, wd_cipher_setting.driver); if (ret) @@ -782,11 +784,6 @@ int wd_do_cipher_async(handle_t h_sess, struct wd_cipher_req *req) return ret; } -struct wd_cipher_msg *wd_cipher_get_msg(__u32 idx, __u32 tag) -{ - return wd_find_msg_in_pool(&wd_cipher_setting.pool, idx, tag); -} - int wd_cipher_poll_ctx(__u32 idx, __u32 expt, __u32 *count) { struct wd_ctx_config_internal *config = &wd_cipher_setting.config; diff --git a/wd_comp.c b/wd_comp.c index 0fa5f926..4abb64d2 100644 --- a/wd_comp.c +++ b/wd_comp.c @@ -165,6 +165,8 @@ static int wd_comp_init_nolock(struct wd_ctx_config *config, struct wd_sched *sc if (ret < 0) goto out_clear_sched; + wd_comp_setting.config.pool = &wd_comp_setting.pool; + ret = wd_alg_init_driver(&wd_comp_setting.config, wd_comp_setting.driver); if (ret) @@ -347,11 +349,6 @@ void wd_comp_uninit2(void) wd_alg_clear_init(&wd_comp_setting.status); } -struct wd_comp_msg *wd_comp_get_msg(__u32 idx, __u32 tag) -{ - return wd_find_msg_in_pool(&wd_comp_setting.pool, idx, tag); -} - int wd_comp_poll_ctx(__u32 idx, __u32 expt, __u32 *count) { struct wd_ctx_config_internal *config = &wd_comp_setting.config; diff --git a/wd_dh.c b/wd_dh.c index 043c3be9..2686dda6 100644 --- a/wd_dh.c +++ b/wd_dh.c @@ -139,6 +139,8 @@ static int wd_dh_common_init(struct wd_ctx_config *config, struct wd_sched *sche if (ret) goto out_clear_sched; + wd_dh_setting.config.pool = &wd_dh_setting.pool; + ret = wd_alg_init_driver(&wd_dh_setting.config, wd_dh_setting.driver); if (ret) @@ -453,11 +455,6 @@ int wd_do_dh_async(handle_t sess, struct wd_dh_req *req) return ret; } -struct wd_dh_msg *wd_dh_get_msg(__u32 idx, __u32 tag) -{ - return wd_find_msg_in_pool(&wd_dh_setting.pool, idx, tag); -} - int wd_dh_poll_ctx(__u32 idx, __u32 expt, __u32 *count) { struct wd_ctx_config_internal *config = &wd_dh_setting.config; diff --git a/wd_digest.c b/wd_digest.c index 58f621af..85b722f3 100644 --- a/wd_digest.c +++ b/wd_digest.c @@ -276,6 +276,8 @@ static int wd_digest_init_nolock(struct wd_ctx_config *config, if (ret < 0) goto out_clear_sched; + wd_digest_setting.config.pool = &wd_digest_setting.pool; + ret = wd_alg_init_driver(&wd_digest_setting.config, wd_digest_setting.driver); if (ret) @@ -733,11 +735,6 @@ int wd_do_digest_async(handle_t h_sess, struct wd_digest_req *req) return ret; } -struct wd_digest_msg *wd_digest_get_msg(__u32 idx, __u32 tag) -{ - return wd_find_msg_in_pool(&wd_digest_setting.pool, idx, tag); -} - int wd_digest_poll_ctx(__u32 idx, __u32 expt, __u32 *count) { struct wd_ctx_config_internal *config = &wd_digest_setting.config; diff --git a/wd_ecc.c b/wd_ecc.c index 292338a6..5588e577 100644 --- a/wd_ecc.c +++ b/wd_ecc.c @@ -202,6 +202,8 @@ static int wd_ecc_common_init(struct wd_ctx_config *config, struct wd_sched *sch if (ret < 0) goto out_clear_sched; + wd_ecc_setting.config.pool = &wd_ecc_setting.pool; + ret = wd_alg_init_driver(&wd_ecc_setting.config, wd_ecc_setting.driver); if (ret) @@ -2298,11 +2300,6 @@ int wd_do_ecc_async(handle_t sess, struct wd_ecc_req *req) return ret; } -struct wd_ecc_msg *wd_ecc_get_msg(__u32 idx, __u32 tag) -{ - return wd_find_msg_in_pool(&wd_ecc_setting.pool, idx, tag); -} - int wd_ecc_poll_ctx(__u32 idx, __u32 expt, __u32 *count) { struct wd_ctx_config_internal *config = &wd_ecc_setting.config; diff --git a/wd_rsa.c b/wd_rsa.c index 366e7660..ea340c07 100644 --- a/wd_rsa.c +++ b/wd_rsa.c @@ -179,6 +179,8 @@ static int wd_rsa_common_init(struct wd_ctx_config *config, struct wd_sched *sch if (ret < 0) goto out_clear_sched; + wd_rsa_setting.config.pool = &wd_rsa_setting.pool; + ret = wd_alg_init_driver(&wd_rsa_setting.config, wd_rsa_setting.driver); if (ret) @@ -513,11 +515,6 @@ int wd_do_rsa_async(handle_t sess, struct wd_rsa_req *req) return ret; } -struct wd_rsa_msg *wd_rsa_get_msg(__u32 idx, __u32 tag) -{ - return wd_find_msg_in_pool(&wd_rsa_setting.pool, idx, tag); -} - int wd_rsa_poll_ctx(__u32 idx, __u32 expt, __u32 *count) { struct wd_ctx_config_internal *config = &wd_rsa_setting.config;