summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Belopuhov <mikeb@cvs.openbsd.org>2013-10-31 10:32:39 +0000
committerMike Belopuhov <mikeb@cvs.openbsd.org>2013-10-31 10:32:39 +0000
commit9a6b386561645fdcf73aea552b4b68ebab03a9b8 (patch)
treee4eae85448964219b9ea8e6b9f49e45bb00b8170
parentaa289985ec24857db8d6a701e5e2e5d529db91a8 (diff)
convert crypto work queue to the task_add(9) api; ok dlg
-rw-r--r--sys/crypto/crypto.c27
-rw-r--r--sys/crypto/cryptodev.h8
2 files changed, 18 insertions, 17 deletions
diff --git a/sys/crypto/crypto.c b/sys/crypto/crypto.c
index 7df0c435ae1..d34f065aae4 100644
--- a/sys/crypto/crypto.c
+++ b/sys/crypto/crypto.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: crypto.c,v 1.60 2013/03/27 16:42:05 tedu Exp $ */
+/* $OpenBSD: crypto.c,v 1.61 2013/10/31 10:32:38 mikeb Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu)
*
@@ -36,7 +36,7 @@ int crypto_drivers_num = 0;
struct pool cryptop_pool;
struct pool cryptodesc_pool;
-struct workq *crypto_workq;
+struct taskq *crypto_taskq;
/*
* Create a new session.
@@ -416,9 +416,9 @@ crypto_dispatch(struct cryptop *crp)
crypto_drivers[hid].cc_queued++;
splx(s);
- if (crypto_workq) {
- workq_queue_task(crypto_workq, &crp->crp_wqt, 0,
- (workq_fn)crypto_invoke, crp, NULL);
+ if (crypto_taskq) {
+ task_set(&crp->crp_task, (void (*))crypto_invoke, crp, NULL);
+ task_add(crypto_taskq, &crp->crp_task);
} else {
crypto_invoke(crp);
}
@@ -429,9 +429,9 @@ crypto_dispatch(struct cryptop *crp)
int
crypto_kdispatch(struct cryptkop *krp)
{
- if (crypto_workq) {
- workq_queue_task(crypto_workq, &krp->krp_wqt, 0,
- (workq_fn)crypto_kinvoke, krp, NULL);
+ if (crypto_taskq) {
+ task_set(&krp->krp_task, (void (*))crypto_kinvoke, krp, NULL);
+ task_add(crypto_taskq, &krp->krp_task);
} else {
crypto_kinvoke(krp);
}
@@ -618,7 +618,7 @@ crypto_getreq(int num)
void
crypto_init(void)
{
- crypto_workq = workq_create("crypto", 1, IPL_HIGH);
+ crypto_taskq = taskq_create("crypto", 1, IPL_HIGH);
pool_init(&cryptop_pool, sizeof(struct cryptop), 0, 0,
0, "cryptop", NULL);
@@ -637,8 +637,9 @@ crypto_done(struct cryptop *crp)
/* not from the crypto queue, wakeup the userland process */
crp->crp_callback(crp);
} else {
- workq_queue_task(crypto_workq, &crp->crp_wqt, 0,
- (workq_fn)crp->crp_callback, crp, NULL);
+ task_set(&crp->crp_task, (void (*))crp->crp_callback,
+ crp, NULL);
+ task_add(crypto_taskq, &crp->crp_task);
}
}
@@ -648,8 +649,8 @@ crypto_done(struct cryptop *crp)
void
crypto_kdone(struct cryptkop *krp)
{
- workq_queue_task(crypto_workq, &krp->krp_wqt, 0,
- (workq_fn)krp->krp_callback, krp, NULL);
+ task_set(&krp->krp_task, (void (*))krp->krp_callback, krp, NULL);
+ task_add(crypto_taskq, &krp->krp_task);
}
int
diff --git a/sys/crypto/cryptodev.h b/sys/crypto/cryptodev.h
index 4f87046ec25..69911e7e0e1 100644
--- a/sys/crypto/cryptodev.h
+++ b/sys/crypto/cryptodev.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cryptodev.h,v 1.57 2013/03/27 16:42:05 tedu Exp $ */
+/* $OpenBSD: cryptodev.h,v 1.58 2013/10/31 10:32:38 mikeb Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu)
@@ -53,7 +53,7 @@
#define _CRYPTO_CRYPTO_H_
#include <sys/ioccom.h>
-#include <sys/workq.h>
+#include <sys/task.h>
/* Some initial values */
#define CRYPTO_DRIVERS_INITIAL 4
@@ -160,7 +160,7 @@ struct cryptodesc {
/* Structure describing complete operation */
struct cryptop {
- struct workq_task crp_wqt;
+ struct task crp_task;
u_int64_t crp_sid; /* Session ID */
int crp_ilen; /* Input data total length */
@@ -230,7 +230,7 @@ struct crypt_kop {
#define CRF_DH_COMPUTE_KEY (1 << CRK_DH_COMPUTE_KEY)
struct cryptkop {
- struct workq_task krp_wqt;
+ struct task krp_task;
u_int krp_op; /* ie. CRK_MOD_EXP or other */
u_int krp_status; /* return status */