Lines Matching full:backend
64 CryptoDevBackend *backend; in qmp_query_cryptodev_foreach() local
75 backend = CRYPTODEV_BACKEND(obj); in qmp_query_cryptodev_foreach()
76 services = backend->conf.crypto_services; in qmp_query_cryptodev_foreach()
83 for (i = 0; i < backend->conf.peers.queues; i++) { in qmp_query_cryptodev_foreach()
84 CryptoDevBackendClient *cc = backend->conf.peers.ccs[i]; in qmp_query_cryptodev_foreach()
126 CryptoDevBackend *backend, in cryptodev_backend_cleanup() argument
130 CRYPTODEV_BACKEND_GET_CLASS(backend); in cryptodev_backend_cleanup()
133 bc->cleanup(backend, errp); in cryptodev_backend_cleanup()
136 g_free(backend->sym_stat); in cryptodev_backend_cleanup()
137 g_free(backend->asym_stat); in cryptodev_backend_cleanup()
141 CryptoDevBackend *backend, in cryptodev_backend_create_session() argument
148 CRYPTODEV_BACKEND_GET_CLASS(backend); in cryptodev_backend_create_session()
151 return bc->create_session(backend, sess_info, queue_index, cb, opaque); in cryptodev_backend_create_session()
157 CryptoDevBackend *backend, in cryptodev_backend_close_session() argument
164 CRYPTODEV_BACKEND_GET_CLASS(backend); in cryptodev_backend_close_session()
167 return bc->close_session(backend, session_id, queue_index, cb, opaque); in cryptodev_backend_close_session()
173 CryptoDevBackend *backend, in cryptodev_backend_operation() argument
177 CRYPTODEV_BACKEND_GET_CLASS(backend); in cryptodev_backend_operation()
180 return bc->do_op(backend, op_info); in cryptodev_backend_operation()
185 static int cryptodev_backend_account(CryptoDevBackend *backend, in cryptodev_backend_account() argument
195 if (unlikely(!backend->asym_stat)) { in cryptodev_backend_account()
201 CryptodevAsymStatIncEncrypt(backend, len); in cryptodev_backend_account()
204 CryptodevAsymStatIncDecrypt(backend, len); in cryptodev_backend_account()
207 CryptodevAsymStatIncSign(backend, len); in cryptodev_backend_account()
210 CryptodevAsymStatIncVerify(backend, len); in cryptodev_backend_account()
219 if (unlikely(!backend->sym_stat)) { in cryptodev_backend_account()
225 CryptodevSymStatIncEncrypt(backend, len); in cryptodev_backend_account()
228 CryptodevSymStatIncDecrypt(backend, len); in cryptodev_backend_account()
243 CryptoDevBackend *backend = (CryptoDevBackend *)opaque; in cryptodev_backend_throttle_timer_cb() local
247 QTAILQ_FOREACH_SAFE(op_info, &backend->opinfos, next, tmpop) { in cryptodev_backend_throttle_timer_cb()
248 QTAILQ_REMOVE(&backend->opinfos, op_info, next); in cryptodev_backend_throttle_timer_cb()
249 ret = cryptodev_backend_account(backend, op_info); in cryptodev_backend_throttle_timer_cb()
255 throttle_account(&backend->ts, THROTTLE_WRITE, ret); in cryptodev_backend_throttle_timer_cb()
256 cryptodev_backend_operation(backend, op_info); in cryptodev_backend_throttle_timer_cb()
257 if (throttle_enabled(&backend->tc) && in cryptodev_backend_throttle_timer_cb()
258 throttle_schedule_timer(&backend->ts, &backend->tt, in cryptodev_backend_throttle_timer_cb()
266 CryptoDevBackend *backend, in cryptodev_backend_crypto_operation() argument
271 if (!throttle_enabled(&backend->tc)) { in cryptodev_backend_crypto_operation()
275 if (throttle_schedule_timer(&backend->ts, &backend->tt, THROTTLE_WRITE) || in cryptodev_backend_crypto_operation()
276 !QTAILQ_EMPTY(&backend->opinfos)) { in cryptodev_backend_crypto_operation()
277 QTAILQ_INSERT_TAIL(&backend->opinfos, op_info, next); in cryptodev_backend_crypto_operation()
282 ret = cryptodev_backend_account(backend, op_info); in cryptodev_backend_crypto_operation()
287 throttle_account(&backend->ts, THROTTLE_WRITE, ret); in cryptodev_backend_crypto_operation()
289 return cryptodev_backend_operation(backend, op_info); in cryptodev_backend_crypto_operation()
296 CryptoDevBackend *backend = CRYPTODEV_BACKEND(obj); in cryptodev_backend_get_queues() local
297 uint32_t value = backend->conf.peers.queues; in cryptodev_backend_get_queues()
306 CryptoDevBackend *backend = CRYPTODEV_BACKEND(obj); in cryptodev_backend_set_queues() local
317 backend->conf.peers.queues = value; in cryptodev_backend_set_queues()
320 static void cryptodev_backend_set_throttle(CryptoDevBackend *backend, int field, in cryptodev_backend_set_throttle() argument
323 uint64_t orig = backend->tc.buckets[field].avg; in cryptodev_backend_set_throttle()
324 bool enabled = throttle_enabled(&backend->tc); in cryptodev_backend_set_throttle()
330 backend->tc.buckets[field].avg = value; in cryptodev_backend_set_throttle()
331 if (!throttle_enabled(&backend->tc)) { in cryptodev_backend_set_throttle()
332 throttle_timers_destroy(&backend->tt); in cryptodev_backend_set_throttle()
333 cryptodev_backend_throttle_timer_cb(backend); /* drain opinfos */ in cryptodev_backend_set_throttle()
337 if (!throttle_is_valid(&backend->tc, errp)) { in cryptodev_backend_set_throttle()
338 backend->tc.buckets[field].avg = orig; /* revert change */ in cryptodev_backend_set_throttle()
343 throttle_init(&backend->ts); in cryptodev_backend_set_throttle()
344 throttle_timers_init(&backend->tt, qemu_get_aio_context(), in cryptodev_backend_set_throttle()
346 cryptodev_backend_throttle_timer_cb, backend); in cryptodev_backend_set_throttle()
349 throttle_config(&backend->ts, QEMU_CLOCK_REALTIME, &backend->tc); in cryptodev_backend_set_throttle()
356 CryptoDevBackend *backend = CRYPTODEV_BACKEND(obj); in cryptodev_backend_get_bps() local
357 uint64_t value = backend->tc.buckets[THROTTLE_BPS_TOTAL].avg; in cryptodev_backend_get_bps()
365 CryptoDevBackend *backend = CRYPTODEV_BACKEND(obj); in cryptodev_backend_set_bps() local
372 cryptodev_backend_set_throttle(backend, THROTTLE_BPS_TOTAL, value, errp); in cryptodev_backend_set_bps()
378 CryptoDevBackend *backend = CRYPTODEV_BACKEND(obj); in cryptodev_backend_get_ops() local
379 uint64_t value = backend->tc.buckets[THROTTLE_OPS_TOTAL].avg; in cryptodev_backend_get_ops()
388 CryptoDevBackend *backend = CRYPTODEV_BACKEND(obj); in cryptodev_backend_set_ops() local
395 cryptodev_backend_set_throttle(backend, THROTTLE_OPS_TOTAL, value, errp); in cryptodev_backend_set_ops()
402 CryptoDevBackend *backend = CRYPTODEV_BACKEND(uc); in cryptodev_backend_complete() local
407 QTAILQ_INIT(&backend->opinfos); in cryptodev_backend_complete()
408 value = backend->tc.buckets[THROTTLE_OPS_TOTAL].avg; in cryptodev_backend_complete()
409 cryptodev_backend_set_throttle(backend, THROTTLE_OPS_TOTAL, value, errp); in cryptodev_backend_complete()
413 value = backend->tc.buckets[THROTTLE_BPS_TOTAL].avg; in cryptodev_backend_complete()
414 cryptodev_backend_set_throttle(backend, THROTTLE_BPS_TOTAL, value, errp); in cryptodev_backend_complete()
420 bc->init(backend, errp); in cryptodev_backend_complete()
426 services = backend->conf.crypto_services; in cryptodev_backend_complete()
428 backend->sym_stat = g_new0(CryptodevBackendSymStat, 1); in cryptodev_backend_complete()
432 backend->asym_stat = g_new0(CryptodevBackendAsymStat, 1); in cryptodev_backend_complete()
436 void cryptodev_backend_set_used(CryptoDevBackend *backend, bool used) in cryptodev_backend_set_used() argument
438 backend->is_used = used; in cryptodev_backend_set_used()
441 bool cryptodev_backend_is_used(CryptoDevBackend *backend) in cryptodev_backend_is_used() argument
443 return backend->is_used; in cryptodev_backend_is_used()
446 void cryptodev_backend_set_ready(CryptoDevBackend *backend, bool ready) in cryptodev_backend_set_ready() argument
448 backend->ready = ready; in cryptodev_backend_set_ready()
451 bool cryptodev_backend_is_ready(CryptoDevBackend *backend) in cryptodev_backend_is_ready() argument
453 return backend->ready; in cryptodev_backend_is_ready()
464 CryptoDevBackend *backend = CRYPTODEV_BACKEND(obj); in cryptodev_backend_instance_init() local
469 throttle_config_init(&backend->tc); in cryptodev_backend_instance_init()
474 CryptoDevBackend *backend = CRYPTODEV_BACKEND(obj); in cryptodev_backend_finalize() local
476 cryptodev_backend_cleanup(backend, NULL); in cryptodev_backend_finalize()
477 if (throttle_enabled(&backend->tc)) { in cryptodev_backend_finalize()
478 throttle_timers_destroy(&backend->tt); in cryptodev_backend_finalize()
502 CryptoDevBackend *backend; in cryptodev_backend_stats_query() local
510 backend = CRYPTODEV_BACKEND(obj); in cryptodev_backend_stats_query()
511 sym_stat = backend->sym_stat; in cryptodev_backend_stats_query()
523 asym_stat = backend->asym_stat; in cryptodev_backend_stats_query()