route: Delete ortentry, SIOC{ADD,DEL}RT and RTM_OLD{ADD,DEL}
[dragonfly.git] / sys / net / if_media.h
blob25d68c83e64ea59d02e1f8fe887efafcdd4e3639
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 $ */
4 /*
5 * Copyright (c) 1997
6 * Jonathan Stone and Jason R. Thorpe. All rights reserved.
8 * This software is derived from information provided by Matt Thomas.
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.
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.
38 #ifndef _NET_IF_MEDIA_H_
39 #define _NET_IF_MEDIA_H_
41 #ifndef _SYS_TYPES_H_
42 #include <sys/types.h>
43 #endif
46 * Prototypes and definitions for BSD/OS-compatible network interface
47 * media selection.
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.
53 * Many thanks to Matt Thomas for providing the information necessary
54 * to implement this interface.
57 #ifdef _KERNEL
59 #ifndef _SYS_QUEUE_H_
60 #include <sys/queue.h>
61 #endif
63 struct ifnet;
64 struct ifreq;
65 struct ifmediareq;
68 * Driver callbacks for media status and change requests.
70 typedef int (*ifm_change_cb_t)(struct ifnet *ifp);
71 typedef void (*ifm_stat_cb_t)(struct ifnet *ifp, struct ifmediareq *req);
74 * In-kernel representation of a single supported media type.
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 */
84 * One of these goes into a network interface's softc structure.
85 * It is used to keep general media state.
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 */
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);
100 /* Remove all mediums from a struct ifmedia. */
101 void ifmedia_removeall( struct ifmedia *ifm);
103 /* Add one supported medium to a struct ifmedia. */
104 void ifmedia_add(struct ifmedia *ifm, int mword, int data, void *aux);
105 int ifmedia_add_nodup(struct ifmedia *ifm, int mword, int data, void *aux);
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);
111 /* Set default media type on initialization. */
112 void ifmedia_set(struct ifmedia *ifm, int mword);
113 int ifmedia_tryset(struct ifmedia *ifm, int mword);
115 /* Common ioctl function for getting/setting media, called by driver. */
116 int ifmedia_ioctl(struct ifnet *ifp, struct ifreq *ifr,
117 struct ifmedia *ifm, u_long cmd);
119 /* Compute baudrate for a given media. */
120 uint64_t ifmedia_baudrate(int);
121 #endif /*_KERNEL */
124 * if_media Options word:
125 * Bits Use
126 * ---- -------
127 * 0-4 Media variant MAX SUBTYPE == 31!!
128 * 5-7 Media type
129 * 8-15 Type specific options
130 * 16-18 Mode (for multi-mode devices)
131 * 19 RFU
132 * 20-27 Shared (global) options
133 * 28-31 Instance
137 * Ethernet
139 #define IFM_ETHER 0x00000020
140 #define IFM_10_T 3 /* 10BaseT - RJ45 */
141 #define IFM_10_2 4 /* 10Base2 - Thinnet */
142 #define IFM_10_5 5 /* 10Base5 - AUI */
143 #define IFM_100_TX 6 /* 100BaseTX - RJ45 */
144 #define IFM_100_FX 7 /* 100BaseFX - Fiber */
145 #define IFM_100_T4 8 /* 100BaseT4 - 4 pair cat 3 */
146 #define IFM_100_VG 9 /* 100VG-AnyLAN */
147 #define IFM_100_T2 10 /* 100BaseT2 */
148 #define IFM_1000_FX 11 /* 1000BaseFX - gigabit over fiber */
149 #define IFM_10_STP 12 /* 10BaseT over shielded TP */
150 #define IFM_10_FL 13 /* 10baseFL - Fiber */
151 #define IFM_1000_SX 14 /* 1000BaseSX Multi-mode Fiber */
152 #define IFM_1000_LX 15 /* 1000BaseLX Single-mode Fiber */
153 #define IFM_1000_CX 16 /* 1000BaseCX 150ohm STP */
154 #define IFM_1000_T 17 /* 1000BaseT 4 pair cat 5 */
155 #define IFM_HPNA_1 18 /* HomePNA media for ethernet frames */
156 #define IFM_10G_LR 18 /* 10GBase-LR 1310nm Single-mode */
157 #define IFM_10G_SR 19 /* 10GBase-SR 850nm Multi-mode */
158 #define IFM_10G_CX4 20 /* 10GBase CX4 copper */
159 #define IFM_2500_SX 21 /* 2500BaseSX - multi-mode fiber */
160 #define IFM_10G_TWINAX 22 /* 10GBase Twinax copper */
161 #define IFM_10G_TWINAX_LONG 23 /* 10GBase Twinax Long copper */
162 #define IFM_10G_LRM 24 /* 10GBase-LRM 850nm Multi-mode */
163 #define IFM_UNKNOWN 25 /* media types not defined yet */
164 #define IFM_10G_T 26 /* 10GBase-T - RJ45 */
165 #define IFM_40G_CR4 27 /* 40GBase-CR4 */
166 #define IFM_40G_SR4 28 /* 40GBase-SR4 */
167 #define IFM_40G_LR4 29 /* 40GBase-LR4 */
169 #define IFM_ETH_MASTER 0x00000100 /* master mode (1000baseT) */
170 #define IFM_ETH_RXPAUSE 0x00000200 /* receive PAUSE frames */
171 #define IFM_ETH_TXPAUSE 0x00000400 /* transmit PAUSE frames */
172 #define IFM_ETH_FORCEPAUSE 0x00000800 /* force flow control settings */
175 * IEEE 802.11 Wireless
177 #define IFM_IEEE80211 0x00000080
178 /* NB: 0,1,2 are auto, manual, none defined below */
179 #define IFM_IEEE80211_FH1 3 /* Frequency Hopping 1Mbps */
180 #define IFM_IEEE80211_FH2 4 /* Frequency Hopping 2Mbps */
181 #define IFM_IEEE80211_DS1 5 /* Direct Sequence 1Mbps */
182 #define IFM_IEEE80211_DS2 6 /* Direct Sequence 2Mbps */
183 #define IFM_IEEE80211_DS5 7 /* Direct Sequence 5.5Mbps */
184 #define IFM_IEEE80211_DS11 8 /* Direct Sequence 11Mbps */
185 #define IFM_IEEE80211_DS22 9 /* Direct Sequence 22Mbps */
186 #define IFM_IEEE80211_OFDM6 10 /* OFDM 6Mbps */
187 #define IFM_IEEE80211_OFDM9 11 /* OFDM 9Mbps */
188 #define IFM_IEEE80211_OFDM12 12 /* OFDM 12Mbps */
189 #define IFM_IEEE80211_OFDM18 13 /* OFDM 18Mbps */
190 #define IFM_IEEE80211_OFDM24 14 /* OFDM 24Mbps */
191 #define IFM_IEEE80211_OFDM36 15 /* OFDM 36Mbps */
192 #define IFM_IEEE80211_OFDM48 16 /* OFDM 48Mbps */
193 #define IFM_IEEE80211_OFDM54 17 /* OFDM 54Mbps */
194 #define IFM_IEEE80211_OFDM72 18 /* OFDM 72Mbps */
195 #define IFM_IEEE80211_DS354k 19 /* Direct Sequence 354Kbps */
196 #define IFM_IEEE80211_DS512k 20 /* Direct Sequence 512Kbps */
197 #define IFM_IEEE80211_OFDM3 21 /* OFDM 3Mbps */
198 #define IFM_IEEE80211_OFDM4 22 /* OFDM 4.5Mbps */
199 #define IFM_IEEE80211_OFDM27 23 /* OFDM 27Mbps */
200 /* NB: not enough bits to express MCS fully */
201 #define IFM_IEEE80211_MCS 24 /* HT MCS rate */
203 #define IFM_IEEE80211_ADHOC 0x00000100 /* Operate in Adhoc mode */
204 #define IFM_IEEE80211_HOSTAP 0x00000200 /* Operate in Host AP mode */
205 #define IFM_IEEE80211_IBSS 0x00000400 /* Operate in IBSS mode */
206 #define IFM_IEEE80211_WDS 0x00000800 /* Operate in WDS mode */
207 #define IFM_IEEE80211_TURBO 0x00001000 /* Operate in turbo mode */
208 #define IFM_IEEE80211_MONITOR 0x00002000 /* Operate in monitor mode */
209 #define IFM_IEEE80211_MBSS 0x00004000 /* Operate in MBSS mode */
211 /* operating mode for multi-mode devices */
212 #define IFM_IEEE80211_11A 0x00010000 /* 5Ghz, OFDM mode */
213 #define IFM_IEEE80211_11B 0x00020000 /* Direct Sequence mode */
214 #define IFM_IEEE80211_11G 0x00030000 /* 2Ghz, CCK mode */
215 #define IFM_IEEE80211_FH 0x00040000 /* 2Ghz, GFSK mode */
216 #define IFM_IEEE80211_11NA 0x00050000 /* 5Ghz, HT mode */
217 #define IFM_IEEE80211_11NG 0x00060000 /* 2Ghz, HT mode */
221 * ATM
223 #define IFM_ATM 0x000000a0
224 #define IFM_ATM_UNKNOWN 3
225 #define IFM_ATM_UTP_25 4
226 #define IFM_ATM_TAXI_100 5
227 #define IFM_ATM_TAXI_140 6
228 #define IFM_ATM_MM_155 7
229 #define IFM_ATM_SM_155 8
230 #define IFM_ATM_UTP_155 9
231 #define IFM_ATM_MM_622 10
232 #define IFM_ATM_SM_622 11
233 #define IFM_ATM_VIRTUAL 12
234 #define IFM_ATM_SDH 0x00000100 /* SDH instead of SONET */
235 #define IFM_ATM_NOSCRAMB 0x00000200 /* no scrambling */
236 #define IFM_ATM_UNASSIGNED 0x00000400 /* unassigned cells */
239 * CARP Common Address Redundancy Protocol
241 #define IFM_CARP 0x000000c0
244 * Shared media sub-types
246 #define IFM_AUTO 0 /* Autoselect best media */
247 #define IFM_MANUAL 1 /* Jumper/dipswitch selects media */
248 #define IFM_NONE 2 /* Deselect all media */
251 * Shared options
253 #define IFM_FDX 0x00100000 /* Force full duplex */
254 #define IFM_HDX 0x00200000 /* Force half duplex */
255 #define IFM_FLOW 0x00400000 /* enable hardware flow control */
256 #define IFM_FLAG0 0x01000000 /* Driver defined flag */
257 #define IFM_FLAG1 0x02000000 /* Driver defined flag */
258 #define IFM_FLAG2 0x04000000 /* Driver defined flag */
259 #define IFM_LOOP 0x08000000 /* Put hardware in loopback */
262 * Masks
264 #define IFM_NMASK 0x000000e0 /* Network type */
265 #define IFM_TMASK 0x0000001f /* Media sub-type */
266 #define IFM_IMASK 0xf0000000 /* Instance */
267 #define IFM_ISHIFT 28 /* Instance shift */
268 #define IFM_OMASK 0x0000ff00 /* Type specific options */
269 #define IFM_MMASK 0x00070000 /* Mode */
270 #define IFM_MSHIFT 16 /* Mode shift */
271 #define IFM_GMASK 0x0ff00000 /* Global options */
272 /* Ethernet flow control mask */
273 #define IFM_ETH_FCMASK (IFM_ETH_RXPAUSE | IFM_ETH_TXPAUSE | IFM_ETH_FORCEPAUSE)
274 #define IFM_ETH_FMASK (IFM_FLOW | IFM_ETH_FCMASK)
276 #define IFM_NMIN IFM_ETHER /* lowest Network type */
277 #define IFM_NMAX IFM_NMASK /* highest Network type */
280 * Status bits
282 #define IFM_AVALID 0x00000001 /* Active bit valid */
283 #define IFM_ACTIVE 0x00000002 /* Interface attached to working net */
286 * Macros to extract various bits of information from the media word.
288 #define IFM_TYPE(x) ((x) & IFM_NMASK)
289 #define IFM_SUBTYPE(x) ((x) & IFM_TMASK)
290 #define IFM_TYPE_OPTIONS(x) ((x) & IFM_OMASK)
291 #define IFM_INST(x) (((x) & IFM_IMASK) >> IFM_ISHIFT)
292 #define IFM_OPTIONS(x) ((x) & (IFM_OMASK|IFM_GMASK))
293 #define IFM_MODE(x) ((x) & IFM_MMASK)
295 #define IFM_INST_MAX IFM_INST(IFM_IMASK)
298 * Macro to create a media word.
300 #define IFM_MAKEWORD(type, subtype, options, instance) \
301 ((type) | (subtype) | (options) | ((instance) << IFM_ISHIFT))
302 #define IFM_MAKEMODE(mode) \
303 (((mode) << IFM_MSHIFT) & IFM_MMASK)
306 * NetBSD extension not defined in the BSDI API. This is used in various
307 * places to get the canonical description for a given type/subtype.
309 * NOTE: all but the top-level type descriptions must contain NO whitespace!
310 * Otherwise, parsing these in ifconfig(8) would be a nightmare.
312 struct ifmedia_description {
313 int ifmt_word; /* word value; may be masked */
314 const char *ifmt_string; /* description */
317 #define IFM_TYPE_DESCRIPTIONS { \
318 { IFM_ETHER, "Ethernet" }, \
319 { IFM_IEEE80211, "IEEE 802.11 Wireless Ethernet" }, \
320 { IFM_CARP, "Common Address Redundancy Protocol" }, \
321 { 0, NULL }, \
324 #define IFM_SUBTYPE_ETHERNET_DESCRIPTIONS { \
325 { IFM_10_T, "10baseT/UTP" }, \
326 { IFM_10_2, "10base2/BNC" }, \
327 { IFM_10_5, "10base5/AUI" }, \
328 { IFM_100_TX, "100baseTX" }, \
329 { IFM_100_FX, "100baseFX" }, \
330 { IFM_100_T4, "100baseT4" }, \
331 { IFM_100_VG, "100baseVG" }, \
332 { IFM_100_T2, "100baseT2" }, \
333 { IFM_1000_FX, "1000baseFX" }, \
334 { IFM_10_STP, "10baseSTP" }, \
335 { IFM_10_FL, "10baseFL" }, \
336 { IFM_1000_SX, "1000baseSX" }, \
337 { IFM_1000_LX, "1000baseLX" }, \
338 { IFM_1000_CX, "1000baseCX" }, \
339 { IFM_1000_T, "1000baseT" }, \
340 { IFM_HPNA_1, "homePNA" }, \
341 { IFM_10G_LR, "10Gbase-LR" }, \
342 { IFM_10G_SR, "10Gbase-SR" }, \
343 { IFM_10G_CX4, "10Gbase-CX4" }, \
344 { IFM_2500_SX, "2500BaseSX" }, \
345 { IFM_10G_LRM, "10Gbase-LRM" }, \
346 { IFM_10G_TWINAX, "10Gbase-Twinax" }, \
347 { IFM_10G_TWINAX_LONG, "10Gbase-Twinax-Long" }, \
348 { IFM_UNKNOWN, "Unknown" }, \
349 { IFM_10G_T, "10Gbase-T" }, \
350 { IFM_40G_CR4, "40Gbase-CR4" }, \
351 { IFM_40G_SR4, "40Gbase-SR4" }, \
352 { IFM_40G_LR4, "40Gbase-LR4" }, \
353 { 0, NULL }, \
356 #define IFM_SUBTYPE_ETHERNET_ALIASES { \
357 { IFM_10_T, "UTP" }, \
358 { IFM_10_T, "10UTP" }, \
359 { IFM_10_2, "BNC" }, \
360 { IFM_10_2, "10BNC" }, \
361 { IFM_10_5, "AUI" }, \
362 { IFM_10_5, "10AUI" }, \
363 { IFM_100_TX, "100TX" }, \
364 { IFM_100_FX, "100FX" }, \
365 { IFM_100_T4, "100T4" }, \
366 { IFM_100_VG, "100VG" }, \
367 { IFM_100_T2, "100T2" }, \
368 { IFM_1000_FX, "1000FX" }, \
369 { IFM_10_STP, "10STP" }, \
370 { IFM_10_FL, "10FL" }, \
371 { IFM_1000_SX, "1000SX" }, \
372 { IFM_1000_LX, "1000LX" }, \
373 { IFM_1000_CX, "1000CX" }, \
374 { IFM_1000_T, "1000T" }, \
375 { IFM_2500_SX, "2500SX" }, \
376 { 0, NULL }, \
379 #define IFM_SUBTYPE_ETHERNET_OPTION_DESCRIPTIONS { \
380 { IFM_ETH_MASTER, "master" }, \
381 { IFM_ETH_RXPAUSE, "rxpause" }, \
382 { IFM_ETH_TXPAUSE, "txpause" }, \
383 { IFM_ETH_FORCEPAUSE, "forcepause" }, \
384 { 0, NULL }, \
387 #define IFM_SUBTYPE_ETHERNET_OPTION_ALIAS { \
388 { IFM_ETH_TXPAUSE | IFM_ETH_RXPAUSE, "flowcontrol" }, \
389 { 0, NULL }, \
392 #define IFM_SUBTYPE_IEEE80211_DESCRIPTIONS { \
393 { IFM_IEEE80211_FH1, "FH/1Mbps" }, \
394 { IFM_IEEE80211_FH2, "FH/2Mbps" }, \
395 { IFM_IEEE80211_DS1, "DS/1Mbps" }, \
396 { IFM_IEEE80211_DS2, "DS/2Mbps" }, \
397 { IFM_IEEE80211_DS5, "DS/5.5Mbps" }, \
398 { IFM_IEEE80211_DS11, "DS/11Mbps" }, \
399 { IFM_IEEE80211_DS22, "DS/22Mbps" }, \
400 { IFM_IEEE80211_OFDM6, "OFDM/6Mbps" }, \
401 { IFM_IEEE80211_OFDM9, "OFDM/9Mbps" }, \
402 { IFM_IEEE80211_OFDM12, "OFDM/12Mbps" }, \
403 { IFM_IEEE80211_OFDM18, "OFDM/18Mbps" }, \
404 { IFM_IEEE80211_OFDM24, "OFDM/24Mbps" }, \
405 { IFM_IEEE80211_OFDM36, "OFDM/36Mbps" }, \
406 { IFM_IEEE80211_OFDM48, "OFDM/48Mbps" }, \
407 { IFM_IEEE80211_OFDM54, "OFDM/54Mbps" }, \
408 { IFM_IEEE80211_OFDM72, "OFDM/72Mbps" }, \
409 { IFM_IEEE80211_DS354k, "DS/354Kbps" }, \
410 { IFM_IEEE80211_DS512k, "DS/512Kbps" }, \
411 { IFM_IEEE80211_OFDM3, "OFDM/3Mbps" }, \
412 { IFM_IEEE80211_OFDM4, "OFDM/4.5Mbps" }, \
413 { IFM_IEEE80211_OFDM27, "OFDM/27Mbps" }, \
414 { IFM_IEEE80211_MCS, "MCS" }, \
415 { 0, NULL }, \
418 #define IFM_SUBTYPE_IEEE80211_ALIASES { \
419 { IFM_IEEE80211_FH1, "FH1" }, \
420 { IFM_IEEE80211_FH2, "FH2" }, \
421 { IFM_IEEE80211_FH1, "FrequencyHopping/1Mbps" }, \
422 { IFM_IEEE80211_FH2, "FrequencyHopping/2Mbps" }, \
423 { IFM_IEEE80211_DS1, "DS1" }, \
424 { IFM_IEEE80211_DS2, "DS2" }, \
425 { IFM_IEEE80211_DS5, "DS5.5" }, \
426 { IFM_IEEE80211_DS11, "DS11" }, \
427 { IFM_IEEE80211_DS22, "DS22" }, \
428 { IFM_IEEE80211_DS1, "DirectSequence/1Mbps" }, \
429 { IFM_IEEE80211_DS2, "DirectSequence/2Mbps" }, \
430 { IFM_IEEE80211_DS5, "DirectSequence/5.5Mbps" }, \
431 { IFM_IEEE80211_DS11, "DirectSequence/11Mbps" }, \
432 { IFM_IEEE80211_DS22, "DirectSequence/22Mbps" }, \
433 { IFM_IEEE80211_OFDM6, "OFDM6" }, \
434 { IFM_IEEE80211_OFDM9, "OFDM9" }, \
435 { IFM_IEEE80211_OFDM12, "OFDM12" }, \
436 { IFM_IEEE80211_OFDM18, "OFDM18" }, \
437 { IFM_IEEE80211_OFDM24, "OFDM24" }, \
438 { IFM_IEEE80211_OFDM36, "OFDM36" }, \
439 { IFM_IEEE80211_OFDM48, "OFDM48" }, \
440 { IFM_IEEE80211_OFDM54, "OFDM54" }, \
441 { IFM_IEEE80211_OFDM72, "OFDM72" }, \
442 { IFM_IEEE80211_DS1, "CCK1" }, \
443 { IFM_IEEE80211_DS2, "CCK2" }, \
444 { IFM_IEEE80211_DS5, "CCK5.5" }, \
445 { IFM_IEEE80211_DS11, "CCK11" }, \
446 { IFM_IEEE80211_DS354k, "DS354K" }, \
447 { IFM_IEEE80211_DS354k, "DirectSequence/354Kbps" }, \
448 { IFM_IEEE80211_DS512k, "DS512K" }, \
449 { IFM_IEEE80211_DS512k, "DirectSequence/512Kbps" }, \
450 { IFM_IEEE80211_OFDM3, "OFDM3" }, \
451 { IFM_IEEE80211_OFDM4, "OFDM4.5" }, \
452 { IFM_IEEE80211_OFDM27, "OFDM27" }, \
453 { IFM_IEEE80211_MCS, "MCS" }, \
454 { 0, NULL }, \
457 #define IFM_SUBTYPE_IEEE80211_OPTION_DESCRIPTIONS { \
458 { IFM_IEEE80211_ADHOC, "adhoc" }, \
459 { IFM_IEEE80211_HOSTAP, "hostap" }, \
460 { IFM_IEEE80211_IBSS, "ibss" }, \
461 { IFM_IEEE80211_WDS, "wds" }, \
462 { IFM_IEEE80211_TURBO, "turbo" }, \
463 { IFM_IEEE80211_MONITOR, "monitor" }, \
464 { IFM_IEEE80211_MBSS, "mesh" }, \
465 { 0, NULL }, \
468 #define IFM_SUBTYPE_IEEE80211_MODE_DESCRIPTIONS { \
469 { IFM_AUTO, "autoselect" }, \
470 { IFM_IEEE80211_11A, "11a" }, \
471 { IFM_IEEE80211_11B, "11b" }, \
472 { IFM_IEEE80211_11G, "11g" }, \
473 { IFM_IEEE80211_FH, "fh" }, \
474 { IFM_IEEE80211_11NA, "11na" }, \
475 { IFM_IEEE80211_11NG, "11ng" }, \
476 { 0, NULL }, \
479 #define IFM_SUBTYPE_IEEE80211_MODE_ALIASES { \
480 { IFM_AUTO, "auto" }, \
481 { 0, NULL }, \
484 # define IFM_SUBTYPE_ATM_DESCRIPTIONS { \
485 { IFM_ATM_UNKNOWN, "Unknown" }, \
486 { IFM_ATM_UTP_25, "UTP/25.6MBit" }, \
487 { IFM_ATM_TAXI_100, "Taxi/100MBit" }, \
488 { IFM_ATM_TAXI_140, "Taxi/140MBit" }, \
489 { IFM_ATM_MM_155, "Multi-mode/155MBit" }, \
490 { IFM_ATM_SM_155, "Single-mode/155MBit" }, \
491 { IFM_ATM_UTP_155, "UTP/155MBit" }, \
492 { IFM_ATM_MM_622, "Multi-mode/622MBit" }, \
493 { IFM_ATM_SM_622, "Single-mode/622MBit" }, \
494 { IFM_ATM_VIRTUAL, "Virtual" }, \
495 { 0, NULL }, \
498 # define IFM_SUBTYPE_ATM_ALIASES { \
499 { IFM_ATM_UNKNOWN, "UNKNOWN" }, \
500 { IFM_ATM_UTP_25, "UTP-25" }, \
501 { IFM_ATM_TAXI_100, "TAXI-100" }, \
502 { IFM_ATM_TAXI_140, "TAXI-140" }, \
503 { IFM_ATM_MM_155, "MM-155" }, \
504 { IFM_ATM_SM_155, "SM-155" }, \
505 { IFM_ATM_UTP_155, "UTP-155" }, \
506 { IFM_ATM_MM_622, "MM-622" }, \
507 { IFM_ATM_SM_622, "SM-622" }, \
508 { IFM_ATM_VIRTUAL, "VIRTUAL" }, \
509 { 0, NULL }, \
512 #define IFM_SUBTYPE_ATM_OPTION_DESCRIPTIONS { \
513 { IFM_ATM_SDH, "SDH" }, \
514 { IFM_ATM_NOSCRAMB, "Noscramb" }, \
515 { IFM_ATM_UNASSIGNED, "Unassigned" }, \
516 { 0, NULL }, \
520 #define IFM_SUBTYPE_SHARED_DESCRIPTIONS { \
521 { IFM_AUTO, "autoselect" }, \
522 { IFM_MANUAL, "manual" }, \
523 { IFM_NONE, "none" }, \
524 { 0, NULL }, \
527 #define IFM_SUBTYPE_SHARED_ALIASES { \
528 { IFM_AUTO, "auto" }, \
529 { 0, NULL }, \
532 #define IFM_SHARED_OPTION_DESCRIPTIONS { \
533 { IFM_FDX, "full-duplex" }, \
534 { IFM_HDX, "half-duplex" }, \
535 { IFM_FLAG0, "flag0" }, \
536 { IFM_FLAG1, "flag1" }, \
537 { IFM_FLAG2, "flag2" }, \
538 { IFM_LOOP, "hw-loopback" }, \
539 { 0, NULL }, \
543 * Baudrate descriptions for the various media types.
545 struct ifmedia_baudrate {
546 int ifmb_word; /* media word */
547 uint64_t ifmb_baudrate; /* corresponding baudrate */
550 #define IFM_BAUDRATE_DESCRIPTIONS { \
551 { IFM_ETHER|IFM_10_T, IF_Mbps(10) }, \
552 { IFM_ETHER|IFM_10_2, IF_Mbps(10) }, \
553 { IFM_ETHER|IFM_10_5, IF_Mbps(10) }, \
554 { IFM_ETHER|IFM_100_TX, IF_Mbps(100) }, \
555 { IFM_ETHER|IFM_100_FX, IF_Mbps(100) }, \
556 { IFM_ETHER|IFM_100_T4, IF_Mbps(100) }, \
557 { IFM_ETHER|IFM_100_VG, IF_Mbps(100) }, \
558 { IFM_ETHER|IFM_100_T2, IF_Mbps(100) }, \
559 { IFM_ETHER|IFM_1000_SX, IF_Mbps(1000) }, \
560 { IFM_ETHER|IFM_10_STP, IF_Mbps(10) }, \
561 { IFM_ETHER|IFM_10_FL, IF_Mbps(10) }, \
562 { IFM_ETHER|IFM_1000_LX, IF_Mbps(1000) }, \
563 { IFM_ETHER|IFM_1000_CX, IF_Mbps(1000) }, \
564 { IFM_ETHER|IFM_1000_T, IF_Mbps(1000) }, \
565 { IFM_ETHER|IFM_HPNA_1, IF_Mbps(1) }, \
566 { IFM_ETHER|IFM_10G_LR, IF_Gbps(10ULL) }, \
567 { IFM_ETHER|IFM_10G_SR, IF_Gbps(10ULL) }, \
568 { IFM_ETHER|IFM_10G_CX4, IF_Gbps(10ULL) }, \
569 { IFM_ETHER|IFM_2500_SX, IF_Mbps(2500ULL) }, \
570 { IFM_ETHER|IFM_10G_TWINAX, IF_Gbps(10ULL) }, \
571 { IFM_ETHER|IFM_10G_TWINAX_LONG,IF_Gbps(10ULL) }, \
572 { IFM_ETHER|IFM_10G_LRM, IF_Gbps(10ULL) }, \
573 { IFM_ETHER|IFM_10G_T, IF_Gbps(10ULL) }, \
574 { IFM_ETHER | IFM_40G_CR4, IF_Gbps(40ULL) }, \
575 { IFM_ETHER | IFM_40G_SR4, IF_Gbps(40ULL) }, \
576 { IFM_ETHER | IFM_40G_LR4, IF_Gbps(40ULL) }, \
578 { IFM_IEEE80211|IFM_IEEE80211_FH1, IF_Mbps(1) }, \
579 { IFM_IEEE80211|IFM_IEEE80211_FH2, IF_Mbps(2) }, \
580 { IFM_IEEE80211|IFM_IEEE80211_DS1, IF_Mbps(1) }, \
581 { IFM_IEEE80211|IFM_IEEE80211_DS2, IF_Mbps(2) }, \
582 { IFM_IEEE80211|IFM_IEEE80211_DS5, IF_Kbps(5500) }, \
583 { IFM_IEEE80211|IFM_IEEE80211_DS11, IF_Mbps(11) }, \
584 { IFM_IEEE80211|IFM_IEEE80211_DS22, IF_Mbps(22) }, \
585 { IFM_IEEE80211|IFM_IEEE80211_OFDM6, IF_Mbps(6) }, \
586 { IFM_IEEE80211|IFM_IEEE80211_OFDM9, IF_Mbps(9) }, \
587 { IFM_IEEE80211|IFM_IEEE80211_OFDM12, IF_Mbps(12) }, \
588 { IFM_IEEE80211|IFM_IEEE80211_OFDM18, IF_Mbps(18) }, \
589 { IFM_IEEE80211|IFM_IEEE80211_OFDM24, IF_Mbps(24) }, \
590 { IFM_IEEE80211|IFM_IEEE80211_OFDM36, IF_Mbps(36) }, \
591 { IFM_IEEE80211|IFM_IEEE80211_OFDM48, IF_Mbps(48) }, \
592 { IFM_IEEE80211|IFM_IEEE80211_OFDM54, IF_Mbps(54) }, \
593 { IFM_IEEE80211|IFM_IEEE80211_OFDM72, IF_Mbps(72) }, \
595 { 0, 0 }, \
598 #ifdef _KERNEL
600 /* Ethernet flow control strings for tunables */
601 #define IFM_ETH_FC_STRLEN 16
602 #define IFM_ETH_FC_FULL "full"
603 #define IFM_ETH_FC_RXPAUSE "rxpause"
604 #define IFM_ETH_FC_TXPAUSE "txpause"
605 #define IFM_ETH_FC_NONE "none"
606 #define IFM_ETH_FC_FORCE_FULL "force-full"
607 #define IFM_ETH_FC_FORCE_RXPAUSE "force-rxpause"
608 #define IFM_ETH_FC_FORCE_TXPAUSE "force-txpause"
609 #define IFM_ETH_FC_FORCE_NONE "force-none"
611 /* String to flow control media options */
612 int ifmedia_str2ethfc(const char *);
614 #endif /* _KERNEL */
616 #endif /* _NET_IF_MEDIA_H_ */