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