Skip to content

Commit

Permalink
adapter: sort workers as priority if no UADK_CONF
Browse files Browse the repository at this point in the history
if UADK_CONF, worker sequence is decided by UADK_CONF
otherwise, workers is listed as drv->priority

Signed-off-by: Zhangfei Gao <[email protected]>
  • Loading branch information
zhangfeigao committed Oct 8, 2024
1 parent 9c056b5 commit b6cf3b1
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions adapter.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,22 @@ int uadk_adapter_add_workers(struct uadk_adapter *adapter, char *alg)
break;
} while (drv);

/* sorted as priority */
for (int i = 0; i < adapter->workers_nb; i++) {
for (int j = i; j < adapter->workers_nb; j++) {
if (adapter->workers[i].driver->priority <
adapter->workers[j].driver->priority) {
struct uadk_adapter_worker tmp_worker;

tmp_worker.driver = adapter->workers[i].driver;
adapter->workers[i].driver = adapter->workers[j].driver;
adapter->workers[i].idx = i;
adapter->workers[j].driver = tmp_worker.driver;
adapter->workers[j].idx = j;
}
}
}

return (adapter->workers_nb == 0);
}

Expand Down

0 comments on commit b6cf3b1

Please sign in to comment.