Lines Matching refs:lkcf

79     CryptoDevBackendLKCF *lkcf;  member
110 CryptoDevBackendLKCF *lkcf = (CryptoDevBackendLKCF *)opaque; in cryptodev_lkcf_handle_response() local
116 eventfd_read(lkcf->eventfd, &nevent); in cryptodev_lkcf_handle_response()
118 qemu_mutex_lock(&lkcf->rsp_mutex); in cryptodev_lkcf_handle_response()
119 QSIMPLEQ_PREPEND(&responses, &lkcf->responses); in cryptodev_lkcf_handle_response()
120 qemu_mutex_unlock(&lkcf->rsp_mutex); in cryptodev_lkcf_handle_response()
195 static int cryptodev_lkcf_get_unused_session_index(CryptoDevBackendLKCF *lkcf) in cryptodev_lkcf_get_unused_session_index() argument
200 if (lkcf->sess[i] == NULL) { in cryptodev_lkcf_get_unused_session_index()
212 CryptoDevBackendLKCF *lkcf = in cryptodev_lkcf_init() local
220 lkcf->eventfd = eventfd(0, 0); in cryptodev_lkcf_init()
221 if (lkcf->eventfd < 0) { in cryptodev_lkcf_init()
235 lkcf->running = true; in cryptodev_lkcf_init()
237 QSIMPLEQ_INIT(&lkcf->requests); in cryptodev_lkcf_init()
238 QSIMPLEQ_INIT(&lkcf->responses); in cryptodev_lkcf_init()
239 qemu_mutex_init(&lkcf->mutex); in cryptodev_lkcf_init()
240 qemu_mutex_init(&lkcf->rsp_mutex); in cryptodev_lkcf_init()
241 qemu_cond_init(&lkcf->cond); in cryptodev_lkcf_init()
243 qemu_thread_create(&lkcf->worker_threads[i], "lkcf-worker", in cryptodev_lkcf_init()
244 cryptodev_lkcf_worker, lkcf, 0); in cryptodev_lkcf_init()
247 lkcf->eventfd, cryptodev_lkcf_handle_response, NULL, lkcf); in cryptodev_lkcf_init()
253 CryptoDevBackendLKCF *lkcf = CRYPTODEV_BACKEND_LKCF(backend); in cryptodev_lkcf_cleanup() local
259 qemu_mutex_lock(&lkcf->mutex); in cryptodev_lkcf_cleanup()
260 lkcf->running = false; in cryptodev_lkcf_cleanup()
261 qemu_mutex_unlock(&lkcf->mutex); in cryptodev_lkcf_cleanup()
262 qemu_cond_broadcast(&lkcf->cond); in cryptodev_lkcf_cleanup()
264 close(lkcf->eventfd); in cryptodev_lkcf_cleanup()
266 qemu_thread_join(&lkcf->worker_threads[i]); in cryptodev_lkcf_cleanup()
269 QSIMPLEQ_FOREACH_SAFE(task, &lkcf->requests, queue, next) { in cryptodev_lkcf_cleanup()
276 QSIMPLEQ_FOREACH_SAFE(task, &lkcf->responses, queue, next) { in cryptodev_lkcf_cleanup()
283 qemu_mutex_destroy(&lkcf->mutex); in cryptodev_lkcf_cleanup()
284 qemu_cond_destroy(&lkcf->cond); in cryptodev_lkcf_cleanup()
285 qemu_mutex_destroy(&lkcf->rsp_mutex); in cryptodev_lkcf_cleanup()
288 if (lkcf->sess[i] != NULL) { in cryptodev_lkcf_cleanup()
431 qemu_mutex_lock(&task->lkcf->rsp_mutex); in cryptodev_lkcf_execute_task()
432 if (QSIMPLEQ_EMPTY(&task->lkcf->responses)) { in cryptodev_lkcf_execute_task()
435 QSIMPLEQ_INSERT_TAIL(&task->lkcf->responses, task, queue); in cryptodev_lkcf_execute_task()
436 qemu_mutex_unlock(&task->lkcf->rsp_mutex); in cryptodev_lkcf_execute_task()
439 eventfd_write(task->lkcf->eventfd, 1); in cryptodev_lkcf_execute_task()
474 CryptoDevBackendLKCF *lkcf = in cryptodev_lkcf_operation() local
481 lkcf->sess[op_info->session_id] == NULL) { in cryptodev_lkcf_operation()
487 sess = lkcf->sess[op_info->session_id]; in cryptodev_lkcf_operation()
498 task->lkcf = lkcf; in cryptodev_lkcf_operation()
501 qemu_mutex_lock(&lkcf->mutex); in cryptodev_lkcf_operation()
502 QSIMPLEQ_INSERT_TAIL(&lkcf->requests, task, queue); in cryptodev_lkcf_operation()
503 qemu_mutex_unlock(&lkcf->mutex); in cryptodev_lkcf_operation()
504 qemu_cond_signal(&lkcf->cond); in cryptodev_lkcf_operation()
510 CryptoDevBackendLKCF *lkcf, in cryptodev_lkcf_create_asym_session() argument
549 index = cryptodev_lkcf_get_unused_session_index(lkcf); in cryptodev_lkcf_create_asym_session()
560 lkcf->sess[index] = g_steal_pointer(&sess); in cryptodev_lkcf_create_asym_session()
574 CryptoDevBackendLKCF *lkcf = in cryptodev_lkcf_create_session() local
582 lkcf, asym_sess_info, &sess_info->session_id); in cryptodev_lkcf_create_session()
603 CryptoDevBackendLKCF *lkcf = CRYPTODEV_BACKEND_LKCF(backend); in cryptodev_lkcf_close_session() local
606 assert(session_id < MAX_SESSIONS && lkcf->sess[session_id]); in cryptodev_lkcf_close_session()
607 session = lkcf->sess[session_id]; in cryptodev_lkcf_close_session()
608 lkcf->sess[session_id] = NULL; in cryptodev_lkcf_close_session()