Currently, all crypto users set CRYPTO_F_NOQUEUE to run crypto operations
without queue and there are no plans to switch back to using the queue.
The diff below removes the flag together with the queueing code.
ok?
Index: dev/softraid_crypto.c
===================================================================
RCS file: /cvs/src/sys/dev/softraid_crypto.c,v
retrieving revision 1.142
diff -u -p -r1.142 softraid_crypto.c
--- dev/softraid_crypto.c 13 Oct 2021 22:43:44 -0000 1.142
+++ dev/softraid_crypto.c 21 Oct 2021 21:50:31 -0000
@@ -325,7 +325,7 @@ sr_crypto_prepare(struct sr_workunit *wu
crwu->cr_crp->crp_opaque = crwu;
crwu->cr_crp->crp_ilen = xs->datalen;
crwu->cr_crp->crp_alloctype = M_DEVBUF;
- crwu->cr_crp->crp_flags = CRYPTO_F_IOV | CRYPTO_F_NOQUEUE;
+ crwu->cr_crp->crp_flags = CRYPTO_F_IOV;
crwu->cr_crp->crp_buf = &crwu->cr_uio;
for (i = 0; i < crwu->cr_crp->crp_ndesc; i++, blkno++) {
crd = &crwu->cr_crp->crp_desc[i];
Index: netinet/ip_ah.c
===================================================================
RCS file: /cvs/src/sys/netinet/ip_ah.c,v
retrieving revision 1.156
diff -u -p -r1.156 ip_ah.c
--- netinet/ip_ah.c 13 Oct 2021 22:43:44 -0000 1.156
+++ netinet/ip_ah.c 21 Oct 2021 21:50:32 -0000
@@ -684,7 +684,7 @@ ah_input(struct mbuf *m, struct tdb *tdb
/* Crypto operation descriptor. */
crp->crp_ilen = m->m_pkthdr.len; /* Total input length. */
- crp->crp_flags = CRYPTO_F_IMBUF | CRYPTO_F_MPSAFE | CRYPTO_F_NOQUEUE;
+ crp->crp_flags = CRYPTO_F_IMBUF | CRYPTO_F_MPSAFE;
crp->crp_buf = (caddr_t)m;
crp->crp_callback = ipsec_input_cb;
crp->crp_sid = tdb->tdb_cryptoid;
@@ -1131,7 +1131,7 @@ ah_output(struct mbuf *m, struct tdb *td
/* Crypto operation descriptor. */
crp->crp_ilen = m->m_pkthdr.len; /* Total input length. */
- crp->crp_flags = CRYPTO_F_IMBUF | CRYPTO_F_MPSAFE | CRYPTO_F_NOQUEUE;
+ crp->crp_flags = CRYPTO_F_IMBUF | CRYPTO_F_MPSAFE;
crp->crp_buf = (caddr_t)m;
crp->crp_callback = ipsec_output_cb;
crp->crp_sid = tdb->tdb_cryptoid;
Index: netinet/ip_esp.c
===================================================================
RCS file: /cvs/src/sys/netinet/ip_esp.c,v
retrieving revision 1.175
diff -u -p -r1.175 ip_esp.c
--- netinet/ip_esp.c 21 Oct 2021 08:39:33 -0000 1.175
+++ netinet/ip_esp.c 21 Oct 2021 21:50:32 -0000
@@ -496,7 +496,7 @@ esp_input(struct mbuf *m, struct tdb *td
/* Crypto operation descriptor */
crp->crp_ilen = m->m_pkthdr.len; /* Total input length */
- crp->crp_flags = CRYPTO_F_IMBUF | CRYPTO_F_MPSAFE | CRYPTO_F_NOQUEUE;
+ crp->crp_flags = CRYPTO_F_IMBUF | CRYPTO_F_MPSAFE;
crp->crp_buf = (caddr_t)m;
crp->crp_callback = ipsec_input_cb;
crp->crp_sid = tdb->tdb_cryptoid;
@@ -978,7 +978,7 @@ esp_output(struct mbuf *m, struct tdb *t
/* Crypto operation descriptor. */
crp->crp_ilen = m->m_pkthdr.len; /* Total input length. */
- crp->crp_flags = CRYPTO_F_IMBUF | CRYPTO_F_MPSAFE | CRYPTO_F_NOQUEUE;
+ crp->crp_flags = CRYPTO_F_IMBUF | CRYPTO_F_MPSAFE;
crp->crp_buf = (caddr_t)m;
crp->crp_callback = ipsec_output_cb;
crp->crp_opaque = (caddr_t)tc;
Index: netinet/ip_ipcomp.c
===================================================================
RCS file: /cvs/src/sys/netinet/ip_ipcomp.c,v
retrieving revision 1.76
diff -u -p -r1.76 ip_ipcomp.c
--- netinet/ip_ipcomp.c 13 Oct 2021 22:43:44 -0000 1.76
+++ netinet/ip_ipcomp.c 21 Oct 2021 21:50:32 -0000
@@ -174,7 +174,7 @@ ipcomp_input(struct mbuf *m, struct tdb
/* Crypto operation descriptor */
crp->crp_ilen = m->m_pkthdr.len - (skip + hlen);
- crp->crp_flags = CRYPTO_F_IMBUF | CRYPTO_F_MPSAFE | CRYPTO_F_NOQUEUE;
+ crp->crp_flags = CRYPTO_F_IMBUF | CRYPTO_F_MPSAFE;
crp->crp_buf = (caddr_t)m;
crp->crp_callback = ipsec_input_cb;
crp->crp_sid = tdb->tdb_cryptoid;
@@ -476,7 +476,7 @@ ipcomp_output(struct mbuf *m, struct tdb
/* Crypto operation descriptor */
crp->crp_ilen = m->m_pkthdr.len; /* Total input length */
- crp->crp_flags = CRYPTO_F_IMBUF | CRYPTO_F_MPSAFE | CRYPTO_F_NOQUEUE;
+ crp->crp_flags = CRYPTO_F_IMBUF | CRYPTO_F_MPSAFE;
crp->crp_buf = (caddr_t)m;
crp->crp_callback = ipsec_output_cb;
crp->crp_opaque = (caddr_t)tc;
Index: crypto/crypto.c
===================================================================
RCS file: /cvs/src/sys/crypto/crypto.c,v
retrieving revision 1.87
diff -u -p -r1.87 crypto.c
--- crypto/crypto.c 13 Oct 2021 22:43:44 -0000 1.87
+++ crypto/crypto.c 21 Oct 2021 21:50:32 -0000
@@ -401,19 +401,11 @@ crypto_dispatch(struct cryptop *crp)
/* XXXSMP crypto_invoke() is not MP safe */
lock = 1;
- if (crp->crp_flags & CRYPTO_F_NOQUEUE) {
- if (lock)
- KERNEL_LOCK();
- crypto_invoke(crp);
- if (lock)
- KERNEL_UNLOCK();
- } else {
- struct taskq *tq;
-
- tq = lock ? crypto_taskq : crypto_taskq_mpsafe;
- task_set(&crp->crp_task, (void (*))crypto_invoke, crp);
- task_add(tq, &crp->crp_task);
- }
+ if (lock)
+ KERNEL_LOCK();
+ crypto_invoke(crp);
+ if (lock)
+ KERNEL_UNLOCK();
}
/*
@@ -543,15 +535,5 @@ crypto_done(struct cryptop *crp)
{
crp->crp_flags |= CRYPTO_F_DONE;
- if (crp->crp_flags & CRYPTO_F_NOQUEUE) {
- /* not from the crypto queue, wakeup the userland process */
- crp->crp_callback(crp);
- } else {
- struct taskq *tq;
-
- tq = (crp->crp_flags & CRYPTO_F_MPSAFE) ?
- crypto_taskq_mpsafe : crypto_taskq;
- task_set(&crp->crp_task, (void (*))crp->crp_callback, crp);
- task_add(tq, &crp->crp_task);
- }
+ crp->crp_callback(crp);
}
Index: crypto/cryptodev.h
===================================================================
RCS file: /cvs/src/sys/crypto/cryptodev.h,v
retrieving revision 1.76
diff -u -p -r1.76 cryptodev.h
--- crypto/cryptodev.h 13 Oct 2021 22:43:44 -0000 1.76
+++ crypto/cryptodev.h 21 Oct 2021 21:50:32 -0000
@@ -172,8 +172,7 @@ struct cryptop {
#define CRYPTO_F_IMBUF 0x0001 /* Input/output are mbuf chains, otherwise
contig */
#define CRYPTO_F_IOV 0x0002 /* Input/output are uio */
#define CRYPTO_F_MPSAFE 0x0004 /* Do not use kernel lock for callback
*/
-#define CRYPTO_F_NOQUEUE 0x0008 /* Don't use crypto queue/thread */
-#define CRYPTO_F_DONE 0x0010 /* request completed */
+#define CRYPTO_F_DONE 0x0008 /* request completed */
void *crp_buf; /* Data to be processed */
void *crp_opaque; /* Opaque pointer, passed along */