1 /* $OpenBSD: if_media.h,v 1.7 2000/08/26 20:04:16 nate Exp $ */ 2 /* $NetBSD: if_media.h,v 1.22 2000/02/17 21:53:16 sommerfeld Exp $ */ 3 4 /*- 5 * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc. 6 * All rights reserved. 7 * 8 * This code is derived from software contributed to The NetBSD Foundation 9 * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, 10 * NASA Ames Research Center. 11 * 12 * Redistribution and use in source and binary forms, with or without 13 * modification, are permitted provided that the following conditions 14 * are met: 15 * 1. Redistributions of source code must retain the above copyright 16 * notice, this list of conditions and the following disclaimer. 17 * 2. Redistributions in binary form must reproduce the above copyright 18 * notice, this list of conditions and the following disclaimer in the 19 * documentation and/or other materials provided with the distribution. 20 * 3. All advertising materials mentioning features or use of this software 21 * must display the following acknowledgement: 22 * This product includes software developed by the NetBSD 23 * Foundation, Inc. and its contributors. 24 * 4. Neither the name of The NetBSD Foundation nor the names of its 25 * contributors may be used to endorse or promote products derived 26 * from this software without specific prior written permission. 27 * 28 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 29 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 30 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 31 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 32 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 33 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 34 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 35 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 36 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 37 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 38 * POSSIBILITY OF SUCH DAMAGE. 39 */ 40 41 /* 42 * Copyright (c) 1997 43 * Jonathan Stone and Jason R. Thorpe. All rights reserved. 44 * 45 * This software is derived from information provided by Matt Thomas. 46 * 47 * Redistribution and use in source and binary forms, with or without 48 * modification, are permitted provided that the following conditions 49 * are met: 50 * 1. Redistributions of source code must retain the above copyright 51 * notice, this list of conditions and the following disclaimer. 52 * 2. Redistributions in binary form must reproduce the above copyright 53 * notice, this list of conditions and the following disclaimer in the 54 * documentation and/or other materials provided with the distribution. 55 * 3. All advertising materials mentioning features or use of this software 56 * must display the following acknowledgement: 57 * This product includes software developed by Jonathan Stone 58 * and Jason R. Thorpe for the NetBSD Project. 59 * 4. The names of the authors may not be used to endorse or promote products 60 * derived from this software without specific prior written permission. 61 * 62 * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR 63 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 64 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 65 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 66 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 67 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 68 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 69 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 70 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 71 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 72 * SUCH DAMAGE. 73 */ 74 75 #ifndef _NET_IF_MEDIA_H_ 76 #define _NET_IF_MEDIA_H_ 77 78 /* 79 * Prototypes and definitions for BSD/OS-compatible network interface 80 * media selection. 81 * 82 * Where it is safe to do so, this code strays slightly from the BSD/OS 83 * design. Software which uses the API (device drivers, basically) 84 * shouldn't notice any difference. 85 * 86 * Many thanks to Matt Thomas for providing the information necessary 87 * to implement this interface. 88 */ 89 90 #ifdef _KERNEL 91 92 #include <sys/queue.h> 93 94 /* 95 * Driver callbacks for media status and change requests. 96 */ 97 typedef int (*ifm_change_cb_t) __P((struct ifnet *ifp)); 98 typedef void (*ifm_stat_cb_t) __P((struct ifnet *ifp, struct ifmediareq *req)); 99 100 /* 101 * In-kernel representation of a single supported media type. 102 */ 103 struct ifmedia_entry { 104 TAILQ_ENTRY(ifmedia_entry) ifm_list; 105 int ifm_media; /* description of this media attachment */ 106 int ifm_data; /* for driver-specific use */ 107 void *ifm_aux; /* for driver-specific use */ 108 }; 109 110 /* 111 * One of these goes into a network interface's softc structure. 112 * It is used to keep general media state. 113 */ 114 struct ifmedia { 115 int ifm_mask; /* mask of changes we don't care about */ 116 int ifm_media; /* current user-set media word */ 117 struct ifmedia_entry *ifm_cur; /* currently selected media */ 118 TAILQ_HEAD(, ifmedia_entry) ifm_list; /* list of all supported media */ 119 ifm_change_cb_t ifm_change; /* media change driver callback */ 120 ifm_stat_cb_t ifm_status; /* media status driver callback */ 121 }; 122 123 /* Initialize an interface's struct if_media field. */ 124 void ifmedia_init __P((struct ifmedia *ifm, int dontcare_mask, 125 ifm_change_cb_t change_callback, ifm_stat_cb_t status_callback)); 126 127 /* Add one supported medium to a struct ifmedia. */ 128 void ifmedia_add __P((struct ifmedia *ifm, int mword, int data, void *aux)); 129 130 /* Add an array (of ifmedia_entry) media to a struct ifmedia. */ 131 void ifmedia_list_add(struct ifmedia *mp, struct ifmedia_entry *lp, 132 int count); 133 134 /* Set default media type on initialization. */ 135 void ifmedia_set __P((struct ifmedia *ifm, int mword)); 136 137 /* Common ioctl function for getting/setting media, called by driver. */ 138 int ifmedia_ioctl __P((struct ifnet *ifp, struct ifreq *ifr, 139 struct ifmedia *ifm, u_long cmd)); 140 141 /* Locate a media entry */ 142 struct ifmedia_entry *ifmedia_match __P((struct ifmedia *ifm, 143 int flags, int mask)); 144 145 /* Delete all media for a given media instance */ 146 void ifmedia_delete_instance __P((struct ifmedia *, int)); 147 148 /* Compute baudrate for a given media. */ 149 int ifmedia_baudrate __P((int)); 150 #endif /*_KERNEL */ 151 152 /* 153 * if_media Options word: 154 * Bits Use 155 * ---- ------- 156 * 0-4 Media subtype MAX SUBTYPE == 31! 157 * 5-7 Media type 158 * 8-15 Type specific options 159 * 16-19 RFU 160 * 20-27 Shared (global) options 161 * 28-31 Instance 162 */ 163 164 /* 165 * Ethernet 166 */ 167 #define IFM_ETHER 0x00000020 168 #define IFM_10_T 3 /* 10BaseT - RJ45 */ 169 #define IFM_10_2 4 /* 10Base2 - Thinnet */ 170 #define IFM_10_5 5 /* 10Base5 - AUI */ 171 #define IFM_100_TX 6 /* 100BaseTX - RJ45 */ 172 #define IFM_100_FX 7 /* 100BaseFX - Fiber */ 173 #define IFM_100_T4 8 /* 100BaseT4 - 4 pair cat 3 */ 174 #define IFM_100_VG 9 /* 100VG-AnyLAN */ 175 #define IFM_100_T2 10 /* 100BaseT2 */ 176 #define IFM_1000_SX 11 /* 1000BaseSX - multi-mode fiber */ 177 #define IFM_10_STP 12 /* 10BaseT over shielded TP */ 178 #define IFM_10_FL 13 /* 10BaseFL - Fiber */ 179 #define IFM_1000_LX 14 /* 1000baseLX - single-mode fiber */ 180 #define IFM_1000_CX 15 /* 1000baseCX - 150ohm STP */ 181 #define IFM_1000_TX 16 /* 1000baseTX - 4 pair cat 5 */ 182 #define IFM_HPNA_1 17 /* HomePNA 1.0 (1Mb/s) */ 183 184 /* 185 * Token ring 186 */ 187 #define IFM_TOKEN 0x00000040 188 #define IFM_TOK_STP4 3 /* Shielded twisted pair 4m - DB9 */ 189 #define IFM_TOK_STP16 4 /* Shielded twisted pair 16m - DB9 */ 190 #define IFM_TOK_UTP4 5 /* Unshielded twisted pair 4m - RJ45 */ 191 #define IFM_TOK_UTP16 6 /* Unshielded twisted pair 16m - RJ45 */ 192 #define IFM_TOK_ETR 0x00000200 /* Early token release */ 193 #define IFM_TOK_SRCRT 0x00000400 /* Enable source routing features */ 194 #define IFM_TOK_ALLR 0x00000800 /* All routes / Single route bcast */ 195 196 /* 197 * FDDI 198 */ 199 #define IFM_FDDI 0x00000060 200 #define IFM_FDDI_SMF 3 /* Single-mode fiber */ 201 #define IFM_FDDI_MMF 4 /* Multi-mode fiber */ 202 #define IFM_FDDI_UTP 5 /* CDDI / UTP */ 203 #define IFM_FDDI_DA 0x00000100 /* Dual attach / single attach */ 204 205 /* 206 * IEEE 802.11 Wireless 207 */ 208 #define IFM_IEEE80211 0x00000080 209 #define IFM_IEEE80211_FH1 3 /* Frequency Hopping 1Mbps */ 210 #define IFM_IEEE80211_FH2 4 /* Frequency Hopping 2Mbps */ 211 #define IFM_IEEE80211_DS2 5 /* Direct Sequence 2Mbps */ 212 #define IFM_IEEE80211_DS5 6 /* Direct Sequence 5Mbps*/ 213 #define IFM_IEEE80211_DS11 7 /* Direct Sequence 11Mbps*/ 214 #define IFM_IEEE80211_DS1 8 /* Direct Sequence 1Mbps*/ 215 #define IFM_IEEE80211_ADHOC 0x100 /* Operate in Adhoc mode */ 216 217 /* 218 * Shared media sub-types 219 */ 220 #define IFM_AUTO 0 /* Autoselect best media */ 221 #define IFM_MANUAL 1 /* Jumper/dipswitch selects media */ 222 #define IFM_NONE 2 /* Deselect all media */ 223 224 /* 225 * Shared options 226 */ 227 #define IFM_FDX 0x00100000 /* Force full duplex */ 228 #define IFM_HDX 0x00200000 /* Force half duplex */ 229 #define IFM_FLOW 0x00400000 /* enable hardware flow control */ 230 #define IFM_FLAG0 0x01000000 /* Driver defined flag */ 231 #define IFM_FLAG1 0x02000000 /* Driver defined flag */ 232 #define IFM_FLAG2 0x04000000 /* Driver defined flag */ 233 #define IFM_LOOP 0x08000000 /* Put hardware in loopback */ 234 235 /* 236 * Masks 237 */ 238 #define IFM_NMASK 0x000000e0 /* Network type */ 239 #define IFM_TMASK 0x0000001f /* Media sub-type */ 240 #define IFM_IMASK 0xf0000000 /* Instance */ 241 #define IFM_ISHIFT 28 /* Instance shift */ 242 #define IFM_OMASK 0x0000ff00 /* Type specific options */ 243 #define IFM_GMASK 0x0ff00000 /* Global options */ 244 245 #define IFM_NMIN IFM_ETHER /* lowest Network type */ 246 #define IFM_NMAX IFM_NMASK /* highest Network type */ 247 248 /* 249 * Status bits 250 */ 251 #define IFM_AVALID 0x00000001 /* Active bit valid */ 252 #define IFM_ACTIVE 0x00000002 /* Interface attached to working net */ 253 254 /* Mask of "status valid" bits, for ifconfig(8). */ 255 #define IFM_STATUS_VALID IFM_AVALID 256 257 /* List of "status valid" bits, for ifconfig(8). */ 258 #define IFM_STATUS_VALID_LIST { \ 259 IFM_AVALID, \ 260 0 \ 261 } 262 263 /* 264 * Macros to extract various bits of information from the media word. 265 */ 266 #define IFM_TYPE(x) ((x) & IFM_NMASK) 267 #define IFM_SUBTYPE(x) ((x) & IFM_TMASK) 268 #define IFM_INST(x) (((x) & IFM_IMASK) >> IFM_ISHIFT) 269 #define IFM_OPTIONS(x) ((x) & (IFM_OMASK|IFM_GMASK)) 270 271 #define IFM_INST_MAX IFM_INST(IFM_IMASK) 272 #define IFM_INST_ANY (-1) 273 274 /* 275 * Macro to create a media word. 276 */ 277 #define IFM_MAKEWORD(type, subtype, options, instance) \ 278 ((type) | (subtype) | (options) | ((instance) << IFM_ISHIFT)) 279 280 /* 281 * NetBSD extension not defined in the BSDI API. This is used in various 282 * places to get the canonical description for a given type/subtype. 283 * 284 * In the subtype and mediaopt descriptions, the valid TYPE bits are OR'd 285 * in to indicate which TYPE the subtype/option corresponds to. If no 286 * TYPE is present, it is a shared media/mediaopt. 287 * 288 * Note that these are parsed case-insensitive. 289 * 290 * Order is important. The first matching entry is the canonical name 291 * for a media type; subsequent matches are aliases. 292 */ 293 struct ifmedia_description { 294 int ifmt_word; /* word value; may be masked */ 295 const char *ifmt_string; /* description */ 296 }; 297 298 #define IFM_TYPE_DESCRIPTIONS { \ 299 { IFM_ETHER, "Ethernet" }, \ 300 { IFM_ETHER, "ether" }, \ 301 { IFM_TOKEN, "TokenRing" }, \ 302 { IFM_TOKEN, "token" }, \ 303 { IFM_FDDI, "FDDI" }, \ 304 { IFM_IEEE80211, "IEEE802.11" }, \ 305 { 0, NULL }, \ 306 } 307 308 #define IFM_TYPE_MATCH(dt, t) \ 309 (IFM_TYPE((dt)) == 0 || IFM_TYPE((dt)) == IFM_TYPE((t))) 310 311 #define IFM_SUBTYPE_DESCRIPTIONS { \ 312 { IFM_AUTO, "autoselect" }, \ 313 { IFM_AUTO, "auto" }, \ 314 { IFM_MANUAL, "manual" }, \ 315 { IFM_NONE, "none" }, \ 316 \ 317 { IFM_ETHER|IFM_10_T, "10baseT" }, \ 318 { IFM_ETHER|IFM_10_T, "10baseT/UTP" }, \ 319 { IFM_ETHER|IFM_10_T, "UTP" }, \ 320 { IFM_ETHER|IFM_10_T, "10UTP" }, \ 321 { IFM_ETHER|IFM_10_2, "10base2" }, \ 322 { IFM_ETHER|IFM_10_2, "10base2/BNC" }, \ 323 { IFM_ETHER|IFM_10_2, "BNC" }, \ 324 { IFM_ETHER|IFM_10_2, "10BNC" }, \ 325 { IFM_ETHER|IFM_10_5, "10base5" }, \ 326 { IFM_ETHER|IFM_10_5, "10base5/AUI" }, \ 327 { IFM_ETHER|IFM_10_5, "AUI" }, \ 328 { IFM_ETHER|IFM_10_5, "10AUI" }, \ 329 { IFM_ETHER|IFM_100_TX, "100baseTX" }, \ 330 { IFM_ETHER|IFM_100_TX, "100TX" }, \ 331 { IFM_ETHER|IFM_100_FX, "100baseFX" }, \ 332 { IFM_ETHER|IFM_100_FX, "100FX" }, \ 333 { IFM_ETHER|IFM_100_T4, "100baseT4" }, \ 334 { IFM_ETHER|IFM_100_T4, "100T4" }, \ 335 { IFM_ETHER|IFM_100_VG, "100baseVG" }, \ 336 { IFM_ETHER|IFM_100_VG, "100VG" }, \ 337 { IFM_ETHER|IFM_100_T2, "100baseT2" }, \ 338 { IFM_ETHER|IFM_100_T2, "100T2" }, \ 339 { IFM_ETHER|IFM_1000_SX, "1000baseSX" }, \ 340 { IFM_ETHER|IFM_1000_SX, "1000SX" }, \ 341 { IFM_ETHER|IFM_10_STP, "10baseSTP" }, \ 342 { IFM_ETHER|IFM_10_STP, "STP" }, \ 343 { IFM_ETHER|IFM_10_STP, "10STP" }, \ 344 { IFM_ETHER|IFM_10_FL, "10baseFL" }, \ 345 { IFM_ETHER|IFM_10_FL, "FL" }, \ 346 { IFM_ETHER|IFM_10_FL, "10FL" }, \ 347 { IFM_ETHER|IFM_1000_LX, "1000baseLX" }, \ 348 { IFM_ETHER|IFM_1000_LX, "1000LX" }, \ 349 { IFM_ETHER|IFM_1000_CX, "1000baseCX" }, \ 350 { IFM_ETHER|IFM_1000_CX, "1000CX" }, \ 351 { IFM_ETHER|IFM_1000_TX, "1000baseTX" }, \ 352 { IFM_ETHER|IFM_1000_TX, "1000TX" }, \ 353 { IFM_ETHER|IFM_HPNA_1, "HomePNA1" }, \ 354 { IFM_ETHER|IFM_HPNA_1, "HPNA1" }, \ 355 \ 356 { IFM_TOKEN|IFM_TOK_STP4, "DB9/4Mbit" }, \ 357 { IFM_TOKEN|IFM_TOK_STP4, "4STP" }, \ 358 { IFM_TOKEN|IFM_TOK_STP16, "DB9/16Mbit" }, \ 359 { IFM_TOKEN|IFM_TOK_STP16, "16STP" }, \ 360 { IFM_TOKEN|IFM_TOK_UTP4, "UTP/4Mbit" }, \ 361 { IFM_TOKEN|IFM_TOK_UTP4, "4UTP" }, \ 362 { IFM_TOKEN|IFM_TOK_UTP16, "UTP/16Mbit" }, \ 363 { IFM_TOKEN|IFM_TOK_UTP16, "16UTP" }, \ 364 \ 365 { IFM_FDDI|IFM_FDDI_SMF, "Single-mode" }, \ 366 { IFM_FDDI|IFM_FDDI_SMF, "SMF" }, \ 367 { IFM_FDDI|IFM_FDDI_MMF, "Multi-mode" }, \ 368 { IFM_FDDI|IFM_FDDI_MMF, "MMF" }, \ 369 { IFM_FDDI|IFM_FDDI_UTP, "UTP" }, \ 370 { IFM_FDDI|IFM_FDDI_UTP, "CDDI" }, \ 371 \ 372 { IFM_IEEE80211|IFM_IEEE80211_FH1, "FH1" }, \ 373 { IFM_IEEE80211|IFM_IEEE80211_FH2, "FH2" }, \ 374 { IFM_IEEE80211|IFM_IEEE80211_DS1, "DS1" }, \ 375 { IFM_IEEE80211|IFM_IEEE80211_DS2, "DS2" }, \ 376 { IFM_IEEE80211|IFM_IEEE80211_DS5, "DS5" }, \ 377 { IFM_IEEE80211|IFM_IEEE80211_DS11, "DS11" }, \ 378 \ 379 { 0, NULL }, \ 380 } 381 382 #define IFM_OPTION_DESCRIPTIONS { \ 383 { IFM_FDX, "full-duplex" }, \ 384 { IFM_FDX, "fdx" }, \ 385 { IFM_HDX, "half-duplex" }, \ 386 { IFM_HDX, "hdx" }, \ 387 { IFM_FLAG0, "flag0" }, \ 388 { IFM_FLAG1, "flag1" }, \ 389 { IFM_FLAG2, "flag2" }, \ 390 { IFM_LOOP, "loopback" }, \ 391 { IFM_LOOP, "hw-loopback"}, \ 392 { IFM_LOOP, "loop" }, \ 393 \ 394 { IFM_TOKEN|IFM_TOK_ETR, "EarlyTokenRelease" }, \ 395 { IFM_TOKEN|IFM_TOK_ETR, "ETR" }, \ 396 { IFM_TOKEN|IFM_TOK_SRCRT, "SourceRouting" }, \ 397 { IFM_TOKEN|IFM_TOK_SRCRT, "SRCRT" }, \ 398 { IFM_TOKEN|IFM_TOK_ALLR, "AllRoutes" }, \ 399 { IFM_TOKEN|IFM_TOK_ALLR, "ALLR" }, \ 400 \ 401 { IFM_FDDI|IFM_FDDI_DA, "dual-attach" }, \ 402 { IFM_FDDI|IFM_FDDI_DA, "das" }, \ 403 \ 404 { IFM_IEEE80211|IFM_IEEE80211_ADHOC, "adhoc" }, \ 405 \ 406 { 0, NULL }, \ 407 } 408 409 /* 410 * Baudrate descriptions for the various media types. 411 */ 412 struct ifmedia_baudrate { 413 int ifmb_word; /* media word */ 414 int ifmb_baudrate; /* corresponding baudrate */ 415 }; 416 417 #define IFM_BAUDRATE_DESCRIPTIONS { \ 418 { IFM_ETHER|IFM_10_T, IF_Mbps(10) }, \ 419 { IFM_ETHER|IFM_10_2, IF_Mbps(10) }, \ 420 { IFM_ETHER|IFM_10_5, IF_Mbps(10) }, \ 421 { IFM_ETHER|IFM_100_TX, IF_Mbps(100) }, \ 422 { IFM_ETHER|IFM_100_FX, IF_Mbps(100) }, \ 423 { IFM_ETHER|IFM_100_T4, IF_Mbps(100) }, \ 424 { IFM_ETHER|IFM_100_VG, IF_Mbps(100) }, \ 425 { IFM_ETHER|IFM_100_T2, IF_Mbps(100) }, \ 426 { IFM_ETHER|IFM_1000_SX, IF_Mbps(1000) }, \ 427 { IFM_ETHER|IFM_10_STP, IF_Mbps(10) }, \ 428 { IFM_ETHER|IFM_10_FL, IF_Mbps(10) }, \ 429 { IFM_ETHER|IFM_1000_LX, IF_Mbps(1000) }, \ 430 { IFM_ETHER|IFM_1000_CX, IF_Mbps(1000) }, \ 431 { IFM_ETHER|IFM_1000_TX, IF_Mbps(1000) }, \ 432 { IFM_ETHER|IFM_HPNA_1, IF_Mbps(1) }, \ 433 \ 434 { IFM_TOKEN|IFM_TOK_STP4, IF_Mbps(4) }, \ 435 { IFM_TOKEN|IFM_TOK_STP16, IF_Mbps(16) }, \ 436 { IFM_TOKEN|IFM_TOK_UTP4, IF_Mbps(4) }, \ 437 { IFM_TOKEN|IFM_TOK_UTP16, IF_Mbps(16) }, \ 438 \ 439 { IFM_FDDI|IFM_FDDI_SMF, IF_Mbps(100) }, \ 440 { IFM_FDDI|IFM_FDDI_MMF, IF_Mbps(100) }, \ 441 { IFM_FDDI|IFM_FDDI_UTP, IF_Mbps(100) }, \ 442 \ 443 { IFM_IEEE80211|IFM_IEEE80211_FH1, IF_Mbps(1) }, \ 444 { IFM_IEEE80211|IFM_IEEE80211_FH2, IF_Mbps(2) }, \ 445 { IFM_IEEE80211|IFM_IEEE80211_DS2, IF_Mbps(2) }, \ 446 { IFM_IEEE80211|IFM_IEEE80211_DS5, IF_Mbps(5) }, \ 447 { IFM_IEEE80211|IFM_IEEE80211_DS11, IF_Mbps(11) }, \ 448 { IFM_IEEE80211|IFM_IEEE80211_DS1, IF_Mbps(1) }, \ 449 \ 450 { 0, 0 }, \ 451 } 452 453 /* 454 * Status bit descriptions for the various media types. 455 */ 456 struct ifmedia_status_description { 457 int ifms_type; 458 int ifms_valid; 459 int ifms_bit; 460 const char *ifms_string[2]; 461 }; 462 463 #define IFM_STATUS_DESC(ifms, bit) \ 464 (ifms)->ifms_string[((ifms)->ifms_bit & (bit)) ? 1 : 0] 465 466 #define IFM_STATUS_DESCRIPTIONS { \ 467 { IFM_ETHER, IFM_AVALID, IFM_ACTIVE, \ 468 { "no carrier", "active" } }, \ 469 { IFM_FDDI, IFM_AVALID, IFM_ACTIVE, \ 470 { "no ring", "inserted" } }, \ 471 { IFM_TOKEN, IFM_AVALID, IFM_ACTIVE, \ 472 { "no ring", "inserted" } }, \ 473 { IFM_IEEE80211, IFM_AVALID, IFM_ACTIVE, \ 474 { "no network", "active" } }, \ 475 { 0, 0, 0, \ 476 { NULL, NULL } } \ 477 } 478 #endif /* _NET_IF_MEDIA_H_ */ 479