diff options
author | Jason Wright <jason@cvs.openbsd.org> | 2001-05-22 23:07:40 +0000 |
---|---|---|
committer | Jason Wright <jason@cvs.openbsd.org> | 2001-05-22 23:07:40 +0000 |
commit | 499ba4579997a59b29e9b2dcc5e773ca6bed4aff (patch) | |
tree | beaebc413a6cc83c92e791674290dc39e07c45d2 /sys/dev/pci/ubsec.c | |
parent | c289130c8048c971f8492e100a6924068ad850c2 (diff) |
- delay allocation of rng handling structures
- if an rng operation is already in progress, don't setup a new timeout.
Diffstat (limited to 'sys/dev/pci/ubsec.c')
-rw-r--r-- | sys/dev/pci/ubsec.c | 27 |
1 files changed, 5 insertions, 22 deletions
diff --git a/sys/dev/pci/ubsec.c b/sys/dev/pci/ubsec.c index f0384d5f84b..c59cea63029 100644 --- a/sys/dev/pci/ubsec.c +++ b/sys/dev/pci/ubsec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ubsec.c,v 1.50 2001/05/22 22:53:38 jason Exp $ */ +/* $OpenBSD: ubsec.c,v 1.51 2001/05/22 23:07:39 jason Exp $ */ /* * Copyright (c) 2000 Jason L. Wright (jason@thought.net) @@ -209,24 +209,6 @@ ubsec_attach(parent, self, aux) else sc->sc_rnghz = 1; - if (ubsec_dma_malloc(sc, sizeof(struct ubsec_mcr), - &sc->sc_rng.rng_q.q_mcr, 0)) { - printf(": rng mcr alloc failed\n"); - return; - } - if (ubsec_dma_malloc(sc, sizeof(struct ubsec_ctx_rngbypass), - &sc->sc_rng.rng_q.q_ctx, 0)) { - ubsec_dma_free(sc, &sc->sc_rng.rng_q.q_mcr); - printf(": rng ctx alloc failed\n"); - return; - } - if (ubsec_dma_malloc(sc, sizeof(u_int32_t) * UBSEC_RNG_BUFSIZ, - &sc->sc_rng.rng_buf, 0)) { - ubsec_dma_free(sc, &sc->sc_rng.rng_q.q_ctx); - ubsec_dma_free(sc, &sc->sc_rng.rng_q.q_mcr); - printf(": rng buf alloc failed\n"); - return; - } timeout_set(&sc->sc_rngto, ubsec_rng, sc); timeout_add(&sc->sc_rngto, sc->sc_rnghz); printf(", rng"); @@ -1234,6 +1216,10 @@ ubsec_rng(vsc) int s; s = splnet(); + if (rng->rng_used) { + splx(s); + return; + } sc->sc_nqueue2++; if (sc->sc_nqueue2 >= UBS_MAX_NQUEUE) goto out; @@ -1256,9 +1242,6 @@ ubsec_rng(vsc) goto out; } } - - if (rng->rng_used) - goto out; mcr = (struct ubsec_mcr *)rng->rng_q.q_mcr.dma_vaddr; ctx = (struct ubsec_ctx_rngbypass *)rng->rng_q.q_ctx.dma_vaddr; |