Merge from vendor branch LESS:
[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
156 #define IFM_ETH_MASTER  0x00000100      /* master mode (1000baseT) */
157 #define IFM_ETH_RXPAUSE 0x00000200      /* receive PAUSE frames */
158 #define IFM_ETH_TXPAUSE 0x00000400      /* transmit PAUSE frames */
159
160 /*
161  * IEEE 802.11 Wireless
162  */
163 #define IFM_IEEE80211   0x00000080
164 /* NB: 0,1,2 are auto, manual, none defined below */
165 #define IFM_IEEE80211_FH1       3       /* Frequency Hopping 1Mbps */
166 #define IFM_IEEE80211_FH2       4       /* Frequency Hopping 2Mbps */
167 #define IFM_IEEE80211_DS1       5       /* Direct Sequence 1Mbps */
168 #define IFM_IEEE80211_DS2       6       /* Direct Sequence 2Mbps */
169 #define IFM_IEEE80211_DS5       7       /* Direct Sequence 5.5Mbps */
170 #define IFM_IEEE80211_DS11      8       /* Direct Sequence 11Mbps */
171 #define IFM_IEEE80211_DS22      9       /* Direct Sequence 22Mbps */
172 #define IFM_IEEE80211_OFDM6     10      /* OFDM 6Mbps */
173 #define IFM_IEEE80211_OFDM9     11      /* OFDM 9Mbps */
174 #define IFM_IEEE80211_OFDM12    12      /* OFDM 12Mbps */
175 #define IFM_IEEE80211_OFDM18    13      /* OFDM 18Mbps */
176 #define IFM_IEEE80211_OFDM24    14      /* OFDM 24Mbps */
177 #define IFM_IEEE80211_OFDM36    15      /* OFDM 36Mbps */
178 #define IFM_IEEE80211_OFDM48    16      /* OFDM 48Mbps */
179 #define IFM_IEEE80211_OFDM54    17      /* OFDM 54Mbps */
180 #define IFM_IEEE80211_OFDM72    18      /* OFDM 72Mbps */
181 #define IFM_IEEE80211_DS354k    19      /* Direct Sequence 354Kbps */
182 #define IFM_IEEE80211_DS512k    20      /* Direct Sequence 512Kbps */
183
184 #define IFM_IEEE80211_ADHOC     0x00000100      /* Operate in Adhoc mode */
185 #define IFM_IEEE80211_HOSTAP    0x00000200      /* Operate in Host AP mode */
186 #define IFM_IEEE80211_IBSS      0x00000400      /* Operate in IBSS mode */
187 #define IFM_IEEE80211_IBSSMASTER 0x00000800     /* Operate as an IBSS master */
188 #define IFM_IEEE80211_TURBO     0x00001000      /* Operate in turbo mode */
189 #define IFM_IEEE80211_MONITOR   0x00002000      /* Operate in monitor mode */
190
191 /* operating mode for multi-mode devices */
192 #define IFM_IEEE80211_11A       0x00010000      /* 5Ghz, OFDM mode */
193 #define IFM_IEEE80211_11B       0x00020000      /* Direct Sequence mode */
194 #define IFM_IEEE80211_11G       0x00030000      /* 2Ghz, OFDM mode */
195 #define IFM_IEEE80211_FH        0x00040000      /* 2Ghz, GFSK mode */
196
197 /*
198  * ATM
199  */
200 #define IFM_ATM                 0x000000a0
201 #define IFM_ATM_UNKNOWN         3
202 #define IFM_ATM_UTP_25          4
203 #define IFM_ATM_TAXI_100        5
204 #define IFM_ATM_TAXI_140        6
205 #define IFM_ATM_MM_155          7
206 #define IFM_ATM_SM_155          8
207 #define IFM_ATM_UTP_155         9
208 #define IFM_ATM_MM_622          10
209 #define IFM_ATM_SM_622          11
210 #define IFM_ATM_VIRTUAL         12
211 #define IFM_ATM_SDH             0x00000100      /* SDH instead of SONET */
212 #define IFM_ATM_NOSCRAMB        0x00000200      /* no scrambling */
213 #define IFM_ATM_UNASSIGNED      0x00000400      /* unassigned cells */
214
215 /*
216  * CARP Common Address Redundancy Protocol
217  */
218 #define IFM_CARP        0x000000c0
219
220 /*
221  * Shared media sub-types
222  */
223 #define IFM_AUTO        0               /* Autoselect best media */
224 #define IFM_MANUAL      1               /* Jumper/dipswitch selects media */
225 #define IFM_NONE        2               /* Deselect all media */
226
227 /*
228  * Shared options
229  */
230 #define IFM_FDX         0x00100000      /* Force full duplex */
231 #define IFM_HDX         0x00200000      /* Force half duplex */
232 #define IFM_FLOW        0x00400000      /* enable hardware flow control */
233 #define IFM_FLAG0       0x01000000      /* Driver defined flag */
234 #define IFM_FLAG1       0x02000000      /* Driver defined flag */
235 #define IFM_FLAG2       0x04000000      /* Driver defined flag */
236 #define IFM_LOOP        0x08000000      /* Put hardware in loopback */
237
238 /*
239  * Masks
240  */
241 #define IFM_NMASK       0x000000e0      /* Network type */
242 #define IFM_TMASK       0x0000001f      /* Media sub-type */
243 #define IFM_IMASK       0xf0000000      /* Instance */
244 #define IFM_ISHIFT      28              /* Instance shift */
245 #define IFM_OMASK       0x0000ff00      /* Type specific options */
246 #define IFM_MMASK       0x00070000      /* Mode */
247 #define IFM_MSHIFT      16              /* Mode shift */
248 #define IFM_GMASK       0x0ff00000      /* Global options */
249         /* Ethernet flow control mask */
250 #define IFM_ETH_FMASK   (IFM_FLOW | IFM_ETH_RXPAUSE | IFM_ETH_TXPAUSE)
251
252 #define IFM_NMIN        IFM_ETHER       /* lowest Network type */
253 #define IFM_NMAX        IFM_NMASK       /* highest Network type */
254
255 /*
256  * Status bits
257  */
258 #define IFM_AVALID      0x00000001      /* Active bit valid */
259 #define IFM_ACTIVE      0x00000002      /* Interface attached to working net */
260
261 /*
262  * Macros to extract various bits of information from the media word.
263  */
264 #define IFM_TYPE(x)         ((x) & IFM_NMASK)
265 #define IFM_SUBTYPE(x)      ((x) & IFM_TMASK)
266 #define IFM_TYPE_OPTIONS(x) ((x) & IFM_OMASK)
267 #define IFM_INST(x)         (((x) & IFM_IMASK) >> IFM_ISHIFT)
268 #define IFM_OPTIONS(x)      ((x) & (IFM_OMASK|IFM_GMASK))
269 #define IFM_MODE(x)         ((x) & IFM_MMASK)
270
271 #define IFM_INST_MAX    IFM_INST(IFM_IMASK)
272
273 /*
274  * Macro to create a media word.
275  */
276 #define IFM_MAKEWORD(type, subtype, options, instance)                  \
277         ((type) | (subtype) | (options) | ((instance) << IFM_ISHIFT))
278 #define IFM_MAKEMODE(mode) \
279         (((mode) << IFM_MSHIFT) & IFM_MMASK)
280
281 /*
282  * NetBSD extension not defined in the BSDI API.  This is used in various
283  * places to get the canonical description for a given type/subtype.
284  *
285  * NOTE: all but the top-level type descriptions must contain NO whitespace!
286  * Otherwise, parsing these in ifconfig(8) would be a nightmare.
287  */
288 struct ifmedia_description {
289         int     ifmt_word;              /* word value; may be masked */
290         const char *ifmt_string;        /* description */
291 };
292
293 #define IFM_TYPE_DESCRIPTIONS {                                         \
294         { IFM_ETHER,            "Ethernet" },                           \
295         { IFM_IEEE80211,        "IEEE 802.11 Wireless Ethernet" },      \
296         { IFM_CARP,             "Common Address Redundancy Protocol" }, \
297         { 0, NULL },                                                    \
298 }
299
300 #define IFM_SUBTYPE_ETHERNET_DESCRIPTIONS {                             \
301         { IFM_10_T,     "10baseT/UTP" },                                \
302         { IFM_10_2,     "10base2/BNC" },                                \
303         { IFM_10_5,     "10base5/AUI" },                                \
304         { IFM_100_TX,   "100baseTX" },                                  \
305         { IFM_100_FX,   "100baseFX" },                                  \
306         { IFM_100_T4,   "100baseT4" },                                  \
307         { IFM_100_VG,   "100baseVG" },                                  \
308         { IFM_100_T2,   "100baseT2" },                                  \
309         { IFM_1000_FX,  "1000baseFX" },                                 \
310         { IFM_10_STP,   "10baseSTP" },                                  \
311         { IFM_10_FL,    "10baseFL" },                                   \
312         { IFM_1000_SX,  "1000baseSX" },                                 \
313         { IFM_1000_LX,  "1000baseLX" },                                 \
314         { IFM_1000_CX,  "1000baseCX" },                                 \
315         { IFM_1000_T,   "1000baseT" },                                  \
316         { IFM_HPNA_1,   "homePNA" },                                    \
317         { 0, NULL },                                                    \
318 }
319
320 #define IFM_SUBTYPE_ETHERNET_ALIASES {                                  \
321         { IFM_10_T,     "UTP" },                                        \
322         { IFM_10_T,     "10UTP" },                                      \
323         { IFM_10_2,     "BNC" },                                        \
324         { IFM_10_2,     "10BNC" },                                      \
325         { IFM_10_5,     "AUI" },                                        \
326         { IFM_10_5,     "10AUI" },                                      \
327         { IFM_100_TX,   "100TX" },                                      \
328         { IFM_100_FX,   "100FX" },                                      \
329         { IFM_100_T4,   "100T4" },                                      \
330         { IFM_100_VG,   "100VG" },                                      \
331         { IFM_100_T2,   "100T2" },                                      \
332         { IFM_1000_FX,  "1000FX" },                                     \
333         { IFM_10_STP,   "10STP" },                                      \
334         { IFM_10_FL,    "10FL" },                                       \
335         { IFM_1000_SX,  "1000SX" },                                     \
336         { IFM_1000_LX,  "1000LX" },                                     \
337         { IFM_1000_CX,  "1000CX" },                                     \
338         { IFM_1000_T,   "1000T" },                                      \
339         { 0, NULL },                                                    \
340 }
341
342 #define IFM_SUBTYPE_ETHERNET_OPTION_DESCRIPTIONS {                      \
343         { 0, NULL },                                                    \
344 }
345
346 #define IFM_SUBTYPE_IEEE80211_DESCRIPTIONS {                            \
347         { IFM_IEEE80211_FH1, "FH/1Mbps" },                              \
348         { IFM_IEEE80211_FH2, "FH/2Mbps" },                              \
349         { IFM_IEEE80211_DS1, "DS/1Mbps" },                              \
350         { IFM_IEEE80211_DS2, "DS/2Mbps" },                              \
351         { IFM_IEEE80211_DS5, "DS/5.5Mbps" },                            \
352         { IFM_IEEE80211_DS11, "DS/11Mbps" },                            \
353         { IFM_IEEE80211_DS22, "DS/22Mbps" },                            \
354         { IFM_IEEE80211_OFDM6, "OFDM/6Mbps" },                          \
355         { IFM_IEEE80211_OFDM9, "OFDM/9Mbps" },                          \
356         { IFM_IEEE80211_OFDM12, "OFDM/12Mbps" },                        \
357         { IFM_IEEE80211_OFDM18, "OFDM/18Mbps" },                        \
358         { IFM_IEEE80211_OFDM24, "OFDM/24Mbps" },                        \
359         { IFM_IEEE80211_OFDM36, "OFDM/36Mbps" },                        \
360         { IFM_IEEE80211_OFDM48, "OFDM/48Mbps" },                        \
361         { IFM_IEEE80211_OFDM54, "OFDM/54Mbps" },                        \
362         { IFM_IEEE80211_OFDM72, "OFDM/72Mbps" },                        \
363         { 0, NULL },                                                    \
364 }
365
366 #define IFM_SUBTYPE_IEEE80211_ALIASES {                                 \
367         { IFM_IEEE80211_FH1, "FH1" },                                   \
368         { IFM_IEEE80211_FH2, "FH2" },                                   \
369         { IFM_IEEE80211_FH1, "FrequencyHopping/1Mbps" },                \
370         { IFM_IEEE80211_FH2, "FrequencyHopping/2Mbps" },                \
371         { IFM_IEEE80211_DS1, "DS1" },                                   \
372         { IFM_IEEE80211_DS2, "DS2" },                                   \
373         { IFM_IEEE80211_DS5, "DS5.5" },                                 \
374         { IFM_IEEE80211_DS11, "DS11" },                                 \
375         { IFM_IEEE80211_DS22, "DS22" },                                 \
376         { IFM_IEEE80211_DS1, "DirectSequence/1Mbps" },                  \
377         { IFM_IEEE80211_DS2, "DirectSequence/2Mbps" },                  \
378         { IFM_IEEE80211_DS5, "DirectSequence/5.5Mbps" },                \
379         { IFM_IEEE80211_DS11, "DirectSequence/11Mbps" },                \
380         { IFM_IEEE80211_DS22, "DirectSequence/22Mbps" },                \
381         { IFM_IEEE80211_OFDM6, "OFDM6" },                               \
382         { IFM_IEEE80211_OFDM9, "OFDM9" },                               \
383         { IFM_IEEE80211_OFDM12, "OFDM12" },                             \
384         { IFM_IEEE80211_OFDM18, "OFDM18" },                             \
385         { IFM_IEEE80211_OFDM24, "OFDM24" },                             \
386         { IFM_IEEE80211_OFDM36, "OFDM36" },                             \
387         { IFM_IEEE80211_OFDM48, "OFDM48" },                             \
388         { IFM_IEEE80211_OFDM54, "OFDM54" },                             \
389         { IFM_IEEE80211_OFDM72, "OFDM72" },                             \
390         { 0, NULL },                                                    \
391 }
392
393 #define IFM_SUBTYPE_IEEE80211_OPTION_DESCRIPTIONS {                     \
394         { IFM_IEEE80211_ADHOC, "adhoc" },                               \
395         { IFM_IEEE80211_HOSTAP, "hostap" },                             \
396         { IFM_IEEE80211_IBSS, "ibss" },                                 \
397         { IFM_IEEE80211_IBSSMASTER, "ibss-master" },                    \
398         { IFM_IEEE80211_TURBO, "turbo" },                               \
399         { IFM_IEEE80211_MONITOR, "monitor" },                           \
400         { 0, NULL },                                                    \
401 }
402
403 #define IFM_SUBTYPE_IEEE80211_MODE_DESCRIPTIONS {                       \
404         { IFM_AUTO, "autoselect" },                                     \
405         { IFM_IEEE80211_11A, "11a" },                                   \
406         { IFM_IEEE80211_11B, "11b" },                                   \
407         { IFM_IEEE80211_11G, "11g" },                                   \
408         { IFM_IEEE80211_FH, "fh" },                                     \
409         { 0, NULL },                                                    \
410 }
411
412 #define IFM_SUBTYPE_IEEE80211_MODE_ALIASES {                            \
413         { IFM_AUTO, "auto" },                                           \
414         { 0, NULL },                                                    \
415 }
416
417 # define IFM_SUBTYPE_ATM_DESCRIPTIONS {                                 \
418         { IFM_ATM_UNKNOWN,      "Unknown" },                            \
419         { IFM_ATM_UTP_25,       "UTP/25.6MBit" },                       \
420         { IFM_ATM_TAXI_100,     "Taxi/100MBit" },                       \
421         { IFM_ATM_TAXI_140,     "Taxi/140MBit" },                       \
422         { IFM_ATM_MM_155,       "Multi-mode/155MBit" },                 \
423         { IFM_ATM_SM_155,       "Single-mode/155MBit" },                \
424         { IFM_ATM_UTP_155,      "UTP/155MBit" },                        \
425         { IFM_ATM_MM_622,       "Multi-mode/622MBit" },                 \
426         { IFM_ATM_SM_622,       "Single-mode/622MBit" },                \
427         { IFM_ATM_VIRTUAL,      "Virtual" },                            \
428         { 0, NULL },                                                    \
429 }
430
431 # define IFM_SUBTYPE_ATM_ALIASES {                                      \
432         { IFM_ATM_UNKNOWN,      "UNKNOWN" },                            \
433         { IFM_ATM_UTP_25,       "UTP-25" },                             \
434         { IFM_ATM_TAXI_100,     "TAXI-100" },                           \
435         { IFM_ATM_TAXI_140,     "TAXI-140" },                           \
436         { IFM_ATM_MM_155,       "MM-155" },                             \
437         { IFM_ATM_SM_155,       "SM-155" },                             \
438         { IFM_ATM_UTP_155,      "UTP-155" },                            \
439         { IFM_ATM_MM_622,       "MM-622" },                             \
440         { IFM_ATM_SM_622,       "SM-622" },                             \
441         { IFM_ATM_VIRTUAL,      "VIRTUAL" },                            \
442         { 0, NULL },                                                    \
443 }
444
445 #define IFM_SUBTYPE_ATM_OPTION_DESCRIPTIONS {                           \
446         { IFM_ATM_SDH, "SDH" },                                         \
447         { IFM_ATM_NOSCRAMB, "Noscramb" },                               \
448         { IFM_ATM_UNASSIGNED, "Unassigned" },                           \
449         { 0, NULL },                                                    \
450 }
451
452
453 #define IFM_SUBTYPE_SHARED_DESCRIPTIONS {                               \
454         { IFM_AUTO,     "autoselect" },                                 \
455         { IFM_MANUAL,   "manual" },                                     \
456         { IFM_NONE,     "none" },                                       \
457         { 0, NULL },                                                    \
458 }
459
460 #define IFM_SUBTYPE_SHARED_ALIASES {                                    \
461         { IFM_AUTO,     "auto" },                                       \
462         { 0, NULL },                                                    \
463 }
464
465 #define IFM_SHARED_OPTION_DESCRIPTIONS {                                \
466         { IFM_FDX,      "full-duplex" },                                \
467         { IFM_HDX,      "half-duplex" },                                \
468         { IFM_FLAG0,    "flag0" },                                      \
469         { IFM_FLAG1,    "flag1" },                                      \
470         { IFM_FLAG2,    "flag2" },                                      \
471         { IFM_LOOP,     "hw-loopback" },                                \
472         { 0, NULL },                                                    \
473 }
474
475 /*
476  * Baudrate descriptions for the various media types.
477  */
478 struct ifmedia_baudrate {
479         int     ifmb_word;              /* media word */
480         int     ifmb_baudrate;          /* corresponding baudrate */
481 };
482
483 #define IFM_BAUDRATE_DESCRIPTIONS {                                     \
484         { IFM_ETHER|IFM_10_T,           IF_Mbps(10) },                  \
485         { IFM_ETHER|IFM_10_2,           IF_Mbps(10) },                  \
486         { IFM_ETHER|IFM_10_5,           IF_Mbps(10) },                  \
487         { IFM_ETHER|IFM_100_TX,         IF_Mbps(100) },                 \
488         { IFM_ETHER|IFM_100_FX,         IF_Mbps(100) },                 \
489         { IFM_ETHER|IFM_100_T4,         IF_Mbps(100) },                 \
490         { IFM_ETHER|IFM_100_VG,         IF_Mbps(100) },                 \
491         { IFM_ETHER|IFM_100_T2,         IF_Mbps(100) },                 \
492         { IFM_ETHER|IFM_1000_SX,        IF_Mbps(1000) },                \
493         { IFM_ETHER|IFM_10_STP,         IF_Mbps(10) },                  \
494         { IFM_ETHER|IFM_10_FL,          IF_Mbps(10) },                  \
495         { IFM_ETHER|IFM_1000_LX,        IF_Mbps(1000) },                \
496         { IFM_ETHER|IFM_1000_CX,        IF_Mbps(1000) },                \
497         { IFM_ETHER|IFM_1000_T,         IF_Mbps(1000) },                \
498         { IFM_ETHER|IFM_HPNA_1,         IF_Mbps(1) },                   \
499                                                                         \
500         { IFM_IEEE80211|IFM_IEEE80211_FH1, IF_Mbps(1) },                \
501         { IFM_IEEE80211|IFM_IEEE80211_FH2, IF_Mbps(2) },                \
502         { IFM_IEEE80211|IFM_IEEE80211_DS1, IF_Mbps(1) },                \
503         { IFM_IEEE80211|IFM_IEEE80211_DS2, IF_Mbps(2) },                \
504         { IFM_IEEE80211|IFM_IEEE80211_DS5, IF_Mbps(5) },                \
505         { IFM_IEEE80211|IFM_IEEE80211_DS11, IF_Mbps(11) },              \
506         { IFM_IEEE80211|IFM_IEEE80211_DS22, IF_Mbps(22) },              \
507         { IFM_IEEE80211|IFM_IEEE80211_OFDM6, IF_Mbps(6) },              \
508         { IFM_IEEE80211|IFM_IEEE80211_OFDM9, IF_Mbps(9) },              \
509         { IFM_IEEE80211|IFM_IEEE80211_OFDM12, IF_Mbps(12) },            \
510         { IFM_IEEE80211|IFM_IEEE80211_OFDM18, IF_Mbps(18) },            \
511         { IFM_IEEE80211|IFM_IEEE80211_OFDM24, IF_Mbps(24) },            \
512         { IFM_IEEE80211|IFM_IEEE80211_OFDM36, IF_Mbps(36) },            \
513         { IFM_IEEE80211|IFM_IEEE80211_OFDM48, IF_Mbps(48) },            \
514         { IFM_IEEE80211|IFM_IEEE80211_OFDM54, IF_Mbps(54) },            \
515         { IFM_IEEE80211|IFM_IEEE80211_OFDM72, IF_Mbps(72) },            \
516                                                                         \
517         { 0, 0 },                                                       \
518 }
519 #endif  /* _NET_IF_MEDIA_H_ */