summaryrefslogtreecommitdiff
path: root/sys/dev/pci/ubsecvar.h
diff options
context:
space:
mode:
authorJason Wright <jason@cvs.openbsd.org>2002-01-19 21:15:38 +0000
committerJason Wright <jason@cvs.openbsd.org>2002-01-19 21:15:38 +0000
commit9ebe5e77da10fdcc432d37891d31e890599b8aea (patch)
tree5763903b8a03253aff7bd401675ca3355f5f3506 /sys/dev/pci/ubsecvar.h
parent30f247ebd024944044867f908e9b552b29acb7ab (diff)
From Patrik Lindergren (patrik@ipunplugged.com):
* make the driver big-endian aware * handling for DMA errors * move some allocations to attach From me: whitespace clean up and vtophys removal (almost works on sparc64)
Diffstat (limited to 'sys/dev/pci/ubsecvar.h')
-rw-r--r--sys/dev/pci/ubsecvar.h85
1 files changed, 54 insertions, 31 deletions
diff --git a/sys/dev/pci/ubsecvar.h b/sys/dev/pci/ubsecvar.h
index 1a76ba1a1fc..f9a88082fd7 100644
--- a/sys/dev/pci/ubsecvar.h
+++ b/sys/dev/pci/ubsecvar.h
@@ -1,7 +1,8 @@
-/* $OpenBSD: ubsecvar.h,v 1.22 2001/07/02 04:34:47 jason Exp $ */
+/* $OpenBSD: ubsecvar.h,v 1.23 2002/01/19 21:15:37 jason Exp $ */
/*
* Copyright (c) 2000 Theo de Raadt
+ * Copyright (c) 2001 Patrik Lindergren (patrik@ipunplugged.com)
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -33,12 +34,19 @@
#endif
#define UBS_MAX_SCATTER 64 /* Maximum scatter/gather depth */
+
+#ifndef UBS_MAX_AGGR
#define UBS_MAX_AGGR 5 /* Maximum aggregation count */
+#endif
#define UBSEC_CARD(sid) (((sid) & 0xf0000000) >> 28)
#define UBSEC_SESSION(sid) ( (sid) & 0x0fffffff)
#define UBSEC_SID(crd, sesn) (((crd) << 28) | ((sesn) & 0x0fffffff))
+#define UBS_DEF_RTY 0xff /* PCI Retry Timeout */
+#define UBS_DEF_TOUT 0xff /* PCI TRDY Timeout */
+#define UBS_DEF_CACHELINE 0x01 /* Cache Line setting */
+
struct ubsec_dma_alloc {
u_int32_t dma_paddr;
caddr_t dma_vaddr;
@@ -62,10 +70,8 @@ struct ubsec_q2_rng {
#define UBSEC_RNG_BUFSIZ 16 /* measured in 32bit words */
struct ubsec_dmachunk {
-#if 0
struct ubsec_mcr d_mcr;
struct ubsec_mcr_add d_mcradd[UBS_MAX_AGGR-1];
-#endif
struct ubsec_pktbuf d_sbuf[UBS_MAX_SCATTER-1];
struct ubsec_pktbuf d_dbuf[UBS_MAX_SCATTER-1];
u_int32_t d_macbuf[5];
@@ -81,6 +87,32 @@ struct ubsec_dma {
struct ubsec_dma_alloc d_alloc;
};
+#define UBS_FLAGS_KEY 0x01 /* has key accelerator */
+#define UBS_FLAGS_LONGCTX 0x02 /* uses long ipsec ctx */
+
+struct ubsec_q {
+ SIMPLEQ_ENTRY(ubsec_q) q_next;
+ int q_nstacked_mcrs;
+ struct ubsec_q *q_stacked_mcr[UBS_MAX_AGGR-1];
+ struct cryptop *q_crp;
+ struct ubsec_pktbuf q_srcpkt[UBS_MAX_SCATTER-1];
+ struct ubsec_pktbuf q_dstpkt[UBS_MAX_SCATTER-1];
+ struct ubsec_dma *q_dma;
+
+ struct mbuf *q_src_m, *q_dst_m;
+ struct uio *q_src_io, *q_dst_io;
+
+ long q_src_packp[UBS_MAX_SCATTER];
+ int q_src_packl[UBS_MAX_SCATTER];
+ int q_src_npa, q_src_l;
+
+ long q_dst_packp[UBS_MAX_SCATTER];
+ int q_dst_packl[UBS_MAX_SCATTER];
+ int q_dst_npa, q_dst_l;
+ int q_sesn;
+ int q_flags;
+};
+
struct ubsec_softc {
struct device sc_dv; /* generic device */
void *sc_ih; /* interrupt handler cookie */
@@ -93,6 +125,7 @@ struct ubsec_softc {
SIMPLEQ_HEAD(,ubsec_q) sc_queue; /* packet queue, mcr1 */
int sc_nqueue; /* count enqueued, mcr1 */
SIMPLEQ_HEAD(,ubsec_q) sc_qchip; /* on chip, mcr1 */
+ SIMPLEQ_HEAD(,ubsec_q) sc_freequeue; /* list of free queue elements */
SIMPLEQ_HEAD(,ubsec_q2) sc_queue2; /* packet queue, mcr2 */
int sc_nqueue2; /* count enqueued, mcr2 */
SIMPLEQ_HEAD(,ubsec_q2) sc_qchip2; /* on chip, mcr2 */
@@ -102,39 +135,29 @@ struct ubsec_softc {
int sc_rnghz; /* rng poll time */
struct ubsec_q2_rng sc_rng;
struct ubsec_dma sc_dmaa[UBS_MAX_NQUEUE];
- SIMPLEQ_HEAD(,ubsec_dma) sc_dma;
+ struct ubsec_q *sc_queuea[UBS_MAX_NQUEUE];
};
-#define UBS_FLAGS_KEY 0x01 /* has key accelerator */
-#define UBS_FLAGS_LONGCTX 0x02 /* uses long ipsec ctx */
-
-struct ubsec_q {
- SIMPLEQ_ENTRY(ubsec_q) q_next;
- struct cryptop *q_crp;
- struct ubsec_mcr *q_mcr;
- struct ubsec_pktbuf q_srcpkt[UBS_MAX_SCATTER-1];
- struct ubsec_pktbuf q_dstpkt[UBS_MAX_SCATTER-1];
- struct ubsec_dma *q_dma;
-
- struct mbuf *q_src_m, *q_dst_m;
- struct uio *q_src_io, *q_dst_io;
-
- long q_src_packp[UBS_MAX_SCATTER];
- int q_src_packl[UBS_MAX_SCATTER];
- int q_src_npa, q_src_l;
-
- long q_dst_packp[UBS_MAX_SCATTER];
- int q_dst_packl[UBS_MAX_SCATTER];
- int q_dst_npa, q_dst_l;
- int q_sesn;
- int q_flags;
-};
#define UBSEC_QFLAGS_COPYOUTIV 0x1
struct ubsec_session {
u_int32_t ses_used;
u_int32_t ses_deskey[6]; /* 3DES key */
- u_int32_t ses_hminner[5]; /* hmac inner state */
- u_int32_t ses_hmouter[5]; /* hmac outer state */
- u_int32_t ses_iv[2]; /* [3]DES iv */
+ u_int32_t ses_hminner[5]; /* hmac inner state */
+ u_int32_t ses_hmouter[5]; /* hmac outer state */
+ u_int32_t ses_iv[2]; /* [3]DES iv */
};
+
+struct ubsec_stats {
+ u_int64_t hst_ibytes;
+ u_int64_t hst_obytes;
+ u_int32_t hst_ipackets;
+ u_int32_t hst_opackets;
+ u_int32_t hst_invalid;
+ u_int32_t hst_nomem;
+ u_int32_t hst_queuefull;
+ u_int32_t hst_dmaerr;
+ u_int32_t hst_mcrerr;
+ u_int32_t hst_nodmafree;
+};
+