Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/opencrypto refactor crypto_dispatch (2/3): divide migrat...
details: https://anonhg.NetBSD.org/src/rev/403b53cafc01
branches: trunk
changeset: 823974:403b53cafc01
user: knakahara <knakahara%NetBSD.org@localhost>
date: Wed May 17 06:52:08 2017 +0000
description:
refactor crypto_dispatch (2/3): divide migrate operation
diffstat:
sys/opencrypto/crypto.c | 24 ++++++++++++++++++++----
1 files changed, 20 insertions(+), 4 deletions(-)
diffs (50 lines):
diff -r 109f232b6ed3 -r 403b53cafc01 sys/opencrypto/crypto.c
--- a/sys/opencrypto/crypto.c Wed May 17 06:50:12 2017 +0000
+++ b/sys/opencrypto/crypto.c Wed May 17 06:52:08 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: crypto.c,v 1.65 2017/05/17 06:50:12 knakahara Exp $ */
+/* $NetBSD: crypto.c,v 1.66 2017/05/17 06:52:08 knakahara Exp $ */
/* $FreeBSD: src/sys/opencrypto/crypto.c,v 1.4.2.5 2003/02/26 00:14:05 sam Exp $ */
/* $OpenBSD: crypto.c,v 1.41 2002/07/17 23:52:38 art Exp $ */
@@ -53,7 +53,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: crypto.c,v 1.65 2017/05/17 06:50:12 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: crypto.c,v 1.66 2017/05/17 06:52:08 knakahara Exp $");
#include <sys/param.h>
#include <sys/reboot.h>
@@ -774,13 +774,29 @@
mutex_spin_enter(&crypto_q_mtx);
+ cap = crypto_checkdriver(hid);
+ /*
+ * TODO:
+ * If we can ensure the driver has been valid until the driver is
+ * done crypto_unregister(), this migrate operation is not required.
+ */
+ if (cap == NULL) {
+ /*
+ * The driver must be detached, so this request will migrate
+ * to other drivers in cryptointr() later.
+ */
+ TAILQ_INSERT_TAIL(&crp_q, crp, crp_next);
+ mutex_spin_exit(&crypto_q_mtx);
+
+ return 0;
+ }
+
/*
* Caller marked the request to be processed
* immediately; dispatch it directly to the
* driver unless the driver is currently blocked.
*/
- cap = crypto_checkdriver(hid);
- if (cap && !cap->cc_qblocked) {
+ if (!cap->cc_qblocked) {
mutex_spin_exit(&crypto_q_mtx);
result = crypto_invoke(crp, 0);
if (result == ERESTART) {
Home |
Main Index |
Thread Index |
Old Index