]>
Commit | Line | Data |
---|---|---|
1c79356b | 1 | /* |
0a7de745 | 2 | * Copyright (c) 2000-2019 Apple Inc. All rights reserved. |
5d5c5d0d | 3 | * |
2d21ac55 | 4 | * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ |
0a7de745 | 5 | * |
2d21ac55 A |
6 | * This file contains Original Code and/or Modifications of Original Code |
7 | * as defined in and that are subject to the Apple Public Source License | |
8 | * Version 2.0 (the 'License'). You may not use this file except in | |
9 | * compliance with the License. The rights granted to you under the License | |
10 | * may not be used to create, or enable the creation or redistribution of, | |
11 | * unlawful or unlicensed copies of an Apple operating system, or to | |
12 | * circumvent, violate, or enable the circumvention or violation of, any | |
13 | * terms of an Apple operating system software license agreement. | |
0a7de745 | 14 | * |
2d21ac55 A |
15 | * Please obtain a copy of the License at |
16 | * http://www.opensource.apple.com/apsl/ and read it before using this file. | |
0a7de745 | 17 | * |
2d21ac55 A |
18 | * The Original Code and all software distributed under the License are |
19 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
8f6c56a5 A |
20 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
21 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
2d21ac55 A |
22 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. |
23 | * Please see the License for the specific language governing rights and | |
24 | * limitations under the License. | |
0a7de745 | 25 | * |
2d21ac55 | 26 | * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ |
1c79356b | 27 | */ |
cb323159 | 28 | /* $NetBSD: if_media.h,v 1.3 1997/03/26 01:19:27 thorpej Exp $ */ |
9bccf70c | 29 | /* $FreeBSD: src/sys/net/if_media.h,v 1.9.2.1 2001/07/04 00:12:38 brooks Exp $ */ |
1c79356b A |
30 | |
31 | /* | |
32 | * Copyright (c) 1997 | |
cb323159 | 33 | * Jonathan Stone and Jason R. Thorpe. All rights reserved. |
1c79356b A |
34 | * |
35 | * This software is derived from information provided by Matt Thomas. | |
36 | * | |
37 | * Redistribution and use in source and binary forms, with or without | |
38 | * modification, are permitted provided that the following conditions | |
39 | * are met: | |
40 | * 1. Redistributions of source code must retain the above copyright | |
41 | * notice, this list of conditions and the following disclaimer. | |
42 | * 2. Redistributions in binary form must reproduce the above copyright | |
43 | * notice, this list of conditions and the following disclaimer in the | |
44 | * documentation and/or other materials provided with the distribution. | |
45 | * 3. All advertising materials mentioning features or use of this software | |
46 | * must display the following acknowledgement: | |
cb323159 A |
47 | * This product includes software developed by Jonathan Stone |
48 | * and Jason R. Thorpe for the NetBSD Project. | |
1c79356b A |
49 | * 4. The names of the authors may not be used to endorse or promote products |
50 | * derived from this software without specific prior written permission. | |
51 | * | |
52 | * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR | |
53 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
54 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
55 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | |
56 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | |
57 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | |
58 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | |
59 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |
60 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
61 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
62 | * SUCH DAMAGE. | |
63 | */ | |
64 | ||
65 | #ifndef _NET_IF_MEDIA_H_ | |
66 | #define _NET_IF_MEDIA_H_ | |
f427ee49 | 67 | #ifndef DRIVERKIT |
9bccf70c | 68 | #include <sys/appleapiopts.h> |
f427ee49 | 69 | #endif /* DRIVERKIT */ |
1c79356b A |
70 | |
71 | /* | |
72 | * Prototypes and definitions for BSD/OS-compatible network interface | |
73 | * media selection. | |
74 | * | |
75 | * Where it is safe to do so, this code strays slightly from the BSD/OS | |
76 | * design. Software which uses the API (device drivers, basically) | |
77 | * shouldn't notice any difference. | |
78 | * | |
79 | * Many thanks to Matt Thomas for providing the information necessary | |
80 | * to implement this interface. | |
81 | */ | |
82 | ||
91447636 | 83 | #ifdef KERNEL_PRIVATE |
39236c6e | 84 | /* sigh; some modules are lazy and thus rely on this */ |
1c79356b | 85 | #include <sys/queue.h> |
91447636 | 86 | #endif /* KERNEL_PRIVATE */ |
1c79356b A |
87 | |
88 | /* | |
89 | * if_media Options word: | |
90 | * Bits Use | |
91 | * ---- ------- | |
0a7de745 | 92 | * 0-4 Media variant |
cb323159 | 93 | * 5-7 Media type |
1c79356b | 94 | * 8-15 Type specific options |
0a7de745 | 95 | * 16-19 Extended media variant bits |
1c79356b A |
96 | * 20-27 Shared (global) options |
97 | * 28-31 Instance | |
98 | */ | |
99 | ||
100 | /* | |
101 | * Ethernet | |
0a7de745 A |
102 | * |
103 | * In order to use more than 31 subtypes, Ethernet uses the extended media | |
104 | * variant bits | |
105 | * | |
106 | * The extended media variant bits are not backward compatible so they | |
107 | * must not be used by kernel extensions like ifnet and drivers that | |
108 | * are to be deployed on older system versions | |
1c79356b | 109 | */ |
0a7de745 A |
110 | #define IFM_X(x) IFM_X_SUBTYPE(x) /* internal shorthand */ |
111 | ||
112 | #define IFM_ETHER 0x00000020 | |
113 | #define IFM_10_T 3 /* 10BaseT - RJ45 */ | |
114 | #define IFM_10_2 4 /* 10Base2 - Thinnet */ | |
115 | #define IFM_10_5 5 /* 10Base5 - AUI */ | |
116 | #define IFM_100_TX 6 /* 100BaseTX - RJ45 */ | |
117 | #define IFM_100_FX 7 /* 100BaseFX - Fiber */ | |
118 | #define IFM_100_T4 8 /* 100BaseT4 - 4 pair cat 3 */ | |
119 | #define IFM_100_VG 9 /* 100VG-AnyLAN */ | |
120 | #define IFM_100_T2 10 /* 100BaseT2 */ | |
121 | #define IFM_1000_SX 11 /* 1000BaseSX - multi-mode fiber */ | |
122 | #define IFM_10_STP 12 /* 10BaseT over shielded TP */ | |
123 | #define IFM_10_FL 13 /* 10baseFL - Fiber */ | |
124 | #define IFM_1000_LX 14 /* 1000baseLX - single-mode fiber */ | |
125 | #define IFM_1000_CX 15 /* 1000baseCX - 150ohm STP */ | |
126 | #define IFM_1000_T 16 /* 1000baseT - 4 pair cat 5 */ | |
91447636 | 127 | #ifdef PRIVATE |
0a7de745 | 128 | #define IFM_1000_TX IFM_1000_T /* For compatibility */ |
91447636 | 129 | #endif /* PRIVATE */ |
0a7de745 A |
130 | #define IFM_HPNA_1 17 /* HomePNA 1.0 (1Mb/s) */ |
131 | #define IFM_10G_SR 18 /* 10GbaseSR - multi-mode fiber */ | |
132 | #define IFM_10G_LR 19 /* 10GbaseLR - single-mode fiber */ | |
133 | #define IFM_10G_CX4 20 /* 10GbaseCX4 - copper */ | |
134 | #define IFM_10G_T 21 /* 10GbaseT - 4 pair cat 6 */ | |
135 | #define IFM_2500_T 22 /* 2500baseT - 4 pair cat 5 */ | |
136 | #define IFM_5000_T 23 /* 5000baseT - 4 pair cat 5 */ | |
137 | #define IFM_1000_CX_SGMII 24 /* 1000Base-CX-SGMII */ | |
138 | #define IFM_1000_KX 25 /* 1000Base-KX backplane */ | |
139 | #define IFM_10G_KX4 26 /* 10GBase-KX4 backplane */ | |
140 | #define IFM_10G_KR 27 /* 10GBase-KR backplane */ | |
141 | #define IFM_10G_CR1 28 /* 10GBase-CR1 Twinax splitter */ | |
142 | #define IFM_10G_ER 29 /* 10GBase-ER */ | |
143 | #define IFM_20G_KR2 30 /* 20GBase-KR2 backplane */ | |
144 | #define IFM_OTHER 31 /* Other: one of the following */ | |
145 | ||
146 | /* following types are not visible to old binaries using the low bits of IFM_TMASK */ | |
147 | #define IFM_2500_SX IFM_X(32) /* 2500BaseSX - multi-mode fiber */ | |
148 | #define IFM_10G_TWINAX IFM_X(33) /* 10GBase Twinax copper */ | |
149 | #define IFM_10G_TWINAX_LONG IFM_X(34) /* 10GBase Twinax Long copper */ | |
150 | #define IFM_10G_LRM IFM_X(35) /* 10GBase-LRM 850nm Multi-mode */ | |
151 | #define IFM_2500_KX IFM_X(36) /* 2500Base-KX backplane */ | |
152 | #define IFM_40G_CR4 IFM_X(37) /* 40GBase-CR4 */ | |
153 | #define IFM_40G_SR4 IFM_X(38) /* 40GBase-SR4 */ | |
154 | #define IFM_50G_PCIE IFM_X(39) /* 50G Ethernet over PCIE */ | |
155 | #define IFM_25G_PCIE IFM_X(40) /* 25G Ethernet over PCIE */ | |
156 | #define IFM_1000_SGMII IFM_X(41) /* 1G media interface */ | |
157 | #define IFM_10G_SFI IFM_X(42) /* 10G media interface */ | |
158 | #define IFM_40G_XLPPI IFM_X(43) /* 40G media interface */ | |
159 | #define IFM_40G_LR4 IFM_X(44) /* 40GBase-LR4 */ | |
160 | #define IFM_40G_KR4 IFM_X(45) /* 40GBase-KR4 */ | |
161 | #define IFM_100G_CR4 IFM_X(47) /* 100GBase-CR4 */ | |
162 | #define IFM_100G_SR4 IFM_X(48) /* 100GBase-SR4 */ | |
163 | #define IFM_100G_KR4 IFM_X(49) /* 100GBase-KR4 */ | |
164 | #define IFM_100G_LR4 IFM_X(50) /* 100GBase-LR4 */ | |
165 | #define IFM_56G_R4 IFM_X(51) /* 56GBase-R4 */ | |
166 | #define IFM_100_T IFM_X(52) /* 100BaseT - RJ45 */ | |
167 | #define IFM_25G_CR IFM_X(53) /* 25GBase-CR */ | |
168 | #define IFM_25G_KR IFM_X(54) /* 25GBase-KR */ | |
169 | #define IFM_25G_SR IFM_X(55) /* 25GBase-SR */ | |
170 | #define IFM_50G_CR2 IFM_X(56) /* 50GBase-CR2 */ | |
171 | #define IFM_50G_KR2 IFM_X(57) /* 50GBase-KR2 */ | |
172 | #define IFM_25G_LR IFM_X(58) /* 25GBase-LR */ | |
173 | #define IFM_10G_AOC IFM_X(59) /* 10G active optical cable */ | |
174 | #define IFM_25G_ACC IFM_X(60) /* 25G active copper cable */ | |
175 | #define IFM_25G_AOC IFM_X(61) /* 25G active optical cable */ | |
176 | #define IFM_100_SGMII IFM_X(62) /* 100M media interface */ | |
177 | #define IFM_2500_X IFM_X(63) /* 2500BaseX */ | |
178 | #define IFM_5000_KR IFM_X(64) /* 5GBase-KR backplane */ | |
179 | #define IFM_25G_T IFM_X(65) /* 25GBase-T - RJ45 */ | |
180 | #define IFM_25G_CR_S IFM_X(66) /* 25GBase-CR (short) */ | |
181 | #define IFM_25G_CR1 IFM_X(67) /* 25GBase-CR1 DA cable */ | |
182 | #define IFM_25G_KR_S IFM_X(68) /* 25GBase-KR (short) */ | |
183 | #define IFM_5000_KR_S IFM_X(69) /* 5GBase-KR backplane (short) */ | |
184 | #define IFM_5000_KR1 IFM_X(70) /* 5GBase-KR backplane */ | |
185 | #define IFM_25G_AUI IFM_X(71) /* 25G-AUI-C2C (chip to chip) */ | |
186 | #define IFM_40G_XLAUI IFM_X(72) /* 40G-XLAUI */ | |
187 | #define IFM_40G_XLAUI_AC IFM_X(73) /* 40G active copper/optical */ | |
188 | #define IFM_40G_ER4 IFM_X(74) /* 40GBase-ER4 */ | |
189 | #define IFM_50G_SR2 IFM_X(75) /* 50GBase-SR2 */ | |
190 | #define IFM_50G_LR2 IFM_X(76) /* 50GBase-LR2 */ | |
191 | #define IFM_50G_LAUI2_AC IFM_X(77) /* 50G active copper/optical */ | |
192 | #define IFM_50G_LAUI2 IFM_X(78) /* 50G-LAUI2 */ | |
193 | #define IFM_50G_AUI2_AC IFM_X(79) /* 50G active copper/optical */ | |
194 | #define IFM_50G_AUI2 IFM_X(80) /* 50G-AUI2 */ | |
195 | #define IFM_50G_CP IFM_X(81) /* 50GBase-CP */ | |
196 | #define IFM_50G_SR IFM_X(82) /* 50GBase-SR */ | |
197 | #define IFM_50G_LR IFM_X(83) /* 50GBase-LR */ | |
198 | #define IFM_50G_FR IFM_X(84) /* 50GBase-FR */ | |
199 | #define IFM_50G_KR_PAM4 IFM_X(85) /* 50GBase-KR PAM4 */ | |
200 | #define IFM_25G_KR1 IFM_X(86) /* 25GBase-KR1 */ | |
201 | #define IFM_50G_AUI1_AC IFM_X(87) /* 50G active copper/optical */ | |
202 | #define IFM_50G_AUI1 IFM_X(88) /* 50G-AUI1 */ | |
203 | #define IFM_100G_CAUI4_AC IFM_X(89) /* 100G-CAUI4 active copper/optical */ | |
204 | #define IFM_100G_CAUI4 IFM_X(90) /* 100G-CAUI4 */ | |
205 | #define IFM_100G_AUI4_AC IFM_X(91) /* 100G-AUI4 active copper/optical */ | |
206 | #define IFM_100G_AUI4 IFM_X(92) /* 100G-AUI4 */ | |
207 | #define IFM_100G_CR_PAM4 IFM_X(93) /* 100GBase-CR PAM4 */ | |
208 | #define IFM_100G_KR_PAM4 IFM_X(94) /* 100GBase-CR PAM4 */ | |
209 | #define IFM_100G_CP2 IFM_X(95) /* 100GBase-CP2 */ | |
210 | #define IFM_100G_SR2 IFM_X(96) /* 100GBase-SR2 */ | |
211 | #define IFM_100G_DR IFM_X(97) /* 100GBase-DR */ | |
212 | #define IFM_100G_KR2_PAM4 IFM_X(98) /* 100GBase-KR2 PAM4 */ | |
213 | #define IFM_100G_CAUI2_AC IFM_X(99) /* 100G-CAUI2 active copper/optical */ | |
214 | #define IFM_100G_CAUI2 IFM_X(100) /* 100G-CAUI2 */ | |
215 | #define IFM_100G_AUI2_AC IFM_X(101) /* 100G-AUI2 active copper/optical */ | |
216 | #define IFM_100G_AUI2 IFM_X(102) /* 100G-AUI2 */ | |
217 | #define IFM_200G_CR4_PAM4 IFM_X(103) /* 200GBase-CR4 PAM4 */ | |
218 | #define IFM_200G_SR4 IFM_X(104) /* 200GBase-SR4 */ | |
219 | #define IFM_200G_FR4 IFM_X(105) /* 200GBase-FR4 */ | |
220 | #define IFM_200G_LR4 IFM_X(106) /* 200GBase-LR4 */ | |
221 | #define IFM_200G_DR4 IFM_X(107) /* 200GBase-DR4 */ | |
222 | #define IFM_200G_KR4_PAM4 IFM_X(108) /* 200GBase-KR4 PAM4 */ | |
223 | #define IFM_200G_AUI4_AC IFM_X(109) /* 200G-AUI4 active copper/optical */ | |
224 | #define IFM_200G_AUI4 IFM_X(110) /* 200G-AUI4 */ | |
225 | #define IFM_200G_AUI8_AC IFM_X(111) /* 200G-AUI8 active copper/optical */ | |
226 | #define IFM_200G_AUI8 IFM_X(112) /* 200G-AUI8 */ | |
227 | #define IFM_400G_FR8 IFM_X(113) /* 400GBase-FR8 */ | |
228 | #define IFM_400G_LR8 IFM_X(114) /* 400GBase-LR8 */ | |
229 | #define IFM_400G_DR4 IFM_X(115) /* 400GBase-DR4 */ | |
230 | #define IFM_400G_AUI8_AC IFM_X(116) /* 400G-AUI8 active copper/optical */ | |
231 | #define IFM_400G_AUI8 IFM_X(117) /* 400G-AUI8 */ | |
1c79356b A |
232 | |
233 | /* | |
234 | * Token ring | |
235 | */ | |
0a7de745 A |
236 | #define IFM_TOKEN 0x00000040 |
237 | #define IFM_TOK_STP4 3 /* Shielded twisted pair 4m - DB9 */ | |
238 | #define IFM_TOK_STP16 4 /* Shielded twisted pair 16m - DB9 */ | |
239 | #define IFM_TOK_UTP4 5 /* Unshielded twisted pair 4m - RJ45 */ | |
240 | #define IFM_TOK_UTP16 6 /* Unshielded twisted pair 16m - RJ45 */ | |
241 | #define IFM_TOK_STP100 7 /* Shielded twisted pair 100m - DB9 */ | |
242 | #define IFM_TOK_UTP100 8 /* Unshielded twisted pair 100m - RJ45 */ | |
243 | #define IFM_TOK_ETR 0x00000200 /* Early token release */ | |
244 | #define IFM_TOK_SRCRT 0x00000400 /* Enable source routing features */ | |
245 | #define IFM_TOK_ALLR 0x00000800 /* All routes / Single route bcast */ | |
246 | #define IFM_TOK_DTR 0x00002000 /* Dedicated token ring */ | |
247 | #define IFM_TOK_CLASSIC 0x00004000 /* Classic token ring */ | |
248 | #define IFM_TOK_AUTO 0x00008000 /* Automatic Dedicate/Classic token ring */ | |
1c79356b A |
249 | |
250 | /* | |
251 | * FDDI | |
252 | */ | |
0a7de745 A |
253 | #define IFM_FDDI 0x00000060 |
254 | #define IFM_FDDI_SMF 3 /* Single-mode fiber */ | |
255 | #define IFM_FDDI_MMF 4 /* Multi-mode fiber */ | |
256 | #define IFM_FDDI_UTP 5 /* CDDI / UTP */ | |
257 | #define IFM_FDDI_DA 0x00000100 /* Dual attach / single attach */ | |
1c79356b A |
258 | |
259 | /* | |
260 | * IEEE 802.11 Wireless | |
261 | */ | |
0a7de745 A |
262 | #define IFM_IEEE80211 0x00000080 |
263 | #define IFM_IEEE80211_FH1 3 /* Frequency Hopping 1Mbps */ | |
264 | #define IFM_IEEE80211_FH2 4 /* Frequency Hopping 2Mbps */ | |
265 | #define IFM_IEEE80211_DS2 5 /* Direct Sequence 2Mbps */ | |
266 | #define IFM_IEEE80211_DS5 6 /* Direct Sequence 5Mbps*/ | |
267 | #define IFM_IEEE80211_DS11 7 /* Direct Sequence 11Mbps*/ | |
268 | #define IFM_IEEE80211_DS1 8 /* Direct Sequence 1Mbps */ | |
269 | #define IFM_IEEE80211_DS22 9 /* Direct Sequence 22Mbps */ | |
270 | #define IFM_IEEE80211_ADHOC 0x00000100 /* Operate in Adhoc mode */ | |
1c79356b A |
271 | |
272 | /* | |
273 | * Shared media sub-types | |
274 | */ | |
0a7de745 A |
275 | #define IFM_AUTO 0 /* Autoselect best media */ |
276 | #define IFM_MANUAL 1 /* Jumper/dipswitch selects media */ | |
277 | #define IFM_NONE 2 /* Deselect all media */ | |
1c79356b A |
278 | |
279 | /* | |
280 | * Shared options | |
281 | */ | |
0a7de745 A |
282 | #define IFM_FDX 0x00100000 /* Force full duplex */ |
283 | #define IFM_HDX 0x00200000 /* Force half duplex */ | |
284 | #define IFM_FLOW 0x00400000 /* enable hardware flow control */ | |
285 | #define IFM_EEE 0x00800000 /* Support energy efficient ethernet */ | |
286 | #define IFM_FLAG0 0x01000000 /* Driver defined flag */ | |
287 | #define IFM_FLAG1 0x02000000 /* Driver defined flag */ | |
288 | #define IFM_FLAG2 0x04000000 /* Driver defined flag */ | |
289 | #define IFM_LOOP 0x08000000 /* Put hardware in loopback */ | |
290 | ||
291 | /* | |
292 | * Macros to access bits of extended media sub-types (media variants) | |
293 | */ | |
294 | #define IFM_TMASK_COMPAT 0x0000001f /* Lower bits of media sub-type */ | |
295 | #define IFM_TMASK_EXT 0x000f0000 /* For extended media sub-type */ | |
296 | #define IFM_TMASK_EXT_SHIFT 11 /* to extract high bits */ | |
297 | #define IFM_X_SUBTYPE(x) (((x) & IFM_TMASK_COMPAT) | \ | |
298 | (((x) & (IFM_TMASK_EXT >> IFM_TMASK_EXT_SHIFT)) << IFM_TMASK_EXT_SHIFT)) | |
1c79356b A |
299 | |
300 | /* | |
301 | * Masks | |
302 | */ | |
cb323159 | 303 | #define IFM_NMASK 0x000000e0 /* Network type */ |
0a7de745 | 304 | #define IFM_TMASK (IFM_TMASK_COMPAT|IFM_TMASK_EXT) /* Media sub-type */ |
cb323159 A |
305 | #define IFM_IMASK 0xf0000000 /* Instance */ |
306 | #define IFM_ISHIFT 28 /* Instance shift */ | |
307 | #define IFM_OMASK 0x0000ff00 /* Type specific options */ | |
308 | #define IFM_GMASK 0x0ff00000 /* Global options */ | |
1c79356b A |
309 | |
310 | /* | |
311 | * Status bits | |
312 | */ | |
0a7de745 A |
313 | #define IFM_AVALID 0x00000001 /* Active bit valid */ |
314 | #define IFM_ACTIVE 0x00000002 /* Interface attached to working net */ | |
315 | #define IFM_WAKESAMENET 0x00000004 /* No link transition while asleep */ | |
1c79356b A |
316 | |
317 | /* | |
318 | * Macros to extract various bits of information from the media word. | |
319 | */ | |
0a7de745 A |
320 | #define IFM_TYPE(x) ((x) & IFM_NMASK) |
321 | #define IFM_SUBTYPE(x) ((x) & IFM_TMASK) | |
9bccf70c | 322 | #define IFM_TYPE_OPTIONS(x) ((x) & IFM_OMASK) |
0a7de745 | 323 | #define IFM_INST(x) (((x) & IFM_IMASK) >> IFM_ISHIFT) |
cb323159 | 324 | #define IFM_OPTIONS(x) ((x) & (IFM_OMASK|IFM_GMASK)) |
9bccf70c | 325 | |
0a7de745 | 326 | #define IFM_INST_MAX IFM_INST(IFM_IMASK) |
9bccf70c A |
327 | |
328 | /* | |
329 | * Macro to create a media word. | |
330 | */ | |
0a7de745 | 331 | #define IFM_MAKEWORD(type, subtype, options, instance) \ |
9bccf70c | 332 | ((type) | (subtype) | (options) | ((instance) << IFM_ISHIFT)) |
1c79356b A |
333 | |
334 | /* | |
335 | * NetBSD extension not defined in the BSDI API. This is used in various | |
336 | * places to get the canonical description for a given type/subtype. | |
337 | * | |
338 | * NOTE: all but the top-level type descriptions must contain NO whitespace! | |
339 | * Otherwise, parsing these in ifconfig(8) would be a nightmare. | |
340 | */ | |
341 | struct ifmedia_description { | |
0a7de745 A |
342 | int ifmt_word; /* word value; may be masked */ |
343 | const char *ifmt_string; /* description */ | |
1c79356b A |
344 | }; |
345 | ||
346 | #define IFM_TYPE_DESCRIPTIONS { \ | |
347 | { IFM_ETHER, "Ethernet" }, \ | |
348 | { IFM_TOKEN, "Token ring" }, \ | |
349 | { IFM_FDDI, "FDDI" }, \ | |
350 | { IFM_IEEE80211, "IEEE802.11" }, \ | |
351 | { 0, NULL }, \ | |
352 | } | |
353 | ||
cb323159 A |
354 | #define IFM_SUBTYPE_ETHERNET_DESCRIPTIONS { \ |
355 | { IFM_10_T, "10baseT/UTP" }, \ | |
356 | { IFM_10_2, "10base2/BNC" }, \ | |
357 | { IFM_10_5, "10base5/AUI" }, \ | |
358 | { IFM_100_TX, "100baseTX" }, \ | |
359 | { IFM_100_FX, "100baseFX" }, \ | |
360 | { IFM_100_T4, "100baseT4" }, \ | |
361 | { IFM_100_VG, "100baseVG" }, \ | |
362 | { IFM_100_T2, "100baseT2" }, \ | |
363 | { IFM_10_STP, "10baseSTP" }, \ | |
364 | { IFM_10_FL, "10baseFL" }, \ | |
0a7de745 | 365 | { IFM_1000_SX, "1000baseSX" }, \ |
cb323159 A |
366 | { IFM_1000_LX, "1000baseLX" }, \ |
367 | { IFM_1000_CX, "1000baseCX" }, \ | |
368 | { IFM_1000_T, "1000baseT" }, \ | |
0a7de745 A |
369 | { IFM_HPNA_1, "homePNA" }, \ |
370 | { IFM_10G_LR, "10Gbase-LR" }, \ | |
371 | { IFM_10G_SR, "10Gbase-SR" }, \ | |
372 | { IFM_10G_CX4, "10Gbase-CX4" }, \ | |
373 | { IFM_2500_SX, "2500BaseSX" }, \ | |
374 | { IFM_10G_LRM, "10Gbase-LRM" }, \ | |
375 | { IFM_10G_TWINAX, "10Gbase-Twinax" }, \ | |
376 | { IFM_10G_TWINAX_LONG, "10Gbase-Twinax-Long" }, \ | |
377 | { IFM_10G_T, "10Gbase-T" }, \ | |
378 | { IFM_40G_CR4, "40Gbase-CR4" }, \ | |
379 | { IFM_40G_SR4, "40Gbase-SR4" }, \ | |
380 | { IFM_40G_LR4, "40Gbase-LR4" }, \ | |
cb323159 | 381 | { IFM_1000_KX, "1000Base-KX" }, \ |
0a7de745 | 382 | { IFM_OTHER, "Other" }, \ |
cb323159 A |
383 | { IFM_10G_KX4, "10GBase-KX4" }, \ |
384 | { IFM_10G_KR, "10GBase-KR" }, \ | |
385 | { IFM_10G_CR1, "10GBase-CR1" }, \ | |
0a7de745 A |
386 | { IFM_20G_KR2, "20GBase-KR2" }, \ |
387 | { IFM_2500_KX, "2500Base-KX" }, \ | |
388 | { IFM_2500_T, "2500Base-T" }, \ | |
389 | { IFM_5000_T, "5000Base-T" }, \ | |
390 | { IFM_50G_PCIE, "PCIExpress-50G" }, \ | |
391 | { IFM_25G_PCIE, "PCIExpress-25G" }, \ | |
392 | { IFM_1000_SGMII, "1000Base-SGMII" }, \ | |
393 | { IFM_10G_SFI, "10GBase-SFI" }, \ | |
394 | { IFM_40G_XLPPI, "40GBase-XLPPI" }, \ | |
395 | { IFM_1000_CX_SGMII, "1000Base-CX-SGMII" }, \ | |
396 | { IFM_40G_KR4, "40GBase-KR4" }, \ | |
cb323159 | 397 | { IFM_10G_ER, "10GBase-ER" }, \ |
0a7de745 A |
398 | { IFM_100G_CR4, "100GBase-CR4" }, \ |
399 | { IFM_100G_SR4, "100GBase-SR4" }, \ | |
400 | { IFM_100G_KR4, "100GBase-KR4" }, \ | |
401 | { IFM_100G_LR4, "100GBase-LR4" }, \ | |
402 | { IFM_56G_R4, "56GBase-R4" }, \ | |
403 | { IFM_100_T, "100BaseT" }, \ | |
cb323159 A |
404 | { IFM_25G_CR, "25GBase-CR" }, \ |
405 | { IFM_25G_KR, "25GBase-KR" }, \ | |
406 | { IFM_25G_SR, "25GBase-SR" }, \ | |
407 | { IFM_50G_CR2, "50GBase-CR2" }, \ | |
408 | { IFM_50G_KR2, "50GBase-KR2" }, \ | |
0a7de745 A |
409 | { IFM_25G_LR, "25GBase-LR" }, \ |
410 | { IFM_10G_AOC, "10GBase-AOC" }, \ | |
411 | { IFM_25G_ACC, "25GBase-ACC" }, \ | |
412 | { IFM_25G_AOC, "25GBase-AOC" }, \ | |
413 | { IFM_100_SGMII, "100M-SGMII" }, \ | |
414 | { IFM_2500_X, "2500Base-X" }, \ | |
415 | { IFM_5000_KR, "5000Base-KR" }, \ | |
416 | { IFM_25G_T, "25GBase-T" }, \ | |
417 | { IFM_25G_CR_S, "25GBase-CR-S" }, \ | |
418 | { IFM_25G_CR1, "25GBase-CR1" }, \ | |
419 | { IFM_25G_KR_S, "25GBase-KR-S" }, \ | |
420 | { IFM_5000_KR_S, "5000Base-KR-S" }, \ | |
421 | { IFM_5000_KR1, "5000Base-KR1" }, \ | |
422 | { IFM_25G_AUI, "25G-AUI" }, \ | |
423 | { IFM_40G_XLAUI, "40G-XLAUI" }, \ | |
424 | { IFM_40G_XLAUI_AC, "40G-XLAUI-AC" }, \ | |
425 | { IFM_40G_ER4, "40GBase-ER4" }, \ | |
cb323159 A |
426 | { IFM_50G_SR2, "50GBase-SR2" }, \ |
427 | { IFM_50G_LR2, "50GBase-LR2" }, \ | |
0a7de745 A |
428 | { IFM_50G_LAUI2_AC, "50G-LAUI2-AC" }, \ |
429 | { IFM_50G_LAUI2, "50G-LAUI2" }, \ | |
430 | { IFM_50G_AUI2_AC, "50G-AUI2-AC" }, \ | |
431 | { IFM_50G_AUI2, "50G-AUI2" }, \ | |
432 | { IFM_50G_CP, "50GBase-CP" }, \ | |
433 | { IFM_50G_SR, "50GBase-SR" }, \ | |
434 | { IFM_50G_LR, "50GBase-LR" }, \ | |
435 | { IFM_50G_FR, "50GBase-FR" }, \ | |
436 | { IFM_50G_KR_PAM4, "50GBase-KR-PAM4" }, \ | |
437 | { IFM_25G_KR1, "25GBase-KR1" }, \ | |
438 | { IFM_50G_AUI1_AC, "50G-AUI1-AC" }, \ | |
439 | { IFM_50G_AUI1, "50G-AUI1" }, \ | |
440 | { IFM_100G_CAUI4_AC, "100G-CAUI4-AC" }, \ | |
441 | { IFM_100G_CAUI4, "100G-CAUI4" }, \ | |
442 | { IFM_100G_AUI4_AC, "100G-AUI4-AC" }, \ | |
443 | { IFM_100G_AUI4, "100G-AUI4" }, \ | |
444 | { IFM_100G_CR_PAM4, "100GBase-CR-PAM4" }, \ | |
445 | { IFM_100G_KR_PAM4, "100GBase-KR-PAM4" }, \ | |
446 | { IFM_100G_CP2, "100GBase-CP2" }, \ | |
447 | { IFM_100G_SR2, "100GBase-SR2" }, \ | |
448 | { IFM_100G_DR, "100GBase-DR" }, \ | |
449 | { IFM_100G_KR2_PAM4, "100GBase-KR2-PAM4" }, \ | |
450 | { IFM_100G_CAUI2_AC, "100G-CAUI2-AC" }, \ | |
451 | { IFM_100G_CAUI2, "100G-CAUI2" }, \ | |
452 | { IFM_100G_AUI2_AC, "100G-AUI2-AC" }, \ | |
453 | { IFM_100G_AUI2, "100G-AUI2" }, \ | |
454 | { IFM_200G_CR4_PAM4, "200GBase-CR4-PAM4" }, \ | |
455 | { IFM_200G_SR4, "200GBase-SR4" }, \ | |
456 | { IFM_200G_FR4, "200GBase-FR4" }, \ | |
457 | { IFM_200G_LR4, "200GBase-LR4" }, \ | |
458 | { IFM_200G_DR4, "200GBase-DR4" }, \ | |
459 | { IFM_200G_KR4_PAM4, "200GBase-KR4-PAM4" }, \ | |
460 | { IFM_200G_AUI4_AC, "200G-AUI4-AC" }, \ | |
461 | { IFM_200G_AUI4, "200G-AUI4" }, \ | |
462 | { IFM_200G_AUI8_AC, "200G-AUI8-AC" }, \ | |
463 | { IFM_200G_AUI8, "200G-AUI8" }, \ | |
464 | { IFM_400G_FR8, "400GBase-FR8" }, \ | |
465 | { IFM_400G_LR8, "400GBase-LR8" }, \ | |
466 | { IFM_400G_DR4, "400GBase-DR4" }, \ | |
467 | { IFM_400G_AUI8_AC, "400G-AUI8-AC" }, \ | |
468 | { IFM_400G_AUI8, "400G-AUI8" }, \ | |
cb323159 | 469 | { 0, NULL }, \ |
1c79356b A |
470 | } |
471 | ||
472 | #define IFM_SUBTYPE_ETHERNET_ALIASES { \ | |
473 | { IFM_10_T, "UTP" }, \ | |
474 | { IFM_10_T, "10UTP" }, \ | |
475 | { IFM_10_2, "BNC" }, \ | |
476 | { IFM_10_2, "10BNC" }, \ | |
477 | { IFM_10_5, "AUI" }, \ | |
478 | { IFM_10_5, "10AUI" }, \ | |
479 | { IFM_100_TX, "100TX" }, \ | |
480 | { IFM_100_FX, "100FX" }, \ | |
481 | { IFM_100_T4, "100T4" }, \ | |
482 | { IFM_100_VG, "100VG" }, \ | |
483 | { IFM_100_T2, "100T2" }, \ | |
484 | { IFM_1000_SX, "1000SX" }, \ | |
485 | { IFM_10_STP, "STP" }, \ | |
486 | { IFM_10_STP, "10STP" }, \ | |
487 | { IFM_10_FL, "FL" }, \ | |
488 | { IFM_10_FL, "10FL" }, \ | |
489 | { IFM_1000_LX, "1000LX" }, \ | |
490 | { IFM_1000_CX, "1000CX" }, \ | |
91447636 | 491 | { IFM_1000_T, "1000T" }, \ |
1c79356b | 492 | { IFM_HPNA_1, "HPNA1" }, \ |
91447636 A |
493 | { IFM_10G_SR, "10GSR" }, \ |
494 | { IFM_10G_LR, "10GLR" }, \ | |
b0d623f7 A |
495 | { IFM_10G_CX4, "10GCX4" }, \ |
496 | { IFM_10G_T, "10GT" }, \ | |
1c79356b A |
497 | { 0, NULL }, \ |
498 | } | |
499 | ||
500 | #define IFM_SUBTYPE_ETHERNET_OPTION_DESCRIPTIONS { \ | |
501 | { 0, NULL }, \ | |
502 | } | |
503 | ||
504 | #define IFM_SUBTYPE_TOKENRING_DESCRIPTIONS { \ | |
505 | { IFM_TOK_STP4, "DB9/4Mbit" }, \ | |
506 | { IFM_TOK_STP16, "DB9/16Mbit" }, \ | |
507 | { IFM_TOK_UTP4, "UTP/4Mbit" }, \ | |
508 | { IFM_TOK_UTP16, "UTP/16Mbit" }, \ | |
509 | { 0, NULL }, \ | |
510 | } | |
511 | ||
512 | #define IFM_SUBTYPE_TOKENRING_ALIASES { \ | |
513 | { IFM_TOK_STP4, "4STP" }, \ | |
514 | { IFM_TOK_STP16, "16STP" }, \ | |
515 | { IFM_TOK_UTP4, "4UTP" }, \ | |
516 | { IFM_TOK_UTP16, "16UTP" }, \ | |
517 | { 0, NULL }, \ | |
518 | } | |
519 | ||
520 | #define IFM_SUBTYPE_TOKENRING_OPTION_DESCRIPTIONS { \ | |
521 | { IFM_TOK_ETR, "EarlyTokenRelease" }, \ | |
522 | { IFM_TOK_SRCRT, "SourceRouting" }, \ | |
523 | { IFM_TOK_ALLR, "AllRoutes" }, \ | |
524 | { 0, NULL }, \ | |
525 | } | |
526 | ||
527 | #define IFM_SUBTYPE_FDDI_DESCRIPTIONS { \ | |
528 | { IFM_FDDI_SMF, "Single-mode" }, \ | |
529 | { IFM_FDDI_MMF, "Multi-mode" }, \ | |
530 | { IFM_FDDI_UTP, "UTP" }, \ | |
531 | { 0, NULL }, \ | |
532 | } | |
533 | ||
534 | #define IFM_SUBTYPE_FDDI_ALIASES { \ | |
535 | { IFM_FDDI_SMF, "SMF" }, \ | |
536 | { IFM_FDDI_MMF, "MMF" }, \ | |
537 | { IFM_FDDI_UTP, "CDDI" }, \ | |
538 | { 0, NULL }, \ | |
539 | } | |
540 | ||
541 | #define IFM_SUBTYPE_FDDI_OPTION_DESCRIPTIONS { \ | |
542 | { IFM_FDDI_DA, "Dual-attach" }, \ | |
543 | { 0, NULL }, \ | |
544 | } | |
545 | ||
546 | #define IFM_SUBTYPE_IEEE80211_DESCRIPTIONS { \ | |
547 | { IFM_IEEE80211_FH1, "FH1" }, \ | |
548 | { IFM_IEEE80211_FH2, "FH2" }, \ | |
549 | { IFM_IEEE80211_DS1, "DS1" }, \ | |
550 | { IFM_IEEE80211_DS2, "DS2" }, \ | |
551 | { IFM_IEEE80211_DS5, "DS5" }, \ | |
552 | { IFM_IEEE80211_DS11, "DS11" }, \ | |
9bccf70c | 553 | { IFM_IEEE80211_DS22, "DS22" }, \ |
1c79356b A |
554 | { 0, NULL }, \ |
555 | } | |
556 | ||
557 | #define IFM_SUBTYPE_IEEE80211_OPTION_DESCRIPTIONS { \ | |
558 | { IFM_IEEE80211_ADHOC, "adhoc" }, \ | |
559 | { 0, NULL }, \ | |
560 | } | |
561 | ||
562 | #define IFM_SUBTYPE_SHARED_DESCRIPTIONS { \ | |
563 | { IFM_AUTO, "autoselect" }, \ | |
564 | { IFM_MANUAL, "manual" }, \ | |
565 | { IFM_NONE, "none" }, \ | |
566 | { 0, NULL }, \ | |
567 | } | |
568 | ||
569 | #define IFM_SUBTYPE_SHARED_ALIASES { \ | |
570 | { IFM_AUTO, "auto" }, \ | |
571 | { 0, NULL }, \ | |
572 | } | |
573 | ||
574 | #define IFM_SHARED_OPTION_DESCRIPTIONS { \ | |
575 | { IFM_FDX, "full-duplex" }, \ | |
576 | { IFM_HDX, "half-duplex" }, \ | |
577 | { IFM_FLOW, "flow-control" }, \ | |
cb323159 | 578 | { IFM_EEE, "energy-efficient-ethernet" }, \ |
1c79356b A |
579 | { IFM_FLAG0, "flag0" }, \ |
580 | { IFM_FLAG1, "flag1" }, \ | |
581 | { IFM_FLAG2, "flag2" }, \ | |
582 | { IFM_LOOP, "hw-loopback" }, \ | |
583 | { 0, NULL }, \ | |
584 | } | |
585 | ||
0a7de745 | 586 | #endif /* _NET_IF_MEDIA_H_ */ |