Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F107569152
D32739.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
4 KB
Referenced Files
None
Subscribers
None
D32739.diff
View Options
diff --git a/sys/opencrypto/crypto.c b/sys/opencrypto/crypto.c
--- a/sys/opencrypto/crypto.c
+++ b/sys/opencrypto/crypto.c
@@ -168,7 +168,7 @@
uint32_t reorder_ops; /* total ordered sym jobs received */
uint32_t reorder_cur_seq; /* current sym job dispatched */
- struct proc *cryptoretproc;
+ struct thread *td;
};
static struct crypto_ret_worker *crypto_ret_workers = NULL;
@@ -204,9 +204,9 @@
MALLOC_DEFINE(M_CRYPTO_DATA, "crypto", "crypto session records");
-static void crypto_proc(void);
-static struct proc *cryptoproc;
-static void crypto_ret_proc(struct crypto_ret_worker *ret_worker);
+static void crypto_dispatch_thread(void *arg);
+static struct thread *cryptotd;
+static void crypto_ret_thread(void *arg);
static void crypto_destroy(void);
static int crypto_invoke(struct cryptocap *cap, struct cryptop *crp, int hint);
static void crypto_task_invoke(void *ctx, int pending);
@@ -296,6 +296,7 @@
crypto_init(void)
{
struct crypto_ret_worker *ret_worker;
+ struct proc *p;
int error;
mtx_init(&crypto_drivers_mtx, "crypto", "crypto driver table",
@@ -321,8 +322,9 @@
taskqueue_start_threads(&crypto_tq, crypto_workers_num, PRI_MIN_KERN,
"crypto");
- error = kproc_create((void (*)(void *)) crypto_proc, NULL,
- &cryptoproc, 0, 0, "crypto");
+ p = NULL;
+ error = kproc_kthread_add(crypto_dispatch_thread, NULL, &p, &cryptotd,
+ 0, 0, "crypto", "crypto");
if (error) {
printf("crypto_init: cannot start crypto thread; error %d",
error);
@@ -341,8 +343,9 @@
mtx_init(&ret_worker->crypto_ret_mtx, "crypto", "crypto return queues", MTX_DEF);
- error = kproc_create((void (*)(void *)) crypto_ret_proc, ret_worker,
- &ret_worker->cryptoretproc, 0, 0, "crypto returns %td", CRYPTO_RETW_ID(ret_worker));
+ error = kthread_add(crypto_ret_thread, ret_worker, p,
+ &ret_worker->td, 0, 0, "crypto returns %td",
+ CRYPTO_RETW_ID(ret_worker));
if (error) {
printf("crypto_init: cannot start cryptoret thread; error %d",
error);
@@ -366,20 +369,16 @@
* for the other half of this song-and-dance.
*/
static void
-crypto_terminate(struct proc **pp, void *q)
+crypto_terminate(struct thread **tdp, void *q)
{
- struct proc *p;
+ struct thread *td;
mtx_assert(&crypto_drivers_mtx, MA_OWNED);
- p = *pp;
- *pp = NULL;
- if (p) {
+ td = *tdp;
+ *tdp = NULL;
+ if (td != NULL) {
wakeup_one(q);
- PROC_LOCK(p); /* NB: insure we don't miss wakeup */
- CRYPTO_DRIVER_UNLOCK(); /* let crypto_finis progress */
- msleep(p, &p->p_mtx, PWAIT, "crypto_destroy", 0);
- PROC_UNLOCK(p);
- CRYPTO_DRIVER_LOCK();
+ mtx_sleep(td, &crypto_drivers_mtx, PWAIT, "crypto_destroy", 0);
}
}
@@ -442,9 +441,9 @@
if (crypto_tq != NULL)
taskqueue_drain_all(crypto_tq);
CRYPTO_DRIVER_LOCK();
- crypto_terminate(&cryptoproc, &crp_q);
+ crypto_terminate(&cryptotd, &crp_q);
FOREACH_CRYPTO_RETW(ret_worker)
- crypto_terminate(&ret_worker->cryptoretproc, &ret_worker->crp_ret_q);
+ crypto_terminate(&ret_worker->td, &ret_worker->crp_ret_q);
CRYPTO_DRIVER_UNLOCK();
/* XXX flush queues??? */
@@ -1708,14 +1707,14 @@
CRYPTO_DRIVER_LOCK();
wakeup_one(chan);
CRYPTO_DRIVER_UNLOCK();
- kproc_exit(0);
+ kthread_exit();
}
/*
* Crypto thread, dispatches crypto requests.
*/
static void
-crypto_proc(void)
+crypto_dispatch_thread(void *arg __unused)
{
struct cryptop *crp, *submit;
struct cryptocap *cap;
@@ -1804,7 +1803,7 @@
crp_sleep = 1;
msleep(&crp_q, &crypto_q_mtx, PWAIT, "crypto_wait", 0);
crp_sleep = 0;
- if (cryptoproc == NULL)
+ if (cryptotd == NULL)
break;
CRYPTOSTAT_INC(cs_intrs);
}
@@ -1820,8 +1819,9 @@
* callbacks typically are expensive and would slow interrupt handling.
*/
static void
-crypto_ret_proc(struct crypto_ret_worker *ret_worker)
+crypto_ret_thread(void *arg)
{
+ struct crypto_ret_worker *ret_worker = arg;
struct cryptop *crpt;
CRYPTO_RETW_LOCK(ret_worker);
@@ -1858,7 +1858,7 @@
*/
msleep(&ret_worker->crp_ret_q, &ret_worker->crypto_ret_mtx, PWAIT,
"crypto_ret_wait", 0);
- if (ret_worker->cryptoretproc == NULL)
+ if (ret_worker->td == NULL)
break;
CRYPTOSTAT_INC(cs_rets);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Jan 17, 12:45 AM (19 h, 56 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15831294
Default Alt Text
D32739.diff (4 KB)
Attached To
Mode
D32739: crypto: Use a single "crypto" kproc for all of the OCF kthreads.
Attached
Detach File
Event Timeline
Log In to Comment