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 int ifmedia_add_nodup(struct ifmedia *ifm, int mword, int data, void *aux); 106 107 /* Add an array (of ifmedia_entry) media to a struct ifmedia. */ 108 void ifmedia_list_add(struct ifmedia *mp, struct ifmedia_entry *lp, 109 int count); 110 111 /* Set default media type on initialization. */ 112 void ifmedia_set(struct ifmedia *ifm, int mword); 113 int ifmedia_tryset(struct ifmedia *ifm, int mword); 114 115 /* Common ioctl function for getting/setting media, called by driver. */ 116 int ifmedia_ioctl(struct ifnet *ifp, struct ifreq *ifr, 117 struct ifmedia *ifm, u_long cmd); 118 119 /* Compute baudrate for a given media. */ 120 uint64_t ifmedia_baudrate(int); 121 #endif /*_KERNEL */ 122 123 /* 124 * if_media Options word: 125 * Bits Use 126 * ---- ------- 127 * 0-4 Media variant MAX SUBTYPE == 31!! 128 * 5-7 Media type 129 * 8-15 Type specific options 130 * 16-18 Mode (for multi-mode devices) 131 * 19 RFU 132 * 20-27 Shared (global) options 133 * 28-31 Instance 134 */ 135 136 /* 137 * Ethernet 138 * 139 * Please update ieee8023ad_lacp.c:lacp_compose_key() and if_vke.c:vke_attach() 140 * after adding new ethernet media types. 141 */ 142 #define IFM_ETHER 0x00000020 143 #define IFM_10_T 3 /* 10BaseT - RJ45 */ 144 #define IFM_10_2 4 /* 10Base2 - Thinnet */ 145 #define IFM_10_5 5 /* 10Base5 - AUI */ 146 #define IFM_100_TX 6 /* 100BaseTX - RJ45 */ 147 #define IFM_100_FX 7 /* 100BaseFX - Fiber */ 148 #define IFM_100_T4 8 /* 100BaseT4 - 4 pair cat 3 */ 149 #define IFM_100_VG 9 /* 100VG-AnyLAN */ 150 #define IFM_100_T2 10 /* 100BaseT2 */ 151 #define IFM_1000_SX 11 /* 1000BaseSX Multi-mode Fiber */ 152 #define IFM_10_STP 12 /* 10BaseT over shielded TP */ 153 #define IFM_10_FL 13 /* 10baseFL - Fiber */ 154 #define IFM_1000_LX 14 /* 1000BaseLX Single-mode Fiber */ 155 #define IFM_1000_CX 15 /* 1000BaseCX 150ohm STP */ 156 #define IFM_1000_T 16 /* 1000BaseT 4 pair cat 5 */ 157 #define IFM_HPNA_1 17 /* HomePNA media for ethernet frames */ 158 #define IFM_10G_LR 18 /* 10GBase-LR 1310nm Single-mode */ 159 #define IFM_10G_SR 19 /* 10GBase-SR 850nm Multi-mode */ 160 #define IFM_10G_CX4 20 /* 10GBase CX4 copper */ 161 #define IFM_2500_SX 21 /* 2500BaseSX - multi-mode fiber */ 162 #define IFM_10G_TWINAX 22 /* 10GBase Twinax copper */ 163 #define IFM_10G_TWINAX_LONG 23 /* 10GBase Twinax Long copper */ 164 #define IFM_10G_LRM 24 /* 10GBase-LRM 850nm Multi-mode */ 165 #define IFM_UNKNOWN 25 /* media types not defined yet */ 166 #define IFM_10G_T 26 /* 10GBase-T - RJ45 */ 167 #define IFM_40G_CR4 27 /* 40GBase-CR4 */ 168 #define IFM_40G_SR4 28 /* 40GBase-SR4 */ 169 #define IFM_40G_LR4 29 /* 40GBase-LR4 */ 170 171 #define IFM_ETH_MASTER 0x00000100 /* master mode (1000baseT) */ 172 #define IFM_ETH_RXPAUSE 0x00000200 /* receive PAUSE frames */ 173 #define IFM_ETH_TXPAUSE 0x00000400 /* transmit PAUSE frames */ 174 #define IFM_ETH_FORCEPAUSE 0x00000800 /* force flow control settings */ 175 176 /* 177 * IEEE 802.11 Wireless 178 */ 179 #define IFM_IEEE80211 0x00000080 180 /* NB: 0,1,2 are auto, manual, none defined below */ 181 #define IFM_IEEE80211_FH1 3 /* Frequency Hopping 1Mbps */ 182 #define IFM_IEEE80211_FH2 4 /* Frequency Hopping 2Mbps */ 183 #define IFM_IEEE80211_DS1 5 /* Direct Sequence 1Mbps */ 184 #define IFM_IEEE80211_DS2 6 /* Direct Sequence 2Mbps */ 185 #define IFM_IEEE80211_DS5 7 /* Direct Sequence 5.5Mbps */ 186 #define IFM_IEEE80211_DS11 8 /* Direct Sequence 11Mbps */ 187 #define IFM_IEEE80211_DS22 9 /* Direct Sequence 22Mbps */ 188 #define IFM_IEEE80211_OFDM6 10 /* OFDM 6Mbps */ 189 #define IFM_IEEE80211_OFDM9 11 /* OFDM 9Mbps */ 190 #define IFM_IEEE80211_OFDM12 12 /* OFDM 12Mbps */ 191 #define IFM_IEEE80211_OFDM18 13 /* OFDM 18Mbps */ 192 #define IFM_IEEE80211_OFDM24 14 /* OFDM 24Mbps */ 193 #define IFM_IEEE80211_OFDM36 15 /* OFDM 36Mbps */ 194 #define IFM_IEEE80211_OFDM48 16 /* OFDM 48Mbps */ 195 #define IFM_IEEE80211_OFDM54 17 /* OFDM 54Mbps */ 196 #define IFM_IEEE80211_OFDM72 18 /* OFDM 72Mbps */ 197 #define IFM_IEEE80211_DS354k 19 /* Direct Sequence 354Kbps */ 198 #define IFM_IEEE80211_DS512k 20 /* Direct Sequence 512Kbps */ 199 #define IFM_IEEE80211_OFDM3 21 /* OFDM 3Mbps */ 200 #define IFM_IEEE80211_OFDM4 22 /* OFDM 4.5Mbps */ 201 #define IFM_IEEE80211_OFDM27 23 /* OFDM 27Mbps */ 202 /* NB: not enough bits to express MCS fully */ 203 #define IFM_IEEE80211_MCS 24 /* HT MCS rate */ 204 205 #define IFM_IEEE80211_ADHOC 0x00000100 /* Operate in Adhoc mode */ 206 #define IFM_IEEE80211_HOSTAP 0x00000200 /* Operate in Host AP mode */ 207 #define IFM_IEEE80211_IBSS 0x00000400 /* Operate in IBSS mode */ 208 #define IFM_IEEE80211_WDS 0x00000800 /* Operate in WDS mode */ 209 #define IFM_IEEE80211_TURBO 0x00001000 /* Operate in turbo mode */ 210 #define IFM_IEEE80211_MONITOR 0x00002000 /* Operate in monitor mode */ 211 #define IFM_IEEE80211_MBSS 0x00004000 /* Operate in MBSS mode */ 212 213 /* operating mode for multi-mode devices */ 214 #define IFM_IEEE80211_11A 0x00010000 /* 5Ghz, OFDM mode */ 215 #define IFM_IEEE80211_11B 0x00020000 /* Direct Sequence mode */ 216 #define IFM_IEEE80211_11G 0x00030000 /* 2Ghz, CCK mode */ 217 #define IFM_IEEE80211_FH 0x00040000 /* 2Ghz, GFSK mode */ 218 #define IFM_IEEE80211_11NA 0x00050000 /* 5Ghz, HT mode */ 219 #define IFM_IEEE80211_11NG 0x00060000 /* 2Ghz, HT mode */ 220 221 222 /* 223 * ATM 224 */ 225 #define IFM_ATM 0x000000a0 226 #define IFM_ATM_UNKNOWN 3 227 #define IFM_ATM_UTP_25 4 228 #define IFM_ATM_TAXI_100 5 229 #define IFM_ATM_TAXI_140 6 230 #define IFM_ATM_MM_155 7 231 #define IFM_ATM_SM_155 8 232 #define IFM_ATM_UTP_155 9 233 #define IFM_ATM_MM_622 10 234 #define IFM_ATM_SM_622 11 235 #define IFM_ATM_VIRTUAL 12 236 #define IFM_ATM_SDH 0x00000100 /* SDH instead of SONET */ 237 #define IFM_ATM_NOSCRAMB 0x00000200 /* no scrambling */ 238 #define IFM_ATM_UNASSIGNED 0x00000400 /* unassigned cells */ 239 240 /* 241 * CARP Common Address Redundancy Protocol 242 */ 243 #define IFM_CARP 0x000000c0 244 245 /* 246 * Shared media sub-types 247 */ 248 #define IFM_AUTO 0 /* Autoselect best media */ 249 #define IFM_MANUAL 1 /* Jumper/dipswitch selects media */ 250 #define IFM_NONE 2 /* Deselect all media */ 251 252 /* 253 * Shared options 254 */ 255 #define IFM_FDX 0x00100000 /* Force full duplex */ 256 #define IFM_HDX 0x00200000 /* Force half duplex */ 257 #define IFM_FLOW 0x00400000 /* enable hardware flow control */ 258 #define IFM_FLAG0 0x01000000 /* Driver defined flag */ 259 #define IFM_FLAG1 0x02000000 /* Driver defined flag */ 260 #define IFM_FLAG2 0x04000000 /* Driver defined flag */ 261 #define IFM_LOOP 0x08000000 /* Put hardware in loopback */ 262 263 /* 264 * Masks 265 */ 266 #define IFM_NMASK 0x000000e0 /* Network type */ 267 #define IFM_TMASK 0x0000001f /* Media sub-type */ 268 #define IFM_IMASK 0xf0000000 /* Instance */ 269 #define IFM_ISHIFT 28 /* Instance shift */ 270 #define IFM_OMASK 0x0000ff00 /* Type specific options */ 271 #define IFM_MMASK 0x00070000 /* Mode */ 272 #define IFM_MSHIFT 16 /* Mode shift */ 273 #define IFM_GMASK 0x0ff00000 /* Global options */ 274 /* Ethernet flow control mask */ 275 #define IFM_ETH_FCMASK (IFM_ETH_RXPAUSE | IFM_ETH_TXPAUSE | IFM_ETH_FORCEPAUSE) 276 #define IFM_ETH_FMASK (IFM_FLOW | IFM_ETH_FCMASK) 277 278 #define IFM_NMIN IFM_ETHER /* lowest Network type */ 279 #define IFM_NMAX IFM_NMASK /* highest Network type */ 280 281 /* 282 * Status bits 283 */ 284 #define IFM_AVALID 0x00000001 /* Active bit valid */ 285 #define IFM_ACTIVE 0x00000002 /* Interface attached to working net */ 286 287 /* 288 * Macros to extract various bits of information from the media word. 289 */ 290 #define IFM_TYPE(x) ((x) & IFM_NMASK) 291 #define IFM_SUBTYPE(x) ((x) & IFM_TMASK) 292 #define IFM_TYPE_OPTIONS(x) ((x) & IFM_OMASK) 293 #define IFM_INST(x) (((x) & IFM_IMASK) >> IFM_ISHIFT) 294 #define IFM_OPTIONS(x) ((x) & (IFM_OMASK|IFM_GMASK)) 295 #define IFM_MODE(x) ((x) & IFM_MMASK) 296 297 #define IFM_INST_MAX IFM_INST(IFM_IMASK) 298 299 /* 300 * Macro to create a media word. 301 */ 302 #define IFM_MAKEWORD(type, subtype, options, instance) \ 303 ((type) | (subtype) | (options) | ((instance) << IFM_ISHIFT)) 304 #define IFM_MAKEMODE(mode) \ 305 (((mode) << IFM_MSHIFT) & IFM_MMASK) 306 307 /* 308 * NetBSD extension not defined in the BSDI API. This is used in various 309 * places to get the canonical description for a given type/subtype. 310 * 311 * NOTE: all but the top-level type descriptions must contain NO whitespace! 312 * Otherwise, parsing these in ifconfig(8) would be a nightmare. 313 */ 314 struct ifmedia_description { 315 int ifmt_word; /* word value; may be masked */ 316 const char *ifmt_string; /* description */ 317 }; 318 319 #define IFM_TYPE_DESCRIPTIONS { \ 320 { IFM_ETHER, "Ethernet" }, \ 321 { IFM_IEEE80211, "IEEE 802.11 Wireless Ethernet" }, \ 322 { IFM_CARP, "Common Address Redundancy Protocol" }, \ 323 { 0, NULL }, \ 324 } 325 326 #define IFM_SUBTYPE_ETHERNET_DESCRIPTIONS { \ 327 { IFM_10_T, "10baseT/UTP" }, \ 328 { IFM_10_2, "10base2/BNC" }, \ 329 { IFM_10_5, "10base5/AUI" }, \ 330 { IFM_100_TX, "100baseTX" }, \ 331 { IFM_100_FX, "100baseFX" }, \ 332 { IFM_100_T4, "100baseT4" }, \ 333 { IFM_100_VG, "100baseVG" }, \ 334 { IFM_100_T2, "100baseT2" }, \ 335 { IFM_1000_SX, "1000baseSX" }, \ 336 { IFM_10_STP, "10baseSTP" }, \ 337 { IFM_10_FL, "10baseFL" }, \ 338 { IFM_1000_LX, "1000baseLX" }, \ 339 { IFM_1000_CX, "1000baseCX" }, \ 340 { IFM_1000_T, "1000baseT" }, \ 341 { IFM_HPNA_1, "homePNA" }, \ 342 { IFM_10G_LR, "10Gbase-LR" }, \ 343 { IFM_10G_SR, "10Gbase-SR" }, \ 344 { IFM_10G_CX4, "10Gbase-CX4" }, \ 345 { IFM_2500_SX, "2500BaseSX" }, \ 346 { IFM_10G_TWINAX, "10Gbase-Twinax" }, \ 347 { IFM_10G_TWINAX_LONG, "10Gbase-Twinax-Long" }, \ 348 { IFM_10G_LRM, "10Gbase-LRM" }, \ 349 { IFM_UNKNOWN, "Unknown" }, \ 350 { IFM_10G_T, "10Gbase-T" }, \ 351 { IFM_40G_CR4, "40Gbase-CR4" }, \ 352 { IFM_40G_SR4, "40Gbase-SR4" }, \ 353 { IFM_40G_LR4, "40Gbase-LR4" }, \ 354 { 0, NULL }, \ 355 } 356 357 #define IFM_SUBTYPE_ETHERNET_ALIASES { \ 358 { IFM_10_T, "UTP" }, \ 359 { IFM_10_T, "10UTP" }, \ 360 { IFM_10_2, "BNC" }, \ 361 { IFM_10_2, "10BNC" }, \ 362 { IFM_10_5, "AUI" }, \ 363 { IFM_10_5, "10AUI" }, \ 364 { IFM_100_TX, "100TX" }, \ 365 { IFM_100_FX, "100FX" }, \ 366 { IFM_100_T4, "100T4" }, \ 367 { IFM_100_VG, "100VG" }, \ 368 { IFM_100_T2, "100T2" }, \ 369 { IFM_10_STP, "10STP" }, \ 370 { IFM_10_FL, "10FL" }, \ 371 { IFM_1000_SX, "1000SX" }, \ 372 { IFM_1000_LX, "1000LX" }, \ 373 { IFM_1000_CX, "1000CX" }, \ 374 { IFM_1000_T, "1000T" }, \ 375 { IFM_2500_SX, "2500SX" }, \ 376 { 0, NULL }, \ 377 } 378 379 #define IFM_SUBTYPE_ETHERNET_OPTION_DESCRIPTIONS { \ 380 { IFM_ETH_MASTER, "master" }, \ 381 { IFM_ETH_RXPAUSE, "rxpause" }, \ 382 { IFM_ETH_TXPAUSE, "txpause" }, \ 383 { IFM_ETH_FORCEPAUSE, "forcepause" }, \ 384 { 0, NULL }, \ 385 } 386 387 #define IFM_SUBTYPE_ETHERNET_OPTION_ALIAS { \ 388 { IFM_ETH_TXPAUSE | IFM_ETH_RXPAUSE, "flowcontrol" }, \ 389 { 0, NULL }, \ 390 } 391 392 #define IFM_SUBTYPE_IEEE80211_DESCRIPTIONS { \ 393 { IFM_IEEE80211_FH1, "FH/1Mbps" }, \ 394 { IFM_IEEE80211_FH2, "FH/2Mbps" }, \ 395 { IFM_IEEE80211_DS1, "DS/1Mbps" }, \ 396 { IFM_IEEE80211_DS2, "DS/2Mbps" }, \ 397 { IFM_IEEE80211_DS5, "DS/5.5Mbps" }, \ 398 { IFM_IEEE80211_DS11, "DS/11Mbps" }, \ 399 { IFM_IEEE80211_DS22, "DS/22Mbps" }, \ 400 { IFM_IEEE80211_OFDM6, "OFDM/6Mbps" }, \ 401 { IFM_IEEE80211_OFDM9, "OFDM/9Mbps" }, \ 402 { IFM_IEEE80211_OFDM12, "OFDM/12Mbps" }, \ 403 { IFM_IEEE80211_OFDM18, "OFDM/18Mbps" }, \ 404 { IFM_IEEE80211_OFDM24, "OFDM/24Mbps" }, \ 405 { IFM_IEEE80211_OFDM36, "OFDM/36Mbps" }, \ 406 { IFM_IEEE80211_OFDM48, "OFDM/48Mbps" }, \ 407 { IFM_IEEE80211_OFDM54, "OFDM/54Mbps" }, \ 408 { IFM_IEEE80211_OFDM72, "OFDM/72Mbps" }, \ 409 { IFM_IEEE80211_DS354k, "DS/354Kbps" }, \ 410 { IFM_IEEE80211_DS512k, "DS/512Kbps" }, \ 411 { IFM_IEEE80211_OFDM3, "OFDM/3Mbps" }, \ 412 { IFM_IEEE80211_OFDM4, "OFDM/4.5Mbps" }, \ 413 { IFM_IEEE80211_OFDM27, "OFDM/27Mbps" }, \ 414 { IFM_IEEE80211_MCS, "MCS" }, \ 415 { 0, NULL }, \ 416 } 417 418 #define IFM_SUBTYPE_IEEE80211_ALIASES { \ 419 { IFM_IEEE80211_FH1, "FH1" }, \ 420 { IFM_IEEE80211_FH2, "FH2" }, \ 421 { IFM_IEEE80211_FH1, "FrequencyHopping/1Mbps" }, \ 422 { IFM_IEEE80211_FH2, "FrequencyHopping/2Mbps" }, \ 423 { IFM_IEEE80211_DS1, "DS1" }, \ 424 { IFM_IEEE80211_DS2, "DS2" }, \ 425 { IFM_IEEE80211_DS5, "DS5.5" }, \ 426 { IFM_IEEE80211_DS11, "DS11" }, \ 427 { IFM_IEEE80211_DS22, "DS22" }, \ 428 { IFM_IEEE80211_DS1, "DirectSequence/1Mbps" }, \ 429 { IFM_IEEE80211_DS2, "DirectSequence/2Mbps" }, \ 430 { IFM_IEEE80211_DS5, "DirectSequence/5.5Mbps" }, \ 431 { IFM_IEEE80211_DS11, "DirectSequence/11Mbps" }, \ 432 { IFM_IEEE80211_DS22, "DirectSequence/22Mbps" }, \ 433 { IFM_IEEE80211_OFDM6, "OFDM6" }, \ 434 { IFM_IEEE80211_OFDM9, "OFDM9" }, \ 435 { IFM_IEEE80211_OFDM12, "OFDM12" }, \ 436 { IFM_IEEE80211_OFDM18, "OFDM18" }, \ 437 { IFM_IEEE80211_OFDM24, "OFDM24" }, \ 438 { IFM_IEEE80211_OFDM36, "OFDM36" }, \ 439 { IFM_IEEE80211_OFDM48, "OFDM48" }, \ 440 { IFM_IEEE80211_OFDM54, "OFDM54" }, \ 441 { IFM_IEEE80211_OFDM72, "OFDM72" }, \ 442 { IFM_IEEE80211_DS1, "CCK1" }, \ 443 { IFM_IEEE80211_DS2, "CCK2" }, \ 444 { IFM_IEEE80211_DS5, "CCK5.5" }, \ 445 { IFM_IEEE80211_DS11, "CCK11" }, \ 446 { IFM_IEEE80211_DS354k, "DS354K" }, \ 447 { IFM_IEEE80211_DS354k, "DirectSequence/354Kbps" }, \ 448 { IFM_IEEE80211_DS512k, "DS512K" }, \ 449 { IFM_IEEE80211_DS512k, "DirectSequence/512Kbps" }, \ 450 { IFM_IEEE80211_OFDM3, "OFDM3" }, \ 451 { IFM_IEEE80211_OFDM4, "OFDM4.5" }, \ 452 { IFM_IEEE80211_OFDM27, "OFDM27" }, \ 453 { IFM_IEEE80211_MCS, "MCS" }, \ 454 { 0, NULL }, \ 455 } 456 457 #define IFM_SUBTYPE_IEEE80211_OPTION_DESCRIPTIONS { \ 458 { IFM_IEEE80211_ADHOC, "adhoc" }, \ 459 { IFM_IEEE80211_HOSTAP, "hostap" }, \ 460 { IFM_IEEE80211_IBSS, "ibss" }, \ 461 { IFM_IEEE80211_WDS, "wds" }, \ 462 { IFM_IEEE80211_TURBO, "turbo" }, \ 463 { IFM_IEEE80211_MONITOR, "monitor" }, \ 464 { IFM_IEEE80211_MBSS, "mesh" }, \ 465 { 0, NULL }, \ 466 } 467 468 #define IFM_SUBTYPE_IEEE80211_MODE_DESCRIPTIONS { \ 469 { IFM_AUTO, "autoselect" }, \ 470 { IFM_IEEE80211_11A, "11a" }, \ 471 { IFM_IEEE80211_11B, "11b" }, \ 472 { IFM_IEEE80211_11G, "11g" }, \ 473 { IFM_IEEE80211_FH, "fh" }, \ 474 { IFM_IEEE80211_11NA, "11na" }, \ 475 { IFM_IEEE80211_11NG, "11ng" }, \ 476 { 0, NULL }, \ 477 } 478 479 #define IFM_SUBTYPE_IEEE80211_MODE_ALIASES { \ 480 { IFM_AUTO, "auto" }, \ 481 { 0, NULL }, \ 482 } 483 484 # define IFM_SUBTYPE_ATM_DESCRIPTIONS { \ 485 { IFM_ATM_UNKNOWN, "Unknown" }, \ 486 { IFM_ATM_UTP_25, "UTP/25.6MBit" }, \ 487 { IFM_ATM_TAXI_100, "Taxi/100MBit" }, \ 488 { IFM_ATM_TAXI_140, "Taxi/140MBit" }, \ 489 { IFM_ATM_MM_155, "Multi-mode/155MBit" }, \ 490 { IFM_ATM_SM_155, "Single-mode/155MBit" }, \ 491 { IFM_ATM_UTP_155, "UTP/155MBit" }, \ 492 { IFM_ATM_MM_622, "Multi-mode/622MBit" }, \ 493 { IFM_ATM_SM_622, "Single-mode/622MBit" }, \ 494 { IFM_ATM_VIRTUAL, "Virtual" }, \ 495 { 0, NULL }, \ 496 } 497 498 # define IFM_SUBTYPE_ATM_ALIASES { \ 499 { IFM_ATM_UNKNOWN, "UNKNOWN" }, \ 500 { IFM_ATM_UTP_25, "UTP-25" }, \ 501 { IFM_ATM_TAXI_100, "TAXI-100" }, \ 502 { IFM_ATM_TAXI_140, "TAXI-140" }, \ 503 { IFM_ATM_MM_155, "MM-155" }, \ 504 { IFM_ATM_SM_155, "SM-155" }, \ 505 { IFM_ATM_UTP_155, "UTP-155" }, \ 506 { IFM_ATM_MM_622, "MM-622" }, \ 507 { IFM_ATM_SM_622, "SM-622" }, \ 508 { IFM_ATM_VIRTUAL, "VIRTUAL" }, \ 509 { 0, NULL }, \ 510 } 511 512 #define IFM_SUBTYPE_ATM_OPTION_DESCRIPTIONS { \ 513 { IFM_ATM_SDH, "SDH" }, \ 514 { IFM_ATM_NOSCRAMB, "Noscramb" }, \ 515 { IFM_ATM_UNASSIGNED, "Unassigned" }, \ 516 { 0, NULL }, \ 517 } 518 519 520 #define IFM_SUBTYPE_SHARED_DESCRIPTIONS { \ 521 { IFM_AUTO, "autoselect" }, \ 522 { IFM_MANUAL, "manual" }, \ 523 { IFM_NONE, "none" }, \ 524 { 0, NULL }, \ 525 } 526 527 #define IFM_SUBTYPE_SHARED_ALIASES { \ 528 { IFM_AUTO, "auto" }, \ 529 { 0, NULL }, \ 530 } 531 532 #define IFM_SHARED_OPTION_DESCRIPTIONS { \ 533 { IFM_FDX, "full-duplex" }, \ 534 { IFM_HDX, "half-duplex" }, \ 535 { IFM_FLAG0, "flag0" }, \ 536 { IFM_FLAG1, "flag1" }, \ 537 { IFM_FLAG2, "flag2" }, \ 538 { IFM_LOOP, "hw-loopback" }, \ 539 { 0, NULL }, \ 540 } 541 542 /* 543 * Baudrate descriptions for the various media types. 544 */ 545 struct ifmedia_baudrate { 546 int ifmb_word; /* media word */ 547 uint64_t ifmb_baudrate; /* corresponding baudrate */ 548 }; 549 550 #define IFM_BAUDRATE_DESCRIPTIONS { \ 551 { IFM_ETHER|IFM_10_T, IF_Mbps(10) }, \ 552 { IFM_ETHER|IFM_10_2, IF_Mbps(10) }, \ 553 { IFM_ETHER|IFM_10_5, IF_Mbps(10) }, \ 554 { IFM_ETHER|IFM_100_TX, IF_Mbps(100) }, \ 555 { IFM_ETHER|IFM_100_FX, IF_Mbps(100) }, \ 556 { IFM_ETHER|IFM_100_T4, IF_Mbps(100) }, \ 557 { IFM_ETHER|IFM_100_VG, IF_Mbps(100) }, \ 558 { IFM_ETHER|IFM_100_T2, IF_Mbps(100) }, \ 559 { IFM_ETHER|IFM_1000_SX, IF_Mbps(1000) }, \ 560 { IFM_ETHER|IFM_10_STP, IF_Mbps(10) }, \ 561 { IFM_ETHER|IFM_10_FL, IF_Mbps(10) }, \ 562 { IFM_ETHER|IFM_1000_LX, IF_Mbps(1000) }, \ 563 { IFM_ETHER|IFM_1000_CX, IF_Mbps(1000) }, \ 564 { IFM_ETHER|IFM_1000_T, IF_Mbps(1000) }, \ 565 { IFM_ETHER|IFM_HPNA_1, IF_Mbps(1) }, \ 566 { IFM_ETHER|IFM_10G_LR, IF_Gbps(10ULL) }, \ 567 { IFM_ETHER|IFM_10G_SR, IF_Gbps(10ULL) }, \ 568 { IFM_ETHER|IFM_10G_CX4, IF_Gbps(10ULL) }, \ 569 { IFM_ETHER|IFM_2500_SX, IF_Mbps(2500ULL) }, \ 570 { IFM_ETHER|IFM_10G_TWINAX, IF_Gbps(10ULL) }, \ 571 { IFM_ETHER|IFM_10G_TWINAX_LONG,IF_Gbps(10ULL) }, \ 572 { IFM_ETHER|IFM_10G_LRM, IF_Gbps(10ULL) }, \ 573 { IFM_ETHER|IFM_10G_T, IF_Gbps(10ULL) }, \ 574 { IFM_ETHER|IFM_40G_CR4, IF_Gbps(40ULL) }, \ 575 { IFM_ETHER|IFM_40G_SR4, IF_Gbps(40ULL) }, \ 576 { IFM_ETHER|IFM_40G_LR4, IF_Gbps(40ULL) }, \ 577 \ 578 { IFM_IEEE80211|IFM_IEEE80211_FH1, IF_Mbps(1) }, \ 579 { IFM_IEEE80211|IFM_IEEE80211_FH2, IF_Mbps(2) }, \ 580 { IFM_IEEE80211|IFM_IEEE80211_DS1, IF_Mbps(1) }, \ 581 { IFM_IEEE80211|IFM_IEEE80211_DS2, IF_Mbps(2) }, \ 582 { IFM_IEEE80211|IFM_IEEE80211_DS5, IF_Kbps(5500) }, \ 583 { IFM_IEEE80211|IFM_IEEE80211_DS11, IF_Mbps(11) }, \ 584 { IFM_IEEE80211|IFM_IEEE80211_DS22, IF_Mbps(22) }, \ 585 { IFM_IEEE80211|IFM_IEEE80211_OFDM6, IF_Mbps(6) }, \ 586 { IFM_IEEE80211|IFM_IEEE80211_OFDM9, IF_Mbps(9) }, \ 587 { IFM_IEEE80211|IFM_IEEE80211_OFDM12, IF_Mbps(12) }, \ 588 { IFM_IEEE80211|IFM_IEEE80211_OFDM18, IF_Mbps(18) }, \ 589 { IFM_IEEE80211|IFM_IEEE80211_OFDM24, IF_Mbps(24) }, \ 590 { IFM_IEEE80211|IFM_IEEE80211_OFDM36, IF_Mbps(36) }, \ 591 { IFM_IEEE80211|IFM_IEEE80211_OFDM48, IF_Mbps(48) }, \ 592 { IFM_IEEE80211|IFM_IEEE80211_OFDM54, IF_Mbps(54) }, \ 593 { IFM_IEEE80211|IFM_IEEE80211_OFDM72, IF_Mbps(72) }, \ 594 \ 595 { 0, 0 }, \ 596 } 597 598 #ifdef _KERNEL 599 600 /* Ethernet flow control strings for tunables */ 601 #define IFM_ETH_FC_STRLEN 16 602 #define IFM_ETH_FC_FULL "full" 603 #define IFM_ETH_FC_RXPAUSE "rxpause" 604 #define IFM_ETH_FC_TXPAUSE "txpause" 605 #define IFM_ETH_FC_NONE "none" 606 #define IFM_ETH_FC_FORCE_FULL "force-full" 607 #define IFM_ETH_FC_FORCE_RXPAUSE "force-rxpause" 608 #define IFM_ETH_FC_FORCE_TXPAUSE "force-txpause" 609 #define IFM_ETH_FC_FORCE_NONE "force-none" 610 611 /* String to flow control media options */ 612 int ifmedia_str2ethfc(const char *); 613 614 #endif /* _KERNEL */ 615 616 #endif /* _NET_IF_MEDIA_H_ */ 617