FreeBSD/Linux Kernel Cross Reference
sys/netatm/atm_if.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: releng/5.0/sys/netatm/atm_if.h 106651 2002-11-08 18:27:30Z jhb $
27 *
28 */
29
30 /*
31 * Core ATM Services
32 * -----------------
33 *
34 * ATM Physical and Network Interface definitions
35 *
36 */
37
38 #ifndef _NETATM_ATM_IF_H
39 #define _NETATM_ATM_IF_H
40
41 /*
42 * Handy constants
43 */
44 #define ATM_NIF_MTU 9180 /* Default network interface MTU */
45
46 #define ATM_PCR_TAXI100 227273 /* Peak Cell Rate for 100 Mbs TAXI */
47 #define ATM_PCR_TAXI140 318181 /* Peak Cell Rate for 140 Mbs TAXI */
48 #define ATM_PCR_OC3C 353207 /* Peak Cell Rate for OC3c */
49 #define ATM_PCR_OC12C 1416905 /* Peak Cell Rate for OC12c */
50
51
52 /*
53 * Media Access Control (MAC) address
54 */
55 struct mac_addr {
56 u_char ma_data[6]; /* MAC address */
57 };
58 typedef struct mac_addr Mac_addr;
59
60
61 /*
62 * Adapter vendor identifiers
63 */
64 enum atm_vendor {
65 VENDOR_UNKNOWN, /* Unknown vendor */
66 VENDOR_FORE, /* FORE Systems, Inc. */
67 VENDOR_ENI, /* Efficient Networks, Inc. */
68 VENDOR_IDT /* Integrated Device Technology, Inc. */
69 };
70 typedef enum atm_vendor Atm_vendor;
71
72
73 /*
74 * Adapter vendor interface identifiers
75 */
76 enum atm_vendapi {
77 VENDAPI_UNKNOWN, /* Unknown interface */
78 VENDAPI_FORE_1, /* FORE - 200 Series */
79 VENDAPI_ENI_1, /* ENI - Midway */
80 VENDAPI_IDT_1 /* IDT - NICStAR */
81 };
82 typedef enum atm_vendapi Atm_vendapi;
83
84
85 /*
86 * Adapter device model identifiers
87 */
88 enum atm_device {
89 DEV_UNKNOWN, /* Unknown device */
90 DEV_FORE_SBA200E, /* FORE SBA-200E */
91 DEV_FORE_SBA200, /* FORE SBA-200 */
92 DEV_FORE_PCA200E, /* FORE PCA-200E */
93 DEV_FORE_ESA200E, /* FORE ESA-200E */
94 DEV_ENI_155P, /* ENI-155p */
95 DEV_IDT_155 /* IDT NICStAR */
96 };
97 typedef enum atm_device Atm_device;
98
99
100 /*
101 * Adapter media identifiers
102 */
103 enum atm_media {
104 MEDIA_UNKNOWN, /* Unknown media type */
105 MEDIA_TAXI_100, /* TAXI - 100 Mbps */
106 MEDIA_TAXI_140, /* TAXI - 140 Mbps */
107 MEDIA_OC3C, /* OC-3C */
108 MEDIA_OC12C, /* OC-12C */
109 MEDIA_UTP155 /* UTP-155 */
110 };
111 typedef enum atm_media Atm_media;
112
113
114 /*
115 * Bus type identifiers
116 */
117 enum atm_bus {
118 BUS_UNKNOWN, /* Unknown bus type */
119 BUS_SBUS_B16, /* SBus: 16 byte (4 word) max burst */
120 BUS_SBUS_B32, /* SBus: 32 byte (8 word) max burst */
121 BUS_PCI, /* PCI */
122 BUS_EISA /* EISA */
123 };
124 typedef enum atm_bus Atm_bus;
125
126
127 #define VERSION_LEN 16 /* Length of version info string */
128
129
130 /*
131 * ATM adapter configuration information structure
132 */
133 struct atm_config {
134 Atm_vendor ac_vendor; /* Vendor */
135 Atm_vendapi ac_vendapi; /* Vendor interface */
136 Atm_device ac_device; /* Device model */
137 Atm_media ac_media; /* Media type */
138 u_long ac_serial; /* Serial number */
139 Atm_bus ac_bustype; /* Bus type */
140 u_long ac_busslot; /* Bus slot info (bus type dependent) */
141 u_long ac_ram; /* Device ram offset */
142 u_long ac_ramsize; /* Device ram size */
143 Mac_addr ac_macaddr; /* MAC address */
144 char ac_hard_vers[VERSION_LEN]; /* Hardware version */
145 char ac_firm_vers[VERSION_LEN]; /* Firmware version */
146 };
147 typedef struct atm_config Atm_config;
148
149
150 #ifdef _KERNEL
151
152 #include <vm/uma.h>
153
154 /*
155 * Common structure used to define each physical ATM device interface.
156 * This structure will (normally) be embedded at the top of each driver's
157 * device-specific interface structure.
158 */
159 struct atm_pif {
160 struct atm_pif *pif_next; /* Next registered atm interface */
161 char *pif_name; /* Device name */
162 short pif_unit; /* Device unit number */
163 u_char pif_flags; /* Interface flags (see below) */
164 struct sigmgr *pif_sigmgr; /* Signalling Manager for interface */
165 struct siginst *pif_siginst; /* Signalling protocol instance */
166 struct stack_defn *pif_services; /* Interface's stack services */
167 struct mac_addr pif_macaddr; /* Interface's MAC address */
168 struct atm_nif *pif_nif; /* List of network interfaces */
169 struct atm_pif *pif_grnext; /* Next atm device in group */
170
171 /* Exported functions */
172 int (*pif_ioctl) /* Interface ioctl handler */
173 (int, caddr_t, caddr_t);
174
175 /* Interface statistics */
176 u_quad_t pif_ipdus; /* PDUs received from interface */
177 u_quad_t pif_opdus; /* PDUs sent to interface */
178 u_quad_t pif_ibytes; /* Bytes received from interface */
179 u_quad_t pif_obytes; /* Bytes sent to interface */
180 u_quad_t pif_ierrors; /* Errors receiving from interface */
181 u_quad_t pif_oerrors; /* Errors sending to interface */
182 u_quad_t pif_cmderrors; /* Interface command errors */
183 caddr_t pif_cardstats; /* Card specific statistics */
184
185 /* Interface capabilities */
186 u_short pif_maxvpi; /* Maximum VPI value supported */
187 u_short pif_maxvci; /* Maximum VCI value supported */
188 u_int pif_pcr; /* Peak Cell Rate */
189 };
190
191 /*
192 * Physical interface flags
193 */
194 #define PIF_UP 0x01 /* Interface is up */
195 #define PIF_LOOPBACK 0x02 /* Loopback local packets */
196
197
198 /*
199 * Structure defining an ATM network interface. This structure is used as
200 * the hook between the standard BSD network layer interface mechanism and
201 * the ATM device layer. There may be one or more network interfaces for
202 * each physical ATM interface.
203 */
204 struct atm_nif {
205 struct ifnet nif_if; /* Network interface */
206 struct atm_pif *nif_pif; /* Our physical interface */
207 char nif_name[IFNAMSIZ];/* Network interface name */
208 u_char nif_sel; /* Interface's address selector */
209 struct atm_nif *nif_pnext; /* Next net interface on phys i/f */
210
211 /* Interface statistics (in addition to ifnet stats) */
212 long nif_ibytes; /* Bytes received from interface */
213 long nif_obytes; /* Bytes sent to interface */
214 };
215
216
217 /*
218 * Common Device VCC Entry
219 *
220 * Contains the common information for each VCC which is opened
221 * through a particular device.
222 */
223 struct cmn_vcc {
224 struct cmn_vcc *cv_next; /* Next in list */
225 void *cv_toku; /* Upper layer's token */
226 void (*cv_upper) /* Upper layer's interface */
227 (int, void *, intptr_t, intptr_t);
228 Atm_connvc *cv_connvc; /* Associated connection VCC */
229 u_char cv_state; /* VCC state (see below) */
230 u_char cv_flags; /* VCC flags (see below) */
231 };
232 typedef struct cmn_vcc Cmn_vcc;
233
234 /*
235 * VCC States
236 */
237 #define CVS_FREE 0 /* Not allocated */
238 #define CVS_INST 1 /* Instantiated, waiting for INIT */
239 #define CVS_INITED 2 /* Initialized, waiting for driver */
240 #define CVS_ACTIVE 3 /* Device activated by driver */
241 #define CVS_PTERM 4 /* Waiting for TERM */
242 #define CVS_TERM 5 /* Terminated */
243
244 /*
245 * VCC Flags
246 */
247 #define CVF_RSVD 0x0f /* Reserved for device-specific use */
248
249
250 /*
251 * Common Device Unit Structure
252 *
253 * Contains the common information for a single device (adapter).
254 */
255 struct cmn_unit {
256 struct atm_pif cu_pif; /* Physical interface */
257 u_int cu_unit; /* Local unit number */
258 u_char cu_flags; /* Device flags (see below) */
259 u_int cu_mtu; /* Interface MTU */
260
261 u_int cu_open_vcc; /* Open VCC count */
262 Cmn_vcc *cu_vcc; /* List of VCC's on interface */
263
264 u_int cu_intrpri; /* Highest unit interrupt priority */
265 int cu_savepri; /* Saved priority for locking device */
266
267 uma_zone_t cu_vcc_zone; /* Device VCC zone */
268 uma_zone_t cu_nif_zone; /* Device NIF zone */
269
270 int (*cu_ioctl) /* Interface ioctl handler */
271 (int, caddr_t, caddr_t);
272 int (*cu_instvcc) /* VCC stack instantion handler */
273 (struct cmn_unit *, Cmn_vcc *);
274 int (*cu_openvcc) /* Open VCC handler */
275 (struct cmn_unit *, Cmn_vcc *);
276 int (*cu_closevcc) /* Close VCC handler */
277 (struct cmn_unit *, Cmn_vcc *);
278 void (*cu_output) /* Data output handler */
279 (struct cmn_unit *, Cmn_vcc *, KBuffer *);
280
281 Atm_config cu_config; /* Device configuration data */
282
283 void * cu_softc; /* pointer to driver state */
284 };
285 typedef struct cmn_unit Cmn_unit;
286
287 /*
288 * Device flags
289 */
290 #define CUF_REGISTER 0x01 /* Device is registered */
291 #define CUF_INITED 0x02 /* Device is initialized */
292
293
294 /*
295 * Structure used to define a network convergence module and its associated
296 * entry points. A convergence module is used to provide the interface
297 * translations necessary between the ATM system and the BSD network layer
298 * interface mechanism. There will be one network convergence module for
299 * each protocol address family supporting ATM connections.
300 */
301 struct atm_ncm {
302 struct atm_ncm *ncm_next; /* Next in registry list */
303 u_short ncm_family; /* Protocol family */
304 /* Exported functions */
305 int (*ncm_ifoutput) /* Interface if_output handler */
306 (struct ifnet *, KBuffer *, struct sockaddr *);
307 int (*ncm_stat) /* Network i/f status handler */
308 (int, struct atm_nif *, intptr_t);
309 };
310
311 /*
312 * ncm_stat() commands
313 */
314 #define NCM_ATTACH 1 /* Attaching a new net i/f */
315 #define NCM_DETACH 2 /* Detaching a current net i/f */
316 #define NCM_SETADDR 3 /* Net i/f address change */
317 #define NCM_SIGATTACH 4 /* Attaching a signalling manager */
318 #define NCM_SIGDETACH 5 /* Detaching a signalling manager */
319
320
321 /*
322 * atm_dev_alloc() parameters
323 */
324 #define ATM_DEV_NONCACHE 1 /* Allocate non-cacheable memory */
325
326 /*
327 * atm_dev_compress() buffer allocation sizes
328 */
329 #define ATM_DEV_CMPR_LG MCLBYTES /* Size of large buffers */
330 #define ATM_DEV_CMPR_SM MLEN /* Size of small buffers */
331
332 /*
333 * Macros to lock out device interrupts
334 */
335 #define DEVICE_LOCK(u) ((u)->cu_savepri = splimp())
336 #define DEVICE_UNLOCK(u) ((void) splx((u)->cu_savepri))
337
338 /*
339 * Macro to schedule the ATM interrupt queue handler
340 */
341 typedef void (atm_intr_t)(void *, KBuffer *); /* Callback function type */
342 typedef atm_intr_t *atm_intr_func_t; /* Pointer to callback function */
343
344 #endif /* _KERNEL */
345
346 #endif /* _NETATM_ATM_IF_H */
Cache object: 489fc05c767a32845637ede341ebfc0a
|