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$
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_25 59111 /* Peak Cell Rate for 25.6 Mbps */
47 #define ATM_PCR_DS3 (12*8000) /* 12 cells in 1/8000 seconds */
48 #define ATM_PCR_TAXI100 227273 /* Peak Cell Rate for 100 Mbs TAXI */
49 #define ATM_PCR_TAXI140 318181 /* Peak Cell Rate for 140 Mbs TAXI */
50 #define ATM_PCR_OC3C 353207 /* Peak Cell Rate for OC3c */
51 #define ATM_PCR_OC12C 1416905 /* Peak Cell Rate for OC12c */
52
53
54 /*
55 * Media Access Control (MAC) address
56 */
57 struct mac_addr {
58 u_char ma_data[6]; /* MAC address */
59 };
60 typedef struct mac_addr Mac_addr;
61
62
63 /*
64 * Adapter vendor identifiers
65 */
66 enum atm_vendor {
67 VENDOR_UNKNOWN, /* Unknown vendor */
68 VENDOR_FORE, /* FORE Systems, Inc. */
69 VENDOR_ENI, /* Efficient Networks, Inc. */
70 VENDOR_IDT, /* Integrated Device Technology, Inc. */
71 VENDOR_PROSUM, /* PROSUM, Inc. */
72 VENDOR_NETGRAPH, /* Netgraph pseudo device */
73 };
74 typedef enum atm_vendor Atm_vendor;
75
76
77 /*
78 * Adapter vendor interface identifiers
79 */
80 enum atm_vendapi {
81 VENDAPI_UNKNOWN, /* Unknown interface */
82 VENDAPI_FORE_1, /* FORE - 200 Series */
83 VENDAPI_ENI_1, /* ENI - Midway */
84 VENDAPI_IDT_1, /* IDT - NICStAR */
85 VENDAPI_IDT_2, /* IDT 77252 ABR */
86 };
87 typedef enum atm_vendapi Atm_vendapi;
88
89
90 /*
91 * Adapter device model identifiers
92 */
93 enum atm_device {
94 DEV_UNKNOWN, /* Unknown device */
95 DEV_FORE_SBA200E, /* FORE SBA-200E */
96 DEV_FORE_SBA200, /* FORE SBA-200 */
97 DEV_FORE_PCA200E, /* FORE PCA-200E */
98 DEV_FORE_ESA200E, /* FORE ESA-200E */
99 DEV_ENI_155P, /* ENI-155p */
100 DEV_IDT_155, /* IDT NICStAR 155Mbps */
101 DEV_PROATM_25, /* Prosum boards based on IDT 77252 */
102 DEV_PROATM_155, /* Prosum boards based on IDT 77252 */
103 DEV_VATMPIF, /* Virtual ATM Physical IF */
104 };
105 typedef enum atm_device Atm_device;
106
107
108 /*
109 * Adapter media identifiers
110 */
111 enum atm_media {
112 MEDIA_UNKNOWN, /* Unknown media type */
113 MEDIA_TAXI_100, /* TAXI - 100 Mbps */
114 MEDIA_TAXI_140, /* TAXI - 140 Mbps */
115 MEDIA_OC3C, /* OC-3C */
116 MEDIA_OC12C, /* OC-12C */
117 MEDIA_UTP155, /* UTP-155 */
118 MEDIA_UTP25, /* UTP 25.6 */
119 };
120 typedef enum atm_media Atm_media;
121
122
123 /*
124 * Bus type identifiers
125 */
126 enum atm_bus {
127 BUS_UNKNOWN, /* Unknown bus type */
128 BUS_SBUS_B16, /* SBus: 16 byte (4 word) max burst */
129 BUS_SBUS_B32, /* SBus: 32 byte (8 word) max burst */
130 BUS_PCI, /* PCI */
131 BUS_EISA, /* EISA */
132 BUS_USB, /* USB */
133 BUS_VIRTUAL, /* Virtual Bus */
134 };
135 typedef enum atm_bus Atm_bus;
136
137
138 #define VERSION_LEN 16 /* Length of version info string */
139
140
141 /*
142 * ATM adapter configuration information structure
143 */
144 struct atm_config {
145 Atm_vendor ac_vendor; /* Vendor */
146 Atm_vendapi ac_vendapi; /* Vendor interface */
147 Atm_device ac_device; /* Device model */
148 Atm_media ac_media; /* Media type */
149 u_long ac_serial; /* Serial number */
150 Atm_bus ac_bustype; /* Bus type */
151 u_long ac_busslot; /* Bus slot info (bus type dependent) */
152 u_long ac_ram; /* Device ram offset */
153 u_long ac_ramsize; /* Device ram size */
154 Mac_addr ac_macaddr; /* MAC address */
155 char ac_hard_vers[VERSION_LEN]; /* Hardware version */
156 char ac_firm_vers[VERSION_LEN]; /* Firmware version */
157 };
158 typedef struct atm_config Atm_config;
159
160
161 #ifdef ATM_KERNEL
162 /*
163 * Common structure used to define each physical ATM device interface.
164 * This structure will (normally) be embedded at the top of each driver's
165 * device-specific interface structure.
166 */
167 struct atm_pif {
168 struct atm_pif *pif_next; /* Next registered atm interface */
169 char *pif_name; /* Device name */
170 short pif_unit; /* Device unit number */
171 u_char pif_flags; /* Interface flags (see below) */
172 struct sigmgr *pif_sigmgr; /* Signalling Manager for interface */
173 struct siginst *pif_siginst; /* Signalling protocol instance */
174 struct stack_defn *pif_services; /* Interface's stack services */
175 struct mac_addr pif_macaddr; /* Interface's MAC address */
176 struct atm_nif *pif_nif; /* List of network interfaces */
177 struct atm_pif *pif_grnext; /* Next atm device in group */
178
179 /* Exported functions */
180 int (*pif_ioctl) /* Interface ioctl handler */
181 __P((int, caddr_t, caddr_t));
182
183 /* Interface statistics */
184 long pif_ipdus; /* PDUs received from interface */
185 long pif_opdus; /* PDUs sent to interface */
186 long pif_ibytes; /* Bytes received from interface */
187 long pif_obytes; /* Bytes sent to interface */
188 long pif_ierrors; /* Errors receiving from interface */
189 long pif_oerrors; /* Errors sending to interface */
190 long pif_cmderrors; /* Interface command errors */
191 caddr_t pif_cardstats; /* Card specific statistics */
192
193 /* Interface capabilities */
194 u_short pif_maxvpi; /* Maximum VPI value supported */
195 u_short pif_maxvci; /* Maximum VCI value supported */
196 u_int pif_pcr; /* Peak Cell Rate */
197 };
198
199 /*
200 * Physical interface flags
201 */
202 #define PIF_UP 0x01 /* Interface is up */
203 #define PIF_LOOPBACK 0x02 /* Loopback local packets */
204
205
206 /*
207 * Structure defining an ATM network interface. This structure is used as
208 * the hook between the standard BSD network layer interface mechanism and
209 * the ATM device layer. There may be one or more network interfaces for
210 * each physical ATM interface.
211 */
212 struct atm_nif {
213 struct ifnet nif_if; /* Network interface */
214 struct atm_pif *nif_pif; /* Our physical interface */
215 char nif_name[IFNAMSIZ];/* Network interface name */
216 u_char nif_sel; /* Interface's address selector */
217 struct atm_nif *nif_pnext; /* Next net interface on phys i/f */
218
219 /* Interface statistics (in addition to ifnet stats) */
220 long nif_ibytes; /* Bytes received from interface */
221 long nif_obytes; /* Bytes sent to interface */
222 };
223
224
225 /*
226 * Common Device VCC Entry
227 *
228 * Contains the common information for each VCC which is opened
229 * through a particular device.
230 */
231 struct cmn_vcc {
232 struct cmn_vcc *cv_next; /* Next in list */
233 void *cv_toku; /* Upper layer's token */
234 void (*cv_upper) /* Upper layer's interface */
235 __P((int, void *, int, int));
236 Atm_connvc *cv_connvc; /* Associated connection VCC */
237 u_char cv_state; /* VCC state (see below) */
238 u_char cv_flags; /* VCC flags (see below) */
239 };
240 typedef struct cmn_vcc Cmn_vcc;
241
242 /*
243 * VCC States
244 */
245 #define CVS_FREE 0 /* Not allocated */
246 #define CVS_INST 1 /* Instantiated, waiting for INIT */
247 #define CVS_INITED 2 /* Initialized, waiting for driver */
248 #define CVS_ACTIVE 3 /* Device activated by driver */
249 #define CVS_PTERM 4 /* Waiting for TERM */
250 #define CVS_TERM 5 /* Terminated */
251
252 /*
253 * VCC Flags
254 */
255 #define CVF_RSVD 0x0f /* Reserved for device-specific use */
256
257
258 /*
259 * Common Device Unit Structure
260 *
261 * Contains the common information for a single device (adapter).
262 */
263 struct cmn_unit {
264 struct atm_pif cu_pif; /* Physical interface */
265 u_int cu_unit; /* Local unit number */
266 u_char cu_flags; /* Device flags (see below) */
267 u_int cu_mtu; /* Interface MTU */
268
269 u_int cu_open_vcc; /* Open VCC count */
270 Cmn_vcc *cu_vcc; /* List of VCC's on interface */
271
272 u_int cu_intrpri; /* Highest unit interrupt priority */
273 int cu_savepri; /* Saved priority for locking device */
274
275 struct sp_info *cu_vcc_pool; /* Device VCC pool */
276 struct sp_info *cu_nif_pool; /* Device NIF pool */
277
278 int (*cu_ioctl) /* Interface ioctl handler */
279 __P((int, caddr_t, caddr_t));
280 int (*cu_instvcc) /* VCC stack instantion handler */
281 __P((struct cmn_unit *, Cmn_vcc *));
282 int (*cu_openvcc) /* Open VCC handler */
283 __P((struct cmn_unit *, Cmn_vcc *));
284 int (*cu_closevcc) /* Close VCC handler */
285 __P((struct cmn_unit *, Cmn_vcc *));
286 void (*cu_output) /* Data output handler */
287 __P((struct cmn_unit *, Cmn_vcc *, KBuffer *));
288
289 Atm_config cu_config; /* Device configuration data */
290 };
291 typedef struct cmn_unit Cmn_unit;
292
293 /*
294 * Device flags
295 */
296 #define CUF_REGISTER 0x01 /* Device is registered */
297 #define CUF_INITED 0x02 /* Device is initialized */
298
299
300 /*
301 * Structure used to define a network convergence module and its associated
302 * entry points. A convergence module is used to provide the interface
303 * translations necessary between the ATM system and the BSD network layer
304 * interface mechanism. There will be one network convergence module for
305 * each protocol address family supporting ATM connections.
306 */
307 struct atm_ncm {
308 struct atm_ncm *ncm_next; /* Next in registry list */
309 u_short ncm_family; /* Protocol family */
310 /* Exported functions */
311 int (*ncm_ifoutput) /* Interface if_output handler */
312 __P((struct ifnet *, KBuffer *,
313 struct sockaddr *));
314 int (*ncm_stat) /* Network i/f status handler */
315 __P((int, struct atm_nif *, int));
316 };
317
318 /*
319 * ncm_stat() commands
320 */
321 #define NCM_ATTACH 1 /* Attaching a new net i/f */
322 #define NCM_DETACH 2 /* Detaching a current net i/f */
323 #define NCM_SETADDR 3 /* Net i/f address change */
324 #define NCM_SIGATTACH 4 /* Attaching a signalling manager */
325 #define NCM_SIGDETACH 5 /* Detaching a signalling manager */
326
327
328 /*
329 * atm_dev_alloc() parameters
330 */
331 #define ATM_DEV_NONCACHE 1 /* Allocate non-cacheable memory */
332
333 /*
334 * atm_dev_compress() buffer allocation sizes
335 */
336 #if defined(BSD)
337 #define ATM_DEV_CMPR_LG MCLBYTES /* Size of large buffers */
338 #define ATM_DEV_CMPR_SM MLEN /* Size of small buffers */
339 #endif
340
341 /*
342 * Macros to manage DMA addresses
343 */
344 #if defined(sun4c)
345 #define DMA_INIT()
346 #define DMA_GET_ADDR(addr,len,align,flags) ((void *)(addr))
347 #define DMA_FREE_ADDR(addr,daddr,len,flags)
348 #define DMA_RELEASE()
349
350 #elif defined(sun4m)
351 #define DMA_INIT()
352 #define DMA_GET_ADDR(addr,len,align,flags) \
353 (void *)atm_dma_map((addr),(len),(flags))
354 #define DMA_FREE_ADDR(addr,daddr,len,flags) \
355 (void)atm_dma_free((daddr),(flags))
356 #define DMA_RELEASE()
357
358 #elif defined(BSD) && defined(__i386__)
359 #define DMA_INIT()
360 #define DMA_GET_ADDR(addr,len,align,flags) ((void *)vtophys(addr))
361 #define DMA_FREE_ADDR(addr,daddr,len,flags)
362 #define DMA_RELEASE()
363
364 #else
365 #error - Must define hardware-specific requirements here
366 #endif
367
368
369 /*
370 * Macros to lock out device interrupts
371 */
372 #if defined(sun)
373 #define DEVICE_LOCK(u) ((u)->cu_savepri = splr((u)->cu_intrpri))
374 #endif
375 #if defined(__FreeBSD__)
376 #define DEVICE_LOCK(u) ((u)->cu_savepri = splimp())
377 #endif
378 #define DEVICE_UNLOCK(u) ((void) splx((u)->cu_savepri))
379
380
381 /*
382 * SBus defines
383 */
384 #if defined(sun)
385 #define SBUS_BURST32 0x20 /* Device supports 32-byte bursts */
386 #endif
387
388
389 /*
390 * Macro to schedule the ATM interrupt queue handler
391 */
392 typedef void (atm_intr_t) __P((void *, KBuffer *)); /* Callback function type */
393 typedef atm_intr_t *atm_intr_func_t; /* Pointer to callback function */
394
395 #ifdef sun
396 #define SCHED_ATM schednetisr(atm_intr)
397 #endif
398 #ifdef __FreeBSD__
399 #define NETISR_ATM AF_ATM
400 #define SCHED_ATM schednetisr(NETISR_ATM)
401 #endif
402 #ifdef sgi
403 extern int atm_intr_index;
404 #define SCHED_ATM schednetisr(atm_intr_index)
405 #endif
406 #endif /* ATM_KERNEL */
407
408 #endif /* _NETATM_ATM_IF_H */
Cache object: 412a01fa83ad2feda646249b0afed297
|