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

Conversation

gaozhangfei
Copy link
Collaborator

replace pr636, target to develop branch

Use the common func wd_find_msg_in_pool to replace the different
wd_xxx_get_msg via passing the pool to the drv.priv->config.poll

Signed-off-by: Zhangfei Gao <[email protected]>
The wd_util.c and wd_shced.c should be in libwd.so
No need to export in every algo.so

Signed-off-by: Zhangfei Gao <[email protected]>
@gaozhangfei gaozhangfei closed this Dec 4, 2024
@gaozhangfei gaozhangfei reopened this Dec 4, 2024
@gaozhangfei gaozhangfei closed this Dec 5, 2024
@gaozhangfei gaozhangfei reopened this Dec 5, 2024
@@ -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和公共文件耦合,无法理解它的好处。

@youngersh
Copy link
Collaborator

仅我个人观点而言,第二个patch [uadk: use wd_find_msg_in_pool to replace wd_xxx_get_msg] 的修改不是很有必要,理由有:
1、msg算是一个对驱动开发者的南向接口,不是很有必要的情况下,最好不要动接口;
2、虽然当前的get msg看起来都是一层的封装,但是这个接口本身语义很明显,内部逻辑也不复杂,没有什么重复代码,假如涉及到公共部分的修改,仍然可以在find_msg中统一修改,但是如果涉及到算法的私有逻辑之后,当前的格式可以方便的进行适配,改了之后就不行了。

@gaozhangfei
Copy link
Collaborator Author

这是两个事情

  1. 其他drv/应用程序 调用libwd的函数,
    因为肯定-lwd, 所以只要libwd 统一export 就行了。
    不然每个库都要export 一下,当然也是可以的,比如新加一个库,就也需要把这几个函数都export一下

  2. 其他库调用libwd的函数,这个比较多,
    如果完全拆分,统一放libwd export 也行
    不拆分也行,其他库需要编译的时候包括下,
    两种都行,用户无感知,因为用不到

当然patch2 不要也行,只是简化下,不用每个库都export 下这几个app/drv 用到的函数

@Liulongfang
Copy link
Collaborator

It is recommended to put this patches to the PR: Adapter part2 #647

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants