*** BLURB HERE ***
Hao Fang (3): uadk/drv: move hisi_qm_udrv.h to drv directory uadk/test: remove unused header file uadk/libapi: cleanup for some format alignment
Wenkai Lin (2): uadk: v1: fix redundant head uadk: v1: remove dummy
.gitignore | 1 - {include => drv}/hisi_qm_udrv.h | 0 test/hisi_zip_test/test_lib.c | 1 - test/hisi_zip_test/test_lib.h | 1 + v1/drv/dummy_drv.c | 174 -------------------------------- v1/drv/dummy_drv.h | 35 ------- v1/drv/hisi_hpre_udrv.c | 5 - v1/drv/hisi_qm_udrv.c | 4 - v1/drv/hisi_qm_udrv.h | 1 - v1/drv/hisi_sec_udrv.c | 5 - v1/drv/hisi_sec_udrv.h | 1 - v1/drv/hisi_zip_udrv.c | 1 - v1/internal/dummy_hw_usr_if.h | 57 ----------- v1/uacce.h | 1 - v1/wd.h | 1 + v1/wd_adapter.c | 1 - wd_aead.c | 8 +- wd_alg.c | 4 +- wd_cipher.c | 8 +- wd_dh.c | 2 +- wd_digest.c | 10 +- wd_ecc.c | 12 +-- wd_mempool.c | 20 ++-- wd_rsa.c | 36 +++---- wd_sched.c | 6 +- wd_util.c | 12 +-- 26 files changed, 61 insertions(+), 346 deletions(-) rename {include => drv}/hisi_qm_udrv.h (100%) delete mode 100644 v1/drv/dummy_drv.c delete mode 100644 v1/drv/dummy_drv.h delete mode 100644 v1/internal/dummy_hw_usr_if.h
From: Hao Fang fanghao11@huawei.com
The driver header file hisi_qm_udrv.h should be placed in drv directory instead of the include.
Signed-off-by: Hao Fang fanghao11@huawei.com --- {include => drv}/hisi_qm_udrv.h | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {include => drv}/hisi_qm_udrv.h (100%)
diff --git a/include/hisi_qm_udrv.h b/drv/hisi_qm_udrv.h similarity index 100% rename from include/hisi_qm_udrv.h rename to drv/hisi_qm_udrv.h
From: Hao Fang fanghao11@huawei.com
The driver header file hisi_qm_udrv.h should not be included by test tool, and need add config.h to fix the build error.
Signed-off-by: Hao Fang fanghao11@huawei.com --- test/hisi_zip_test/test_lib.c | 1 - test/hisi_zip_test/test_lib.h | 1 + 2 files changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/hisi_zip_test/test_lib.c b/test/hisi_zip_test/test_lib.c index 5918699..384be49 100644 --- a/test/hisi_zip_test/test_lib.c +++ b/test/hisi_zip_test/test_lib.c @@ -10,7 +10,6 @@ #include <sys/mman.h> #include <zlib.h>
-#include "hisi_qm_udrv.h" #include "test_lib.h"
#define SCHED_RR_NAME "sched_rr" diff --git a/test/hisi_zip_test/test_lib.h b/test/hisi_zip_test/test_lib.h index 4820817..70d2c9d 100644 --- a/test/hisi_zip_test/test_lib.h +++ b/test/hisi_zip_test/test_lib.h @@ -18,6 +18,7 @@ #include <sys/stat.h> #include <sys/time.h> #include <unistd.h> +#include "config.h" #include "wd_comp.h" #include "wd_sched.h"
From: Hao Fang fanghao11@huawei.com
Some code format alignment refer to the linux coding style.
Signed-off-by: Hao Fang fanghao11@huawei.com Signed-off-by: Qi Tao taoqi10@huawei.com --- wd_aead.c | 8 ++++---- wd_alg.c | 4 ++-- wd_cipher.c | 8 ++++---- wd_dh.c | 2 +- wd_digest.c | 10 +++++----- wd_ecc.c | 12 ++++++------ wd_mempool.c | 20 ++++++++++---------- wd_rsa.c | 36 ++++++++++++++++++------------------ wd_sched.c | 6 +++--- wd_util.c | 12 ++++++------ 10 files changed, 59 insertions(+), 59 deletions(-)
diff --git a/wd_aead.c b/wd_aead.c index daed761..0e59768 100644 --- a/wd_aead.c +++ b/wd_aead.c @@ -372,7 +372,7 @@ void wd_aead_free_sess(handle_t h_sess) }
static int wd_aead_param_check(struct wd_aead_sess *sess, - struct wd_aead_req *req) + struct wd_aead_req *req) { __u32 len; int ret; @@ -558,7 +558,7 @@ static bool wd_aead_algs_check(const char *alg) }
int wd_aead_init2_(char *alg, __u32 sched_type, int task_type, - struct wd_ctx_params *ctx_params) + struct wd_ctx_params *ctx_params) { struct wd_ctx_nums aead_ctx_num[WD_DIGEST_CIPHER_DECRYPTION + 1] = {0}; struct wd_ctx_params aead_ctx_params = {0}; @@ -697,7 +697,7 @@ static void fill_stream_msg(struct wd_aead_msg *msg, struct wd_aead_req *req, }
static void fill_request_msg(struct wd_aead_msg *msg, struct wd_aead_req *req, - struct wd_aead_sess *sess) + struct wd_aead_sess *sess) { memcpy(&msg->req, req, sizeof(struct wd_aead_req));
@@ -944,7 +944,7 @@ int wd_aead_ctx_num_init(__u32 node, __u32 type, __u32 num, __u8 mode) return ret;
return wd_alg_env_init(&wd_aead_env_config, table, - &wd_aead_ops, ARRAY_SIZE(table), &ctx_attr); + &wd_aead_ops, ARRAY_SIZE(table), &ctx_attr); }
void wd_aead_ctx_num_uninit(void) diff --git a/wd_alg.c b/wd_alg.c index 1457573..3d014e1 100644 --- a/wd_alg.c +++ b/wd_alg.c @@ -270,7 +270,7 @@ struct wd_alg_list *wd_get_alg_head(void) }
bool wd_drv_alg_support(const char *alg_name, - struct wd_alg_driver *drv) + struct wd_alg_driver *drv) { struct wd_alg_list *head = &alg_list_head; struct wd_alg_list *pnext = head->next; @@ -358,7 +358,7 @@ struct wd_alg_driver *wd_request_drv(const char *alg_name, bool hw_mask) }
if (!strcmp(alg_name, pnext->alg_name) && pnext->available && - pnext->drv->priority > tmp_priority) { + pnext->drv->priority > tmp_priority) { tmp_priority = pnext->drv->priority; select_node = pnext; drv = pnext->drv; diff --git a/wd_cipher.c b/wd_cipher.c index 505773a..f34a47e 100644 --- a/wd_cipher.c +++ b/wd_cipher.c @@ -321,7 +321,7 @@ static void wd_cipher_clear_status(void) }
static int wd_cipher_common_init(struct wd_ctx_config *config, - struct wd_sched *sched) + struct wd_sched *sched) { int ret;
@@ -346,7 +346,7 @@ static int wd_cipher_common_init(struct wd_ctx_config *config, goto out_clear_sched;
ret = wd_alg_init_driver(&wd_cipher_setting.config, - wd_cipher_setting.driver); + wd_cipher_setting.driver); if (ret) goto out_clear_pool;
@@ -611,7 +611,7 @@ static int cipher_len_check(handle_t h_sess, struct wd_cipher_req *req) }
static int wd_cipher_check_params(handle_t h_sess, - struct wd_cipher_req *req, __u8 mode) + struct wd_cipher_req *req, __u8 mode) { struct wd_cipher_sess *sess = (struct wd_cipher_sess *)h_sess; int ret; @@ -881,7 +881,7 @@ int wd_cipher_ctx_num_init(__u32 node, __u32 type, __u32 num, __u8 mode) return ret;
return wd_alg_env_init(&wd_cipher_env_config, table, - &wd_cipher_ops, ARRAY_SIZE(table), &ctx_attr); + &wd_cipher_ops, ARRAY_SIZE(table), &ctx_attr); }
void wd_cipher_ctx_num_uninit(void) diff --git a/wd_dh.c b/wd_dh.c index 36b0cd7..cdcba14 100644 --- a/wd_dh.c +++ b/wd_dh.c @@ -320,7 +320,7 @@ void wd_dh_uninit2(void) }
static int fill_dh_msg(struct wd_dh_msg *msg, struct wd_dh_req *req, - struct wd_dh_sess *sess) + struct wd_dh_sess *sess) { memcpy(&msg->req, req, sizeof(*req)); msg->result = WD_EINVAL; diff --git a/wd_digest.c b/wd_digest.c index 7449259..2e9734d 100644 --- a/wd_digest.c +++ b/wd_digest.c @@ -277,7 +277,7 @@ static int wd_digest_init_nolock(struct wd_ctx_config *config, goto out_clear_sched;
ret = wd_alg_init_driver(&wd_digest_setting.config, - wd_digest_setting.driver); + wd_digest_setting.driver); if (ret) goto out_clear_pool;
@@ -364,7 +364,7 @@ static bool wd_digest_algs_check(const char *alg) }
int wd_digest_init2_(char *alg, __u32 sched_type, int task_type, - struct wd_ctx_params *ctx_params) + struct wd_ctx_params *ctx_params) { struct wd_ctx_params digest_ctx_params = {0}; struct wd_ctx_nums digest_ctx_num = {0}; @@ -464,7 +464,7 @@ void wd_digest_uninit2(void) }
static int wd_aes_hmac_length_check(struct wd_digest_sess *sess, - struct wd_digest_req *req) + struct wd_digest_req *req) { switch (sess->alg) { case WD_DIGEST_AES_XCBC_MAC_96: @@ -517,7 +517,7 @@ static int wd_mac_length_check(struct wd_digest_sess *sess, }
static int wd_digest_param_check(struct wd_digest_sess *sess, - struct wd_digest_req *req) + struct wd_digest_req *req) { int ret;
@@ -841,7 +841,7 @@ int wd_digest_ctx_num_init(__u32 node, __u32 type, __u32 num, __u8 mode) return ret;
return wd_alg_env_init(&wd_digest_env_config, table, - &wd_digest_ops, ARRAY_SIZE(table), &ctx_attr); + &wd_digest_ops, ARRAY_SIZE(table), &ctx_attr); }
void wd_digest_ctx_num_uninit(void) diff --git a/wd_ecc.c b/wd_ecc.c index d36a697..ec5e7ad 100644 --- a/wd_ecc.c +++ b/wd_ecc.c @@ -595,7 +595,7 @@ static struct wd_ecc_in *create_ecc_in(struct wd_ecc_sess *sess, __u32 num) }
static struct wd_ecc_in *create_sm2_sign_in(struct wd_ecc_sess *sess, - __u64 m_len) + __u64 m_len) { struct wd_dtb *dgst, *k, *plaintext; __u32 ksz = sess->key_size; @@ -1238,7 +1238,7 @@ struct wd_ecc_key *wd_ecc_get_key(handle_t sess) }
int wd_ecc_set_prikey(struct wd_ecc_key *ecc_key, - struct wd_dtb *prikey) + struct wd_dtb *prikey) { struct wd_ecc_prikey *ecc_prikey; struct wd_dtb *d; @@ -1264,7 +1264,7 @@ int wd_ecc_set_prikey(struct wd_ecc_key *ecc_key, }
int wd_ecc_get_prikey(struct wd_ecc_key *ecc_key, - struct wd_dtb **prikey) + struct wd_dtb **prikey) { if (!ecc_key || !prikey) { WD_ERR("invalid: get ecc prikey parameter err!\n"); @@ -2259,8 +2259,8 @@ int wd_do_ecc_async(handle_t sess, struct wd_ecc_req *req) }
idx = wd_ecc_setting.sched.pick_next_ctx(h_sched_ctx, - sess_t->sched_key, - CTX_MODE_ASYNC); + sess_t->sched_key, + CTX_MODE_ASYNC); ret = wd_check_ctx(config, CTX_MODE_ASYNC, idx); if (ret) return ret; @@ -2408,7 +2408,7 @@ int wd_ecc_ctx_num_init(__u32 node, __u32 type, __u32 num, __u8 mode) return ret;
return wd_alg_env_init(&wd_ecc_env_config, table, - &wd_ecc_ops, ARRAY_SIZE(table), &ctx_attr); + &wd_ecc_ops, ARRAY_SIZE(table), &ctx_attr); }
void wd_ecc_ctx_num_uninit(void) diff --git a/wd_mempool.c b/wd_mempool.c index 47ad36b..2d21a0d 100644 --- a/wd_mempool.c +++ b/wd_mempool.c @@ -409,10 +409,10 @@ static int check_mempool_real_size(struct mempool *mp, struct blkpool *bp) }
static int alloc_block_from_mempool(struct mempool *mp, - struct blkpool *bp, - int pos, - int mem_combined_num, - int mem_splited_num) + struct blkpool *bp, + int pos, + int mem_combined_num, + int mem_splited_num) { int pos_last = pos; int pos_first; @@ -435,7 +435,7 @@ static int alloc_block_from_mempool(struct mempool *mp, set_bit(mp->bitmap, i);
ret = alloc_memzone(bp, mp->addr + pos_first * mp->blk_size, - mem_splited_num, pos_first, pos_last); + mem_splited_num, pos_first, pos_last); if (ret < 0) goto err_clear_bit;
@@ -461,7 +461,7 @@ static int alloc_mem_multi_in_one(struct mempool *mp, struct blkpool *bp)
while (blk_num > 0) { ret = alloc_block_from_mempool(mp, bp, pos, 1, - MIN(blk_num, mem_splited_num)); + MIN(blk_num, mem_splited_num)); if (ret < 0) goto err_free_memzone;
@@ -488,7 +488,7 @@ err_check_size: static int alloc_mem_one_need_multi(struct mempool *mp, struct blkpool *bp) { int mem_combined_num = bp->blk_size / mp->blk_size + - (bp->blk_size % mp->blk_size ? 1 : 0); + (bp->blk_size % mp->blk_size ? 1 : 0); int blk_num = bp->depth; int ret = -WD_ENOMEM; int pos = 0; @@ -499,7 +499,7 @@ static int alloc_mem_one_need_multi(struct mempool *mp, struct blkpool *bp)
while (blk_num > 0) { ret = alloc_block_from_mempool(mp, bp, pos, - mem_combined_num, 1); + mem_combined_num, 1); if (ret < 0) goto err_free_memzone;
@@ -660,8 +660,8 @@ err_open: }
/* hp_dir is e.g. /sys/devices/system/node/nodex/hugepages/hugepages-64kB */ -static int get_hugepage_info_per_type(const char *hugepage_path, int path_size, - struct dirent *hp_dir, struct sys_hugepage_config *cfg) +static int get_hugepage_info_per_type(const char *hugepage_path, int path_size, struct dirent *hp_dir, + struct sys_hugepage_config *cfg) { char path[MAX_ATTR_STR_SIZE]; char *name = hp_dir->d_name; diff --git a/wd_rsa.c b/wd_rsa.c index f7f815c..c3709de 100644 --- a/wd_rsa.c +++ b/wd_rsa.c @@ -605,10 +605,10 @@ int wd_rsa_kg_out_data(struct wd_rsa_kg_out *ko, char **data)
/* Create a RSA key generate operation input with parameter e, p and q */ struct wd_rsa_kg_in *wd_rsa_new_kg_in(handle_t sess, struct wd_dtb *e, - struct wd_dtb *p, struct wd_dtb *q) + struct wd_dtb *p, struct wd_dtb *q) { - struct wd_rsa_kg_in *kg_in; struct wd_rsa_sess *c = (struct wd_rsa_sess *)sess; + struct wd_rsa_kg_in *kg_in; int kg_in_size;
if (!c || !e || !p || !q) { @@ -745,7 +745,7 @@ void wd_rsa_del_kg_out(handle_t sess, struct wd_rsa_kg_out *kout) }
void wd_rsa_get_kg_out_params(struct wd_rsa_kg_out *kout, struct wd_dtb *d, - struct wd_dtb *n) + struct wd_dtb *n) { if (!kout) { WD_ERR("invalid: input null at get key gen params!\n"); @@ -766,8 +766,8 @@ void wd_rsa_get_kg_out_params(struct wd_rsa_kg_out *kout, struct wd_dtb *d, }
void wd_rsa_get_kg_out_crt_params(struct wd_rsa_kg_out *kout, - struct wd_dtb *qinv, - struct wd_dtb *dq, struct wd_dtb *dp) + struct wd_dtb *qinv, + struct wd_dtb *dq, struct wd_dtb *dp) { if (!kout || !qinv || !dq || !dp) { WD_ERR("invalid: input null at get key gen crt para!\n"); @@ -794,9 +794,9 @@ void wd_rsa_get_kg_out_crt_params(struct wd_rsa_kg_out *kout, }
void wd_rsa_set_kg_out_crt_psz(struct wd_rsa_kg_out *kout, - size_t qinv_sz, - size_t dq_sz, - size_t dp_sz) + size_t qinv_sz, + size_t dq_sz, + size_t dp_sz) { kout->qinvbytes = qinv_sz; kout->dqbytes = dq_sz; @@ -804,8 +804,8 @@ void wd_rsa_set_kg_out_crt_psz(struct wd_rsa_kg_out *kout, }
void wd_rsa_set_kg_out_psz(struct wd_rsa_kg_out *kout, - size_t d_sz, - size_t n_sz) + size_t d_sz, + size_t n_sz) { kout->dbytes = d_sz; kout->nbytes = n_sz; @@ -847,7 +847,7 @@ static void init_pubkey(struct wd_rsa_pubkey *pubkey, int ksz) }
static int create_sess_key(struct wd_rsa_sess_setup *setup, - struct wd_rsa_sess *sess) + struct wd_rsa_sess *sess) { struct wd_rsa_prikey2 *pkey2; struct wd_rsa_prikey1 *pkey1; @@ -1036,7 +1036,7 @@ int wd_rsa_set_pubkey_params(handle_t sess, struct wd_dtb *e, struct wd_dtb *n) }
void wd_rsa_get_pubkey_params(struct wd_rsa_pubkey *pbk, struct wd_dtb **e, - struct wd_dtb **n) + struct wd_dtb **n) { if (!pbk) { WD_ERR("invalid: input NULL in get rsa public key!\n"); @@ -1084,7 +1084,7 @@ int wd_rsa_set_prikey_params(handle_t sess, struct wd_dtb *d, struct wd_dtb *n) }
void wd_rsa_get_prikey_params(struct wd_rsa_prikey *pvk, struct wd_dtb **d, - struct wd_dtb **n) + struct wd_dtb **n) { struct wd_rsa_prikey1 *pkey1;
@@ -1148,8 +1148,8 @@ static int rsa_prikey2_param_set(struct wd_rsa_prikey2 *pkey2, }
int wd_rsa_set_crt_prikey_params(handle_t sess, struct wd_dtb *dq, - struct wd_dtb *dp, struct wd_dtb *qinv, - struct wd_dtb *q, struct wd_dtb *p) + struct wd_dtb *dp, struct wd_dtb *qinv, + struct wd_dtb *q, struct wd_dtb *p) { struct wd_rsa_sess *c = (struct wd_rsa_sess *)sess; struct wd_rsa_prikey2 *pkey2; @@ -1200,9 +1200,9 @@ int wd_rsa_set_crt_prikey_params(handle_t sess, struct wd_dtb *dq, }
void wd_rsa_get_crt_prikey_params(struct wd_rsa_prikey *pvk, - struct wd_dtb **dq, - struct wd_dtb **dp, struct wd_dtb **qinv, - struct wd_dtb **q, struct wd_dtb **p) + struct wd_dtb **dq, + struct wd_dtb **dp, struct wd_dtb **qinv, + struct wd_dtb **q, struct wd_dtb **p) { struct wd_rsa_prikey2 *pkey2;
diff --git a/wd_sched.c b/wd_sched.c index 6766872..aa6c91e 100644 --- a/wd_sched.c +++ b/wd_sched.c @@ -362,13 +362,13 @@ static handle_t sched_none_init(handle_t h_sched_ctx, void *sched_param) }
static __u32 sched_none_pick_next_ctx(handle_t sched_ctx, - void *sched_key, const int sched_mode) + void *sched_key, const int sched_mode) { return 0; }
static int sched_none_poll_policy(handle_t h_sched_ctx, - __u32 expect, __u32 *count) + __u32 expect, __u32 *count) { struct wd_sched_ctx *sched_ctx = (struct wd_sched_ctx *)h_sched_ctx; __u32 loop_times = MAX_POLL_TIMES + expect; @@ -403,7 +403,7 @@ static handle_t sched_single_init(handle_t h_sched_ctx, void *sched_param) }
static __u32 sched_single_pick_next_ctx(handle_t sched_ctx, - void *sched_key, const int sched_mode) + void *sched_key, const int sched_mode) { #define CTX_ASYNC 1 #define CTX_SYNC 0 diff --git a/wd_util.c b/wd_util.c index 5f149a1..99be973 100644 --- a/wd_util.c +++ b/wd_util.c @@ -813,7 +813,7 @@ static void wd_free_ctx_table(struct wd_env_config *config) }
static int get_and_fill_ctx_num(struct wd_env_config_per_numa *config_numa, - const char *p, int ctx_num) + const char *p, int ctx_num) { struct wd_ctx_range **ctx_table = config_numa->ctx_table; const char *type; @@ -891,7 +891,7 @@ static int get_start_ctx_index(struct wd_env_config *config, }
static void set_ctx_index(struct wd_env_config_per_numa *config_numa, - __u8 mode, int *start) + __u8 mode, int *start) { struct wd_ctx_range **ctx_table = config_numa->ctx_table; int size, i, sum = 0; @@ -1551,8 +1551,8 @@ static void wd_uninit_one_task_queue(struct async_task_queue *task_queue) }
static int wd_init_async_polling_thread_per_numa(struct wd_env_config *config, - struct wd_env_config_per_numa *config_numa, - void *alg_poll_ctx) + struct wd_env_config_per_numa *config_numa, + void *alg_poll_ctx) { struct async_task_queue *task_queue, *queue_head; int i, j, ret; @@ -1592,7 +1592,7 @@ static int wd_init_async_polling_thread_per_numa(struct wd_env_config *config, }
static void wd_uninit_async_polling_thread_per_numa(struct wd_env_config *cfg, - struct wd_env_config_per_numa *config_numa) + struct wd_env_config_per_numa *config_numa) { struct async_task_queue *task_queue, *head; double num; @@ -2001,7 +2001,7 @@ void wd_dlclose_drv(void *dlh_list) }
static void add_lib_to_list(struct drv_lib_list *head, - struct drv_lib_list *node) + struct drv_lib_list *node) { struct drv_lib_list *tmp = head;
From: Wenkai Lin linwenkai6@hisilicon.com
Remove redundant head files.
Signed-off-by: Wenkai Lin linwenkai6@hisilicon.com Signed-off-by: Qi Tao taoqi10@huawei.com --- v1/drv/dummy_drv.c | 1 - v1/drv/dummy_drv.h | 1 - v1/drv/hisi_hpre_udrv.c | 5 ----- v1/drv/hisi_qm_udrv.c | 4 ---- v1/drv/hisi_qm_udrv.h | 1 - v1/drv/hisi_sec_udrv.c | 5 ----- v1/drv/hisi_sec_udrv.h | 1 - v1/drv/hisi_zip_udrv.c | 1 - v1/internal/dummy_hw_usr_if.h | 1 + v1/uacce.h | 1 - v1/wd.h | 1 + v1/wd_adapter.c | 1 - 12 files changed, 2 insertions(+), 21 deletions(-)
diff --git a/v1/drv/dummy_drv.c b/v1/drv/dummy_drv.c index b1c1968..ca0aa43 100644 --- a/v1/drv/dummy_drv.c +++ b/v1/drv/dummy_drv.c @@ -17,7 +17,6 @@ #include <stdio.h> #include <stdlib.h> #include <unistd.h> -#include <assert.h> #include <sys/mman.h> #include <sys/ioctl.h> #include <linux/types.h> diff --git a/v1/drv/dummy_drv.h b/v1/drv/dummy_drv.h index 392a47e..0825efd 100644 --- a/v1/drv/dummy_drv.h +++ b/v1/drv/dummy_drv.h @@ -17,7 +17,6 @@ #ifndef __DUMMY_DRV_H__ #define __DUMMY_DRV_H__
-#include "v1/internal/wd_dummy_usr_if.h" #include "v1/internal/dummy_hw_usr_if.h" #include "v1/wd.h"
diff --git a/v1/drv/hisi_hpre_udrv.c b/v1/drv/hisi_hpre_udrv.c index eaee4b1..0b2bdd5 100644 --- a/v1/drv/hisi_hpre_udrv.c +++ b/v1/drv/hisi_hpre_udrv.c @@ -18,16 +18,11 @@ #include <unistd.h> #include <stdio.h> #include <sys/mman.h> -#include <assert.h> #include <string.h> #include <stdint.h> -#include <fcntl.h> -#include <sys/stat.h> -#include <sys/ioctl.h> #include <sys/epoll.h> #include <sys/eventfd.h> #include <sys/types.h> -#include "config.h" #include "v1/wd_util.h" #include "hisi_hpre_udrv.h"
diff --git a/v1/drv/hisi_qm_udrv.c b/v1/drv/hisi_qm_udrv.c index 03a875b..ea4b199 100644 --- a/v1/drv/hisi_qm_udrv.c +++ b/v1/drv/hisi_qm_udrv.c @@ -18,17 +18,13 @@ #include <unistd.h> #include <stdio.h> #include <sys/mman.h> -#include <assert.h> #include <string.h> #include <stdint.h> -#include <fcntl.h> -#include <sys/stat.h> #include <sys/ioctl.h> #include <sys/epoll.h> #include <sys/eventfd.h> #include <sys/types.h>
-#include "config.h" #include "v1/drv/hisi_zip_udrv.h" #include "v1/drv/hisi_hpre_udrv.h" #include "v1/drv/hisi_sec_udrv.h" diff --git a/v1/drv/hisi_qm_udrv.h b/v1/drv/hisi_qm_udrv.h index cc1aa33..542d20d 100644 --- a/v1/drv/hisi_qm_udrv.h +++ b/v1/drv/hisi_qm_udrv.h @@ -19,7 +19,6 @@
#include <asm/byteorder.h> #include <linux/types.h> -#include "config.h" #include "v1/wd.h" #include "v1/wd_ecc.h" #include "v1/wd_rsa.h" diff --git a/v1/drv/hisi_sec_udrv.c b/v1/drv/hisi_sec_udrv.c index d4e090a..36b93e6 100644 --- a/v1/drv/hisi_sec_udrv.c +++ b/v1/drv/hisi_sec_udrv.c @@ -18,17 +18,12 @@ #include <unistd.h> #include <stdio.h> #include <sys/mman.h> -#include <assert.h> #include <string.h> #include <stdint.h> -#include <fcntl.h> -#include <sys/stat.h> -#include <sys/ioctl.h> #include <sys/epoll.h> #include <sys/eventfd.h> #include <sys/types.h>
-#include "config.h" #include "hisi_sec_udrv.h"
#define SEC_HW_TASK_DONE 1 diff --git a/v1/drv/hisi_sec_udrv.h b/v1/drv/hisi_sec_udrv.h index 9db4af8..c266e96 100644 --- a/v1/drv/hisi_sec_udrv.h +++ b/v1/drv/hisi_sec_udrv.h @@ -18,7 +18,6 @@ #define __HISI_SEC_DRV_H__
#include <linux/types.h> -#include "config.h" #include "v1/wd.h" #include "v1/wd_util.h" #include "v1/wd_cipher.h" diff --git a/v1/drv/hisi_zip_udrv.c b/v1/drv/hisi_zip_udrv.c index dfd1fb3..9c9694b 100644 --- a/v1/drv/hisi_zip_udrv.c +++ b/v1/drv/hisi_zip_udrv.c @@ -27,7 +27,6 @@ #include <sys/epoll.h> #include <sys/eventfd.h> #include <sys/types.h> -#include "config.h" #include "v1/wd_util.h" #include "v1/wd_comp.h" #include "v1/wd_cipher.h" diff --git a/v1/internal/dummy_hw_usr_if.h b/v1/internal/dummy_hw_usr_if.h index 3a9df48..7fb81a1 100644 --- a/v1/internal/dummy_hw_usr_if.h +++ b/v1/internal/dummy_hw_usr_if.h @@ -23,6 +23,7 @@ #define __DUMMY_HW_USR_IF_H
#include <linux/types.h> +#include "v1/internal/wd_dummy_usr_if.h"
#define DUMMY_WD "dummy_wd"
diff --git a/v1/uacce.h b/v1/uacce.h index d45062e..eef932c 100644 --- a/v1/uacce.h +++ b/v1/uacce.h @@ -17,7 +17,6 @@ #ifndef _UAPI_WD_UACCE_H #define _UAPI_WD_UACCE_H
-#include <linux/types.h> #include <linux/ioctl.h>
#define WD_UACCE_CLASS_NAME "uacce" diff --git a/v1/wd.h b/v1/wd.h index 176f2ef..0a32182 100644 --- a/v1/wd.h +++ b/v1/wd.h @@ -22,6 +22,7 @@ #include <stdio.h> #include <string.h> #include <sys/types.h> +#include <asm/types.h> #include <stdbool.h> #include <sys/stat.h> #include <fcntl.h> diff --git a/v1/wd_adapter.c b/v1/wd_adapter.c index b9b841d..b053264 100644 --- a/v1/wd_adapter.c +++ b/v1/wd_adapter.c @@ -18,7 +18,6 @@ #include <string.h> #include <dirent.h>
-#include "config.h" #include "v1/wd_util.h" #include "v1/drv/hisi_qm_udrv.h" #include "v1/drv/hisi_rng_udrv.h"
From: Wenkai Lin linwenkai6@hisilicon.com
dummy is no longer use, remove it.
Signed-off-by: Wenkai Lin linwenkai6@hisilicon.com Signed-off-by: Qi Tao taoqi10@huawei.com --- .gitignore | 1 - v1/drv/dummy_drv.c | 173 ---------------------------------- v1/drv/dummy_drv.h | 34 ------- v1/internal/dummy_hw_usr_if.h | 58 ------------ 4 files changed, 266 deletions(-) delete mode 100644 v1/drv/dummy_drv.c delete mode 100644 v1/drv/dummy_drv.h delete mode 100644 v1/internal/dummy_hw_usr_if.h
diff --git a/.gitignore b/.gitignore index 6a1eb49..3518081 100644 --- a/.gitignore +++ b/.gitignore @@ -160,7 +160,6 @@ m4/ missing sample/uadk_comp stamp-h1 -test/test_dummy test/test_hisi_zip test/test_hisi_zlib test/test_bind_api diff --git a/v1/drv/dummy_drv.c b/v1/drv/dummy_drv.c deleted file mode 100644 index ca0aa43..0000000 --- a/v1/drv/dummy_drv.c +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Copyright 2019 Huawei Technologies Co.,Ltd.All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <sys/mman.h> -#include <sys/ioctl.h> -#include <linux/types.h> - -#include "v1/wd_util.h" -#include "dummy_drv.h" - -#define QM_VERSION_V1 1 -#define QM_VERSION_V2 2 - -struct dummy_q_priv { - int ver; - int head; /* queue head */ - int resp_tail; /* resp tail in the queue */ - /* so in the user side: when add to queue, head++ but don't exceed resp_tail. - * when get back from the queue, resp_tail++ but don't exceed tail. - * in the kernel side: when get from queue, tail++ but don't exceed head-1 */ - - struct dummy_hw_queue_reg *reg; - uint64_t *db; -}; - -int dummy_set_queue_dio(struct wd_queue *q) -{ - int ret = 0; - struct dummy_q_priv *priv; - struct q_info *qinfo = q->qinfo; - - priv = calloc(1, sizeof(*priv)); - if (!priv) { - DUMMY_ERR("No memory for dummy queue!\n"); - ret = -ENOMEM; - goto out; - } - - qinfo->priv = priv; - priv->ver = qinfo->qfrs_offset[WD_UACCE_QFRT_DUS] == - WD_UACCE_QFRT_INVALID ? - QM_VERSION_V1 : QM_VERSION_V2; - - if (priv->ver == QM_VERSION_V2) { - priv->db = wd_drv_mmap_qfr(q, WD_UACCE_QFRT_MMIO, 0); - if (priv->db == MAP_FAILED) { - DUMMY_ERR("mmap db fail (%d)\n", errno); - goto out_with_priv; - } - } - - priv->reg = wd_drv_mmap_qfr(q, priv->ver == QM_VERSION_V1 ? - WD_UACCE_QFRT_MMIO : WD_UACCE_QFRT_DUS, 0); - if (priv->reg == MAP_FAILED) { - DUMMY_ERR("mmap bd fail (%d)\n", errno); - goto out_with_db_map; - } - - /* detect hardware for v1 (v2 can be detected only after start) */ - if (priv->ver == QM_VERSION_V1 && - memcmp(priv->reg->hw_tag, DUMMY_HW_TAG, DUMMY_HW_TAG_SZ)) { - DUMMY_ERR("hw detection fail\n"); - goto out_with_bd_map; - } - - return 0; - -out_with_bd_map: - if (priv->ver == QM_VERSION_V1) - wd_drv_unmmap_qfr(q, priv->reg, WD_UACCE_QFRT_MMIO, 0); - else - wd_drv_unmmap_qfr(q, priv->reg, WD_UACCE_QFRT_DUS, 0); -out_with_db_map: - if (priv->ver == QM_VERSION_V2) - wd_drv_unmmap_qfr(q, priv->db, WD_UACCE_QFRT_MMIO, 0); -out_with_priv: - free(priv); - qinfo->priv = NULL; -out: - if (errno) - ret = errno; - else - ret = -EIO; - return ret; -} - -void dummy_unset_queue_dio(struct wd_queue *q) -{ - struct q_info *qinfo = q->qinfo; - struct dummy_q_priv *priv = (struct dummy_q_priv *)qinfo->priv; - - ASSERT(priv); - - munmap(priv->reg, sizeof(struct dummy_hw_queue_reg)); - free(priv); - qinfo->priv = NULL; -} - -int dummy_add_to_dio_q(struct wd_queue *q, void **req, __u32 num) -{ - struct q_info *qinfo = q->qinfo; - struct dummy_q_priv *priv = (struct dummy_q_priv *)qinfo->priv; - int bd_num; - - ASSERT(priv); - - bd_num = priv->reg->ring_bd_num; - - if ((priv->head + 1) % bd_num == priv->resp_tail) - return -EBUSY; /* the queue is full */ - else { - priv->reg->ring[priv->head] = *((struct ring_bd *)(req[0])); - priv->reg->ring[priv->head].ptr = req[0]; - priv->head = (priv->head + 1) % bd_num; - wd_reg_write(&priv->reg->head, priv->head); - printf("add to queue, new head=%d, %d\n", priv->head, priv->reg->head); - - if (priv->ver == QM_VERSION_V2) - wd_reg_write(priv->db, 1); - } - - return 0; -} - -int dummy_get_from_dio_q(struct wd_queue *q, void **resp, __u32 num) -{ - struct q_info *qinfo = q->qinfo; - struct dummy_q_priv *priv = (struct dummy_q_priv *)qinfo->priv; - int bd_num = priv->reg->ring_bd_num; - int ret; - int tail; - - ASSERT(priv); - - tail = wd_reg_read(&priv->reg->tail); - printf("get queue tail=%d,%d\n", tail, priv->resp_tail); - if (priv->resp_tail == tail) { - return -EBUSY; - } else { - ret = priv->reg->ring[priv->resp_tail].ret; - *resp = priv->reg->ring[priv->resp_tail].ptr; - priv->resp_tail = (priv->resp_tail + 1) % bd_num; - printf("get resp %d, %d\n", ret, priv->resp_tail); - return ret; - } -} - -void dummy_flush(struct wd_queue *q) -{ - struct q_info *qinfo = q->qinfo; - struct dummy_q_priv *priv = (struct dummy_q_priv *)qinfo->priv; - - if (priv->ver == QM_VERSION_V1) - ioctl(qinfo->fd, DUMMY_CMD_FLUSH); - else - wd_reg_write(priv->db, 1); -} diff --git a/v1/drv/dummy_drv.h b/v1/drv/dummy_drv.h deleted file mode 100644 index 0825efd..0000000 --- a/v1/drv/dummy_drv.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2019 Huawei Technologies Co.,Ltd.All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef __DUMMY_DRV_H__ -#define __DUMMY_DRV_H__ - -#include "v1/internal/dummy_hw_usr_if.h" -#include "v1/wd.h" - -#ifndef DUMMY_ERR -#define DUMMY_ERR(format, args...) printf(format, ##args) -#endif - -int dummy_set_queue_dio(struct wd_queue *q); -void dummy_unset_queue_dio(struct wd_queue *q); -int dummy_add_to_dio_q(struct wd_queue *q, void **req, __u32 num); -int dummy_get_from_dio_q(struct wd_queue *q, void **resp, __u32 num); -void dummy_flush(struct wd_queue *q); -void *dummy_reserve_mem(struct wd_queue *q, size_t size); - -#endif diff --git a/v1/internal/dummy_hw_usr_if.h b/v1/internal/dummy_hw_usr_if.h deleted file mode 100644 index 7fb81a1..0000000 --- a/v1/internal/dummy_hw_usr_if.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2019 Huawei Technologies Co.,Ltd.All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * This file defines the dummy hardware/driver interface between the user and - * kernel space - */ - -#ifndef __DUMMY_HW_USR_IF_H -#define __DUMMY_HW_USR_IF_H - -#include <linux/types.h> -#include "v1/internal/wd_dummy_usr_if.h" - -#define DUMMY_WD "dummy_wd" - -#define Q_BDS 16 -#define DUMMY_HW_TAG_SZ 8 -#define DUMMY_HW_TAG "WDDUMMY" - -/* the format of the device ring space, which is of drv */ -#define ring_bd wd_dummy_cpy_msg - -/* the format of the device io space, which is of drv */ -struct dummy_hw_queue_reg { - char hw_tag[DUMMY_HW_TAG_SZ]; /* should be "WDDUMMY\0" */ - struct ring_bd ring[Q_BDS]; /* in real hardware, this is good to be - in memory space, and will be fast - for communication. here we keep it - in io space just to make it simple - */ - __u32 ring_bd_num; /* ring_bd_num, now it is Q_BDS until - we use a memory ring */ - __u32 head; /* assume int is atomical. it should be - fine as a dummy and test function. - head is for the writer(user) while - tail is for the reader(kernel). - head==tail means the queue is empty - */ - __u32 tail; -}; - -#define DUMMY_CMD_FLUSH _IO('d', 0) - -#endif