aboutsummaryrefslogtreecommitdiff
path: root/sys/opencrypto/crypto.c
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2020-06-30 15:56:54 +0000
committerMark Johnston <markj@FreeBSD.org>2020-06-30 15:56:54 +0000
commita5c053f5a78ca68f9dcace37186142266787eaa0 (patch)
tree8e01377a04d0b432cabb6844108dd1b4c468e1ad /sys/opencrypto/crypto.c
parentd326a6c7c1e271919288627fda136f5fd82fd8ac (diff)
downloadsrc-a5c053f5a78ca68f9dcace37186142266787eaa0.tar.gz
src-a5c053f5a78ca68f9dcace37186142266787eaa0.zip
Remove CRYPTO_TIMING.
It was added a very long time ago. It is single-threaded, so only really useful for basic measurements, and in the meantime we've gotten some more sophisticated profiling tools. Reviewed by: cem, delphij, jhb Sponsored by: Rubicon Communications, LLC (Netgate) Differential Revision: https://reviews.freebsd.org/D25464
Notes
Notes: svn path=/head/; revision=362801
Diffstat (limited to 'sys/opencrypto/crypto.c')
-rw-r--r--sys/opencrypto/crypto.c81
1 files changed, 4 insertions, 77 deletions
diff --git a/sys/opencrypto/crypto.c b/sys/opencrypto/crypto.c
index e9ddaebbb9f2..7464fafa5d2d 100644
--- a/sys/opencrypto/crypto.c
+++ b/sys/opencrypto/crypto.c
@@ -54,8 +54,6 @@ __FBSDID("$FreeBSD$");
* PURPOSE.
*/
-#define CRYPTO_TIMING /* enable timing support */
-
#include "opt_compat.h"
#include "opt_ddb.h"
@@ -238,12 +236,6 @@ static struct cryptostats cryptostats;
SYSCTL_STRUCT(_kern_crypto, OID_AUTO, stats, CTLFLAG_RW, &cryptostats,
cryptostats, "Crypto system statistics");
-#ifdef CRYPTO_TIMING
-static int crypto_timing = 0;
-SYSCTL_INT(_debug, OID_AUTO, crypto_timing, CTLFLAG_RW,
- &crypto_timing, 0, "Enable/disable crypto timing support");
-#endif
-
/* Try to avoid directly exposing the key buffer as a symbol */
static struct keybuf *keybuf;
@@ -1409,11 +1401,6 @@ crypto_dispatch(struct cryptop *crp)
cryptostats.cs_ops++;
-#ifdef CRYPTO_TIMING
- if (crypto_timing)
- binuptime(&crp->crp_tstamp);
-#endif
-
crp->crp_retw_id = ((uintptr_t)crp->crp_session) % crypto_workers_num;
if (CRYPTOP_ASYNC(crp)) {
@@ -1647,32 +1634,6 @@ crypto_kinvoke(struct cryptkop *krp)
return (0);
}
-#ifdef CRYPTO_TIMING
-static void
-crypto_tstat(struct cryptotstat *ts, struct bintime *bt)
-{
- struct bintime now, delta;
- struct timespec t;
- uint64_t u;
-
- binuptime(&now);
- u = now.frac;
- delta.frac = now.frac - bt->frac;
- delta.sec = now.sec - bt->sec;
- if (u < delta.frac)
- delta.sec--;
- bintime2timespec(&delta, &t);
- timespecadd(&ts->acc, &t, &ts->acc);
- if (timespeccmp(&t, &ts->min, <))
- ts->min = t;
- if (timespeccmp(&t, &ts->max, >))
- ts->max = t;
- ts->count++;
-
- *bt = now;
-}
-#endif
-
static void
crypto_task_invoke(void *ctx, int pending)
{
@@ -1700,10 +1661,6 @@ crypto_invoke(struct cryptocap *cap, struct cryptop *crp, int hint)
KASSERT(crp->crp_session != NULL,
("%s: crp->crp_session == NULL", __func__));
-#ifdef CRYPTO_TIMING
- if (crypto_timing)
- crypto_tstat(&cryptostats.cs_invoke, &crp->crp_tstamp);
-#endif
if (cap->cc_flags & CRYPTOCAP_F_CLEANUP) {
struct crypto_session_params csp;
crypto_session_t nses;
@@ -1811,10 +1768,7 @@ crypto_done(struct cryptop *crp)
crp->crp_flags |= CRYPTO_F_DONE;
if (crp->crp_etype != 0)
cryptostats.cs_errs++;
-#ifdef CRYPTO_TIMING
- if (crypto_timing)
- crypto_tstat(&cryptostats.cs_done, &crp->crp_tstamp);
-#endif
+
/*
* CBIMM means unconditionally do the callback immediately;
* CBIFSYNC means do the callback immediately only if the
@@ -1831,20 +1785,7 @@ crypto_done(struct cryptop *crp)
* callback routine does very little (e.g. the
* /dev/crypto callback method just does a wakeup).
*/
-#ifdef CRYPTO_TIMING
- if (crypto_timing) {
- /*
- * NB: We must copy the timestamp before
- * doing the callback as the cryptop is
- * likely to be reclaimed.
- */
- struct bintime t = crp->crp_tstamp;
- crypto_tstat(&cryptostats.cs_cb, &t);
- crp->crp_callback(crp);
- crypto_tstat(&cryptostats.cs_finis, &t);
- } else
-#endif
- crp->crp_callback(crp);
+ crp->crp_callback(crp);
} else {
struct crypto_ret_worker *ret_worker;
bool wake;
@@ -2144,22 +2085,8 @@ crypto_ret_proc(struct crypto_ret_worker *ret_worker)
/*
* Run callbacks unlocked.
*/
- if (crpt != NULL) {
-#ifdef CRYPTO_TIMING
- if (crypto_timing) {
- /*
- * NB: We must copy the timestamp before
- * doing the callback as the cryptop is
- * likely to be reclaimed.
- */
- struct bintime t = crpt->crp_tstamp;
- crypto_tstat(&cryptostats.cs_cb, &t);
- crpt->crp_callback(crpt);
- crypto_tstat(&cryptostats.cs_finis, &t);
- } else
-#endif
- crpt->crp_callback(crpt);
- }
+ if (crpt != NULL)
+ crpt->crp_callback(crpt);
if (krpt != NULL)
krpt->krp_callback(krpt);
CRYPTO_RETW_LOCK(ret_worker);