Source-Changes-HG archive

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

[src/trunk]: src/sys/opencrypto Divide crp_devflags from crp_flags to write e...



details:   https://anonhg.NetBSD.org/src/rev/885b98653fd0
branches:  trunk
changeset: 824703:885b98653fd0
user:      knakahara <knakahara%NetBSD.org@localhost>
date:      Thu Jun 15 12:41:18 2017 +0000

description:
Divide crp_devflags from crp_flags to write exclusively.

CRYPTO_F_DQRETQ(new name is CRYPTODEV_F_RET) is used by cryptodev.c only.
It should be divided to other member.

diffstat:

 sys/opencrypto/cryptodev.c |  12 ++++++------
 sys/opencrypto/cryptodev.h |  13 +++++++++----
 2 files changed, 15 insertions(+), 10 deletions(-)

diffs (95 lines):

diff -r 88987f8ce9d4 -r 885b98653fd0 sys/opencrypto/cryptodev.c
--- a/sys/opencrypto/cryptodev.c        Thu Jun 15 11:25:52 2017 +0000
+++ b/sys/opencrypto/cryptodev.c        Thu Jun 15 12:41:18 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cryptodev.c,v 1.94 2017/06/08 09:49:46 knakahara Exp $ */
+/*     $NetBSD: cryptodev.c,v 1.95 2017/06/15 12:41:18 knakahara Exp $ */
 /*     $FreeBSD: src/sys/opencrypto/cryptodev.c,v 1.4.2.4 2003/06/03 00:09:02 sam Exp $        */
 /*     $OpenBSD: cryptodev.c,v 1.53 2002/07/10 22:21:30 mickey Exp $   */
 
@@ -64,7 +64,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cryptodev.c,v 1.94 2017/06/08 09:49:46 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cryptodev.c,v 1.95 2017/06/15 12:41:18 knakahara Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -689,7 +689,7 @@
                goto bail;
        }
 
-       while (!(crp->crp_flags & CRYPTO_F_DQRETQ)) {
+       while (!(crp->crp_devflags & CRYPTODEV_F_RET)) {
                DPRINTF("cse->sid[%d]: sleeping on cv %p for crp %p\n",
                        (uint32_t)cse->sid, &crp->crp_cv, crp);
                cv_wait(&crp->crp_cv, &cryptodev_mtx);  /* XXX cv_wait_sig? */
@@ -763,7 +763,7 @@
                mutex_enter(&cryptodev_mtx);
        }
        if (error != 0 || (crp->crp_flags & CRYPTO_F_DONE)) {
-               crp->crp_flags |= CRYPTO_F_DQRETQ;
+               crp->crp_devflags |= CRYPTODEV_F_RET;
                cv_signal(&crp->crp_cv);
        }
        mutex_exit(&cryptodev_mtx);
@@ -800,7 +800,7 @@
        struct cryptkop *krp = op;
        
        mutex_enter(&cryptodev_mtx);
-       krp->krp_flags |= CRYPTO_F_DQRETQ;
+       krp->krp_devflags |= CRYPTODEV_F_RET;
        cv_signal(&krp->krp_cv);
        mutex_exit(&cryptodev_mtx);
        return 0;
@@ -915,7 +915,7 @@
        }
 
        mutex_enter(&cryptodev_mtx);
-       while (!(krp->krp_flags & CRYPTO_F_DQRETQ)) {
+       while (!(krp->krp_devflags & CRYPTODEV_F_RET)) {
                cv_wait(&krp->krp_cv, &cryptodev_mtx);  /* XXX cv_wait_sig? */
        }
        mutex_exit(&cryptodev_mtx);
diff -r 88987f8ce9d4 -r 885b98653fd0 sys/opencrypto/cryptodev.h
--- a/sys/opencrypto/cryptodev.h        Thu Jun 15 11:25:52 2017 +0000
+++ b/sys/opencrypto/cryptodev.h        Thu Jun 15 12:41:18 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cryptodev.h,v 1.36 2017/06/06 01:48:33 knakahara Exp $ */
+/*     $NetBSD: cryptodev.h,v 1.37 2017/06/15 12:41:18 knakahara Exp $ */
 /*     $FreeBSD: src/sys/opencrypto/cryptodev.h,v 1.2.2.6 2003/07/02 17:04:50 sam Exp $        */
 /*     $OpenBSD: cryptodev.h,v 1.33 2002/07/17 23:52:39 art Exp $      */
 
@@ -461,8 +461,10 @@
                                         * should always check and use the new
                                         * value on future requests.
                                         */
-       int             crp_flags;      /* Note: must hold mutext to modify */
-
+       int             crp_flags;      /*
+                                        * other than crypto.c must not write
+                                        * after crypto_dispatch().
+                                        */
 #define CRYPTO_F_IMBUF         0x0001  /* Input/output are mbuf chains */
 #define CRYPTO_F_IOV           0x0002  /* Input/output are uio */
 #define CRYPTO_F_REL           0x0004  /* Must return data in same place */
@@ -473,7 +475,9 @@
 #define        CRYPTO_F_ONRETQ         0x0080  /* Request is on return queue */
 #define        CRYPTO_F_USER           0x0100  /* Request is in user context */
 #define        CRYPTO_F_MORE           0x0200  /* more data to follow */
-#define        CRYPTO_F_DQRETQ         0x0400  /* Dequeued from crp_ret_{,k}q */
+
+       int             crp_devflags;   /* other than cryptodev.c must not use. */
+#define        CRYPTODEV_F_RET         0x0001  /* return from crypto.c to cryptodev.c */
 
        void *          crp_buf;        /* Data to be processed */
        void *          crp_opaque;     /* Opaque pointer, passed along */
@@ -528,6 +532,7 @@
        struct crparam  krp_param[CRK_MAXPARAM];        /* kvm */
        int             (*krp_callback)(struct cryptkop *);
        int             krp_flags;      /* same values as crp_flags */
+       int             krp_devflags;   /* same values as crp_devflags */
        kcondvar_t      krp_cv;
        struct fcrypt   *fcrp;
        struct crparam  crk_param[CRK_MAXPARAM];



Home | Main Index | Thread Index | Old Index