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