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