summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/pci/hifn7751.c33
-rw-r--r--sys/dev/pci/hifn7751reg.h5
-rw-r--r--sys/dev/pci/hifn7751var.h35
3 files changed, 21 insertions, 52 deletions
diff --git a/sys/dev/pci/hifn7751.c b/sys/dev/pci/hifn7751.c
index 87f87b7118d..f4e4f4c68de 100644
--- a/sys/dev/pci/hifn7751.c
+++ b/sys/dev/pci/hifn7751.c
@@ -1,9 +1,11 @@
-/* $OpenBSD: hifn7751.c,v 1.18 2000/03/29 21:03:11 jason Exp $ */
+/* $OpenBSD: hifn7751.c,v 1.19 2000/03/29 22:39:38 jason Exp $ */
/*
* Invertex AEON / Hi/fn 7751 driver
* Copyright (c) 1999 Invertex Inc. All rights reserved.
* Copyright (c) 1999 Theo de Raadt
+ * Copyright (c) 2000 Network Security Technologies, Inc.
+ * http://www.netsec.net
*
* This driver is based on a previous driver by Invertex, for which they
* requested: Please send any comments, feedback, bug-fixes, or feature
@@ -1012,7 +1014,7 @@ hifn_crypto(sc, cmd)
struct hifn_dma *dma = sc->sc_dma;
struct hifn_command_buf_data cmd_buf_data;
int cmdi, srci, dsti, resi, nicealign = 0;
- int error, s, i;
+ int s, i;
if (cmd->src_npa == 0 && cmd->src_m)
cmd->src_l = hifn_mbuf(cmd->src_m, &cmd->src_npa,
@@ -1057,15 +1059,12 @@ hifn_crypto(sc, cmd)
* need 1 cmd, and 1 res
* need N src, and N dst
*/
- while (dma->cmdu+1 > HIFN_D_CMD_RSIZE ||
+ if (dma->cmdu+1 > HIFN_D_CMD_RSIZE ||
dma->srcu+cmd->src_npa > HIFN_D_SRC_RSIZE ||
dma->dstu+cmd->dst_npa > HIFN_D_DST_RSIZE ||
dma->resu+1 > HIFN_D_RES_RSIZE) {
- if (cmd->flags & HIFN_DMA_FULL_NOBLOCK) {
splx(s);
return (HIFN_CRYPTO_RINGS_FULL);
- }
- tsleep((caddr_t) dma, PZERO, "hifnring", 1);
}
if (dma->cmdi == HIFN_D_CMD_RSIZE) {
@@ -1138,21 +1137,6 @@ hifn_crypto(sc, cmd)
dma->resr[resi].l = HIFN_MAX_RESULT | HIFN_D_VALID | HIFN_D_LAST;
dma->resu++;
- /*
- * If not given a callback routine, we block until the dest data is
- * ready. (Setting interrupt timeout at 3 seconds.)
- */
- if (cmd->dest_ready_callback == NULL) {
- printf("%s: no callback -- we're sleeping\n",
- sc->sc_dv.dv_xname);
- error = tsleep((caddr_t) & dma->resr[resi], PZERO, "CRYPT",
- hz * 3);
- if (error != 0)
- printf("%s: timed out waiting for interrupt"
- " -- tsleep() exited with %d\n",
- sc->sc_dv.dv_xname, error);
- }
-
#ifdef HIFN_DEBUG
printf("%s: command: stat %8x ier %8x\n",
sc->sc_dv.dv_xname,
@@ -1205,10 +1189,7 @@ hifn_intr(arg)
}
/* position is done, notify producer with wakup or callback */
- if (cmd->dest_ready_callback == NULL)
- wakeup((caddr_t) &dma->resr[dma->resk]);
- else
- cmd->dest_ready_callback(cmd);
+ cmd->dest_ready_callback(cmd);
if (++dma->resk == HIFN_D_RES_RSIZE)
dma->resk = 0;
@@ -1326,8 +1307,6 @@ hifn_process(crp)
goto errout;
bzero(cmd, sizeof(struct hifn_command));
- cmd->flags = HIFN_DMA_FULL_NOBLOCK;
-
if (crp->crp_flags & CRYPTO_F_IMBUF) {
cmd->src_m = (struct mbuf *)crp->crp_buf;
cmd->dst_m = (struct mbuf *)crp->crp_buf;
diff --git a/sys/dev/pci/hifn7751reg.h b/sys/dev/pci/hifn7751reg.h
index b6465d01312..cf5edea5a35 100644
--- a/sys/dev/pci/hifn7751reg.h
+++ b/sys/dev/pci/hifn7751reg.h
@@ -1,8 +1,11 @@
-/* $OpenBSD: hifn7751reg.h,v 1.9 2000/03/29 20:54:59 jason Exp $ */
+/* $OpenBSD: hifn7751reg.h,v 1.10 2000/03/29 22:39:39 jason Exp $ */
/*
* Invertex AEON / Hi/fn 7751 driver
* Copyright (c) 1999 Invertex Inc. All rights reserved.
+ * Copyright (c) 1999 Theo de Raadt
+ * Copyright (c) 2000 Network Security Technologies, Inc.
+ * http://www.netsec.net
*
* Please send any comments, feedback, bug-fixes, or feature requests to
* software@invertex.com.
diff --git a/sys/dev/pci/hifn7751var.h b/sys/dev/pci/hifn7751var.h
index b4d8f779838..1e3d877974d 100644
--- a/sys/dev/pci/hifn7751var.h
+++ b/sys/dev/pci/hifn7751var.h
@@ -1,11 +1,14 @@
-/* $OpenBSD: hifn7751var.h,v 1.8 2000/03/29 21:03:11 jason Exp $ */
+/* $OpenBSD: hifn7751var.h,v 1.9 2000/03/29 22:39:39 jason Exp $ */
/*
- * Invertex AEON / Hi/fn 7751 driver
- * Copyright (c) 1999 Invertex Inc. All rights reserved.
+ * Invertex AEON / Hi/fn 7751 driver
+ * Copyright (c) 1999 Invertex Inc. All rights reserved.
+ * Copyright (c) 1999 Theo de Raadt
+ * Copyright (c) 2000 Network Security Technologies, Inc.
+ * http://www.netsec.net
*
- * Please send any comments, feedback, bug-fixes, or feature requests to
- * software@invertex.com.
+ * Please send any comments, feedback, bug-fixes, or feature requests to
+ * software@invertex.com.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -86,14 +89,6 @@
*
* HIFN_CRYPT_NEW_KEY, HIFN_MAC_NEW_KEY
*
- * Whether we block or not waiting for the dest data to be ready is
- * determined by whether a callback function is given. The other
- * place we could block is when all the DMA rings are full. If
- * it is not okay to block while waiting for an open slot in the
- * rings, include in the following value:
- *
- * HIFN_DMA_FULL_NOBLOCK
- *
* result_flags
* ------------
* result_flags is a bitwise "or" of result values. The result_flags
@@ -228,7 +223,6 @@ typedef struct hifn_command {
#define HIFN_MAC_TRUNC 0x0040
#define HIFN_CRYPT_NEW_KEY 0x0080
#define HIFN_MAC_NEW_KEY 0x0100
-#define HIFN_DMA_FULL_NOBLOCK 0x0200
#define HIFN_USING_CRYPT(f) ((f) & (HIFN_CRYPT_3DES|HIFN_CRYPT_DES))
#define HIFN_USING_MAC(f) ((f) & (HIFN_MAC_MD5|HIFN_MAC_SHA1))
@@ -250,16 +244,9 @@ typedef struct hifn_command {
*
* Blocking/Non-blocking Issues
* ============================
- * If the dest_ready_callback field of the hifn_command structure
- * is NULL, hifn_encrypt will block until the dest_data is ready --
- * otherwise hifn_encrypt() will return immediately and the
- * dest_ready_callback routine will be called when the dest data is
- * ready.
- *
- * The routine can also block when waiting for an open slot when all
- * DMA rings are full. You can avoid this behaviour by sending the
- * HIFN_DMA_FULL_NOBLOCK as part of the command flags. This will
- * make hifn_crypt() return immediately when the rings are full.
+ * The driver cannot block in hifn_crypto (no calls to tsleep) currently.
+ * hifn_crypto() returns HIFN_CRYPTO_RINGS_FULL if there is not enough
+ * room in any of the rings for the request to proceed.
*
* Return Values
* =============