1/* $NetBSD: if_atm.h,v 1.7 1996/11/09 23:02:27 chuck Exp $ */
|
2/* $FreeBSD: head/sys/net/if_atm.h 114201 2003-04-29 08:07:44Z harti $ */
|
2/* $FreeBSD: head/sys/net/if_atm.h 114739 2003-05-05 16:35:52Z harti $ */ |
3 4/* 5 * 6 * Copyright (c) 1996 Charles D. Cranor and Washington University. 7 * All rights reserved. 8 * 9 * Redistribution and use in source and binary forms, with or without 10 * modification, are permitted provided that the following conditions 11 * are met: 12 * 1. Redistributions of source code must retain the above copyright 13 * notice, this list of conditions and the following disclaimer. 14 * 2. Redistributions in binary form must reproduce the above copyright 15 * notice, this list of conditions and the following disclaimer in the 16 * documentation and/or other materials provided with the distribution. 17 * 3. All advertising materials mentioning features or use of this software 18 * must display the following acknowledgement: 19 * This product includes software developed by Charles D. Cranor and 20 * Washington University. 21 * 4. The name of the author may not be used to endorse or promote products 22 * derived from this software without specific prior written permission. 23 * 24 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 25 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 26 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 27 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 28 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 29 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 30 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 31 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 33 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 */ 35 36/* 37 * net/if_atm.h 38 */ 39
|
40/* 41 * Classification of ATM cards. 42 */ 43#define ATM_DEVICE_UNKNOWN 0 44#define ATM_DEVICE_PCA200E 1 /* Fore/Marconi PCA200-E */ 45#define ATM_DEVICE_HE155 2 /* Fore/Marconi HE155 */ 46#define ATM_DEVICE_HE622 3 /* Fore/Marconi HE622 */ 47#define ATM_DEVICE_ENI155P 4 /* Efficient networks 155p */ 48#define ATM_DEVICE_ADP155P 5 /* Adaptec 155p */ 49 50/* map to strings and vendors */ 51#define ATM_DEVICE_NAMES \ 52 { "Unknown", "Unknown" }, \ 53 { "PCA200-E", "Fore/Marconi" }, \ 54 { "HE155", "Fore/Marconi" }, \ 55 { "HE622", "Fore/Marconi" }, \ 56 { "ENI155p", "Efficient Networks" }, \ 57 { "ADP155p", "Adaptec" }, 58 59/* 60 * This is the common link layer MIB for all ATM interfaces. Much of the 61 * information here is needed for ILMI. This will be augmented by statistics 62 * at some point. 63 */ 64struct ifatm_mib { 65 /* configuration data */ 66 uint8_t device; /* type of card */ 67 u_char esi[6]; /* end system identifier (MAC) */ 68 uint32_t serial; /* card serial number */ 69 uint32_t hw_version; /* card version */ 70 uint32_t sw_version; /* firmware version (if any) */ 71 uint32_t pcr; /* supported peak cell rate */ 72 uint32_t media; /* physical media */ 73 uint8_t vpi_bits; /* number of used bits in VPI field */ 74 uint8_t vci_bits; /* number of used bits in VCI field */ 75 uint16_t max_vpcs; /* maximum number of VPCs */ 76 uint32_t max_vccs; /* maximum number of VCCs */ 77}; 78 79#ifdef _KERNEL 80/* 81 * Common fields for all ATM interfaces. Each driver's softc must start with 82 * this structure. 83 */ 84struct ifatm { 85 struct ifnet ifnet; /* required by if_var.h */ 86 struct ifatm_mib mib; /* exported data */ 87 void *phy; /* usually SUNI */ 88 void *ngpriv; /* netgraph link */ 89}; 90#endif 91 92/* 93 * Peak cell rates for various physical media. Note, that there are 94 * different opinions on what the correct values are. 95 */ 96#define ATM_RATE_155M 353208 97#define ATM_RATE_622M 1412830 98#define ATM_RATE_24G 5651320 99 |
100#if defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__) 101#define RTALLOC1(A,B) rtalloc1((A),(B)) 102#elif defined(__FreeBSD__) 103#define RTALLOC1(A,B) rtalloc1((A),(B),0UL) 104#endif 105 106/* 107 * pseudo header for packet transmission 108 */ 109struct atm_pseudohdr { 110 u_int8_t atm_ph[4]; /* flags+VPI+VCI1(msb)+VCI2(lsb) */ 111}; 112 113#define ATM_PH_FLAGS(X) ((X)->atm_ph[0]) 114#define ATM_PH_VPI(X) ((X)->atm_ph[1]) 115#define ATM_PH_VCI(X) ((((X)->atm_ph[2]) << 8) | ((X)->atm_ph[3])) 116#define ATM_PH_SETVCI(X,V) { \ 117 (X)->atm_ph[2] = ((V) >> 8) & 0xff; \ 118 (X)->atm_ph[3] = ((V) & 0xff); \ 119} 120 121#define ATM_PH_AAL5 0x01 /* use AAL5? (0 == aal0) */ 122#define ATM_PH_LLCSNAP 0x02 /* use the LLC SNAP encoding (iff aal5) */ 123 124#define ATM_PH_DRIVER7 0x40 /* reserve for driver's use */ 125#define ATM_PH_DRIVER8 0x80 /* reserve for driver's use */ 126 127#define ATMMTU 9180 /* ATM MTU size for IP */ 128 /* XXX: could be 9188 with LLC/SNAP according 129 to comer */ 130 131/* user's ioctl hook for raw atm mode */ 132#define SIOCRAWATM _IOWR('a', 122, int) /* set driver's raw mode */ 133 134/* atm_pseudoioctl: turns on and off RX VCIs [for internal use only!] */ 135struct atm_pseudoioctl { 136 struct atm_pseudohdr aph; 137 void *rxhand; 138}; 139#define SIOCATMENA _IOWR('a', 123, struct atm_pseudoioctl) /* enable */ 140#define SIOCATMDIS _IOWR('a', 124, struct atm_pseudoioctl) /* disable */ 141 142 143/* 144 * XXX forget all the garbage in if_llc.h and do it the easy way 145 */ 146 147#define ATMLLC_HDR "\252\252\3\0\0\0" 148struct atmllc { 149 u_int8_t llchdr[6]; /* aa.aa.03.00.00.00 */ 150 u_int8_t type[2]; /* "ethernet" type */ 151}; 152 153/* ATM_LLC macros: note type code in host byte order */ 154#define ATM_LLC_TYPE(X) (((X)->type[0] << 8) | ((X)->type[1])) 155#define ATM_LLC_SETTYPE(X,V) { \ 156 (X)->type[0] = ((V) >> 8) & 0xff; \ 157 (X)->type[1] = ((V) & 0xff); \ 158} 159 160#ifdef _KERNEL 161void atm_ifattach(struct ifnet *); 162void atm_ifdetach(struct ifnet *); 163void atm_input(struct ifnet *, struct atm_pseudohdr *, 164 struct mbuf *, void *); 165int atm_output(struct ifnet *, struct mbuf *, struct sockaddr *, 166 struct rtentry *); 167#endif 168
|