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