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

Adapter part2 #642

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open

Adapter part2 #642

wants to merge 9 commits into from

Conversation

gaozhangfei
Copy link
Collaborator

adapter part 2,

  1. add adapter
  2. use workers to record each resources, each work should work independently
  3. switch between works

part1 is #636

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]>
Now wd_init_sched will copy sched memory,
later the &sched will be directly used without copy.
So use static var instead of temp var, which will be freed.

Signed-off-by: Zhangfei Gao <[email protected]>
poll_ctx adds para wd_sched to transfer para,
since different driver may use different pool.

Signed-off-by: Zhangfei Gao <[email protected]>
wd_find_drv is used to find drv with name and alg,
also takes idx to search the idx'th drv

Signed-off-by: Zhangfei Gao <[email protected]>
Using uadk_adapter_worker to record driver and resources.
So adding multi driver is adding workers.
The worker priority and mode can be set by env UADK_CONF.

For export UADK_CONF=TO_PATH/uadk.conf

    Example: uadk.conf
    mode=1
    driver_name=isa_ce_sm3
    driver_name=hisi_sec2

If env UADK_CONF exist, only parse UADK_CONF and add to
adapter->workers[] one by one. So the first driver
has higher priority

Otherwise, parse all drivers and choose the top two
priorities drivers to adapter->workers[]

Signed-off-by: Zhangfei Gao <[email protected]>
Using uadk_adapter_worker to record driver and resources.
so adding multi driver is adding workers.
To make sure different worker can work.

Signed-off-by: Zhangfei Gao <[email protected]>
case 1: sync or async error, switch worker
case 2: roundrobin mode, switch worker after worker->looptime (10)

Signed-off-by: Zhangfei Gao <[email protected]>
By default each worker loop 10 times in roundrobin mode,
except looptime is set in UADK_CONF

For example:
uadk.conf
looptime=5
mode=1

Signed-off-by: Zhangfei Gao <[email protected]>
@gaozhangfei
Copy link
Collaborator Author

如何使用

  1. 默认,没有配置文件,
    选最高优先级两个驱动,primary 模式,工作时最高优先级驱动,worker[0], 出错时才切换次优先级驱动worker[1], 运行10次(looptime)再尝试切回worker[0]

命令和之前一样
example:
numactl --cpubind=0 --membind=0 uadk_tool benchmark --alg sm3 --mode instr --opt 0 --sync --pktlen 1024 --seconds 20 --multi 1 --thread 8 --ctxnum 8 --init2

  1. 提供配置文件, 根据配置文件依次worker[0], worke[1], 可以配置round robin模式,轮流跑10次(looptime 可配置)
    example:
    vi uadk.conf
    mode=1
    driver_name=isa_ce_sm3
    driver_name=hisi_sec2
    export UADK_CONF=xxx/uadk.conf
    运行命令

  2. config 每次运行生效,可以更换驱动顺序,
    参数有
    mode=1 (默认是primary模式,出错才选择worker[1], mode=1时round robin, 两个驱动依次执行looptime次)
    looptime=5 (默认10,)

  3. 工作机制
    setting -> adapter -> workers[]
    sess->worker: alloc_sess 会选择worker[0], 某些时候sess->worker 会切换,如果出错或者round robin
    工作时,worker=sess->worker

细节参考
【腾讯文档】adapter2024.7.31
https://docs.qq.com/doc/DRWVVTWFQWU1QeVFz

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.

2 participants