-/* $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
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,
* 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) {
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,
}
/* 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;
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;
-/* $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.
-/* $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
*
* 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
#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))
*
* 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
* =============