Merge from vendor branch BIND:
[dragonfly.git] / sys / dev / atm / hfa / fore.h
1 /*
2  *
3  * ===================================
4  * HARP  |  Host ATM Research Platform
5  * ===================================
6  *
7  *
8  * This Host ATM Research Platform ("HARP") file (the "Software") is
9  * made available by Network Computing Services, Inc. ("NetworkCS")
10  * "AS IS".  NetworkCS does not provide maintenance, improvements or
11  * support of any kind.
12  *
13  * NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
14  * INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
15  * AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
16  * SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
17  * In no event shall NetworkCS be responsible for any damages, including
18  * but not limited to consequential damages, arising from or relating to
19  * any use of the Software or related support.
20  *
21  * Copyright 1994-1998 Network Computing Services, Inc.
22  *
23  * Copies of this Software may be made, however, the above copyright
24  * notice must be reproduced on all copies.
25  *
26  *      @(#) $FreeBSD: src/sys/dev/hfa/fore.h,v 1.2.2.1 2001/07/20 20:43:17 pirzyk Exp $
27  *      @(#) $DragonFly: src/sys/dev/atm/hfa/fore.h,v 1.2 2003/06/17 04:28:26 dillon Exp $
28  *
29  */
30
31 /*
32  * FORE Systems 200-Series Adapter Support
33  * ---------------------------------------
34  *
35  * Protocol and implementation definitions
36  *
37  */
38
39 #ifndef _FORE_H
40 #define _FORE_H
41
42 #ifndef FORE_DEV_NAME
43 #define FORE_DEV_NAME   "hfa"
44 #endif
45
46 #define FORE_MAX_UNITS  8       /* Maximum number of devices we support */
47 #define FORE_MIN_UCODE  0x20300 /* Minimum microcode version we support */
48
49 #define FORE_IFF_MTU    9188    /* Network interface MTU */
50 #define FORE_MAX_VCC    1024    /* Maximum number of open VCCs */
51 #define FORE_MAX_VPI    0       /* Maximum VPI value */
52 #define FORE_MAX_VCI    1023    /* Maximum VCI value */
53 #define FORE_DEF_RATE   0x00000000      /* Default rate control = disabled */
54
55 #define XMIT_QUELEN     32      /* Length of transmit queue */
56 #define RECV_QUELEN     32      /* Length of receive queue */
57 #define CMD_QUELEN      8       /* Length of command queue */
58
59 #define FORE_TIME_TICK  5       /* Watchdog timer tick (seconds) */
60 #define FORE_WATCHDOG   3       /* Device watchdog timeout (ticks) */
61 #define FORE_RECV_RETRY 3       /* Wait for receive queue entry retry count */
62 #define FORE_RECV_DELAY 10      /* Wait for receive queue entry delay (usec) */
63
64
65 /*
66  * Receive Buffer strategies
67  */
68 #define BUF_MIN_VCC     4       /* Minimum for buffer supply calculations */
69
70 #ifdef FORE_SBUS
71 #if defined(sun4c)
72 #define BUF_DATA_ALIGN  32      /* Fore-required data alignment */
73 #elif defined(sun4m)
74 #define BUF_DATA_ALIGN  64      /* Fore-required data alignment */
75 #endif
76 #endif
77 #ifdef FORE_PCI
78 #define BUF_DATA_ALIGN  4       /* Fore-required data alignment */
79 #endif
80
81 #if defined(BSD)
82 /*
83  * Strategy 1 Small - mbuf
84  * Strategy 1 Large - cluster mbuf
85  *
86  * XXX buffer controls - the RECV_MAX_SEGS calculation comes out wrong
87  * using the true buffer size values if the CP really only does full-cell
88  * filling of a particular buffer - we must clarify this...it also appears
89  * the minimum buffer size is 64, even if the CP can only fit in 1 cell.
90  */
91 #define SIZEOF_Buf_handle       16      /* XXX sizeof(Buf_handle) */
92
93 #if BSD >= 199103
94 #undef m_ext
95 typedef struct m_ext    M_ext;
96 #define m_ext           M_dat.MH.MH_dat.MH_ext
97 #define BUF1_SM_HOFF    (sizeof(struct m_hdr))  /* Buffer-to-handle offset */
98 #define BUF1_SM_HDR     (sizeof(struct m_hdr) + sizeof(struct pkthdr))
99 #define BUF1_SM_LEN     (MHLEN)
100 #define BUF1_LG_HOFF    (sizeof(struct m_hdr) + sizeof(struct pkthdr) \
101                             + sizeof(M_ext))    /* Buffer-to-handle offset */
102 #else
103 #define BUF1_SM_HOFF    (MMINOFF)               /* Buffer-to-handle offset */
104 #define BUF1_SM_HDR     (MMINOFF)
105 #define BUF1_SM_LEN     (MLEN)
106 #define BUF1_LG_HOFF    (MMINOFF + 16)          /* Buffer-to-handle offset */
107 #endif
108
109 /*
110  * BUF1_SM_DOFF - CP data offset into buffer data space
111  * BUF1_SM_SIZE - Buffer size
112  *
113  * These should be defined as follows, but we need compile-time constants:
114  *
115  *      #define BUF1_SM_DOFF (roundup(BUF1_SM_HOFF + SIZEOF_Buf_handle, 
116  *                      BUF_DATA_ALIGN) - BUF1_SM_HDR)
117  *      #define BUF1_SM_SIZE    MAX(BUF1_SM_LEN - BUF1_SM_DOFF, 64)
118  *
119  */
120 #if ((BSD >= 199103) && defined(FORE_PCI))
121 #define BUF1_SM_DOFF    (SIZEOF_Buf_handle)
122 #define BUF1_SM_SIZE    (BUF1_SM_LEN - BUF1_SM_DOFF)
123 #endif
124 #if ((BSD < 199103) && defined(FORE_SBUS) && defined(sun4c))
125 #define BUF1_SM_DOFF    (BUF_DATA_ALIGN - BUF1_SM_HDR)
126 #define BUF1_SM_SIZE    (BUF1_SM_LEN - BUF1_SM_DOFF)
127 #endif
128 #if ((BSD < 199103) && defined(FORE_SBUS) && defined(sun4m))
129 #define BUF1_SM_DOFF    (BUF_DATA_ALIGN - BUF1_SM_HDR)
130 #define BUF1_SM_SIZE    (64)
131 #endif
132
133 #define BUF1_SM_QUELEN  16      /* Entries in supply queue */
134 #define BUF1_SM_CPPOOL  256     /* Buffers in CP-resident pool */
135 #define BUF1_SM_ENTSIZE 8       /* Buffers in each supply queue entry */
136
137 #define BUF1_LG_DOFF    0       /* CP data offset into mbuf data space */
138 #define BUF1_LG_SIZE    MCLBYTES        /* Buffer size */
139 #define BUF1_LG_QUELEN  16      /* Entries in supply queue */
140 #define BUF1_LG_CPPOOL  512     /* Buffers in CP-resident pool */
141 #define BUF1_LG_ENTSIZE 8       /* Buffers in each supply queue entry */
142
143 #endif /* defined(BSD) */
144
145 #endif  /* _FORE_H */