MCPcopy Create free account
hub / github.com/F-Stack/f-stack / crypto_dispatch

Function crypto_dispatch

freebsd/opencrypto/crypto.c:1412–1461  ·  view source on GitHub ↗

* Add a crypto request to a queue, to be processed by the kernel thread. */

Source from the content-addressed store, hash-verified

1410 * Add a crypto request to a queue, to be processed by the kernel thread.
1411 */
1412int
1413crypto_dispatch(struct cryptop *crp)
1414{
1415 struct cryptocap *cap;
1416 int result;
1417
1418#ifdef INVARIANTS
1419 crp_sanity(crp);
1420#endif
1421
1422 CRYPTOSTAT_INC(cs_ops);
1423
1424 crp->crp_retw_id = crp->crp_session->id % crypto_workers_num;
1425
1426 if (CRYPTOP_ASYNC(crp)) {
1427 if (crp->crp_flags & CRYPTO_F_ASYNC_KEEPORDER) {
1428 struct crypto_ret_worker *ret_worker;
1429
1430 ret_worker = CRYPTO_RETW(crp->crp_retw_id);
1431
1432 CRYPTO_RETW_LOCK(ret_worker);
1433 crp->crp_seq = ret_worker->reorder_ops++;
1434 CRYPTO_RETW_UNLOCK(ret_worker);
1435 }
1436
1437 TASK_INIT(&crp->crp_task, 0, crypto_task_invoke, crp);
1438 taskqueue_enqueue(crypto_tq, &crp->crp_task);
1439 return (0);
1440 }
1441
1442 if ((crp->crp_flags & CRYPTO_F_BATCH) == 0) {
1443 /*
1444 * Caller marked the request to be processed
1445 * immediately; dispatch it directly to the
1446 * driver unless the driver is currently blocked.
1447 */
1448 cap = crp->crp_session->cap;
1449 if (!cap->cc_qblocked) {
1450 result = crypto_invoke(cap, crp, 0);
1451 if (result != ERESTART)
1452 return (result);
1453 /*
1454 * The driver ran out of resources, put the request on
1455 * the queue.
1456 */
1457 }
1458 }
1459 crypto_batch_enqueue(crp);
1460 return 0;
1461}
1462
1463void
1464crypto_batch_enqueue(struct cryptop *crp)

Callers 15

zfs_crypto_dispatchFunction · 0.85
cryptodev_opFunction · 0.85
cryptodev_aeadFunction · 0.85
ktls_ocf_dispatchFunction · 0.85
ipcomp_inputFunction · 0.85
ipcomp_input_cbFunction · 0.85
ipcomp_outputFunction · 0.85
ipcomp_output_cbFunction · 0.85
ah_inputFunction · 0.85
ah_input_cbFunction · 0.85
ah_outputFunction · 0.85
ah_output_cbFunction · 0.85

Calls 4

crp_sanityFunction · 0.85
taskqueue_enqueueFunction · 0.85
crypto_invokeFunction · 0.85
crypto_batch_enqueueFunction · 0.85

Tested by

no test coverage detected