| 1 | /* $NetBSD: if_media.h,v 1.45 2006/05/18 09:05:51 liamjfoy Exp $ */ |
| 2 | /* $FreeBSD: src/sys/net/if_media.h,v 1.9.2.4 2002/07/30 06:22:40 imp Exp $ */ |
| 3 | |
| 4 | /* |
| 5 | * Copyright (c) 1997 |
| 6 | * Jonathan Stone and Jason R. Thorpe. All rights reserved. |
| 7 | * |
| 8 | * This software is derived from information provided by Matt Thomas. |
| 9 | * |
| 10 | * Redistribution and use in source and binary forms, with or without |
| 11 | * modification, are permitted provided that the following conditions |
| 12 | * are met: |
| 13 | * 1. Redistributions of source code must retain the above copyright |
| 14 | * notice, this list of conditions and the following disclaimer. |
| 15 | * 2. Redistributions in binary form must reproduce the above copyright |
| 16 | * notice, this list of conditions and the following disclaimer in the |
| 17 | * documentation and/or other materials provided with the distribution. |
| 18 | * 3. All advertising materials mentioning features or use of this software |
| 19 | * must display the following acknowledgement: |
| 20 | * This product includes software developed by Jonathan Stone |
| 21 | * and Jason R. Thorpe for the NetBSD Project. |
| 22 | * 4. The names of the authors may not be used to endorse or promote products |
| 23 | * derived from this software without specific prior written permission. |
| 24 | * |
| 25 | * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR |
| 26 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
| 27 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
| 28 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
| 29 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
| 30 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 31 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
| 32 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
| 33 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 34 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 35 | * SUCH DAMAGE. |
| 36 | */ |
| 37 | |
| 38 | #ifndef _NET_IF_MEDIA_H_ |
| 39 | #define _NET_IF_MEDIA_H_ |
| 40 | |
| 41 | #ifndef _SYS_TYPES_H_ |
| 42 | #include <sys/types.h> |
| 43 | #endif |
| 44 | |
| 45 | /* |
| 46 | * Prototypes and definitions for BSD/OS-compatible network interface |
| 47 | * media selection. |
| 48 | * |
| 49 | * Where it is safe to do so, this code strays slightly from the BSD/OS |
| 50 | * design. Software which uses the API (device drivers, basically) |
| 51 | * shouldn't notice any difference. |
| 52 | * |
| 53 | * Many thanks to Matt Thomas for providing the information necessary |
| 54 | * to implement this interface. |
| 55 | */ |
| 56 | |
| 57 | #ifdef _KERNEL |
| 58 | |
| 59 | #ifndef _SYS_QUEUE_H_ |
| 60 | #include <sys/queue.h> |
| 61 | #endif |
| 62 | |
| 63 | struct ifnet; |
| 64 | struct ifreq; |
| 65 | struct ifmediareq; |
| 66 | |
| 67 | /* |
| 68 | * Driver callbacks for media status and change requests. |
| 69 | */ |
| 70 | typedef int (*ifm_change_cb_t)(struct ifnet *ifp); |
| 71 | typedef void (*ifm_stat_cb_t)(struct ifnet *ifp, struct ifmediareq *req); |
| 72 | |
| 73 | /* |
| 74 | * In-kernel representation of a single supported media type. |
| 75 | */ |
| 76 | struct ifmedia_entry { |
| 77 | LIST_ENTRY(ifmedia_entry) ifm_list; |
| 78 | int ifm_media; /* description of this media attachment */ |
| 79 | int ifm_data; /* for driver-specific use */ |
| 80 | void *ifm_aux; /* for driver-specific use */ |
| 81 | }; |
| 82 | |
| 83 | /* |
| 84 | * One of these goes into a network interface's softc structure. |
| 85 | * It is used to keep general media state. |
| 86 | */ |
| 87 | struct ifmedia { |
| 88 | int ifm_mask; /* mask of changes we don't care about */ |
| 89 | int ifm_media; /* current user-set media word */ |
| 90 | struct ifmedia_entry *ifm_cur; /* currently selected media */ |
| 91 | LIST_HEAD(, ifmedia_entry) ifm_list; /* list of all supported media */ |
| 92 | ifm_change_cb_t ifm_change; /* media change driver callback */ |
| 93 | ifm_stat_cb_t ifm_status; /* media status driver callback */ |
| 94 | }; |
| 95 | |
| 96 | /* Initialize an interface's struct if_media field. */ |
| 97 | void ifmedia_init(struct ifmedia *ifm, int dontcare_mask, |
| 98 | ifm_change_cb_t change_callback, ifm_stat_cb_t status_callback); |
| 99 | |
| 100 | /* Remove all mediums from a struct ifmedia. */ |
| 101 | void ifmedia_removeall( struct ifmedia *ifm); |
| 102 | |
| 103 | /* Add one supported medium to a struct ifmedia. */ |
| 104 | void ifmedia_add(struct ifmedia *ifm, int mword, int data, void *aux); |
| 105 | |
| 106 | /* Add an array (of ifmedia_entry) media to a struct ifmedia. */ |
| 107 | void ifmedia_list_add(struct ifmedia *mp, struct ifmedia_entry *lp, |
| 108 | int count); |
| 109 | |
| 110 | /* Set default media type on initialization. */ |
| 111 | void ifmedia_set(struct ifmedia *ifm, int mword); |
| 112 | |
| 113 | /* Common ioctl function for getting/setting media, called by driver. */ |
| 114 | int ifmedia_ioctl(struct ifnet *ifp, struct ifreq *ifr, |
| 115 | struct ifmedia *ifm, u_long cmd); |
| 116 | |
| 117 | /* Compute baudrate for a given media. */ |
| 118 | uint64_t ifmedia_baudrate(int); |
| 119 | #endif /*_KERNEL */ |
| 120 | |
| 121 | /* |
| 122 | * if_media Options word: |
| 123 | * Bits Use |
| 124 | * ---- ------- |
| 125 | * 0-4 Media variant MAX SUBTYPE == 31!! |
| 126 | * 5-7 Media type |
| 127 | * 8-15 Type specific options |
| 128 | * 16-18 Mode (for multi-mode devices) |
| 129 | * 19 RFU |
| 130 | * 20-27 Shared (global) options |
| 131 | * 28-31 Instance |
| 132 | */ |
| 133 | |
| 134 | /* |
| 135 | * Ethernet |
| 136 | */ |
| 137 | #define IFM_ETHER 0x00000020 |
| 138 | #define IFM_10_T 3 /* 10BaseT - RJ45 */ |
| 139 | #define IFM_10_2 4 /* 10Base2 - Thinnet */ |
| 140 | #define IFM_10_5 5 /* 10Base5 - AUI */ |
| 141 | #define IFM_100_TX 6 /* 100BaseTX - RJ45 */ |
| 142 | #define IFM_100_FX 7 /* 100BaseFX - Fiber */ |
| 143 | #define IFM_100_T4 8 /* 100BaseT4 - 4 pair cat 3 */ |
| 144 | #define IFM_100_VG 9 /* 100VG-AnyLAN */ |
| 145 | #define IFM_100_T2 10 /* 100BaseT2 */ |
| 146 | #define IFM_1000_FX 11 /* 1000BaseFX - gigabit over fiber */ |
| 147 | #define IFM_10_STP 12 /* 10BaseT over shielded TP */ |
| 148 | #define IFM_10_FL 13 /* 10baseFL - Fiber */ |
| 149 | #define IFM_1000_SX 14 /* 1000BaseSX Multi-mode Fiber */ |
| 150 | #define IFM_1000_LX 15 /* 1000BaseLX Single-mode Fiber */ |
| 151 | #define IFM_1000_CX 16 /* 1000BaseCX 150ohm STP */ |
| 152 | #define IFM_1000_T 17 /* 1000BaseT 4 pair cat 5 */ |
| 153 | #define IFM_HPNA_1 18 /* HomePNA media for ethernet frames */ |
| 154 | #define IFM_10G_LR 18 /* 10GBase-LR 1310nm Single-mode */ |
| 155 | #define IFM_10G_SR 19 /* 10GBase-SR 850nm Multi-mode */ |
| 156 | #define IFM_10G_CX4 20 /* 10GBase CX4 copper */ |
| 157 | #define IFM_2500_SX 21 /* 2500BaseSX - multi-mode fiber */ |
| 158 | #define IFM_10G_TWINAX 22 /* 10GBase Twinax copper */ |
| 159 | #define IFM_10G_TWINAX_LONG 23 /* 10GBase Twinax Long copper */ |
| 160 | #define IFM_10G_LRM 24 /* 10GBase-LRM 850nm Multi-mode */ |
| 161 | #define IFM_UNKNOWN 25 /* media types not defined yet */ |
| 162 | #define IFM_10G_T 26 /* 10GBase-T - RJ45 */ |
| 163 | |
| 164 | #define IFM_ETH_MASTER 0x00000100 /* master mode (1000baseT) */ |
| 165 | #define IFM_ETH_RXPAUSE 0x00000200 /* receive PAUSE frames */ |
| 166 | #define IFM_ETH_TXPAUSE 0x00000400 /* transmit PAUSE frames */ |
| 167 | |
| 168 | /* |
| 169 | * IEEE 802.11 Wireless |
| 170 | */ |
| 171 | #define IFM_IEEE80211 0x00000080 |
| 172 | /* NB: 0,1,2 are auto, manual, none defined below */ |
| 173 | #define IFM_IEEE80211_FH1 3 /* Frequency Hopping 1Mbps */ |
| 174 | #define IFM_IEEE80211_FH2 4 /* Frequency Hopping 2Mbps */ |
| 175 | #define IFM_IEEE80211_DS1 5 /* Direct Sequence 1Mbps */ |
| 176 | #define IFM_IEEE80211_DS2 6 /* Direct Sequence 2Mbps */ |
| 177 | #define IFM_IEEE80211_DS5 7 /* Direct Sequence 5.5Mbps */ |
| 178 | #define IFM_IEEE80211_DS11 8 /* Direct Sequence 11Mbps */ |
| 179 | #define IFM_IEEE80211_DS22 9 /* Direct Sequence 22Mbps */ |
| 180 | #define IFM_IEEE80211_OFDM6 10 /* OFDM 6Mbps */ |
| 181 | #define IFM_IEEE80211_OFDM9 11 /* OFDM 9Mbps */ |
| 182 | #define IFM_IEEE80211_OFDM12 12 /* OFDM 12Mbps */ |
| 183 | #define IFM_IEEE80211_OFDM18 13 /* OFDM 18Mbps */ |
| 184 | #define IFM_IEEE80211_OFDM24 14 /* OFDM 24Mbps */ |
| 185 | #define IFM_IEEE80211_OFDM36 15 /* OFDM 36Mbps */ |
| 186 | #define IFM_IEEE80211_OFDM48 16 /* OFDM 48Mbps */ |
| 187 | #define IFM_IEEE80211_OFDM54 17 /* OFDM 54Mbps */ |
| 188 | #define IFM_IEEE80211_OFDM72 18 /* OFDM 72Mbps */ |
| 189 | #define IFM_IEEE80211_DS354k 19 /* Direct Sequence 354Kbps */ |
| 190 | #define IFM_IEEE80211_DS512k 20 /* Direct Sequence 512Kbps */ |
| 191 | #define IFM_IEEE80211_OFDM3 21 /* OFDM 3Mbps */ |
| 192 | #define IFM_IEEE80211_OFDM4 22 /* OFDM 4.5Mbps */ |
| 193 | #define IFM_IEEE80211_OFDM27 23 /* OFDM 27Mbps */ |
| 194 | /* NB: not enough bits to express MCS fully */ |
| 195 | #define IFM_IEEE80211_MCS 24 /* HT MCS rate */ |
| 196 | |
| 197 | #define IFM_IEEE80211_ADHOC 0x00000100 /* Operate in Adhoc mode */ |
| 198 | #define IFM_IEEE80211_HOSTAP 0x00000200 /* Operate in Host AP mode */ |
| 199 | #define IFM_IEEE80211_IBSS 0x00000400 /* Operate in IBSS mode */ |
| 200 | #define IFM_IEEE80211_WDS 0x00000800 /* Operate in WDS mode */ |
| 201 | #define IFM_IEEE80211_TURBO 0x00001000 /* Operate in turbo mode */ |
| 202 | #define IFM_IEEE80211_MONITOR 0x00002000 /* Operate in monitor mode */ |
| 203 | #define IFM_IEEE80211_MBSS 0x00004000 /* Operate in MBSS mode */ |
| 204 | |
| 205 | /* operating mode for multi-mode devices */ |
| 206 | #define IFM_IEEE80211_11A 0x00010000 /* 5Ghz, OFDM mode */ |
| 207 | #define IFM_IEEE80211_11B 0x00020000 /* Direct Sequence mode */ |
| 208 | #define IFM_IEEE80211_11G 0x00030000 /* 2Ghz, CCK mode */ |
| 209 | #define IFM_IEEE80211_FH 0x00040000 /* 2Ghz, GFSK mode */ |
| 210 | #define IFM_IEEE80211_11NA 0x00050000 /* 5Ghz, HT mode */ |
| 211 | #define IFM_IEEE80211_11NG 0x00060000 /* 2Ghz, HT mode */ |
| 212 | |
| 213 | |
| 214 | /* |
| 215 | * ATM |
| 216 | */ |
| 217 | #define IFM_ATM 0x000000a0 |
| 218 | #define IFM_ATM_UNKNOWN 3 |
| 219 | #define IFM_ATM_UTP_25 4 |
| 220 | #define IFM_ATM_TAXI_100 5 |
| 221 | #define IFM_ATM_TAXI_140 6 |
| 222 | #define IFM_ATM_MM_155 7 |
| 223 | #define IFM_ATM_SM_155 8 |
| 224 | #define IFM_ATM_UTP_155 9 |
| 225 | #define IFM_ATM_MM_622 10 |
| 226 | #define IFM_ATM_SM_622 11 |
| 227 | #define IFM_ATM_VIRTUAL 12 |
| 228 | #define IFM_ATM_SDH 0x00000100 /* SDH instead of SONET */ |
| 229 | #define IFM_ATM_NOSCRAMB 0x00000200 /* no scrambling */ |
| 230 | #define IFM_ATM_UNASSIGNED 0x00000400 /* unassigned cells */ |
| 231 | |
| 232 | /* |
| 233 | * CARP Common Address Redundancy Protocol |
| 234 | */ |
| 235 | #define IFM_CARP 0x000000c0 |
| 236 | |
| 237 | /* |
| 238 | * Shared media sub-types |
| 239 | */ |
| 240 | #define IFM_AUTO 0 /* Autoselect best media */ |
| 241 | #define IFM_MANUAL 1 /* Jumper/dipswitch selects media */ |
| 242 | #define IFM_NONE 2 /* Deselect all media */ |
| 243 | |
| 244 | /* |
| 245 | * Shared options |
| 246 | */ |
| 247 | #define IFM_FDX 0x00100000 /* Force full duplex */ |
| 248 | #define IFM_HDX 0x00200000 /* Force half duplex */ |
| 249 | #define IFM_FLOW 0x00400000 /* enable hardware flow control */ |
| 250 | #define IFM_FLAG0 0x01000000 /* Driver defined flag */ |
| 251 | #define IFM_FLAG1 0x02000000 /* Driver defined flag */ |
| 252 | #define IFM_FLAG2 0x04000000 /* Driver defined flag */ |
| 253 | #define IFM_LOOP 0x08000000 /* Put hardware in loopback */ |
| 254 | |
| 255 | /* |
| 256 | * Masks |
| 257 | */ |
| 258 | #define IFM_NMASK 0x000000e0 /* Network type */ |
| 259 | #define IFM_TMASK 0x0000001f /* Media sub-type */ |
| 260 | #define IFM_IMASK 0xf0000000 /* Instance */ |
| 261 | #define IFM_ISHIFT 28 /* Instance shift */ |
| 262 | #define IFM_OMASK 0x0000ff00 /* Type specific options */ |
| 263 | #define IFM_MMASK 0x00070000 /* Mode */ |
| 264 | #define IFM_MSHIFT 16 /* Mode shift */ |
| 265 | #define IFM_GMASK 0x0ff00000 /* Global options */ |
| 266 | /* Ethernet flow control mask */ |
| 267 | #define IFM_ETH_FMASK (IFM_FLOW | IFM_ETH_RXPAUSE | IFM_ETH_TXPAUSE) |
| 268 | |
| 269 | #define IFM_NMIN IFM_ETHER /* lowest Network type */ |
| 270 | #define IFM_NMAX IFM_NMASK /* highest Network type */ |
| 271 | |
| 272 | /* |
| 273 | * Status bits |
| 274 | */ |
| 275 | #define IFM_AVALID 0x00000001 /* Active bit valid */ |
| 276 | #define IFM_ACTIVE 0x00000002 /* Interface attached to working net */ |
| 277 | |
| 278 | /* |
| 279 | * Macros to extract various bits of information from the media word. |
| 280 | */ |
| 281 | #define IFM_TYPE(x) ((x) & IFM_NMASK) |
| 282 | #define IFM_SUBTYPE(x) ((x) & IFM_TMASK) |
| 283 | #define IFM_TYPE_OPTIONS(x) ((x) & IFM_OMASK) |
| 284 | #define IFM_INST(x) (((x) & IFM_IMASK) >> IFM_ISHIFT) |
| 285 | #define IFM_OPTIONS(x) ((x) & (IFM_OMASK|IFM_GMASK)) |
| 286 | #define IFM_MODE(x) ((x) & IFM_MMASK) |
| 287 | |
| 288 | #define IFM_INST_MAX IFM_INST(IFM_IMASK) |
| 289 | |
| 290 | /* |
| 291 | * Macro to create a media word. |
| 292 | */ |
| 293 | #define IFM_MAKEWORD(type, subtype, options, instance) \ |
| 294 | ((type) | (subtype) | (options) | ((instance) << IFM_ISHIFT)) |
| 295 | #define IFM_MAKEMODE(mode) \ |
| 296 | (((mode) << IFM_MSHIFT) & IFM_MMASK) |
| 297 | |
| 298 | /* |
| 299 | * NetBSD extension not defined in the BSDI API. This is used in various |
| 300 | * places to get the canonical description for a given type/subtype. |
| 301 | * |
| 302 | * NOTE: all but the top-level type descriptions must contain NO whitespace! |
| 303 | * Otherwise, parsing these in ifconfig(8) would be a nightmare. |
| 304 | */ |
| 305 | struct ifmedia_description { |
| 306 | int ifmt_word; /* word value; may be masked */ |
| 307 | const char *ifmt_string; /* description */ |
| 308 | }; |
| 309 | |
| 310 | #define IFM_TYPE_DESCRIPTIONS { \ |
| 311 | { IFM_ETHER, "Ethernet" }, \ |
| 312 | { IFM_IEEE80211, "IEEE 802.11 Wireless Ethernet" }, \ |
| 313 | { IFM_CARP, "Common Address Redundancy Protocol" }, \ |
| 314 | { 0, NULL }, \ |
| 315 | } |
| 316 | |
| 317 | #define IFM_SUBTYPE_ETHERNET_DESCRIPTIONS { \ |
| 318 | { IFM_10_T, "10baseT/UTP" }, \ |
| 319 | { IFM_10_2, "10base2/BNC" }, \ |
| 320 | { IFM_10_5, "10base5/AUI" }, \ |
| 321 | { IFM_100_TX, "100baseTX" }, \ |
| 322 | { IFM_100_FX, "100baseFX" }, \ |
| 323 | { IFM_100_T4, "100baseT4" }, \ |
| 324 | { IFM_100_VG, "100baseVG" }, \ |
| 325 | { IFM_100_T2, "100baseT2" }, \ |
| 326 | { IFM_1000_FX, "1000baseFX" }, \ |
| 327 | { IFM_10_STP, "10baseSTP" }, \ |
| 328 | { IFM_10_FL, "10baseFL" }, \ |
| 329 | { IFM_1000_SX, "1000baseSX" }, \ |
| 330 | { IFM_1000_LX, "1000baseLX" }, \ |
| 331 | { IFM_1000_CX, "1000baseCX" }, \ |
| 332 | { IFM_1000_T, "1000baseT" }, \ |
| 333 | { IFM_HPNA_1, "homePNA" }, \ |
| 334 | { IFM_10G_LR, "10Gbase-LR" }, \ |
| 335 | { IFM_10G_SR, "10Gbase-SR" }, \ |
| 336 | { IFM_10G_CX4, "10Gbase-CX4" }, \ |
| 337 | { IFM_2500_SX, "2500BaseSX" }, \ |
| 338 | { IFM_10G_LRM, "10Gbase-LRM" }, \ |
| 339 | { IFM_10G_TWINAX, "10Gbase-Twinax" }, \ |
| 340 | { IFM_10G_TWINAX_LONG, "10Gbase-Twinax-Long" }, \ |
| 341 | { IFM_UNKNOWN, "Unknown" }, \ |
| 342 | { IFM_10G_T, "10Gbase-T" }, \ |
| 343 | { 0, NULL }, \ |
| 344 | } |
| 345 | |
| 346 | #define IFM_SUBTYPE_ETHERNET_ALIASES { \ |
| 347 | { IFM_10_T, "UTP" }, \ |
| 348 | { IFM_10_T, "10UTP" }, \ |
| 349 | { IFM_10_2, "BNC" }, \ |
| 350 | { IFM_10_2, "10BNC" }, \ |
| 351 | { IFM_10_5, "AUI" }, \ |
| 352 | { IFM_10_5, "10AUI" }, \ |
| 353 | { IFM_100_TX, "100TX" }, \ |
| 354 | { IFM_100_FX, "100FX" }, \ |
| 355 | { IFM_100_T4, "100T4" }, \ |
| 356 | { IFM_100_VG, "100VG" }, \ |
| 357 | { IFM_100_T2, "100T2" }, \ |
| 358 | { IFM_1000_FX, "1000FX" }, \ |
| 359 | { IFM_10_STP, "10STP" }, \ |
| 360 | { IFM_10_FL, "10FL" }, \ |
| 361 | { IFM_1000_SX, "1000SX" }, \ |
| 362 | { IFM_1000_LX, "1000LX" }, \ |
| 363 | { IFM_1000_CX, "1000CX" }, \ |
| 364 | { IFM_1000_T, "1000T" }, \ |
| 365 | { IFM_2500_SX, "2500SX" }, \ |
| 366 | { 0, NULL }, \ |
| 367 | } |
| 368 | |
| 369 | #define IFM_SUBTYPE_ETHERNET_OPTION_DESCRIPTIONS { \ |
| 370 | { 0, NULL }, \ |
| 371 | } |
| 372 | |
| 373 | #define IFM_SUBTYPE_IEEE80211_DESCRIPTIONS { \ |
| 374 | { IFM_IEEE80211_FH1, "FH/1Mbps" }, \ |
| 375 | { IFM_IEEE80211_FH2, "FH/2Mbps" }, \ |
| 376 | { IFM_IEEE80211_DS1, "DS/1Mbps" }, \ |
| 377 | { IFM_IEEE80211_DS2, "DS/2Mbps" }, \ |
| 378 | { IFM_IEEE80211_DS5, "DS/5.5Mbps" }, \ |
| 379 | { IFM_IEEE80211_DS11, "DS/11Mbps" }, \ |
| 380 | { IFM_IEEE80211_DS22, "DS/22Mbps" }, \ |
| 381 | { IFM_IEEE80211_OFDM6, "OFDM/6Mbps" }, \ |
| 382 | { IFM_IEEE80211_OFDM9, "OFDM/9Mbps" }, \ |
| 383 | { IFM_IEEE80211_OFDM12, "OFDM/12Mbps" }, \ |
| 384 | { IFM_IEEE80211_OFDM18, "OFDM/18Mbps" }, \ |
| 385 | { IFM_IEEE80211_OFDM24, "OFDM/24Mbps" }, \ |
| 386 | { IFM_IEEE80211_OFDM36, "OFDM/36Mbps" }, \ |
| 387 | { IFM_IEEE80211_OFDM48, "OFDM/48Mbps" }, \ |
| 388 | { IFM_IEEE80211_OFDM54, "OFDM/54Mbps" }, \ |
| 389 | { IFM_IEEE80211_OFDM72, "OFDM/72Mbps" }, \ |
| 390 | { IFM_IEEE80211_DS354k, "DS/354Kbps" }, \ |
| 391 | { IFM_IEEE80211_DS512k, "DS/512Kbps" }, \ |
| 392 | { IFM_IEEE80211_OFDM3, "OFDM/3Mbps" }, \ |
| 393 | { IFM_IEEE80211_OFDM4, "OFDM/4.5Mbps" }, \ |
| 394 | { IFM_IEEE80211_OFDM27, "OFDM/27Mbps" }, \ |
| 395 | { 0, NULL }, \ |
| 396 | } |
| 397 | |
| 398 | #define IFM_SUBTYPE_IEEE80211_ALIASES { \ |
| 399 | { IFM_IEEE80211_FH1, "FH1" }, \ |
| 400 | { IFM_IEEE80211_FH2, "FH2" }, \ |
| 401 | { IFM_IEEE80211_FH1, "FrequencyHopping/1Mbps" }, \ |
| 402 | { IFM_IEEE80211_FH2, "FrequencyHopping/2Mbps" }, \ |
| 403 | { IFM_IEEE80211_DS1, "DS1" }, \ |
| 404 | { IFM_IEEE80211_DS2, "DS2" }, \ |
| 405 | { IFM_IEEE80211_DS5, "DS5.5" }, \ |
| 406 | { IFM_IEEE80211_DS11, "DS11" }, \ |
| 407 | { IFM_IEEE80211_DS22, "DS22" }, \ |
| 408 | { IFM_IEEE80211_DS1, "DirectSequence/1Mbps" }, \ |
| 409 | { IFM_IEEE80211_DS2, "DirectSequence/2Mbps" }, \ |
| 410 | { IFM_IEEE80211_DS5, "DirectSequence/5.5Mbps" }, \ |
| 411 | { IFM_IEEE80211_DS11, "DirectSequence/11Mbps" }, \ |
| 412 | { IFM_IEEE80211_DS22, "DirectSequence/22Mbps" }, \ |
| 413 | { IFM_IEEE80211_OFDM6, "OFDM6" }, \ |
| 414 | { IFM_IEEE80211_OFDM9, "OFDM9" }, \ |
| 415 | { IFM_IEEE80211_OFDM12, "OFDM12" }, \ |
| 416 | { IFM_IEEE80211_OFDM18, "OFDM18" }, \ |
| 417 | { IFM_IEEE80211_OFDM24, "OFDM24" }, \ |
| 418 | { IFM_IEEE80211_OFDM36, "OFDM36" }, \ |
| 419 | { IFM_IEEE80211_OFDM48, "OFDM48" }, \ |
| 420 | { IFM_IEEE80211_OFDM54, "OFDM54" }, \ |
| 421 | { IFM_IEEE80211_OFDM72, "OFDM72" }, \ |
| 422 | { IFM_IEEE80211_DS1, "CCK1" }, \ |
| 423 | { IFM_IEEE80211_DS2, "CCK2" }, \ |
| 424 | { IFM_IEEE80211_DS5, "CCK5.5" }, \ |
| 425 | { IFM_IEEE80211_DS11, "CCK11" }, \ |
| 426 | { IFM_IEEE80211_DS354k, "DS354K" }, \ |
| 427 | { IFM_IEEE80211_DS354k, "DirectSequence/354Kbps" }, \ |
| 428 | { IFM_IEEE80211_DS512k, "DS512K" }, \ |
| 429 | { IFM_IEEE80211_DS512k, "DirectSequence/512Kbps" }, \ |
| 430 | { IFM_IEEE80211_OFDM3, "OFDM3" }, \ |
| 431 | { IFM_IEEE80211_OFDM4, "OFDM4.5" }, \ |
| 432 | { IFM_IEEE80211_OFDM27, "OFDM27" }, \ |
| 433 | { 0, NULL }, \ |
| 434 | } |
| 435 | |
| 436 | #define IFM_SUBTYPE_IEEE80211_OPTION_DESCRIPTIONS { \ |
| 437 | { IFM_IEEE80211_ADHOC, "adhoc" }, \ |
| 438 | { IFM_IEEE80211_HOSTAP, "hostap" }, \ |
| 439 | { IFM_IEEE80211_IBSS, "ibss" }, \ |
| 440 | { IFM_IEEE80211_WDS, "wds" }, \ |
| 441 | { IFM_IEEE80211_TURBO, "turbo" }, \ |
| 442 | { IFM_IEEE80211_MONITOR, "monitor" }, \ |
| 443 | { IFM_IEEE80211_MBSS, "mesh" }, \ |
| 444 | { 0, NULL }, \ |
| 445 | } |
| 446 | |
| 447 | #define IFM_SUBTYPE_IEEE80211_MODE_DESCRIPTIONS { \ |
| 448 | { IFM_AUTO, "autoselect" }, \ |
| 449 | { IFM_IEEE80211_11A, "11a" }, \ |
| 450 | { IFM_IEEE80211_11B, "11b" }, \ |
| 451 | { IFM_IEEE80211_11G, "11g" }, \ |
| 452 | { IFM_IEEE80211_FH, "fh" }, \ |
| 453 | { IFM_IEEE80211_11NA, "11na" }, \ |
| 454 | { IFM_IEEE80211_11NG, "11ng" }, \ |
| 455 | { 0, NULL }, \ |
| 456 | } |
| 457 | |
| 458 | #define IFM_SUBTYPE_IEEE80211_MODE_ALIASES { \ |
| 459 | { IFM_AUTO, "auto" }, \ |
| 460 | { 0, NULL }, \ |
| 461 | } |
| 462 | |
| 463 | # define IFM_SUBTYPE_ATM_DESCRIPTIONS { \ |
| 464 | { IFM_ATM_UNKNOWN, "Unknown" }, \ |
| 465 | { IFM_ATM_UTP_25, "UTP/25.6MBit" }, \ |
| 466 | { IFM_ATM_TAXI_100, "Taxi/100MBit" }, \ |
| 467 | { IFM_ATM_TAXI_140, "Taxi/140MBit" }, \ |
| 468 | { IFM_ATM_MM_155, "Multi-mode/155MBit" }, \ |
| 469 | { IFM_ATM_SM_155, "Single-mode/155MBit" }, \ |
| 470 | { IFM_ATM_UTP_155, "UTP/155MBit" }, \ |
| 471 | { IFM_ATM_MM_622, "Multi-mode/622MBit" }, \ |
| 472 | { IFM_ATM_SM_622, "Single-mode/622MBit" }, \ |
| 473 | { IFM_ATM_VIRTUAL, "Virtual" }, \ |
| 474 | { 0, NULL }, \ |
| 475 | } |
| 476 | |
| 477 | # define IFM_SUBTYPE_ATM_ALIASES { \ |
| 478 | { IFM_ATM_UNKNOWN, "UNKNOWN" }, \ |
| 479 | { IFM_ATM_UTP_25, "UTP-25" }, \ |
| 480 | { IFM_ATM_TAXI_100, "TAXI-100" }, \ |
| 481 | { IFM_ATM_TAXI_140, "TAXI-140" }, \ |
| 482 | { IFM_ATM_MM_155, "MM-155" }, \ |
| 483 | { IFM_ATM_SM_155, "SM-155" }, \ |
| 484 | { IFM_ATM_UTP_155, "UTP-155" }, \ |
| 485 | { IFM_ATM_MM_622, "MM-622" }, \ |
| 486 | { IFM_ATM_SM_622, "SM-622" }, \ |
| 487 | { IFM_ATM_VIRTUAL, "VIRTUAL" }, \ |
| 488 | { 0, NULL }, \ |
| 489 | } |
| 490 | |
| 491 | #define IFM_SUBTYPE_ATM_OPTION_DESCRIPTIONS { \ |
| 492 | { IFM_ATM_SDH, "SDH" }, \ |
| 493 | { IFM_ATM_NOSCRAMB, "Noscramb" }, \ |
| 494 | { IFM_ATM_UNASSIGNED, "Unassigned" }, \ |
| 495 | { 0, NULL }, \ |
| 496 | } |
| 497 | |
| 498 | |
| 499 | #define IFM_SUBTYPE_SHARED_DESCRIPTIONS { \ |
| 500 | { IFM_AUTO, "autoselect" }, \ |
| 501 | { IFM_MANUAL, "manual" }, \ |
| 502 | { IFM_NONE, "none" }, \ |
| 503 | { 0, NULL }, \ |
| 504 | } |
| 505 | |
| 506 | #define IFM_SUBTYPE_SHARED_ALIASES { \ |
| 507 | { IFM_AUTO, "auto" }, \ |
| 508 | { 0, NULL }, \ |
| 509 | } |
| 510 | |
| 511 | #define IFM_SHARED_OPTION_DESCRIPTIONS { \ |
| 512 | { IFM_FDX, "full-duplex" }, \ |
| 513 | { IFM_HDX, "half-duplex" }, \ |
| 514 | { IFM_FLAG0, "flag0" }, \ |
| 515 | { IFM_FLAG1, "flag1" }, \ |
| 516 | { IFM_FLAG2, "flag2" }, \ |
| 517 | { IFM_LOOP, "hw-loopback" }, \ |
| 518 | { 0, NULL }, \ |
| 519 | } |
| 520 | |
| 521 | /* |
| 522 | * Baudrate descriptions for the various media types. |
| 523 | */ |
| 524 | struct ifmedia_baudrate { |
| 525 | int ifmb_word; /* media word */ |
| 526 | uint64_t ifmb_baudrate; /* corresponding baudrate */ |
| 527 | }; |
| 528 | |
| 529 | #define IFM_BAUDRATE_DESCRIPTIONS { \ |
| 530 | { IFM_ETHER|IFM_10_T, IF_Mbps(10) }, \ |
| 531 | { IFM_ETHER|IFM_10_2, IF_Mbps(10) }, \ |
| 532 | { IFM_ETHER|IFM_10_5, IF_Mbps(10) }, \ |
| 533 | { IFM_ETHER|IFM_100_TX, IF_Mbps(100) }, \ |
| 534 | { IFM_ETHER|IFM_100_FX, IF_Mbps(100) }, \ |
| 535 | { IFM_ETHER|IFM_100_T4, IF_Mbps(100) }, \ |
| 536 | { IFM_ETHER|IFM_100_VG, IF_Mbps(100) }, \ |
| 537 | { IFM_ETHER|IFM_100_T2, IF_Mbps(100) }, \ |
| 538 | { IFM_ETHER|IFM_1000_SX, IF_Mbps(1000) }, \ |
| 539 | { IFM_ETHER|IFM_10_STP, IF_Mbps(10) }, \ |
| 540 | { IFM_ETHER|IFM_10_FL, IF_Mbps(10) }, \ |
| 541 | { IFM_ETHER|IFM_1000_LX, IF_Mbps(1000) }, \ |
| 542 | { IFM_ETHER|IFM_1000_CX, IF_Mbps(1000) }, \ |
| 543 | { IFM_ETHER|IFM_1000_T, IF_Mbps(1000) }, \ |
| 544 | { IFM_ETHER|IFM_HPNA_1, IF_Mbps(1) }, \ |
| 545 | \ |
| 546 | { IFM_IEEE80211|IFM_IEEE80211_FH1, IF_Mbps(1) }, \ |
| 547 | { IFM_IEEE80211|IFM_IEEE80211_FH2, IF_Mbps(2) }, \ |
| 548 | { IFM_IEEE80211|IFM_IEEE80211_DS1, IF_Mbps(1) }, \ |
| 549 | { IFM_IEEE80211|IFM_IEEE80211_DS2, IF_Mbps(2) }, \ |
| 550 | { IFM_IEEE80211|IFM_IEEE80211_DS5, IF_Mbps(5) }, \ |
| 551 | { IFM_IEEE80211|IFM_IEEE80211_DS11, IF_Mbps(11) }, \ |
| 552 | { IFM_IEEE80211|IFM_IEEE80211_DS22, IF_Mbps(22) }, \ |
| 553 | { IFM_IEEE80211|IFM_IEEE80211_OFDM6, IF_Mbps(6) }, \ |
| 554 | { IFM_IEEE80211|IFM_IEEE80211_OFDM9, IF_Mbps(9) }, \ |
| 555 | { IFM_IEEE80211|IFM_IEEE80211_OFDM12, IF_Mbps(12) }, \ |
| 556 | { IFM_IEEE80211|IFM_IEEE80211_OFDM18, IF_Mbps(18) }, \ |
| 557 | { IFM_IEEE80211|IFM_IEEE80211_OFDM24, IF_Mbps(24) }, \ |
| 558 | { IFM_IEEE80211|IFM_IEEE80211_OFDM36, IF_Mbps(36) }, \ |
| 559 | { IFM_IEEE80211|IFM_IEEE80211_OFDM48, IF_Mbps(48) }, \ |
| 560 | { IFM_IEEE80211|IFM_IEEE80211_OFDM54, IF_Mbps(54) }, \ |
| 561 | { IFM_IEEE80211|IFM_IEEE80211_OFDM72, IF_Mbps(72) }, \ |
| 562 | \ |
| 563 | { 0, 0 }, \ |
| 564 | } |
| 565 | #endif /* _NET_IF_MEDIA_H_ */ |