diff options
| author | chs <chs@NetBSD.org> | 2020-04-13 00:27:16 +0000 |
|---|---|---|
| committer | chs <chs@NetBSD.org> | 2020-04-13 00:27:16 +0000 |
| commit | 52a7600feae741691e79870121f44c3a8452723c (patch) | |
| tree | ad1436616ccea86d1e289e5f83c8ffa749dfaece /sys/opencrypto | |
| parent | f69ad8342e0880e2f9210342387e87cf58fbf134 (diff) | |
slightly change and fix the semantics of pool_set*wat(), pool_sethardlimit()
and pool_prime() (and their pool_cache_* counterparts):
- the pool_set*wat() APIs are supposed to specify thresholds for the count of
free items in the pool before pool pages are automatically allocated or freed
during pool_get() / pool_put(), whereas pool_sethardlimit() and pool_prime()
are supposed to specify minimum and maximum numbers of total items
in the pool (both free and allocated). these were somewhat conflated
in the existing code, so separate them as they were intended.
- change pool_prime() to take an absolute number of items to preallocate
rather than an increment over whatever was done before, and wait for
any memory allocations to succeed. since pool_prime() can no longer fail
after this, change its return value to void and adjust all callers.
- pool_setlowat() is documented as not immediately attempting to allocate
any memory, but it was changed some time ago to immediately try to allocate
up to the lowat level, so just fix the manpage to describe the current
behaviour.
- add a pool_cache_prime() to complete the API set.
Diffstat (limited to 'sys/opencrypto')
| -rw-r--r-- | sys/opencrypto/cryptodev.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/sys/opencrypto/cryptodev.c b/sys/opencrypto/cryptodev.c index d749cec9526..5f65e13d25c 100644 --- a/sys/opencrypto/cryptodev.c +++ b/sys/opencrypto/cryptodev.c @@ -1,4 +1,4 @@ -/* $NetBSD: cryptodev.c,v 1.104 2020/01/27 02:56:15 pgoyette Exp $ */ +/* $NetBSD: cryptodev.c,v 1.105 2020/04/13 00:27:17 chs Exp $ */ /* $FreeBSD: src/sys/opencrypto/cryptodev.c,v 1.4.2.4 2003/06/03 00:09:02 sam Exp $ */ /* $OpenBSD: cryptodev.c,v 1.53 2002/07/10 22:21:30 mickey Exp $ */ @@ -64,7 +64,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: cryptodev.c,v 1.104 2020/01/27 02:56:15 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cryptodev.c,v 1.105 2020/04/13 00:27:17 chs Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -2117,7 +2117,6 @@ cryptof_poll(struct file *fp, int events) void cryptoattach(int num) { - int error; crypto_init(); @@ -2135,9 +2134,8 @@ cryptoattach(int num) * the negotiation, plus HMAC_SHA1 for the actual SSL records, * consuming one session here for each algorithm. */ - if ((error = pool_prime(&fcrpl, 64)) != 0 || - (error = pool_prime(&csepl, 64 * 5)) != 0) - panic("%s: can't prime pool: %d", __func__, error); + pool_prime(&fcrpl, 64); + pool_prime(&csepl, 64 * 5); } void crypto_attach(device_t, device_t, void *); |
