if_media.h revision 1.55 1 1.55 cegger /* $NetBSD: if_media.h,v 1.55 2011/02/20 13:51:17 cegger Exp $ */
2 1.7 thorpej
3 1.7 thorpej /*-
4 1.24 thorpej * Copyright (c) 1998, 2000, 2001 The NetBSD Foundation, Inc.
5 1.7 thorpej * All rights reserved.
6 1.7 thorpej *
7 1.7 thorpej * This code is derived from software contributed to The NetBSD Foundation
8 1.7 thorpej * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
9 1.7 thorpej * NASA Ames Research Center.
10 1.7 thorpej *
11 1.7 thorpej * Redistribution and use in source and binary forms, with or without
12 1.7 thorpej * modification, are permitted provided that the following conditions
13 1.7 thorpej * are met:
14 1.7 thorpej * 1. Redistributions of source code must retain the above copyright
15 1.7 thorpej * notice, this list of conditions and the following disclaimer.
16 1.7 thorpej * 2. Redistributions in binary form must reproduce the above copyright
17 1.7 thorpej * notice, this list of conditions and the following disclaimer in the
18 1.7 thorpej * documentation and/or other materials provided with the distribution.
19 1.7 thorpej *
20 1.7 thorpej * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
21 1.7 thorpej * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22 1.7 thorpej * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 1.7 thorpej * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
24 1.7 thorpej * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 1.7 thorpej * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 1.7 thorpej * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 1.7 thorpej * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 1.7 thorpej * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 1.7 thorpej * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 1.7 thorpej * POSSIBILITY OF SUCH DAMAGE.
31 1.7 thorpej */
32 1.1 thorpej
33 1.1 thorpej /*
34 1.1 thorpej * Copyright (c) 1997
35 1.1 thorpej * Jonathan Stone and Jason R. Thorpe. All rights reserved.
36 1.1 thorpej *
37 1.1 thorpej * This software is derived from information provided by Matt Thomas.
38 1.1 thorpej *
39 1.1 thorpej * Redistribution and use in source and binary forms, with or without
40 1.1 thorpej * modification, are permitted provided that the following conditions
41 1.1 thorpej * are met:
42 1.1 thorpej * 1. Redistributions of source code must retain the above copyright
43 1.1 thorpej * notice, this list of conditions and the following disclaimer.
44 1.1 thorpej * 2. Redistributions in binary form must reproduce the above copyright
45 1.1 thorpej * notice, this list of conditions and the following disclaimer in the
46 1.1 thorpej * documentation and/or other materials provided with the distribution.
47 1.1 thorpej * 3. All advertising materials mentioning features or use of this software
48 1.1 thorpej * must display the following acknowledgement:
49 1.1 thorpej * This product includes software developed by Jonathan Stone
50 1.1 thorpej * and Jason R. Thorpe for the NetBSD Project.
51 1.1 thorpej * 4. The names of the authors may not be used to endorse or promote products
52 1.1 thorpej * derived from this software without specific prior written permission.
53 1.1 thorpej *
54 1.1 thorpej * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
55 1.1 thorpej * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
56 1.1 thorpej * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
57 1.1 thorpej * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
58 1.1 thorpej * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
59 1.1 thorpej * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
60 1.1 thorpej * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
61 1.1 thorpej * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
62 1.1 thorpej * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
63 1.1 thorpej * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
64 1.1 thorpej * SUCH DAMAGE.
65 1.1 thorpej */
66 1.1 thorpej
67 1.1 thorpej #ifndef _NET_IF_MEDIA_H_
68 1.1 thorpej #define _NET_IF_MEDIA_H_
69 1.1 thorpej
70 1.1 thorpej /*
71 1.1 thorpej * Prototypes and definitions for BSD/OS-compatible network interface
72 1.1 thorpej * media selection.
73 1.1 thorpej *
74 1.1 thorpej * Where it is safe to do so, this code strays slightly from the BSD/OS
75 1.1 thorpej * design. Software which uses the API (device drivers, basically)
76 1.1 thorpej * shouldn't notice any difference.
77 1.1 thorpej *
78 1.1 thorpej * Many thanks to Matt Thomas for providing the information necessary
79 1.1 thorpej * to implement this interface.
80 1.1 thorpej */
81 1.1 thorpej
82 1.1 thorpej #ifdef _KERNEL
83 1.1 thorpej
84 1.1 thorpej #include <sys/queue.h>
85 1.1 thorpej
86 1.1 thorpej /*
87 1.1 thorpej * Driver callbacks for media status and change requests.
88 1.1 thorpej */
89 1.40 thorpej typedef int (*ifm_change_cb_t)(struct ifnet *);
90 1.40 thorpej typedef void (*ifm_stat_cb_t)(struct ifnet *, struct ifmediareq *);
91 1.1 thorpej
92 1.1 thorpej /*
93 1.1 thorpej * In-kernel representation of a single supported media type.
94 1.1 thorpej */
95 1.1 thorpej struct ifmedia_entry {
96 1.15 thorpej TAILQ_ENTRY(ifmedia_entry) ifm_list;
97 1.30 thorpej u_int ifm_media; /* description of this media attachment */
98 1.31 thorpej u_int ifm_data; /* for driver-specific use */
99 1.1 thorpej void *ifm_aux; /* for driver-specific use */
100 1.1 thorpej };
101 1.1 thorpej
102 1.1 thorpej /*
103 1.1 thorpej * One of these goes into a network interface's softc structure.
104 1.1 thorpej * It is used to keep general media state.
105 1.1 thorpej */
106 1.1 thorpej struct ifmedia {
107 1.30 thorpej u_int ifm_mask; /* mask of changes we don't care about */
108 1.30 thorpej u_int ifm_media; /* current user-set media word */
109 1.1 thorpej struct ifmedia_entry *ifm_cur; /* currently selected media */
110 1.15 thorpej TAILQ_HEAD(, ifmedia_entry) ifm_list; /* list of all supported media */
111 1.1 thorpej ifm_change_cb_t ifm_change; /* media change driver callback */
112 1.1 thorpej ifm_stat_cb_t ifm_status; /* media status driver callback */
113 1.1 thorpej };
114 1.1 thorpej
115 1.1 thorpej /* Initialize an interface's struct if_media field. */
116 1.40 thorpej void ifmedia_init(struct ifmedia *, int, ifm_change_cb_t, ifm_stat_cb_t);
117 1.1 thorpej
118 1.47 dyoung int ifmedia_change(struct ifmedia *, struct ifnet *);
119 1.47 dyoung
120 1.1 thorpej /* Add one supported medium to a struct ifmedia. */
121 1.40 thorpej void ifmedia_add(struct ifmedia *, int, int, void *);
122 1.1 thorpej
123 1.1 thorpej /* Add an array (of ifmedia_entry) media to a struct ifmedia. */
124 1.35 itojun void ifmedia_list_add(struct ifmedia *, struct ifmedia_entry *, int);
125 1.1 thorpej
126 1.1 thorpej /* Set default media type on initialization. */
127 1.40 thorpej void ifmedia_set(struct ifmedia *ifm, int mword);
128 1.1 thorpej
129 1.1 thorpej /* Common ioctl function for getting/setting media, called by driver. */
130 1.40 thorpej int ifmedia_ioctl(struct ifnet *, struct ifreq *, struct ifmedia *, u_long);
131 1.14 thorpej
132 1.14 thorpej /* Look up a media entry. */
133 1.40 thorpej struct ifmedia_entry *ifmedia_match(struct ifmedia *, u_int, u_int);
134 1.1 thorpej
135 1.20 thorpej /* Delete all media for a given media instance */
136 1.40 thorpej void ifmedia_delete_instance(struct ifmedia *, u_int);
137 1.20 thorpej
138 1.23 thorpej /* Compute baudrate for a given media. */
139 1.53 dyoung uint64_t ifmedia_baudrate(int);
140 1.42 dsl
141 1.50 christos /* Remove all media */
142 1.50 christos void ifmedia_removeall(struct ifmedia *);
143 1.50 christos
144 1.1 thorpej #endif /*_KERNEL */
145 1.1 thorpej
146 1.1 thorpej /*
147 1.1 thorpej * if_media Options word:
148 1.1 thorpej * Bits Use
149 1.1 thorpej * ---- -------
150 1.21 thorpej * 0-4 Media subtype MAX SUBTYPE == 31!
151 1.1 thorpej * 5-7 Media type
152 1.1 thorpej * 8-15 Type specific options
153 1.36 dyoung * 16-18 Mode (for multi-mode devices)
154 1.36 dyoung * 19 RFU
155 1.1 thorpej * 20-27 Shared (global) options
156 1.1 thorpej * 28-31 Instance
157 1.1 thorpej */
158 1.1 thorpej
159 1.1 thorpej /*
160 1.1 thorpej * Ethernet
161 1.1 thorpej */
162 1.50 christos #define IFM_ETHER 0x00000020
163 1.1 thorpej #define IFM_10_T 3 /* 10BaseT - RJ45 */
164 1.1 thorpej #define IFM_10_2 4 /* 10Base2 - Thinnet */
165 1.1 thorpej #define IFM_10_5 5 /* 10Base5 - AUI */
166 1.1 thorpej #define IFM_100_TX 6 /* 100BaseTX - RJ45 */
167 1.1 thorpej #define IFM_100_FX 7 /* 100BaseFX - Fiber */
168 1.1 thorpej #define IFM_100_T4 8 /* 100BaseT4 - 4 pair cat 3 */
169 1.1 thorpej #define IFM_100_VG 9 /* 100VG-AnyLAN */
170 1.1 thorpej #define IFM_100_T2 10 /* 100BaseT2 */
171 1.19 thorpej #define IFM_1000_SX 11 /* 1000BaseSX - multi-mode fiber */
172 1.4 thorpej #define IFM_10_STP 12 /* 10BaseT over shielded TP */
173 1.6 thorpej #define IFM_10_FL 13 /* 10BaseFL - Fiber */
174 1.19 thorpej #define IFM_1000_LX 14 /* 1000baseLX - single-mode fiber */
175 1.19 thorpej #define IFM_1000_CX 15 /* 1000baseCX - 150ohm STP */
176 1.25 bjh21 #define IFM_1000_T 16 /* 1000baseT - 4 pair cat 5 */
177 1.21 thorpej #define IFM_HPNA_1 17 /* HomePNA 1.0 (1Mb/s) */
178 1.37 ragge #define IFM_10G_LR 18 /* 10GbaseLR - single-mode fiber */
179 1.46 ragge #define IFM_10G_SR 19 /* 10GBase-SR 850nm Multi-mode */
180 1.46 ragge #define IFM_10G_CX4 20 /* 10GBase CX4 copper */
181 1.51 mhitch #define IFM_2500_SX 21 /* 2500baseSX - multi-mode fiber */
182 1.52 msaitoh #define IFM_1000_BX10 22 /* 1000base-BX10 */
183 1.54 dyoung #define IFM_10G_TWINAX 23 /* 10GBase Twinax copper */
184 1.54 dyoung #define IFM_10G_TWINAX_LONG 24 /* 10GBase Twinax Long copper */
185 1.54 dyoung #define IFM_10G_LRM 25 /* 10GBase-LRM 850nm Multi-mode */
186 1.54 dyoung #define IFM_10G_T 26 /* 10GBase-T - RJ45 */
187 1.1 thorpej
188 1.25 bjh21 #define IFM_ETH_MASTER 0x00000100 /* master mode (1000baseT) */
189 1.39 thorpej #define IFM_ETH_RXPAUSE 0x00000200 /* receive PAUSE frames */
190 1.39 thorpej #define IFM_ETH_TXPAUSE 0x00000400 /* transmit PAUSE frames */
191 1.24 thorpej
192 1.1 thorpej /*
193 1.1 thorpej * Token ring
194 1.1 thorpej */
195 1.1 thorpej #define IFM_TOKEN 0x00000040
196 1.1 thorpej #define IFM_TOK_STP4 3 /* Shielded twisted pair 4m - DB9 */
197 1.1 thorpej #define IFM_TOK_STP16 4 /* Shielded twisted pair 16m - DB9 */
198 1.1 thorpej #define IFM_TOK_UTP4 5 /* Unshielded twisted pair 4m - RJ45 */
199 1.1 thorpej #define IFM_TOK_UTP16 6 /* Unshielded twisted pair 16m - RJ45 */
200 1.1 thorpej #define IFM_TOK_ETR 0x00000200 /* Early token release */
201 1.1 thorpej #define IFM_TOK_SRCRT 0x00000400 /* Enable source routing features */
202 1.1 thorpej #define IFM_TOK_ALLR 0x00000800 /* All routes / Single route bcast */
203 1.1 thorpej
204 1.1 thorpej /*
205 1.1 thorpej * FDDI
206 1.1 thorpej */
207 1.1 thorpej #define IFM_FDDI 0x00000060
208 1.1 thorpej #define IFM_FDDI_SMF 3 /* Single-mode fiber */
209 1.1 thorpej #define IFM_FDDI_MMF 4 /* Multi-mode fiber */
210 1.50 christos #define IFM_FDDI_UTP 5 /* CDDI / UTP */
211 1.50 christos #define IFM_FDDI_DA 0x00000100 /* Dual attach / single attach */
212 1.1 thorpej
213 1.1 thorpej /*
214 1.16 chopps * IEEE 802.11 Wireless
215 1.16 chopps */
216 1.16 chopps #define IFM_IEEE80211 0x00000080
217 1.17 augustss #define IFM_IEEE80211_FH1 3 /* Frequency Hopping 1Mbps */
218 1.16 chopps #define IFM_IEEE80211_FH2 4 /* Frequency Hopping 2Mbps */
219 1.16 chopps #define IFM_IEEE80211_DS2 5 /* Direct Sequence 2Mbps */
220 1.16 chopps #define IFM_IEEE80211_DS5 6 /* Direct Sequence 5Mbps*/
221 1.16 chopps #define IFM_IEEE80211_DS11 7 /* Direct Sequence 11Mbps*/
222 1.22 sommerfe #define IFM_IEEE80211_DS1 8 /* Direct Sequence 1Mbps */
223 1.36 dyoung #define IFM_IEEE80211_DS22 9 /* Direct Sequence 22Mbps */
224 1.36 dyoung #define IFM_IEEE80211_OFDM6 10 /* OFDM 6Mbps */
225 1.36 dyoung #define IFM_IEEE80211_OFDM9 11 /* OFDM 9Mbps */
226 1.36 dyoung #define IFM_IEEE80211_OFDM12 12 /* OFDM 12Mbps */
227 1.36 dyoung #define IFM_IEEE80211_OFDM18 13 /* OFDM 18Mbps */
228 1.36 dyoung #define IFM_IEEE80211_OFDM24 14 /* OFDM 24Mbps */
229 1.36 dyoung #define IFM_IEEE80211_OFDM36 15 /* OFDM 36Mbps */
230 1.36 dyoung #define IFM_IEEE80211_OFDM48 16 /* OFDM 48Mbps */
231 1.36 dyoung #define IFM_IEEE80211_OFDM54 17 /* OFDM 54Mbps */
232 1.36 dyoung #define IFM_IEEE80211_OFDM72 18 /* OFDM 72Mbps */
233 1.50 christos #define IFM_IEEE80211_DS354k 19 /* Direct Sequence 354Kbps */
234 1.50 christos #define IFM_IEEE80211_DS512k 20 /* Direct Sequence 512Kbps */
235 1.50 christos #define IFM_IEEE80211_OFDM3 21 /* OFDM 3Mbps */
236 1.50 christos #define IFM_IEEE80211_OFDM4 22 /* OFDM 4.5Mbps */
237 1.50 christos #define IFM_IEEE80211_OFDM27 23 /* OFDM 27Mbps */
238 1.50 christos /* NB: not enough bits to express MCS fully */
239 1.50 christos #define IFM_IEEE80211_MCS 24 /* HT MCS rate */
240 1.50 christos
241 1.50 christos #define IFM_IEEE80211_ADHOC 0x00000100 /* Operate in Adhoc mode */
242 1.50 christos #define IFM_IEEE80211_HOSTAP 0x00000200 /* Operate in Host AP mode */
243 1.50 christos #define IFM_IEEE80211_MONITOR 0x00000400 /* Operate in Monitor mode */
244 1.50 christos #define IFM_IEEE80211_TURBO 0x00000800 /* Operate in Turbo mode */
245 1.50 christos #define IFM_IEEE80211_IBSS 0x00001000 /* Operate in IBSS mode */
246 1.50 christos #define IFM_IEEE80211_WDS 0x00002000 /* Operate as an WDS master */
247 1.55 cegger #define IFM_IEEE80211_MBSS 0x00004000 /* Operate in MBSS mode */
248 1.36 dyoung
249 1.36 dyoung /* operating mode for multi-mode devices */
250 1.44 lukem #define IFM_IEEE80211_11A 0x00010000 /* 5 GHz, OFDM mode */
251 1.36 dyoung #define IFM_IEEE80211_11B 0x00020000 /* Direct Sequence mode */
252 1.44 lukem #define IFM_IEEE80211_11G 0x00030000 /* 2 GHz, CCK mode */
253 1.44 lukem #define IFM_IEEE80211_FH 0x00040000 /* 2 GHz, GFSK mode */
254 1.50 christos #define IFM_IEEE80211_11NA 0x00050000 /* 5Ghz, HT mode */
255 1.50 christos #define IFM_IEEE80211_11NG 0x00060000 /* 2Ghz, HT mode */
256 1.50 christos
257 1.16 chopps
258 1.16 chopps /*
259 1.48 skrll * Common Address Redundancy Protocol
260 1.45 liamjfoy */
261 1.45 liamjfoy #define IFM_CARP 0x000000c0
262 1.45 liamjfoy
263 1.45 liamjfoy /*
264 1.1 thorpej * Shared media sub-types
265 1.1 thorpej */
266 1.1 thorpej #define IFM_AUTO 0 /* Autoselect best media */
267 1.1 thorpej #define IFM_MANUAL 1 /* Jumper/dipswitch selects media */
268 1.1 thorpej #define IFM_NONE 2 /* Deselect all media */
269 1.1 thorpej
270 1.1 thorpej /*
271 1.1 thorpej * Shared options
272 1.1 thorpej */
273 1.50 christos #define IFM_FDX 0x00100000 /* Force full duplex */
274 1.1 thorpej #define IFM_HDX 0x00200000 /* Force half duplex */
275 1.13 thorpej #define IFM_FLOW 0x00400000 /* enable hardware flow control */
276 1.50 christos #define IFM_FLAG0 0x01000000 /* Driver defined flag */
277 1.50 christos #define IFM_FLAG1 0x02000000 /* Driver defined flag */
278 1.50 christos #define IFM_FLAG2 0x04000000 /* Driver defined flag */
279 1.1 thorpej #define IFM_LOOP 0x08000000 /* Put hardware in loopback */
280 1.1 thorpej
281 1.1 thorpej /*
282 1.1 thorpej * Masks
283 1.1 thorpej */
284 1.1 thorpej #define IFM_NMASK 0x000000e0 /* Network type */
285 1.21 thorpej #define IFM_TMASK 0x0000001f /* Media sub-type */
286 1.1 thorpej #define IFM_IMASK 0xf0000000 /* Instance */
287 1.1 thorpej #define IFM_ISHIFT 28 /* Instance shift */
288 1.1 thorpej #define IFM_OMASK 0x0000ff00 /* Type specific options */
289 1.36 dyoung #define IFM_MMASK 0x00070000 /* Mode */
290 1.36 dyoung #define IFM_MSHIFT 16 /* Mode shift */
291 1.1 thorpej #define IFM_GMASK 0x0ff00000 /* Global options */
292 1.9 thorpej
293 1.39 thorpej /* Ethernet flow control mask */
294 1.41 dsl #define IFM_ETH_FMASK (IFM_FLOW | IFM_ETH_RXPAUSE | IFM_ETH_TXPAUSE)
295 1.39 thorpej
296 1.9 thorpej #define IFM_NMIN IFM_ETHER /* lowest Network type */
297 1.9 thorpej #define IFM_NMAX IFM_NMASK /* highest Network type */
298 1.1 thorpej
299 1.1 thorpej /*
300 1.1 thorpej * Status bits
301 1.1 thorpej */
302 1.1 thorpej #define IFM_AVALID 0x00000001 /* Active bit valid */
303 1.1 thorpej #define IFM_ACTIVE 0x00000002 /* Interface attached to working net */
304 1.1 thorpej
305 1.18 thorpej /* Mask of "status valid" bits, for ifconfig(8). */
306 1.18 thorpej #define IFM_STATUS_VALID IFM_AVALID
307 1.18 thorpej
308 1.18 thorpej /* List of "status valid" bits, for ifconfig(8). */
309 1.18 thorpej #define IFM_STATUS_VALID_LIST { \
310 1.18 thorpej IFM_AVALID, \
311 1.18 thorpej 0, \
312 1.18 thorpej }
313 1.18 thorpej
314 1.1 thorpej /*
315 1.1 thorpej * Macros to extract various bits of information from the media word.
316 1.1 thorpej */
317 1.1 thorpej #define IFM_TYPE(x) ((x) & IFM_NMASK)
318 1.1 thorpej #define IFM_SUBTYPE(x) ((x) & IFM_TMASK)
319 1.1 thorpej #define IFM_INST(x) (((x) & IFM_IMASK) >> IFM_ISHIFT)
320 1.41 dsl #define IFM_OPTIONS(x) ((x) & (IFM_OMASK | IFM_GMASK))
321 1.36 dyoung #define IFM_MODE(x) ((x) & IFM_MMASK)
322 1.10 thorpej
323 1.10 thorpej #define IFM_INST_MAX IFM_INST(IFM_IMASK)
324 1.32 thorpej #define IFM_INST_ANY ((u_int) -1)
325 1.8 thorpej
326 1.8 thorpej /*
327 1.8 thorpej * Macro to create a media word.
328 1.8 thorpej */
329 1.8 thorpej #define IFM_MAKEWORD(type, subtype, options, instance) \
330 1.8 thorpej ((type) | (subtype) | (options) | ((instance) << IFM_ISHIFT))
331 1.36 dyoung #define IFM_MAKEMODE(mode) \
332 1.36 dyoung (((mode) << IFM_MSHIFT) & IFM_MMASK)
333 1.1 thorpej
334 1.1 thorpej /*
335 1.1 thorpej * NetBSD extension not defined in the BSDI API. This is used in various
336 1.1 thorpej * places to get the canonical description for a given type/subtype.
337 1.1 thorpej *
338 1.7 thorpej * In the subtype and mediaopt descriptions, the valid TYPE bits are OR'd
339 1.7 thorpej * in to indicate which TYPE the subtype/option corresponds to. If no
340 1.7 thorpej * TYPE is present, it is a shared media/mediaopt.
341 1.7 thorpej *
342 1.7 thorpej * Note that these are parsed case-insensitive.
343 1.7 thorpej *
344 1.7 thorpej * Order is important. The first matching entry is the canonical name
345 1.7 thorpej * for a media type; subsequent matches are aliases.
346 1.1 thorpej */
347 1.1 thorpej struct ifmedia_description {
348 1.1 thorpej int ifmt_word; /* word value; may be masked */
349 1.1 thorpej const char *ifmt_string; /* description */
350 1.1 thorpej };
351 1.1 thorpej
352 1.1 thorpej #define IFM_TYPE_DESCRIPTIONS { \
353 1.7 thorpej { IFM_ETHER, "Ethernet" }, \
354 1.7 thorpej { IFM_ETHER, "ether" }, \
355 1.7 thorpej { IFM_TOKEN, "TokenRing" }, \
356 1.7 thorpej { IFM_TOKEN, "token" }, \
357 1.7 thorpej { IFM_FDDI, "FDDI" }, \
358 1.16 chopps { IFM_IEEE80211, "IEEE802.11" }, \
359 1.45 liamjfoy { IFM_CARP, "CARP" }, \
360 1.7 thorpej { 0, NULL }, \
361 1.7 thorpej }
362 1.7 thorpej
363 1.7 thorpej #define IFM_TYPE_MATCH(dt, t) \
364 1.7 thorpej (IFM_TYPE((dt)) == 0 || IFM_TYPE((dt)) == IFM_TYPE((t)))
365 1.7 thorpej
366 1.7 thorpej #define IFM_SUBTYPE_DESCRIPTIONS { \
367 1.7 thorpej { IFM_AUTO, "autoselect" }, \
368 1.7 thorpej { IFM_AUTO, "auto" }, \
369 1.7 thorpej { IFM_MANUAL, "manual" }, \
370 1.7 thorpej { IFM_NONE, "none" }, \
371 1.7 thorpej \
372 1.41 dsl { IFM_ETHER | IFM_10_T, "10baseT" }, \
373 1.41 dsl { IFM_ETHER | IFM_10_T, "10baseT/UTP" }, \
374 1.41 dsl { IFM_ETHER | IFM_10_T, "UTP" }, \
375 1.41 dsl { IFM_ETHER | IFM_10_T, "10UTP" }, \
376 1.41 dsl { IFM_ETHER | IFM_10_T, "10BASE-T" }, \
377 1.41 dsl { IFM_ETHER | IFM_10_2, "10base2" }, \
378 1.41 dsl { IFM_ETHER | IFM_10_2, "10base2/BNC" }, \
379 1.41 dsl { IFM_ETHER | IFM_10_2, "BNC" }, \
380 1.41 dsl { IFM_ETHER | IFM_10_2, "10BNC" }, \
381 1.41 dsl { IFM_ETHER | IFM_10_2, "10BASE2" }, \
382 1.41 dsl { IFM_ETHER | IFM_10_5, "10base5" }, \
383 1.41 dsl { IFM_ETHER | IFM_10_5, "10base5/AUI" }, \
384 1.41 dsl { IFM_ETHER | IFM_10_5, "AUI" }, \
385 1.41 dsl { IFM_ETHER | IFM_10_5, "10AUI" }, \
386 1.41 dsl { IFM_ETHER | IFM_10_5, "10BASE5" }, \
387 1.41 dsl { IFM_ETHER | IFM_100_TX, "100baseTX" }, \
388 1.41 dsl { IFM_ETHER | IFM_100_TX, "100TX" }, \
389 1.41 dsl { IFM_ETHER | IFM_100_TX, "100BASE-TX" }, \
390 1.41 dsl { IFM_ETHER | IFM_100_FX, "100baseFX" }, \
391 1.41 dsl { IFM_ETHER | IFM_100_FX, "100FX" }, \
392 1.41 dsl { IFM_ETHER | IFM_100_FX, "100BASE-FX" }, \
393 1.41 dsl { IFM_ETHER | IFM_100_T4, "100baseT4" }, \
394 1.41 dsl { IFM_ETHER | IFM_100_T4, "100T4" }, \
395 1.41 dsl { IFM_ETHER | IFM_100_T4, "100BASE-T4" }, \
396 1.41 dsl { IFM_ETHER | IFM_100_VG, "100baseVG" }, \
397 1.41 dsl { IFM_ETHER | IFM_100_VG, "100VG" }, \
398 1.41 dsl { IFM_ETHER | IFM_100_VG, "100VG-AnyLAN" }, \
399 1.41 dsl { IFM_ETHER | IFM_100_T2, "100baseT2" }, \
400 1.41 dsl { IFM_ETHER | IFM_100_T2, "100T2" }, \
401 1.41 dsl { IFM_ETHER | IFM_100_T2, "100BASE-T2" }, \
402 1.41 dsl { IFM_ETHER | IFM_1000_SX, "1000baseSX" }, \
403 1.41 dsl { IFM_ETHER | IFM_1000_SX, "1000SX" }, \
404 1.41 dsl { IFM_ETHER | IFM_1000_SX, "1000BASE-SX" }, \
405 1.41 dsl { IFM_ETHER | IFM_10_STP, "10baseSTP" }, \
406 1.41 dsl { IFM_ETHER | IFM_10_STP, "STP" }, \
407 1.41 dsl { IFM_ETHER | IFM_10_STP, "10STP" }, \
408 1.41 dsl { IFM_ETHER | IFM_10_STP, "10BASE-STP" }, \
409 1.41 dsl { IFM_ETHER | IFM_10_FL, "10baseFL" }, \
410 1.41 dsl { IFM_ETHER | IFM_10_FL, "FL" }, \
411 1.41 dsl { IFM_ETHER | IFM_10_FL, "10FL" }, \
412 1.41 dsl { IFM_ETHER | IFM_10_FL, "10BASE-FL" }, \
413 1.41 dsl { IFM_ETHER | IFM_1000_LX, "1000baseLX" }, \
414 1.41 dsl { IFM_ETHER | IFM_1000_LX, "1000LX" }, \
415 1.41 dsl { IFM_ETHER | IFM_1000_LX, "1000BASE-LX" }, \
416 1.41 dsl { IFM_ETHER | IFM_1000_CX, "1000baseCX" }, \
417 1.41 dsl { IFM_ETHER | IFM_1000_CX, "1000CX" }, \
418 1.41 dsl { IFM_ETHER | IFM_1000_CX, "1000BASE-CX" }, \
419 1.52 msaitoh { IFM_ETHER | IFM_1000_BX10, "1000BASE-BX10" }, \
420 1.41 dsl { IFM_ETHER | IFM_1000_T, "1000baseT" }, \
421 1.41 dsl { IFM_ETHER | IFM_1000_T, "1000T" }, \
422 1.41 dsl { IFM_ETHER | IFM_1000_T, "1000BASE-T" }, \
423 1.41 dsl { IFM_ETHER | IFM_HPNA_1, "HomePNA1" }, \
424 1.41 dsl { IFM_ETHER | IFM_HPNA_1, "HPNA1" }, \
425 1.41 dsl { IFM_ETHER | IFM_10G_LR, "10GbaseLR" }, \
426 1.41 dsl { IFM_ETHER | IFM_10G_LR, "10GLR" }, \
427 1.41 dsl { IFM_ETHER | IFM_10G_LR, "10GBASE-LR" }, \
428 1.46 ragge { IFM_ETHER | IFM_10G_SR, "10GbaseSR" }, \
429 1.46 ragge { IFM_ETHER | IFM_10G_SR, "10GSR" }, \
430 1.46 ragge { IFM_ETHER | IFM_10G_SR, "10GBASE-SR" }, \
431 1.54 dyoung { IFM_ETHER | IFM_10G_LRM, "10Gbase-LRM" }, \
432 1.54 dyoung { IFM_ETHER | IFM_10G_TWINAX, "10Gbase-Twinax" }, \
433 1.54 dyoung { IFM_ETHER | IFM_10G_TWINAX_LONG, "10Gbase-Twinax-Long" },\
434 1.54 dyoung { IFM_ETHER | IFM_10G_T, "10Gbase-T" }, \
435 1.46 ragge { IFM_ETHER | IFM_10G_CX4, "10GbaseCX4" }, \
436 1.46 ragge { IFM_ETHER | IFM_10G_CX4, "10GCX4" }, \
437 1.46 ragge { IFM_ETHER | IFM_10G_CX4, "10GBASE-CX4" }, \
438 1.51 mhitch { IFM_ETHER | IFM_2500_SX, "2500baseSX" }, \
439 1.51 mhitch { IFM_ETHER | IFM_2500_SX, "2500SX" }, \
440 1.41 dsl \
441 1.41 dsl { IFM_TOKEN | IFM_TOK_STP4, "DB9/4Mbit" }, \
442 1.41 dsl { IFM_TOKEN | IFM_TOK_STP4, "4STP" }, \
443 1.41 dsl { IFM_TOKEN | IFM_TOK_STP16, "DB9/16Mbit" }, \
444 1.41 dsl { IFM_TOKEN | IFM_TOK_STP16, "16STP" }, \
445 1.41 dsl { IFM_TOKEN | IFM_TOK_UTP4, "UTP/4Mbit" }, \
446 1.41 dsl { IFM_TOKEN | IFM_TOK_UTP4, "4UTP" }, \
447 1.41 dsl { IFM_TOKEN | IFM_TOK_UTP16, "UTP/16Mbit" }, \
448 1.41 dsl { IFM_TOKEN | IFM_TOK_UTP16, "16UTP" }, \
449 1.41 dsl \
450 1.41 dsl { IFM_FDDI | IFM_FDDI_SMF, "Single-mode" }, \
451 1.41 dsl { IFM_FDDI | IFM_FDDI_SMF, "SMF" }, \
452 1.41 dsl { IFM_FDDI | IFM_FDDI_MMF, "Multi-mode" }, \
453 1.41 dsl { IFM_FDDI | IFM_FDDI_MMF, "MMF" }, \
454 1.41 dsl { IFM_FDDI | IFM_FDDI_UTP, "UTP" }, \
455 1.41 dsl { IFM_FDDI | IFM_FDDI_UTP, "CDDI" }, \
456 1.12 thorpej \
457 1.12 thorpej /* \
458 1.12 thorpej * Short-hand for common media+option combos. \
459 1.12 thorpej */ \
460 1.41 dsl { IFM_ETHER | IFM_10_T | IFM_FDX, "10baseT-FDX" }, \
461 1.41 dsl { IFM_ETHER | IFM_10_T | IFM_FDX, "10BASE-T-FDX" }, \
462 1.41 dsl { IFM_ETHER | IFM_100_TX | IFM_FDX, "100baseTX-FDX" }, \
463 1.41 dsl { IFM_ETHER | IFM_100_TX | IFM_FDX, "100BASE-TX-FDX" }, \
464 1.7 thorpej \
465 1.16 chopps /* \
466 1.16 chopps * IEEE 802.11 \
467 1.16 chopps */ \
468 1.41 dsl { IFM_IEEE80211 | IFM_IEEE80211_FH1, "FH1" }, \
469 1.41 dsl { IFM_IEEE80211 | IFM_IEEE80211_FH2, "FH2" }, \
470 1.41 dsl { IFM_IEEE80211 | IFM_IEEE80211_DS1, "DS1" }, \
471 1.41 dsl { IFM_IEEE80211 | IFM_IEEE80211_DS2, "DS2" }, \
472 1.41 dsl { IFM_IEEE80211 | IFM_IEEE80211_DS5, "DS5" }, \
473 1.41 dsl { IFM_IEEE80211 | IFM_IEEE80211_DS11, "DS11" }, \
474 1.41 dsl { IFM_IEEE80211 | IFM_IEEE80211_DS22, "DS22" }, \
475 1.41 dsl { IFM_IEEE80211 | IFM_IEEE80211_OFDM6, "OFDM6" }, \
476 1.41 dsl { IFM_IEEE80211 | IFM_IEEE80211_OFDM9, "OFDM9" }, \
477 1.41 dsl { IFM_IEEE80211 | IFM_IEEE80211_OFDM12, "OFDM12" }, \
478 1.41 dsl { IFM_IEEE80211 | IFM_IEEE80211_OFDM18, "OFDM18" }, \
479 1.41 dsl { IFM_IEEE80211 | IFM_IEEE80211_OFDM24, "OFDM24" }, \
480 1.41 dsl { IFM_IEEE80211 | IFM_IEEE80211_OFDM36, "OFDM36" }, \
481 1.41 dsl { IFM_IEEE80211 | IFM_IEEE80211_OFDM48, "OFDM48" }, \
482 1.41 dsl { IFM_IEEE80211 | IFM_IEEE80211_OFDM54, "OFDM54" }, \
483 1.41 dsl { IFM_IEEE80211 | IFM_IEEE80211_OFDM72, "OFDM72" }, \
484 1.50 christos { IFM_IEEE80211 | IFM_IEEE80211_DS354k, "DS/354Kbps" }, \
485 1.50 christos { IFM_IEEE80211 | IFM_IEEE80211_DS512k, "DS/512Kbps" }, \
486 1.50 christos { IFM_IEEE80211 | IFM_IEEE80211_OFDM3, "OFDM/3Mbps" }, \
487 1.50 christos { IFM_IEEE80211 | IFM_IEEE80211_OFDM4, "OFDM/4.5Mbps" }, \
488 1.50 christos { IFM_IEEE80211 | IFM_IEEE80211_OFDM27, "OFDM/27Mbps" }, \
489 1.16 chopps \
490 1.7 thorpej { 0, NULL }, \
491 1.7 thorpej }
492 1.7 thorpej
493 1.36 dyoung #define IFM_MODE_DESCRIPTIONS { \
494 1.36 dyoung { IFM_AUTO, "autoselect" }, \
495 1.36 dyoung { IFM_AUTO, "auto" }, \
496 1.41 dsl { IFM_IEEE80211 | IFM_IEEE80211_11A, "11a" }, \
497 1.41 dsl { IFM_IEEE80211 | IFM_IEEE80211_11B, "11b" }, \
498 1.41 dsl { IFM_IEEE80211 | IFM_IEEE80211_11G, "11g" }, \
499 1.41 dsl { IFM_IEEE80211 | IFM_IEEE80211_FH, "fh" }, \
500 1.50 christos { IFM_IEEE80211 | IFM_IEEE80211_11NA, "11na" }, \
501 1.50 christos { IFM_IEEE80211 | IFM_IEEE80211_11NG, "11ng" }, \
502 1.36 dyoung { 0, NULL }, \
503 1.36 dyoung }
504 1.36 dyoung
505 1.7 thorpej #define IFM_OPTION_DESCRIPTIONS { \
506 1.7 thorpej { IFM_FDX, "full-duplex" }, \
507 1.7 thorpej { IFM_FDX, "fdx" }, \
508 1.7 thorpej { IFM_HDX, "half-duplex" }, \
509 1.7 thorpej { IFM_HDX, "hdx" }, \
510 1.39 thorpej { IFM_FLOW, "flowcontrol" }, \
511 1.39 thorpej { IFM_FLOW, "flow" }, \
512 1.7 thorpej { IFM_FLAG0, "flag0" }, \
513 1.7 thorpej { IFM_FLAG1, "flag1" }, \
514 1.7 thorpej { IFM_FLAG2, "flag2" }, \
515 1.7 thorpej { IFM_LOOP, "loopback" }, \
516 1.7 thorpej { IFM_LOOP, "hw-loopback"}, \
517 1.7 thorpej { IFM_LOOP, "loop" }, \
518 1.24 thorpej \
519 1.41 dsl { IFM_ETHER | IFM_ETH_MASTER, "master" }, \
520 1.41 dsl { IFM_ETHER | IFM_ETH_RXPAUSE, "rxpause" }, \
521 1.41 dsl { IFM_ETHER | IFM_ETH_TXPAUSE, "txpause" }, \
522 1.41 dsl \
523 1.41 dsl { IFM_TOKEN | IFM_TOK_ETR, "EarlyTokenRelease" }, \
524 1.41 dsl { IFM_TOKEN | IFM_TOK_ETR, "ETR" }, \
525 1.41 dsl { IFM_TOKEN | IFM_TOK_SRCRT, "SourceRouting" }, \
526 1.41 dsl { IFM_TOKEN | IFM_TOK_SRCRT, "SRCRT" }, \
527 1.41 dsl { IFM_TOKEN | IFM_TOK_ALLR, "AllRoutes" }, \
528 1.41 dsl { IFM_TOKEN | IFM_TOK_ALLR, "ALLR" }, \
529 1.41 dsl \
530 1.41 dsl { IFM_FDDI | IFM_FDDI_DA, "dual-attach" }, \
531 1.41 dsl { IFM_FDDI | IFM_FDDI_DA, "das" }, \
532 1.41 dsl \
533 1.41 dsl { IFM_IEEE80211 | IFM_IEEE80211_ADHOC, "adhoc" }, \
534 1.41 dsl { IFM_IEEE80211 | IFM_IEEE80211_HOSTAP, "hostap" }, \
535 1.41 dsl { IFM_IEEE80211 | IFM_IEEE80211_MONITOR,"monitor" }, \
536 1.41 dsl { IFM_IEEE80211 | IFM_IEEE80211_TURBO, "turbo" }, \
537 1.50 christos { IFM_IEEE80211 | IFM_IEEE80211_IBSS, "ibss" }, \
538 1.50 christos { IFM_IEEE80211 | IFM_IEEE80211_WDS, "wds" }, \
539 1.55 cegger { IFM_IEEE80211 | IFM_IEEE80211_MBSS, "mesh" }, \
540 1.7 thorpej \
541 1.1 thorpej { 0, NULL }, \
542 1.23 thorpej }
543 1.23 thorpej
544 1.23 thorpej /*
545 1.23 thorpej * Baudrate descriptions for the various media types.
546 1.23 thorpej */
547 1.23 thorpej struct ifmedia_baudrate {
548 1.23 thorpej int ifmb_word; /* media word */
549 1.53 dyoung uint64_t ifmb_baudrate; /* corresponding baudrate */
550 1.23 thorpej };
551 1.23 thorpej
552 1.23 thorpej #define IFM_BAUDRATE_DESCRIPTIONS { \
553 1.41 dsl { IFM_ETHER | IFM_10_T, IF_Mbps(10) }, \
554 1.41 dsl { IFM_ETHER | IFM_10_2, IF_Mbps(10) }, \
555 1.41 dsl { IFM_ETHER | IFM_10_5, IF_Mbps(10) }, \
556 1.41 dsl { IFM_ETHER | IFM_100_TX, IF_Mbps(100) }, \
557 1.41 dsl { IFM_ETHER | IFM_100_FX, IF_Mbps(100) }, \
558 1.41 dsl { IFM_ETHER | IFM_100_T4, IF_Mbps(100) }, \
559 1.41 dsl { IFM_ETHER | IFM_100_VG, IF_Mbps(100) }, \
560 1.41 dsl { IFM_ETHER | IFM_100_T2, IF_Mbps(100) }, \
561 1.41 dsl { IFM_ETHER | IFM_1000_SX, IF_Mbps(1000) }, \
562 1.41 dsl { IFM_ETHER | IFM_10_STP, IF_Mbps(10) }, \
563 1.41 dsl { IFM_ETHER | IFM_10_FL, IF_Mbps(10) }, \
564 1.41 dsl { IFM_ETHER | IFM_1000_LX, IF_Mbps(1000) }, \
565 1.41 dsl { IFM_ETHER | IFM_1000_CX, IF_Mbps(1000) }, \
566 1.41 dsl { IFM_ETHER | IFM_1000_T, IF_Mbps(1000) }, \
567 1.41 dsl { IFM_ETHER | IFM_HPNA_1, IF_Mbps(1) }, \
568 1.41 dsl { IFM_ETHER | IFM_10G_LR, IF_Gbps(10ULL) }, \
569 1.46 ragge { IFM_ETHER | IFM_10G_SR, IF_Gbps(10ULL) }, \
570 1.46 ragge { IFM_ETHER | IFM_10G_CX4, IF_Gbps(10ULL) }, \
571 1.51 mhitch { IFM_ETHER | IFM_2500_SX, IF_Mbps(2500ULL) }, \
572 1.41 dsl \
573 1.41 dsl { IFM_TOKEN | IFM_TOK_STP4, IF_Mbps(4) }, \
574 1.41 dsl { IFM_TOKEN | IFM_TOK_STP16, IF_Mbps(16) }, \
575 1.41 dsl { IFM_TOKEN | IFM_TOK_UTP4, IF_Mbps(4) }, \
576 1.41 dsl { IFM_TOKEN | IFM_TOK_UTP16, IF_Mbps(16) }, \
577 1.41 dsl \
578 1.41 dsl { IFM_FDDI | IFM_FDDI_SMF, IF_Mbps(100) }, \
579 1.41 dsl { IFM_FDDI | IFM_FDDI_MMF, IF_Mbps(100) }, \
580 1.41 dsl { IFM_FDDI | IFM_FDDI_UTP, IF_Mbps(100) }, \
581 1.41 dsl \
582 1.41 dsl { IFM_IEEE80211 | IFM_IEEE80211_FH1, IF_Mbps(1) }, \
583 1.41 dsl { IFM_IEEE80211 | IFM_IEEE80211_FH2, IF_Mbps(2) }, \
584 1.41 dsl { IFM_IEEE80211 | IFM_IEEE80211_DS2, IF_Mbps(2) }, \
585 1.41 dsl { IFM_IEEE80211 | IFM_IEEE80211_DS5, IF_Kbps(5500) }, \
586 1.41 dsl { IFM_IEEE80211 | IFM_IEEE80211_DS11, IF_Mbps(11) }, \
587 1.41 dsl { IFM_IEEE80211 | IFM_IEEE80211_DS1, IF_Mbps(1) }, \
588 1.41 dsl { IFM_IEEE80211 | IFM_IEEE80211_DS22, IF_Mbps(22) }, \
589 1.41 dsl { IFM_IEEE80211 | IFM_IEEE80211_OFDM6, IF_Mbps(6) }, \
590 1.41 dsl { IFM_IEEE80211 | IFM_IEEE80211_OFDM9, IF_Mbps(9) }, \
591 1.41 dsl { IFM_IEEE80211 | IFM_IEEE80211_OFDM12, IF_Mbps(12) }, \
592 1.41 dsl { IFM_IEEE80211 | IFM_IEEE80211_OFDM18, IF_Mbps(18) }, \
593 1.41 dsl { IFM_IEEE80211 | IFM_IEEE80211_OFDM24, IF_Mbps(24) }, \
594 1.41 dsl { IFM_IEEE80211 | IFM_IEEE80211_OFDM36, IF_Mbps(36) }, \
595 1.41 dsl { IFM_IEEE80211 | IFM_IEEE80211_OFDM48, IF_Mbps(48) }, \
596 1.41 dsl { IFM_IEEE80211 | IFM_IEEE80211_OFDM54, IF_Mbps(54) }, \
597 1.41 dsl { IFM_IEEE80211 | IFM_IEEE80211_OFDM72, IF_Mbps(72) }, \
598 1.23 thorpej \
599 1.23 thorpej { 0, 0 }, \
600 1.18 thorpej }
601 1.18 thorpej
602 1.18 thorpej /*
603 1.18 thorpej * Status bit descriptions for the various media types.
604 1.18 thorpej */
605 1.18 thorpej struct ifmedia_status_description {
606 1.18 thorpej int ifms_type;
607 1.18 thorpej int ifms_valid;
608 1.18 thorpej int ifms_bit;
609 1.18 thorpej const char *ifms_string[2];
610 1.18 thorpej };
611 1.18 thorpej
612 1.18 thorpej #define IFM_STATUS_DESC(ifms, bit) \
613 1.18 thorpej (ifms)->ifms_string[((ifms)->ifms_bit & (bit)) ? 1 : 0]
614 1.18 thorpej
615 1.18 thorpej #define IFM_STATUS_DESCRIPTIONS { \
616 1.18 thorpej { IFM_ETHER, IFM_AVALID, IFM_ACTIVE, \
617 1.18 thorpej { "no carrier", "active" } }, \
618 1.18 thorpej \
619 1.18 thorpej { IFM_FDDI, IFM_AVALID, IFM_ACTIVE, \
620 1.18 thorpej { "no ring", "inserted" } }, \
621 1.18 thorpej \
622 1.18 thorpej { IFM_TOKEN, IFM_AVALID, IFM_ACTIVE, \
623 1.18 thorpej { "no ring", "inserted" } }, \
624 1.18 thorpej \
625 1.18 thorpej { IFM_IEEE80211, IFM_AVALID, IFM_ACTIVE, \
626 1.18 thorpej { "no network", "active" } }, \
627 1.18 thorpej \
628 1.45 liamjfoy { IFM_CARP, IFM_AVALID, IFM_ACTIVE, \
629 1.45 liamjfoy { "backup", "master" } }, \
630 1.45 liamjfoy \
631 1.18 thorpej { 0, 0, 0, \
632 1.18 thorpej { NULL, NULL } }, \
633 1.1 thorpej }
634 1.1 thorpej
635 1.42 dsl #ifndef _KERNEL
636 1.42 dsl /* Functions for converting media to/from strings, in libutil/if_media.c */
637 1.42 dsl const char *get_media_type_string(int);
638 1.42 dsl const char *get_media_subtype_string(int);
639 1.42 dsl const char *get_media_mode_string(int);
640 1.42 dsl const char *get_media_option_string(int *);
641 1.42 dsl int get_media_mode(int, const char *);
642 1.42 dsl int get_media_subtype(int, const char *);
643 1.42 dsl int get_media_options(int, const char *, char **);
644 1.42 dsl int lookup_media_word(struct ifmedia_description *, int, const char *);
645 1.42 dsl #endif /* _KERNEL */
646 1.42 dsl
647 1.43 elad #endif /* !_NET_IF_MEDIA_H_ */
648