Skip to content

Commit

Permalink
adapter: add LOOP_KEY "looptime"
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
zhangfeigao committed Dec 26, 2024
1 parent f4fc058 commit 3fc0fc5
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions adapter.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#define CONFIG_FILE_ENV "UADK_CONF"
#define DRIVER_NAME_KEY "driver_name"
#define MODE_KEY "mode"
#define LOOP_KEY "looptime"
#define WORKERS_NB 8

static int read_value_int(char *conf, const char *key)
Expand Down Expand Up @@ -91,8 +92,14 @@ int uadk_adapter_add_workers(struct uadk_adapter *adapter, char *alg)
adapter->looptime = UADK_WORKER_LOOPTIME;

if (conf != NULL) {
int looptime = 0;

/* if env UADK_CONF exist, parse config first */
adapter->mode = read_value_int(conf, MODE_KEY);
looptime = read_value_int(conf, LOOP_KEY);
if (looptime != 0)
adapter->looptime = looptime;

read_config_entries(conf, adapter, alg);
if (adapter->workers_nb != 0)
return 0;
Expand Down

0 comments on commit 3fc0fc5

Please sign in to comment.