Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F142652283
D28195.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D28195.id.diff
View Options
diff --git a/sys/opencrypto/ktls_ocf.c b/sys/opencrypto/ktls_ocf.c
--- a/sys/opencrypto/ktls_ocf.c
+++ b/sys/opencrypto/ktls_ocf.c
@@ -108,7 +108,13 @@
"Number of OCF encryption operation retries");
static int
-ktls_ocf_callback(struct cryptop *crp)
+ktls_ocf_callback_sync(struct cryptop *crp __unused)
+{
+ return (0);
+}
+
+static int
+ktls_ocf_callback_async(struct cryptop *crp)
{
struct ocf_operation *oo;
@@ -125,21 +131,26 @@
{
struct ocf_operation oo;
int error;
+ bool async;
oo.os = os;
oo.done = false;
crp->crp_opaque = &oo;
- crp->crp_callback = ktls_ocf_callback;
for (;;) {
+ async = !CRYPTO_SESS_SYNC(crp->crp_session);
+ crp->crp_callback = async ? ktls_ocf_callback_async :
+ ktls_ocf_callback_sync;
+
error = crypto_dispatch(crp);
if (error)
break;
-
- mtx_lock(&os->lock);
- while (!oo.done)
- mtx_sleep(&oo, &os->lock, 0, "ocfktls", 0);
- mtx_unlock(&os->lock);
+ if (async) {
+ mtx_lock(&os->lock);
+ while (!oo.done)
+ mtx_sleep(&oo, &os->lock, 0, "ocfktls", 0);
+ mtx_unlock(&os->lock);
+ }
if (crp->crp_etype != EAGAIN) {
error = crp->crp_etype;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Jan 22, 9:34 PM (20 h, 28 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27863876
Default Alt Text
D28195.id.diff (1 KB)
Attached To
Mode
D28195: ktls: Avoid wakeups and locking for synchronous callbacks
Attached
Detach File
Event Timeline
Log In to Comment