From: tobhe Date: Thu, 21 Oct 2021 22:59:07 +0000 (+0000) Subject: Remove code to run crypto operations in a task queue. The code was X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=42abd1cf63da2eed72b29c125accaca173dcee36;p=openbsd Remove code to run crypto operations in a task queue. The code was not reachable because all callers had set the CRYPTO_F_NOQUEUE flag. ok patrick@ mvs@ bluhm@ --- diff --git a/sys/crypto/crypto.c b/sys/crypto/crypto.c index dc613267ed6..3ea4ae48b33 100644 --- a/sys/crypto/crypto.c +++ b/sys/crypto/crypto.c @@ -1,4 +1,4 @@ -/* $OpenBSD: crypto.c,v 1.87 2021/10/13 22:43:44 bluhm Exp $ */ +/* $OpenBSD: crypto.c,v 1.88 2021/10/21 22:59:08 tobhe Exp $ */ /* * The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu) * @@ -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); } diff --git a/sys/crypto/cryptodev.h b/sys/crypto/cryptodev.h index 86b5d93509c..020ca4a6840 100644 --- a/sys/crypto/cryptodev.h +++ b/sys/crypto/cryptodev.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cryptodev.h,v 1.76 2021/10/13 22:43:44 bluhm Exp $ */ +/* $OpenBSD: cryptodev.h,v 1.77 2021/10/21 22:59:08 tobhe Exp $ */ /* * The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu) @@ -172,7 +172,6 @@ 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 */ void *crp_buf; /* Data to be processed */ diff --git a/sys/netinet/ip_ah.c b/sys/netinet/ip_ah.c index 050d0e634d9..59c3f2e930e 100644 --- a/sys/netinet/ip_ah.c +++ b/sys/netinet/ip_ah.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_ah.c,v 1.156 2021/10/13 22:43:44 bluhm Exp $ */ +/* $OpenBSD: ip_ah.c,v 1.157 2021/10/21 22:59:07 tobhe Exp $ */ /* * The authors of this code are John Ioannidis (ji@tla.org), * Angelos D. Keromytis (kermit@csd.uch.gr) and @@ -684,7 +684,7 @@ ah_input(struct mbuf *m, struct tdb *tdb, int skip, int protoff) /* 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 *tdb, int skip, int protoff) /* 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; diff --git a/sys/netinet/ip_esp.c b/sys/netinet/ip_esp.c index 20323ae8c95..d88aaf6da5a 100644 --- a/sys/netinet/ip_esp.c +++ b/sys/netinet/ip_esp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_esp.c,v 1.175 2021/10/21 08:39:33 tobhe Exp $ */ +/* $OpenBSD: ip_esp.c,v 1.176 2021/10/21 22:59:07 tobhe Exp $ */ /* * The authors of this code are John Ioannidis (ji@tla.org), * Angelos D. Keromytis (kermit@csd.uch.gr) and @@ -496,7 +496,7 @@ esp_input(struct mbuf *m, struct tdb *tdb, int skip, int protoff) /* 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 *tdb, int skip, int protoff) /* 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; diff --git a/sys/netinet/ip_ipcomp.c b/sys/netinet/ip_ipcomp.c index 124a095e6d5..e4de546c77f 100644 --- a/sys/netinet/ip_ipcomp.c +++ b/sys/netinet/ip_ipcomp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_ipcomp.c,v 1.76 2021/10/13 22:43:44 bluhm Exp $ */ +/* $OpenBSD: ip_ipcomp.c,v 1.77 2021/10/21 22:59:07 tobhe Exp $ */ /* * Copyright (c) 2001 Jean-Jacques Bernard-Gundol (jj@wabbitt.org) @@ -174,7 +174,7 @@ ipcomp_input(struct mbuf *m, struct tdb *tdb, int skip, int protoff) /* 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 *tdb, int skip, int protoff) /* 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;