1f94bb788SPeter Wemm /* $NetBSD: if_media.h,v 1.3 1997/03/26 01:19:27 thorpej Exp $ */ 2c3aac50fSPeter Wemm /* $FreeBSD$ */ 3f94bb788SPeter Wemm 4c398230bSWarner Losh /*- 5f94bb788SPeter Wemm * Copyright (c) 1997 6f94bb788SPeter Wemm * Jonathan Stone and Jason R. Thorpe. All rights reserved. 7f94bb788SPeter Wemm * 8f94bb788SPeter Wemm * This software is derived from information provided by Matt Thomas. 9f94bb788SPeter Wemm * 10f94bb788SPeter Wemm * Redistribution and use in source and binary forms, with or without 11f94bb788SPeter Wemm * modification, are permitted provided that the following conditions 12f94bb788SPeter Wemm * are met: 13f94bb788SPeter Wemm * 1. Redistributions of source code must retain the above copyright 14f94bb788SPeter Wemm * notice, this list of conditions and the following disclaimer. 15f94bb788SPeter Wemm * 2. Redistributions in binary form must reproduce the above copyright 16f94bb788SPeter Wemm * notice, this list of conditions and the following disclaimer in the 17f94bb788SPeter Wemm * documentation and/or other materials provided with the distribution. 18f94bb788SPeter Wemm * 3. All advertising materials mentioning features or use of this software 19f94bb788SPeter Wemm * must display the following acknowledgement: 20f94bb788SPeter Wemm * This product includes software developed by Jonathan Stone 21f94bb788SPeter Wemm * and Jason R. Thorpe for the NetBSD Project. 22f94bb788SPeter Wemm * 4. The names of the authors may not be used to endorse or promote products 23f94bb788SPeter Wemm * derived from this software without specific prior written permission. 24f94bb788SPeter Wemm * 25f94bb788SPeter Wemm * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR 26f94bb788SPeter Wemm * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 27f94bb788SPeter Wemm * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 28f94bb788SPeter Wemm * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 29f94bb788SPeter Wemm * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 30f94bb788SPeter Wemm * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 31f94bb788SPeter Wemm * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 32f94bb788SPeter Wemm * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 33f94bb788SPeter Wemm * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 34f94bb788SPeter Wemm * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 35f94bb788SPeter Wemm * SUCH DAMAGE. 36f94bb788SPeter Wemm */ 37f94bb788SPeter Wemm 38f94bb788SPeter Wemm #ifndef _NET_IF_MEDIA_H_ 39f94bb788SPeter Wemm #define _NET_IF_MEDIA_H_ 40f94bb788SPeter Wemm 41f94bb788SPeter Wemm /* 42f94bb788SPeter Wemm * Prototypes and definitions for BSD/OS-compatible network interface 43f94bb788SPeter Wemm * media selection. 44f94bb788SPeter Wemm * 45f94bb788SPeter Wemm * Where it is safe to do so, this code strays slightly from the BSD/OS 46f94bb788SPeter Wemm * design. Software which uses the API (device drivers, basically) 47f94bb788SPeter Wemm * shouldn't notice any difference. 48f94bb788SPeter Wemm * 49f94bb788SPeter Wemm * Many thanks to Matt Thomas for providing the information necessary 50f94bb788SPeter Wemm * to implement this interface. 51f94bb788SPeter Wemm */ 52f94bb788SPeter Wemm 53664a31e4SPeter Wemm #ifdef _KERNEL 54f94bb788SPeter Wemm 55f94bb788SPeter Wemm #include <sys/queue.h> 56f94bb788SPeter Wemm 57f94bb788SPeter Wemm /* 58f94bb788SPeter Wemm * Driver callbacks for media status and change requests. 59f94bb788SPeter Wemm */ 60929ddbbbSAlfred Perlstein typedef int (*ifm_change_cb_t)(struct ifnet *ifp); 61929ddbbbSAlfred Perlstein typedef void (*ifm_stat_cb_t)(struct ifnet *ifp, struct ifmediareq *req); 62f94bb788SPeter Wemm 63f94bb788SPeter Wemm /* 64f94bb788SPeter Wemm * In-kernel representation of a single supported media type. 65f94bb788SPeter Wemm */ 66f94bb788SPeter Wemm struct ifmedia_entry { 67e3975643SJake Burkholder LIST_ENTRY(ifmedia_entry) ifm_list; 68f94bb788SPeter Wemm int ifm_media; /* description of this media attachment */ 69f94bb788SPeter Wemm int ifm_data; /* for driver-specific use */ 70f94bb788SPeter Wemm void *ifm_aux; /* for driver-specific use */ 71f94bb788SPeter Wemm }; 72f94bb788SPeter Wemm 73f94bb788SPeter Wemm /* 74f94bb788SPeter Wemm * One of these goes into a network interface's softc structure. 75f94bb788SPeter Wemm * It is used to keep general media state. 76f94bb788SPeter Wemm */ 77f94bb788SPeter Wemm struct ifmedia { 78f94bb788SPeter Wemm int ifm_mask; /* mask of changes we don't care about */ 79f94bb788SPeter Wemm int ifm_media; /* current user-set media word */ 80f94bb788SPeter Wemm struct ifmedia_entry *ifm_cur; /* currently selected media */ 81e3975643SJake Burkholder LIST_HEAD(, ifmedia_entry) ifm_list; /* list of all supported media */ 82f94bb788SPeter Wemm ifm_change_cb_t ifm_change; /* media change driver callback */ 83f94bb788SPeter Wemm ifm_stat_cb_t ifm_status; /* media status driver callback */ 84f94bb788SPeter Wemm }; 85f94bb788SPeter Wemm 86f94bb788SPeter Wemm /* Initialize an interface's struct if_media field. */ 87929ddbbbSAlfred Perlstein void ifmedia_init(struct ifmedia *ifm, int dontcare_mask, 88929ddbbbSAlfred Perlstein ifm_change_cb_t change_callback, ifm_stat_cb_t status_callback); 89f94bb788SPeter Wemm 906182fdbdSPeter Wemm /* Remove all mediums from a struct ifmedia. */ 91929ddbbbSAlfred Perlstein void ifmedia_removeall( struct ifmedia *ifm); 926182fdbdSPeter Wemm 93f94bb788SPeter Wemm /* Add one supported medium to a struct ifmedia. */ 94929ddbbbSAlfred Perlstein void ifmedia_add(struct ifmedia *ifm, int mword, int data, void *aux); 95f94bb788SPeter Wemm 96f94bb788SPeter Wemm /* Add an array (of ifmedia_entry) media to a struct ifmedia. */ 97f94bb788SPeter Wemm void ifmedia_list_add(struct ifmedia *mp, struct ifmedia_entry *lp, 98f94bb788SPeter Wemm int count); 99f94bb788SPeter Wemm 100f94bb788SPeter Wemm /* Set default media type on initialization. */ 101929ddbbbSAlfred Perlstein void ifmedia_set(struct ifmedia *ifm, int mword); 102f94bb788SPeter Wemm 103f94bb788SPeter Wemm /* Common ioctl function for getting/setting media, called by driver. */ 104929ddbbbSAlfred Perlstein int ifmedia_ioctl(struct ifnet *ifp, struct ifreq *ifr, 105929ddbbbSAlfred Perlstein struct ifmedia *ifm, u_long cmd); 106f94bb788SPeter Wemm 107efd19b8fSGleb Smirnoff /* Compute baudrate for a given media. */ 108efd19b8fSGleb Smirnoff uint64_t ifmedia_baudrate(int); 109efd19b8fSGleb Smirnoff 110664a31e4SPeter Wemm #endif /*_KERNEL */ 111f94bb788SPeter Wemm 112f94bb788SPeter Wemm /* 113f94bb788SPeter Wemm * if_media Options word: 114f94bb788SPeter Wemm * Bits Use 115f94bb788SPeter Wemm * ---- ------- 11662811dadSJulian Elischer * 0-4 Media variant 117f94bb788SPeter Wemm * 5-7 Media type 118f94bb788SPeter Wemm * 8-15 Type specific options 1191311709aSSam Leffler * 16-18 Mode (for multi-mode devices) 1201311709aSSam Leffler * 19 RFU 121f94bb788SPeter Wemm * 20-27 Shared (global) options 122f94bb788SPeter Wemm * 28-31 Instance 123f94bb788SPeter Wemm */ 124f94bb788SPeter Wemm 125f94bb788SPeter Wemm /* 126f94bb788SPeter Wemm * Ethernet 127f94bb788SPeter Wemm */ 128f94bb788SPeter Wemm #define IFM_ETHER 0x00000020 129f94bb788SPeter Wemm #define IFM_10_T 3 /* 10BaseT - RJ45 */ 130f94bb788SPeter Wemm #define IFM_10_2 4 /* 10Base2 - Thinnet */ 131f94bb788SPeter Wemm #define IFM_10_5 5 /* 10Base5 - AUI */ 132f94bb788SPeter Wemm #define IFM_100_TX 6 /* 100BaseTX - RJ45 */ 133f94bb788SPeter Wemm #define IFM_100_FX 7 /* 100BaseFX - Fiber */ 134f94bb788SPeter Wemm #define IFM_100_T4 8 /* 100BaseT4 - 4 pair cat 3 */ 135f94bb788SPeter Wemm #define IFM_100_VG 9 /* 100VG-AnyLAN */ 136f94bb788SPeter Wemm #define IFM_100_T2 10 /* 100BaseT2 */ 13745521525SPoul-Henning Kamp #define IFM_1000_SX 11 /* 1000BaseSX - multi-mode fiber */ 13827ab138fSBill Paul #define IFM_10_STP 12 /* 10BaseT over shielded TP */ 13945521525SPoul-Henning Kamp #define IFM_10_FL 13 /* 10BaseFL - Fiber */ 14045521525SPoul-Henning Kamp #define IFM_1000_LX 14 /* 1000baseLX - single-mode fiber */ 14145521525SPoul-Henning Kamp #define IFM_1000_CX 15 /* 1000baseCX - 150ohm STP */ 14245521525SPoul-Henning Kamp #define IFM_1000_T 16 /* 1000baseT - 4 pair cat 5 */ 14345521525SPoul-Henning Kamp #define IFM_HPNA_1 17 /* HomePNA 1.0 (1Mb/s) */ 144efd19b8fSGleb Smirnoff #define IFM_10G_LR 18 /* 10GBase-LR 1310nm Single-mode */ 145efd19b8fSGleb Smirnoff #define IFM_10G_SR 19 /* 10GBase-SR 850nm Multi-mode */ 1464ec449aeSGleb Smirnoff #define IFM_10G_CX4 20 /* 10GBase CX4 copper */ 147051e7561SDavid Christensen #define IFM_2500_SX 21 /* 2500BaseSX - multi-mode fiber */ 148b59db7bbSTony Ackerman 14962811dadSJulian Elischer /* note 31 is the max! */ 150f94bb788SPeter Wemm 15145521525SPoul-Henning Kamp #define IFM_ETH_MASTER 0x00000100 /* master mode (1000baseT) */ 15245521525SPoul-Henning Kamp 153f94bb788SPeter Wemm /* 154f94bb788SPeter Wemm * Token ring 155f94bb788SPeter Wemm */ 156f94bb788SPeter Wemm #define IFM_TOKEN 0x00000040 157f94bb788SPeter Wemm #define IFM_TOK_STP4 3 /* Shielded twisted pair 4m - DB9 */ 158f94bb788SPeter Wemm #define IFM_TOK_STP16 4 /* Shielded twisted pair 16m - DB9 */ 159f94bb788SPeter Wemm #define IFM_TOK_UTP4 5 /* Unshielded twisted pair 4m - RJ45 */ 160f94bb788SPeter Wemm #define IFM_TOK_UTP16 6 /* Unshielded twisted pair 16m - RJ45 */ 161722012ccSJulian Elischer #define IFM_TOK_STP100 7 /* Shielded twisted pair 100m - DB9 */ 162722012ccSJulian Elischer #define IFM_TOK_UTP100 8 /* Unshielded twisted pair 100m - RJ45 */ 163f94bb788SPeter Wemm #define IFM_TOK_ETR 0x00000200 /* Early token release */ 164f94bb788SPeter Wemm #define IFM_TOK_SRCRT 0x00000400 /* Enable source routing features */ 165f94bb788SPeter Wemm #define IFM_TOK_ALLR 0x00000800 /* All routes / Single route bcast */ 166722012ccSJulian Elischer #define IFM_TOK_DTR 0x00002000 /* Dedicated token ring */ 167722012ccSJulian Elischer #define IFM_TOK_CLASSIC 0x00004000 /* Classic token ring */ 168722012ccSJulian Elischer #define IFM_TOK_AUTO 0x00008000 /* Automatic Dedicate/Classic token ring */ 169f94bb788SPeter Wemm 170f94bb788SPeter Wemm /* 171f94bb788SPeter Wemm * FDDI 172f94bb788SPeter Wemm */ 173f94bb788SPeter Wemm #define IFM_FDDI 0x00000060 174f94bb788SPeter Wemm #define IFM_FDDI_SMF 3 /* Single-mode fiber */ 175f94bb788SPeter Wemm #define IFM_FDDI_MMF 4 /* Multi-mode fiber */ 176f94bb788SPeter Wemm #define IFM_FDDI_UTP 5 /* CDDI / UTP */ 177f94bb788SPeter Wemm #define IFM_FDDI_DA 0x00000100 /* Dual attach / single attach */ 178f94bb788SPeter Wemm 179f94bb788SPeter Wemm /* 180419d8080SPoul-Henning Kamp * IEEE 802.11 Wireless 181419d8080SPoul-Henning Kamp */ 182419d8080SPoul-Henning Kamp #define IFM_IEEE80211 0x00000080 1831311709aSSam Leffler /* NB: 0,1,2 are auto, manual, none defined below */ 184419d8080SPoul-Henning Kamp #define IFM_IEEE80211_FH1 3 /* Frequency Hopping 1Mbps */ 185419d8080SPoul-Henning Kamp #define IFM_IEEE80211_FH2 4 /* Frequency Hopping 2Mbps */ 186419d8080SPoul-Henning Kamp #define IFM_IEEE80211_DS1 5 /* Direct Sequence 1Mbps */ 187419d8080SPoul-Henning Kamp #define IFM_IEEE80211_DS2 6 /* Direct Sequence 2Mbps */ 188419d8080SPoul-Henning Kamp #define IFM_IEEE80211_DS5 7 /* Direct Sequence 5.5Mbps */ 189419d8080SPoul-Henning Kamp #define IFM_IEEE80211_DS11 8 /* Direct Sequence 11Mbps */ 190419d8080SPoul-Henning Kamp #define IFM_IEEE80211_DS22 9 /* Direct Sequence 22Mbps */ 1911311709aSSam Leffler #define IFM_IEEE80211_OFDM6 10 /* OFDM 6Mbps */ 1921311709aSSam Leffler #define IFM_IEEE80211_OFDM9 11 /* OFDM 9Mbps */ 1931311709aSSam Leffler #define IFM_IEEE80211_OFDM12 12 /* OFDM 12Mbps */ 1941311709aSSam Leffler #define IFM_IEEE80211_OFDM18 13 /* OFDM 18Mbps */ 1951311709aSSam Leffler #define IFM_IEEE80211_OFDM24 14 /* OFDM 24Mbps */ 1961311709aSSam Leffler #define IFM_IEEE80211_OFDM36 15 /* OFDM 36Mbps */ 1971311709aSSam Leffler #define IFM_IEEE80211_OFDM48 16 /* OFDM 48Mbps */ 1981311709aSSam Leffler #define IFM_IEEE80211_OFDM54 17 /* OFDM 54Mbps */ 1991311709aSSam Leffler #define IFM_IEEE80211_OFDM72 18 /* OFDM 72Mbps */ 20094251138SMax Khon #define IFM_IEEE80211_DS354k 19 /* Direct Sequence 354Kbps */ 20194251138SMax Khon #define IFM_IEEE80211_DS512k 20 /* Direct Sequence 512Kbps */ 20241b3c790SSam Leffler #define IFM_IEEE80211_OFDM3 21 /* OFDM 3Mbps */ 20341b3c790SSam Leffler #define IFM_IEEE80211_OFDM4 22 /* OFDM 4.5Mbps */ 20441b3c790SSam Leffler #define IFM_IEEE80211_OFDM27 23 /* OFDM 27Mbps */ 20568e8e04eSSam Leffler /* NB: not enough bits to express MCS fully */ 20668e8e04eSSam Leffler #define IFM_IEEE80211_MCS 24 /* HT MCS rate */ 2074844aa7dSAtsushi Onoe 208419d8080SPoul-Henning Kamp #define IFM_IEEE80211_ADHOC 0x00000100 /* Operate in Adhoc mode */ 20973ce5facSWarner Losh #define IFM_IEEE80211_HOSTAP 0x00000200 /* Operate in Host AP mode */ 210f6462e80SWarner Losh #define IFM_IEEE80211_IBSS 0x00000400 /* Operate in IBSS mode */ 211acaf1de6SSam Leffler #define IFM_IEEE80211_WDS 0x00000800 /* Operate in WDS mode */ 2121311709aSSam Leffler #define IFM_IEEE80211_TURBO 0x00001000 /* Operate in turbo mode */ 2132bbe529dSSam Leffler #define IFM_IEEE80211_MONITOR 0x00002000 /* Operate in monitor mode */ 2144844aa7dSAtsushi Onoe 2151311709aSSam Leffler /* operating mode for multi-mode devices */ 2164844aa7dSAtsushi Onoe #define IFM_IEEE80211_11A 0x00010000 /* 5Ghz, OFDM mode */ 2174844aa7dSAtsushi Onoe #define IFM_IEEE80211_11B 0x00020000 /* Direct Sequence mode */ 2184844aa7dSAtsushi Onoe #define IFM_IEEE80211_11G 0x00030000 /* 2Ghz, CCK mode */ 2194844aa7dSAtsushi Onoe #define IFM_IEEE80211_FH 0x00040000 /* 2Ghz, GFSK mode */ 22068e8e04eSSam Leffler #define IFM_IEEE80211_11NA 0x00050000 /* 5Ghz, HT mode */ 22168e8e04eSSam Leffler #define IFM_IEEE80211_11NG 0x00060000 /* 2Ghz, HT mode */ 222419d8080SPoul-Henning Kamp 223419d8080SPoul-Henning Kamp /* 2242b75e097SHartmut Brandt * ATM 2252b75e097SHartmut Brandt */ 2262b75e097SHartmut Brandt #define IFM_ATM 0x000000a0 2272b75e097SHartmut Brandt #define IFM_ATM_UNKNOWN 3 2282b75e097SHartmut Brandt #define IFM_ATM_UTP_25 4 2292b75e097SHartmut Brandt #define IFM_ATM_TAXI_100 5 2302b75e097SHartmut Brandt #define IFM_ATM_TAXI_140 6 2312b75e097SHartmut Brandt #define IFM_ATM_MM_155 7 2322b75e097SHartmut Brandt #define IFM_ATM_SM_155 8 2332b75e097SHartmut Brandt #define IFM_ATM_UTP_155 9 2342b75e097SHartmut Brandt #define IFM_ATM_MM_622 10 2352b75e097SHartmut Brandt #define IFM_ATM_SM_622 11 2366eadc708SHartmut Brandt #define IFM_ATM_VIRTUAL 12 2372b75e097SHartmut Brandt #define IFM_ATM_SDH 0x00000100 /* SDH instead of SONET */ 2382b75e097SHartmut Brandt #define IFM_ATM_NOSCRAMB 0x00000200 /* no scrambling */ 2392b75e097SHartmut Brandt #define IFM_ATM_UNASSIGNED 0x00000400 /* unassigned cells */ 2402b75e097SHartmut Brandt 2412b75e097SHartmut Brandt /* 242a9771948SGleb Smirnoff * CARP Common Address Redundancy Protocol 243a9771948SGleb Smirnoff */ 244a9771948SGleb Smirnoff #define IFM_CARP 0x000000c0 245a9771948SGleb Smirnoff 246a9771948SGleb Smirnoff /* 247f94bb788SPeter Wemm * Shared media sub-types 248f94bb788SPeter Wemm */ 249f94bb788SPeter Wemm #define IFM_AUTO 0 /* Autoselect best media */ 250f94bb788SPeter Wemm #define IFM_MANUAL 1 /* Jumper/dipswitch selects media */ 251f94bb788SPeter Wemm #define IFM_NONE 2 /* Deselect all media */ 252f94bb788SPeter Wemm 253f94bb788SPeter Wemm /* 254f94bb788SPeter Wemm * Shared options 255f94bb788SPeter Wemm */ 256f94bb788SPeter Wemm #define IFM_FDX 0x00100000 /* Force full duplex */ 257f94bb788SPeter Wemm #define IFM_HDX 0x00200000 /* Force half duplex */ 258f94bb788SPeter Wemm #define IFM_FLAG0 0x01000000 /* Driver defined flag */ 259f94bb788SPeter Wemm #define IFM_FLAG1 0x02000000 /* Driver defined flag */ 260f94bb788SPeter Wemm #define IFM_FLAG2 0x04000000 /* Driver defined flag */ 261f94bb788SPeter Wemm #define IFM_LOOP 0x08000000 /* Put hardware in loopback */ 262f94bb788SPeter Wemm 263f94bb788SPeter Wemm /* 264f94bb788SPeter Wemm * Masks 265f94bb788SPeter Wemm */ 266f94bb788SPeter Wemm #define IFM_NMASK 0x000000e0 /* Network type */ 26762811dadSJulian Elischer #define IFM_TMASK 0x0000001f /* Media sub-type */ 268f94bb788SPeter Wemm #define IFM_IMASK 0xf0000000 /* Instance */ 269f94bb788SPeter Wemm #define IFM_ISHIFT 28 /* Instance shift */ 270f94bb788SPeter Wemm #define IFM_OMASK 0x0000ff00 /* Type specific options */ 2711311709aSSam Leffler #define IFM_MMASK 0x00070000 /* Mode */ 2721311709aSSam Leffler #define IFM_MSHIFT 16 /* Mode shift */ 273f94bb788SPeter Wemm #define IFM_GMASK 0x0ff00000 /* Global options */ 274f94bb788SPeter Wemm 275f94bb788SPeter Wemm /* 276f94bb788SPeter Wemm * Status bits 277f94bb788SPeter Wemm */ 278f94bb788SPeter Wemm #define IFM_AVALID 0x00000001 /* Active bit valid */ 279f94bb788SPeter Wemm #define IFM_ACTIVE 0x00000002 /* Interface attached to working net */ 280f94bb788SPeter Wemm 281e4bd8f10SAndre Oppermann /* Mask of "status valid" bits, for ifconfig(8). */ 282e4bd8f10SAndre Oppermann #define IFM_STATUS_VALID IFM_AVALID 283e4bd8f10SAndre Oppermann 284e4bd8f10SAndre Oppermann /* List of "status valid" bits, for ifconfig(8). */ 285e4bd8f10SAndre Oppermann #define IFM_STATUS_VALID_LIST { \ 286e4bd8f10SAndre Oppermann IFM_AVALID, \ 287e4bd8f10SAndre Oppermann 0 \ 288e4bd8f10SAndre Oppermann } 289e4bd8f10SAndre Oppermann 290f94bb788SPeter Wemm /* 291f94bb788SPeter Wemm * Macros to extract various bits of information from the media word. 292f94bb788SPeter Wemm */ 293f94bb788SPeter Wemm #define IFM_TYPE(x) ((x) & IFM_NMASK) 294f94bb788SPeter Wemm #define IFM_SUBTYPE(x) ((x) & IFM_TMASK) 295722012ccSJulian Elischer #define IFM_TYPE_OPTIONS(x) ((x) & IFM_OMASK) 296f94bb788SPeter Wemm #define IFM_INST(x) (((x) & IFM_IMASK) >> IFM_ISHIFT) 29727ab138fSBill Paul #define IFM_OPTIONS(x) ((x) & (IFM_OMASK|IFM_GMASK)) 298c66380c1SAtsushi Onoe #define IFM_MODE(x) ((x) & IFM_MMASK) 29927ab138fSBill Paul 30027ab138fSBill Paul #define IFM_INST_MAX IFM_INST(IFM_IMASK) 30127ab138fSBill Paul 30227ab138fSBill Paul /* 30327ab138fSBill Paul * Macro to create a media word. 30427ab138fSBill Paul */ 30527ab138fSBill Paul #define IFM_MAKEWORD(type, subtype, options, instance) \ 30627ab138fSBill Paul ((type) | (subtype) | (options) | ((instance) << IFM_ISHIFT)) 3071311709aSSam Leffler #define IFM_MAKEMODE(mode) \ 3081311709aSSam Leffler (((mode) << IFM_MSHIFT) & IFM_MMASK) 309f94bb788SPeter Wemm 310f94bb788SPeter Wemm /* 311f94bb788SPeter Wemm * NetBSD extension not defined in the BSDI API. This is used in various 312f94bb788SPeter Wemm * places to get the canonical description for a given type/subtype. 313f94bb788SPeter Wemm * 314f94bb788SPeter Wemm * NOTE: all but the top-level type descriptions must contain NO whitespace! 315f94bb788SPeter Wemm * Otherwise, parsing these in ifconfig(8) would be a nightmare. 316f94bb788SPeter Wemm */ 317f94bb788SPeter Wemm struct ifmedia_description { 318f94bb788SPeter Wemm int ifmt_word; /* word value; may be masked */ 319f94bb788SPeter Wemm const char *ifmt_string; /* description */ 320f94bb788SPeter Wemm }; 321f94bb788SPeter Wemm 322f94bb788SPeter Wemm #define IFM_TYPE_DESCRIPTIONS { \ 323f94bb788SPeter Wemm { IFM_ETHER, "Ethernet" }, \ 324f94bb788SPeter Wemm { IFM_TOKEN, "Token ring" }, \ 325f94bb788SPeter Wemm { IFM_FDDI, "FDDI" }, \ 326419d8080SPoul-Henning Kamp { IFM_IEEE80211, "IEEE 802.11 Wireless Ethernet" }, \ 3272b75e097SHartmut Brandt { IFM_ATM, "ATM" }, \ 328a9771948SGleb Smirnoff { IFM_CARP, "Common Address Redundancy Protocol" }, \ 329f94bb788SPeter Wemm { 0, NULL }, \ 330f94bb788SPeter Wemm } 331f94bb788SPeter Wemm 332f94bb788SPeter Wemm #define IFM_SUBTYPE_ETHERNET_DESCRIPTIONS { \ 333f94bb788SPeter Wemm { IFM_10_T, "10baseT/UTP" }, \ 334f94bb788SPeter Wemm { IFM_10_2, "10base2/BNC" }, \ 335f94bb788SPeter Wemm { IFM_10_5, "10base5/AUI" }, \ 336f94bb788SPeter Wemm { IFM_100_TX, "100baseTX" }, \ 337f94bb788SPeter Wemm { IFM_100_FX, "100baseFX" }, \ 338f94bb788SPeter Wemm { IFM_100_T4, "100baseT4" }, \ 339f94bb788SPeter Wemm { IFM_100_VG, "100baseVG" }, \ 340f94bb788SPeter Wemm { IFM_100_T2, "100baseT2" }, \ 34127ab138fSBill Paul { IFM_10_STP, "10baseSTP" }, \ 34227ab138fSBill Paul { IFM_10_FL, "10baseFL" }, \ 3436b3cb593SBill Paul { IFM_1000_SX, "1000baseSX" }, \ 3446b3cb593SBill Paul { IFM_1000_LX, "1000baseLX" }, \ 3456b3cb593SBill Paul { IFM_1000_CX, "1000baseCX" }, \ 34669237b10SAntoine Brodin { IFM_1000_T, "1000baseT" }, \ 34745521525SPoul-Henning Kamp { IFM_HPNA_1, "homePNA" }, \ 348a7c959feSGleb Smirnoff { IFM_10G_LR, "10Gbase-LR" }, \ 349a7c959feSGleb Smirnoff { IFM_10G_SR, "10Gbase-SR" }, \ 3504ec449aeSGleb Smirnoff { IFM_10G_CX4, "10Gbase-CX4" }, \ 351051e7561SDavid Christensen { IFM_2500_SX, "2500BaseSX" }, \ 352f94bb788SPeter Wemm { 0, NULL }, \ 353f94bb788SPeter Wemm } 354f94bb788SPeter Wemm 355f94bb788SPeter Wemm #define IFM_SUBTYPE_ETHERNET_ALIASES { \ 356f94bb788SPeter Wemm { IFM_10_T, "UTP" }, \ 357f94bb788SPeter Wemm { IFM_10_T, "10UTP" }, \ 358f94bb788SPeter Wemm { IFM_10_2, "BNC" }, \ 359f94bb788SPeter Wemm { IFM_10_2, "10BNC" }, \ 360f94bb788SPeter Wemm { IFM_10_5, "AUI" }, \ 361f94bb788SPeter Wemm { IFM_10_5, "10AUI" }, \ 362f94bb788SPeter Wemm { IFM_100_TX, "100TX" }, \ 363f94bb788SPeter Wemm { IFM_100_T4, "100T4" }, \ 364f94bb788SPeter Wemm { IFM_100_VG, "100VG" }, \ 365f94bb788SPeter Wemm { IFM_100_T2, "100T2" }, \ 36627ab138fSBill Paul { IFM_10_STP, "10STP" }, \ 36727ab138fSBill Paul { IFM_10_FL, "10FL" }, \ 36845521525SPoul-Henning Kamp { IFM_1000_SX, "1000SX" }, \ 36945521525SPoul-Henning Kamp { IFM_1000_LX, "1000LX" }, \ 37045521525SPoul-Henning Kamp { IFM_1000_CX, "1000CX" }, \ 37169237b10SAntoine Brodin { IFM_1000_T, "1000baseTX" }, \ 37245521525SPoul-Henning Kamp { IFM_1000_T, "1000TX" }, \ 37345521525SPoul-Henning Kamp { IFM_1000_T, "1000T" }, \ 374051e7561SDavid Christensen { IFM_2500_SX, "2500SX" }, \ 375f94bb788SPeter Wemm { 0, NULL }, \ 376f94bb788SPeter Wemm } 377f94bb788SPeter Wemm 378f94bb788SPeter Wemm #define IFM_SUBTYPE_ETHERNET_OPTION_DESCRIPTIONS { \ 379f94bb788SPeter Wemm { 0, NULL }, \ 380f94bb788SPeter Wemm } 381f94bb788SPeter Wemm 382f94bb788SPeter Wemm #define IFM_SUBTYPE_TOKENRING_DESCRIPTIONS { \ 383f94bb788SPeter Wemm { IFM_TOK_STP4, "DB9/4Mbit" }, \ 384f94bb788SPeter Wemm { IFM_TOK_STP16, "DB9/16Mbit" }, \ 385f94bb788SPeter Wemm { IFM_TOK_UTP4, "UTP/4Mbit" }, \ 386f94bb788SPeter Wemm { IFM_TOK_UTP16, "UTP/16Mbit" }, \ 387722012ccSJulian Elischer { IFM_TOK_STP100, "STP/100Mbit" }, \ 388722012ccSJulian Elischer { IFM_TOK_UTP100, "UTP/100Mbit" }, \ 389f94bb788SPeter Wemm { 0, NULL }, \ 390f94bb788SPeter Wemm } 391f94bb788SPeter Wemm 392f94bb788SPeter Wemm #define IFM_SUBTYPE_TOKENRING_ALIASES { \ 393f94bb788SPeter Wemm { IFM_TOK_STP4, "4STP" }, \ 394f94bb788SPeter Wemm { IFM_TOK_STP16, "16STP" }, \ 395f94bb788SPeter Wemm { IFM_TOK_UTP4, "4UTP" }, \ 396f94bb788SPeter Wemm { IFM_TOK_UTP16, "16UTP" }, \ 397722012ccSJulian Elischer { IFM_TOK_STP100, "100STP" }, \ 398722012ccSJulian Elischer { IFM_TOK_UTP100, "100UTP" }, \ 399f94bb788SPeter Wemm { 0, NULL }, \ 400f94bb788SPeter Wemm } 401f94bb788SPeter Wemm 402f94bb788SPeter Wemm #define IFM_SUBTYPE_TOKENRING_OPTION_DESCRIPTIONS { \ 403f94bb788SPeter Wemm { IFM_TOK_ETR, "EarlyTokenRelease" }, \ 404f94bb788SPeter Wemm { IFM_TOK_SRCRT, "SourceRouting" }, \ 405f94bb788SPeter Wemm { IFM_TOK_ALLR, "AllRoutes" }, \ 406722012ccSJulian Elischer { IFM_TOK_DTR, "Dedicated" }, \ 407722012ccSJulian Elischer { IFM_TOK_CLASSIC,"Classic" }, \ 408722012ccSJulian Elischer { IFM_TOK_AUTO, " " }, \ 409f94bb788SPeter Wemm { 0, NULL }, \ 410f94bb788SPeter Wemm } 411f94bb788SPeter Wemm 412f94bb788SPeter Wemm #define IFM_SUBTYPE_FDDI_DESCRIPTIONS { \ 413f94bb788SPeter Wemm { IFM_FDDI_SMF, "Single-mode" }, \ 414f94bb788SPeter Wemm { IFM_FDDI_MMF, "Multi-mode" }, \ 415f94bb788SPeter Wemm { IFM_FDDI_UTP, "UTP" }, \ 416f94bb788SPeter Wemm { 0, NULL }, \ 417f94bb788SPeter Wemm } 418f94bb788SPeter Wemm 419f94bb788SPeter Wemm #define IFM_SUBTYPE_FDDI_ALIASES { \ 420f94bb788SPeter Wemm { IFM_FDDI_SMF, "SMF" }, \ 421f94bb788SPeter Wemm { IFM_FDDI_MMF, "MMF" }, \ 422f94bb788SPeter Wemm { IFM_FDDI_UTP, "CDDI" }, \ 423f94bb788SPeter Wemm { 0, NULL }, \ 424f94bb788SPeter Wemm } 425f94bb788SPeter Wemm 426f94bb788SPeter Wemm #define IFM_SUBTYPE_FDDI_OPTION_DESCRIPTIONS { \ 427f94bb788SPeter Wemm { IFM_FDDI_DA, "Dual-attach" }, \ 428f94bb788SPeter Wemm { 0, NULL }, \ 429f94bb788SPeter Wemm } 430f94bb788SPeter Wemm 431419d8080SPoul-Henning Kamp #define IFM_SUBTYPE_IEEE80211_DESCRIPTIONS { \ 432419d8080SPoul-Henning Kamp { IFM_IEEE80211_FH1, "FH/1Mbps" }, \ 433419d8080SPoul-Henning Kamp { IFM_IEEE80211_FH2, "FH/2Mbps" }, \ 434419d8080SPoul-Henning Kamp { IFM_IEEE80211_DS1, "DS/1Mbps" }, \ 435419d8080SPoul-Henning Kamp { IFM_IEEE80211_DS2, "DS/2Mbps" }, \ 436419d8080SPoul-Henning Kamp { IFM_IEEE80211_DS5, "DS/5.5Mbps" }, \ 437419d8080SPoul-Henning Kamp { IFM_IEEE80211_DS11, "DS/11Mbps" }, \ 438419d8080SPoul-Henning Kamp { IFM_IEEE80211_DS22, "DS/22Mbps" }, \ 4391311709aSSam Leffler { IFM_IEEE80211_OFDM6, "OFDM/6Mbps" }, \ 4401311709aSSam Leffler { IFM_IEEE80211_OFDM9, "OFDM/9Mbps" }, \ 4411311709aSSam Leffler { IFM_IEEE80211_OFDM12, "OFDM/12Mbps" }, \ 4421311709aSSam Leffler { IFM_IEEE80211_OFDM18, "OFDM/18Mbps" }, \ 4431311709aSSam Leffler { IFM_IEEE80211_OFDM24, "OFDM/24Mbps" }, \ 4441311709aSSam Leffler { IFM_IEEE80211_OFDM36, "OFDM/36Mbps" }, \ 4451311709aSSam Leffler { IFM_IEEE80211_OFDM48, "OFDM/48Mbps" }, \ 4461311709aSSam Leffler { IFM_IEEE80211_OFDM54, "OFDM/54Mbps" }, \ 4471311709aSSam Leffler { IFM_IEEE80211_OFDM72, "OFDM/72Mbps" }, \ 44894251138SMax Khon { IFM_IEEE80211_DS354k, "DS/354Kbps" }, \ 44994251138SMax Khon { IFM_IEEE80211_DS512k, "DS/512Kbps" }, \ 45041b3c790SSam Leffler { IFM_IEEE80211_OFDM3, "OFDM/3Mbps" }, \ 45141b3c790SSam Leffler { IFM_IEEE80211_OFDM4, "OFDM/4.5Mbps" }, \ 45241b3c790SSam Leffler { IFM_IEEE80211_OFDM27, "OFDM/27Mbps" }, \ 453419d8080SPoul-Henning Kamp { 0, NULL }, \ 454419d8080SPoul-Henning Kamp } 455419d8080SPoul-Henning Kamp 456419d8080SPoul-Henning Kamp #define IFM_SUBTYPE_IEEE80211_ALIASES { \ 457419d8080SPoul-Henning Kamp { IFM_IEEE80211_FH1, "FH1" }, \ 458419d8080SPoul-Henning Kamp { IFM_IEEE80211_FH2, "FH2" }, \ 459419d8080SPoul-Henning Kamp { IFM_IEEE80211_FH1, "FrequencyHopping/1Mbps" }, \ 460419d8080SPoul-Henning Kamp { IFM_IEEE80211_FH2, "FrequencyHopping/2Mbps" }, \ 461419d8080SPoul-Henning Kamp { IFM_IEEE80211_DS1, "DS1" }, \ 462419d8080SPoul-Henning Kamp { IFM_IEEE80211_DS2, "DS2" }, \ 463419d8080SPoul-Henning Kamp { IFM_IEEE80211_DS5, "DS5.5" }, \ 464419d8080SPoul-Henning Kamp { IFM_IEEE80211_DS11, "DS11" }, \ 465419d8080SPoul-Henning Kamp { IFM_IEEE80211_DS22, "DS22" }, \ 466419d8080SPoul-Henning Kamp { IFM_IEEE80211_DS1, "DirectSequence/1Mbps" }, \ 467419d8080SPoul-Henning Kamp { IFM_IEEE80211_DS2, "DirectSequence/2Mbps" }, \ 468419d8080SPoul-Henning Kamp { IFM_IEEE80211_DS5, "DirectSequence/5.5Mbps" }, \ 469419d8080SPoul-Henning Kamp { IFM_IEEE80211_DS11, "DirectSequence/11Mbps" }, \ 470419d8080SPoul-Henning Kamp { IFM_IEEE80211_DS22, "DirectSequence/22Mbps" }, \ 4711311709aSSam Leffler { IFM_IEEE80211_OFDM6, "OFDM6" }, \ 4721311709aSSam Leffler { IFM_IEEE80211_OFDM9, "OFDM9" }, \ 4731311709aSSam Leffler { IFM_IEEE80211_OFDM12, "OFDM12" }, \ 4741311709aSSam Leffler { IFM_IEEE80211_OFDM18, "OFDM18" }, \ 4751311709aSSam Leffler { IFM_IEEE80211_OFDM24, "OFDM24" }, \ 4761311709aSSam Leffler { IFM_IEEE80211_OFDM36, "OFDM36" }, \ 4771311709aSSam Leffler { IFM_IEEE80211_OFDM48, "OFDM48" }, \ 4781311709aSSam Leffler { IFM_IEEE80211_OFDM54, "OFDM54" }, \ 4791311709aSSam Leffler { IFM_IEEE80211_OFDM72, "OFDM72" }, \ 4801311709aSSam Leffler { IFM_IEEE80211_DS1, "CCK1" }, \ 4811311709aSSam Leffler { IFM_IEEE80211_DS2, "CCK2" }, \ 4821311709aSSam Leffler { IFM_IEEE80211_DS5, "CCK5.5" }, \ 4831311709aSSam Leffler { IFM_IEEE80211_DS11, "CCK11" }, \ 48494251138SMax Khon { IFM_IEEE80211_DS354k, "DS354K" }, \ 48594251138SMax Khon { IFM_IEEE80211_DS354k, "DirectSequence/354Kbps" }, \ 48694251138SMax Khon { IFM_IEEE80211_DS512k, "DS512K" }, \ 48794251138SMax Khon { IFM_IEEE80211_DS512k, "DirectSequence/512Kbps" }, \ 48841b3c790SSam Leffler { IFM_IEEE80211_OFDM3, "OFDM3" }, \ 48941b3c790SSam Leffler { IFM_IEEE80211_OFDM4, "OFDM4.5" }, \ 49041b3c790SSam Leffler { IFM_IEEE80211_OFDM27, "OFDM27" }, \ 491419d8080SPoul-Henning Kamp { 0, NULL }, \ 492419d8080SPoul-Henning Kamp } 493419d8080SPoul-Henning Kamp 494419d8080SPoul-Henning Kamp #define IFM_SUBTYPE_IEEE80211_OPTION_DESCRIPTIONS { \ 495419d8080SPoul-Henning Kamp { IFM_IEEE80211_ADHOC, "adhoc" }, \ 49673ce5facSWarner Losh { IFM_IEEE80211_HOSTAP, "hostap" }, \ 497f6462e80SWarner Losh { IFM_IEEE80211_IBSS, "ibss" }, \ 498acaf1de6SSam Leffler { IFM_IEEE80211_WDS, "wds" }, \ 4991311709aSSam Leffler { IFM_IEEE80211_TURBO, "turbo" }, \ 5002bbe529dSSam Leffler { IFM_IEEE80211_MONITOR, "monitor" }, \ 5011311709aSSam Leffler { 0, NULL }, \ 5021311709aSSam Leffler } 5031311709aSSam Leffler 5041311709aSSam Leffler #define IFM_SUBTYPE_IEEE80211_MODE_DESCRIPTIONS { \ 5052dd59091SSam Leffler { IFM_AUTO, "autoselect" }, \ 5061311709aSSam Leffler { IFM_IEEE80211_11A, "11a" }, \ 5071311709aSSam Leffler { IFM_IEEE80211_11B, "11b" }, \ 5081311709aSSam Leffler { IFM_IEEE80211_11G, "11g" }, \ 5094844aa7dSAtsushi Onoe { IFM_IEEE80211_FH, "fh" }, \ 51068e8e04eSSam Leffler { IFM_IEEE80211_11NA, "11na" }, \ 51168e8e04eSSam Leffler { IFM_IEEE80211_11NG, "11ng" }, \ 512419d8080SPoul-Henning Kamp { 0, NULL }, \ 513419d8080SPoul-Henning Kamp } 514419d8080SPoul-Henning Kamp 5152dd59091SSam Leffler #define IFM_SUBTYPE_IEEE80211_MODE_ALIASES { \ 5162dd59091SSam Leffler { IFM_AUTO, "auto" }, \ 5172dd59091SSam Leffler { 0, NULL }, \ 5182dd59091SSam Leffler } 5192dd59091SSam Leffler 5202b75e097SHartmut Brandt # define IFM_SUBTYPE_ATM_DESCRIPTIONS { \ 5212b75e097SHartmut Brandt { IFM_ATM_UNKNOWN, "Unknown" }, \ 5222b75e097SHartmut Brandt { IFM_ATM_UTP_25, "UTP/25.6MBit" }, \ 5232b75e097SHartmut Brandt { IFM_ATM_TAXI_100, "Taxi/100MBit" }, \ 5242b75e097SHartmut Brandt { IFM_ATM_TAXI_140, "Taxi/140MBit" }, \ 5252b75e097SHartmut Brandt { IFM_ATM_MM_155, "Multi-mode/155MBit" }, \ 5262b75e097SHartmut Brandt { IFM_ATM_SM_155, "Single-mode/155MBit" }, \ 5272b75e097SHartmut Brandt { IFM_ATM_UTP_155, "UTP/155MBit" }, \ 528d68d53d4SHartmut Brandt { IFM_ATM_MM_622, "Multi-mode/622MBit" }, \ 5292b75e097SHartmut Brandt { IFM_ATM_SM_622, "Single-mode/622MBit" }, \ 5306eadc708SHartmut Brandt { IFM_ATM_VIRTUAL, "Virtual" }, \ 5312b75e097SHartmut Brandt { 0, NULL }, \ 5322b75e097SHartmut Brandt } 5332b75e097SHartmut Brandt 5342b75e097SHartmut Brandt # define IFM_SUBTYPE_ATM_ALIASES { \ 5352b75e097SHartmut Brandt { IFM_ATM_UNKNOWN, "UNKNOWN" }, \ 5362b75e097SHartmut Brandt { IFM_ATM_UTP_25, "UTP-25" }, \ 5372b75e097SHartmut Brandt { IFM_ATM_TAXI_100, "TAXI-100" }, \ 5382b75e097SHartmut Brandt { IFM_ATM_TAXI_140, "TAXI-140" }, \ 5392b75e097SHartmut Brandt { IFM_ATM_MM_155, "MM-155" }, \ 5402b75e097SHartmut Brandt { IFM_ATM_SM_155, "SM-155" }, \ 5412b75e097SHartmut Brandt { IFM_ATM_UTP_155, "UTP-155" }, \ 5422b75e097SHartmut Brandt { IFM_ATM_MM_622, "MM-622" }, \ 5432b75e097SHartmut Brandt { IFM_ATM_SM_622, "SM-622" }, \ 5446eadc708SHartmut Brandt { IFM_ATM_VIRTUAL, "VIRTUAL" }, \ 5452b75e097SHartmut Brandt { 0, NULL }, \ 5462b75e097SHartmut Brandt } 5472b75e097SHartmut Brandt 5482b75e097SHartmut Brandt #define IFM_SUBTYPE_ATM_OPTION_DESCRIPTIONS { \ 5492b75e097SHartmut Brandt { IFM_ATM_SDH, "SDH" }, \ 5502b75e097SHartmut Brandt { IFM_ATM_NOSCRAMB, "Noscramb" }, \ 5512b75e097SHartmut Brandt { IFM_ATM_UNASSIGNED, "Unassigned" }, \ 5522b75e097SHartmut Brandt { 0, NULL }, \ 5532b75e097SHartmut Brandt } 5542b75e097SHartmut Brandt 5552b75e097SHartmut Brandt 556f94bb788SPeter Wemm #define IFM_SUBTYPE_SHARED_DESCRIPTIONS { \ 557f94bb788SPeter Wemm { IFM_AUTO, "autoselect" }, \ 558f94bb788SPeter Wemm { IFM_MANUAL, "manual" }, \ 559f94bb788SPeter Wemm { IFM_NONE, "none" }, \ 560f94bb788SPeter Wemm { 0, NULL }, \ 561f94bb788SPeter Wemm } 562f94bb788SPeter Wemm 563f94bb788SPeter Wemm #define IFM_SUBTYPE_SHARED_ALIASES { \ 564f94bb788SPeter Wemm { IFM_AUTO, "auto" }, \ 565f94bb788SPeter Wemm { 0, NULL }, \ 566f94bb788SPeter Wemm } 567f94bb788SPeter Wemm 568f94bb788SPeter Wemm #define IFM_SHARED_OPTION_DESCRIPTIONS { \ 569f94bb788SPeter Wemm { IFM_FDX, "full-duplex" }, \ 570f94bb788SPeter Wemm { IFM_HDX, "half-duplex" }, \ 571f94bb788SPeter Wemm { IFM_FLAG0, "flag0" }, \ 572f94bb788SPeter Wemm { IFM_FLAG1, "flag1" }, \ 573f94bb788SPeter Wemm { IFM_FLAG2, "flag2" }, \ 574f94bb788SPeter Wemm { IFM_LOOP, "hw-loopback" }, \ 575f94bb788SPeter Wemm { 0, NULL }, \ 576f94bb788SPeter Wemm } 577f94bb788SPeter Wemm 578efd19b8fSGleb Smirnoff /* 579efd19b8fSGleb Smirnoff * Baudrate descriptions for the various media types. 580efd19b8fSGleb Smirnoff */ 581efd19b8fSGleb Smirnoff struct ifmedia_baudrate { 582efd19b8fSGleb Smirnoff int ifmb_word; /* media word */ 583efd19b8fSGleb Smirnoff uint64_t ifmb_baudrate; /* corresponding baudrate */ 584efd19b8fSGleb Smirnoff }; 585efd19b8fSGleb Smirnoff 586efd19b8fSGleb Smirnoff #define IFM_BAUDRATE_DESCRIPTIONS { \ 587efd19b8fSGleb Smirnoff { IFM_ETHER | IFM_10_T, IF_Mbps(10) }, \ 588efd19b8fSGleb Smirnoff { IFM_ETHER | IFM_10_2, IF_Mbps(10) }, \ 589efd19b8fSGleb Smirnoff { IFM_ETHER | IFM_10_5, IF_Mbps(10) }, \ 590efd19b8fSGleb Smirnoff { IFM_ETHER | IFM_100_TX, IF_Mbps(100) }, \ 591efd19b8fSGleb Smirnoff { IFM_ETHER | IFM_100_FX, IF_Mbps(100) }, \ 592efd19b8fSGleb Smirnoff { IFM_ETHER | IFM_100_T4, IF_Mbps(100) }, \ 593efd19b8fSGleb Smirnoff { IFM_ETHER | IFM_100_VG, IF_Mbps(100) }, \ 594efd19b8fSGleb Smirnoff { IFM_ETHER | IFM_100_T2, IF_Mbps(100) }, \ 595efd19b8fSGleb Smirnoff { IFM_ETHER | IFM_1000_SX, IF_Mbps(1000) }, \ 596efd19b8fSGleb Smirnoff { IFM_ETHER | IFM_10_STP, IF_Mbps(10) }, \ 597efd19b8fSGleb Smirnoff { IFM_ETHER | IFM_10_FL, IF_Mbps(10) }, \ 598efd19b8fSGleb Smirnoff { IFM_ETHER | IFM_1000_LX, IF_Mbps(1000) }, \ 599efd19b8fSGleb Smirnoff { IFM_ETHER | IFM_1000_CX, IF_Mbps(1000) }, \ 600efd19b8fSGleb Smirnoff { IFM_ETHER | IFM_1000_T, IF_Mbps(1000) }, \ 601efd19b8fSGleb Smirnoff { IFM_ETHER | IFM_HPNA_1, IF_Mbps(1) }, \ 602efd19b8fSGleb Smirnoff { IFM_ETHER | IFM_10G_LR, IF_Gbps(10ULL) }, \ 6034ec449aeSGleb Smirnoff { IFM_ETHER | IFM_10G_SR, IF_Gbps(10ULL) }, \ 6044ec449aeSGleb Smirnoff { IFM_ETHER | IFM_10G_CX4, IF_Gbps(10ULL) }, \ 605051e7561SDavid Christensen { IFM_ETHER | IFM_2500_SX, IF_Mbps(2500ULL) }, \ 606efd19b8fSGleb Smirnoff \ 607efd19b8fSGleb Smirnoff { IFM_TOKEN | IFM_TOK_STP4, IF_Mbps(4) }, \ 608efd19b8fSGleb Smirnoff { IFM_TOKEN | IFM_TOK_STP16, IF_Mbps(16) }, \ 609efd19b8fSGleb Smirnoff { IFM_TOKEN | IFM_TOK_UTP4, IF_Mbps(4) }, \ 610efd19b8fSGleb Smirnoff { IFM_TOKEN | IFM_TOK_UTP16, IF_Mbps(16) }, \ 611efd19b8fSGleb Smirnoff \ 612efd19b8fSGleb Smirnoff { IFM_FDDI | IFM_FDDI_SMF, IF_Mbps(100) }, \ 613efd19b8fSGleb Smirnoff { IFM_FDDI | IFM_FDDI_MMF, IF_Mbps(100) }, \ 614efd19b8fSGleb Smirnoff { IFM_FDDI | IFM_FDDI_UTP, IF_Mbps(100) }, \ 615efd19b8fSGleb Smirnoff \ 616efd19b8fSGleb Smirnoff { IFM_IEEE80211 | IFM_IEEE80211_FH1, IF_Mbps(1) }, \ 617efd19b8fSGleb Smirnoff { IFM_IEEE80211 | IFM_IEEE80211_FH2, IF_Mbps(2) }, \ 618efd19b8fSGleb Smirnoff { IFM_IEEE80211 | IFM_IEEE80211_DS2, IF_Mbps(2) }, \ 619efd19b8fSGleb Smirnoff { IFM_IEEE80211 | IFM_IEEE80211_DS5, IF_Kbps(5500) }, \ 620efd19b8fSGleb Smirnoff { IFM_IEEE80211 | IFM_IEEE80211_DS11, IF_Mbps(11) }, \ 621efd19b8fSGleb Smirnoff { IFM_IEEE80211 | IFM_IEEE80211_DS1, IF_Mbps(1) }, \ 622efd19b8fSGleb Smirnoff { IFM_IEEE80211 | IFM_IEEE80211_DS22, IF_Mbps(22) }, \ 623efd19b8fSGleb Smirnoff { IFM_IEEE80211 | IFM_IEEE80211_OFDM6, IF_Mbps(6) }, \ 624efd19b8fSGleb Smirnoff { IFM_IEEE80211 | IFM_IEEE80211_OFDM9, IF_Mbps(9) }, \ 625efd19b8fSGleb Smirnoff { IFM_IEEE80211 | IFM_IEEE80211_OFDM12, IF_Mbps(12) }, \ 626efd19b8fSGleb Smirnoff { IFM_IEEE80211 | IFM_IEEE80211_OFDM18, IF_Mbps(18) }, \ 627efd19b8fSGleb Smirnoff { IFM_IEEE80211 | IFM_IEEE80211_OFDM24, IF_Mbps(24) }, \ 628efd19b8fSGleb Smirnoff { IFM_IEEE80211 | IFM_IEEE80211_OFDM36, IF_Mbps(36) }, \ 629efd19b8fSGleb Smirnoff { IFM_IEEE80211 | IFM_IEEE80211_OFDM48, IF_Mbps(48) }, \ 630efd19b8fSGleb Smirnoff { IFM_IEEE80211 | IFM_IEEE80211_OFDM54, IF_Mbps(54) }, \ 631efd19b8fSGleb Smirnoff { IFM_IEEE80211 | IFM_IEEE80211_OFDM72, IF_Mbps(72) }, \ 632efd19b8fSGleb Smirnoff \ 633efd19b8fSGleb Smirnoff { 0, 0 }, \ 634efd19b8fSGleb Smirnoff } 635efd19b8fSGleb Smirnoff 636e4bd8f10SAndre Oppermann /* 637e4bd8f10SAndre Oppermann * Status descriptions for the various media types. 638e4bd8f10SAndre Oppermann */ 639e4bd8f10SAndre Oppermann struct ifmedia_status_description { 640e4bd8f10SAndre Oppermann int ifms_type; 641e4bd8f10SAndre Oppermann int ifms_valid; 642e4bd8f10SAndre Oppermann int ifms_bit; 643e4bd8f10SAndre Oppermann const char *ifms_string[2]; 644e4bd8f10SAndre Oppermann }; 645e4bd8f10SAndre Oppermann 646e4bd8f10SAndre Oppermann #define IFM_STATUS_DESC(ifms, bit) \ 647e4bd8f10SAndre Oppermann (ifms)->ifms_string[((ifms)->ifms_bit & (bit)) ? 1 : 0] 648e4bd8f10SAndre Oppermann 649e4bd8f10SAndre Oppermann #define IFM_STATUS_DESCRIPTIONS { \ 650e4bd8f10SAndre Oppermann { IFM_ETHER, IFM_AVALID, IFM_ACTIVE, \ 651e4bd8f10SAndre Oppermann { "no carrier", "active" } }, \ 652e4bd8f10SAndre Oppermann { IFM_FDDI, IFM_AVALID, IFM_ACTIVE, \ 653e4bd8f10SAndre Oppermann { "no ring", "inserted" } }, \ 654e4bd8f10SAndre Oppermann { IFM_TOKEN, IFM_AVALID, IFM_ACTIVE, \ 655e4bd8f10SAndre Oppermann { "no ring", "inserted" } }, \ 656e4bd8f10SAndre Oppermann { IFM_IEEE80211, IFM_AVALID, IFM_ACTIVE, \ 657e4bd8f10SAndre Oppermann { "no network", "active" } }, \ 658e4bd8f10SAndre Oppermann { IFM_ATM, IFM_AVALID, IFM_ACTIVE, \ 659e4bd8f10SAndre Oppermann { "no network", "active" } }, \ 660e4bd8f10SAndre Oppermann { IFM_CARP, IFM_AVALID, IFM_ACTIVE, \ 661e4bd8f10SAndre Oppermann { "backup", "master" } }, \ 662e4bd8f10SAndre Oppermann { 0, 0, 0, \ 663e4bd8f10SAndre Oppermann { NULL, NULL } } \ 664e4bd8f10SAndre Oppermann } 665f94bb788SPeter Wemm #endif /* _NET_IF_MEDIA_H_ */ 666