Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/opencrypto decrease the priority of batch crp even if th...



details:   https://anonhg.NetBSD.org/src/rev/9d0261ce7a78
branches:  trunk
changeset: 823980:9d0261ce7a78
user:      knakahara <knakahara%NetBSD.org@localhost>
date:      Wed May 17 12:11:41 2017 +0000

description:
decrease the priority of batch crp even if there are more than one batch crp.

diffstat:

 sys/opencrypto/crypto.c |  44 +++++++++++++++++++++++++-------------------
 1 files changed, 25 insertions(+), 19 deletions(-)

diffs (66 lines):

diff -r 024e624f9c24 -r 9d0261ce7a78 sys/opencrypto/crypto.c
--- a/sys/opencrypto/crypto.c   Wed May 17 11:04:38 2017 +0000
+++ b/sys/opencrypto/crypto.c   Wed May 17 12:11:41 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: crypto.c,v 1.70 2017/05/17 11:04:38 knakahara Exp $ */
+/*     $NetBSD: crypto.c,v 1.71 2017/05/17 12:11:41 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.70 2017/05/17 11:04:38 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: crypto.c,v 1.71 2017/05/17 12:11:41 knakahara Exp $");
 
 #include <sys/param.h>
 #include <sys/reboot.h>
@@ -1272,24 +1272,30 @@
                        if (cap->cc_qblocked != 0)
                                continue;
 
-                       if (submit != NULL) {
-                               /*
-                                * We stop on finding another op,
-                                * regardless whether its for the same
-                                * driver or not.  We could keep
-                                * searching the queue but it might be
-                                * better to just use a per-driver
-                                * queue instead.
-                                */
-                               if (CRYPTO_SESID2HID(submit->crp_sid) == hid)
-                                       hint = CRYPTO_HINT_MORE;
-                               break;
-                       } else {
-                               submit = crp;
-                               if ((submit->crp_flags & CRYPTO_F_BATCH) == 0)
-                                       break;
-                               /* keep scanning for more are q'd */
+                       /*
+                        * skip batch crp until the end of crp_q
+                        */
+                       if ((crp->crp_flags & CRYPTO_F_BATCH) != 0) {
+                               if (submit == NULL) {
+                                       submit = crp;
+                               } else {
+                                       if (CRYPTO_SESID2HID(submit->crp_sid)
+                                           == hid)
+                                               hint = CRYPTO_HINT_MORE;
+                               }
+
+                               continue;
                        }
+
+                       /*
+                        * found first crp which is neither blocked nor batch.
+                        */
+                       submit = crp;
+                       /*
+                        * batch crp can be processed much later, so clear hint.
+                        */
+                       hint = 0;
+                       break;
                }
                if (submit != NULL) {
                        TAILQ_REMOVE(&crp_q, submit, crp_next);



Home | Main Index | Thread Index | Old Index