xref: /freebsd/sys/net/if_media.h (revision 78c63ed260fa20b3500aedfe41dc0dcae9593f51)
1f94bb788SPeter Wemm /*	$NetBSD: if_media.h,v 1.3 1997/03/26 01:19:27 thorpej Exp $	*/
2f94bb788SPeter Wemm 
3c398230bSWarner Losh /*-
4fe267a55SPedro F. Giffuni  * SPDX-License-Identifier: BSD-4-Clause
5fe267a55SPedro F. Giffuni  *
6f94bb788SPeter Wemm  * Copyright (c) 1997
7f94bb788SPeter Wemm  *	Jonathan Stone and Jason R. Thorpe.  All rights reserved.
8f94bb788SPeter Wemm  *
9f94bb788SPeter Wemm  * This software is derived from information provided by Matt Thomas.
10f94bb788SPeter Wemm  *
11f94bb788SPeter Wemm  * Redistribution and use in source and binary forms, with or without
12f94bb788SPeter Wemm  * modification, are permitted provided that the following conditions
13f94bb788SPeter Wemm  * are met:
14f94bb788SPeter Wemm  * 1. Redistributions of source code must retain the above copyright
15f94bb788SPeter Wemm  *    notice, this list of conditions and the following disclaimer.
16f94bb788SPeter Wemm  * 2. Redistributions in binary form must reproduce the above copyright
17f94bb788SPeter Wemm  *    notice, this list of conditions and the following disclaimer in the
18f94bb788SPeter Wemm  *    documentation and/or other materials provided with the distribution.
19f94bb788SPeter Wemm  * 3. All advertising materials mentioning features or use of this software
20f94bb788SPeter Wemm  *    must display the following acknowledgement:
21f94bb788SPeter Wemm  *	This product includes software developed by Jonathan Stone
22f94bb788SPeter Wemm  *	and Jason R. Thorpe for the NetBSD Project.
23f94bb788SPeter Wemm  * 4. The names of the authors may not be used to endorse or promote products
24f94bb788SPeter Wemm  *    derived from this software without specific prior written permission.
25f94bb788SPeter Wemm  *
26f94bb788SPeter Wemm  * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
27f94bb788SPeter Wemm  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
28f94bb788SPeter Wemm  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
29f94bb788SPeter Wemm  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
30f94bb788SPeter Wemm  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
31f94bb788SPeter Wemm  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
32f94bb788SPeter Wemm  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
33f94bb788SPeter Wemm  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
34f94bb788SPeter Wemm  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35f94bb788SPeter Wemm  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36f94bb788SPeter Wemm  * SUCH DAMAGE.
37f94bb788SPeter Wemm  */
38f94bb788SPeter Wemm 
39f94bb788SPeter Wemm #ifndef _NET_IF_MEDIA_H_
40f94bb788SPeter Wemm #define	_NET_IF_MEDIA_H_
41f94bb788SPeter Wemm 
42f94bb788SPeter Wemm /*
43f94bb788SPeter Wemm  * Prototypes and definitions for BSD/OS-compatible network interface
44f94bb788SPeter Wemm  * media selection.
45f94bb788SPeter Wemm  *
46f94bb788SPeter Wemm  * Where it is safe to do so, this code strays slightly from the BSD/OS
47f94bb788SPeter Wemm  * design.  Software which uses the API (device drivers, basically)
48f94bb788SPeter Wemm  * shouldn't notice any difference.
49f94bb788SPeter Wemm  *
50f94bb788SPeter Wemm  * Many thanks to Matt Thomas for providing the information necessary
51f94bb788SPeter Wemm  * to implement this interface.
52f94bb788SPeter Wemm  */
53f94bb788SPeter Wemm 
54664a31e4SPeter Wemm #ifdef _KERNEL
55f94bb788SPeter Wemm 
56f94bb788SPeter Wemm #include <sys/queue.h>
57f94bb788SPeter Wemm 
58628c030fSGleb Smirnoff struct ifnet;
59628c030fSGleb Smirnoff 
60f94bb788SPeter Wemm /*
61f94bb788SPeter Wemm  * Driver callbacks for media status and change requests.
62f94bb788SPeter Wemm  */
6362d76917SMarcel Moolenaar typedef	int (*ifm_change_cb_t)(struct ifnet *);
6462d76917SMarcel Moolenaar typedef	void (*ifm_stat_cb_t)(struct ifnet *, struct ifmediareq *req);
65f94bb788SPeter Wemm 
66f94bb788SPeter Wemm /*
67f94bb788SPeter Wemm  * In-kernel representation of a single supported media type.
68f94bb788SPeter Wemm  */
69f94bb788SPeter Wemm struct ifmedia_entry {
70e3975643SJake Burkholder 	LIST_ENTRY(ifmedia_entry) ifm_list;
71f94bb788SPeter Wemm 	int	ifm_media;	/* description of this media attachment */
72f94bb788SPeter Wemm 	int	ifm_data;	/* for driver-specific use */
73f94bb788SPeter Wemm 	void	*ifm_aux;	/* for driver-specific use */
74f94bb788SPeter Wemm };
75f94bb788SPeter Wemm 
76f94bb788SPeter Wemm /*
77f94bb788SPeter Wemm  * One of these goes into a network interface's softc structure.
78f94bb788SPeter Wemm  * It is used to keep general media state.
79f94bb788SPeter Wemm  */
80f94bb788SPeter Wemm struct ifmedia {
81f94bb788SPeter Wemm 	int	ifm_mask;	/* mask of changes we don't care about */
82f94bb788SPeter Wemm 	int	ifm_media;	/* current user-set media word */
83f94bb788SPeter Wemm 	struct ifmedia_entry *ifm_cur;	/* currently selected media */
84e3975643SJake Burkholder 	LIST_HEAD(, ifmedia_entry) ifm_list; /* list of all supported media */
85f94bb788SPeter Wemm 	ifm_change_cb_t	ifm_change;	/* media change driver callback */
86f94bb788SPeter Wemm 	ifm_stat_cb_t	ifm_status;	/* media status driver callback */
87f94bb788SPeter Wemm };
88f94bb788SPeter Wemm 
89f94bb788SPeter Wemm /* Initialize an interface's struct if_media field. */
90929ddbbbSAlfred Perlstein void	ifmedia_init(struct ifmedia *ifm, int dontcare_mask,
91929ddbbbSAlfred Perlstein 	    ifm_change_cb_t change_callback, ifm_stat_cb_t status_callback);
92f94bb788SPeter Wemm 
936182fdbdSPeter Wemm /* Remove all mediums from a struct ifmedia.  */
94929ddbbbSAlfred Perlstein void	ifmedia_removeall( struct ifmedia *ifm);
956182fdbdSPeter Wemm 
96f94bb788SPeter Wemm /* Add one supported medium to a struct ifmedia. */
97929ddbbbSAlfred Perlstein void	ifmedia_add(struct ifmedia *ifm, int mword, int data, void *aux);
98f94bb788SPeter Wemm 
99f94bb788SPeter Wemm /* Add an array (of ifmedia_entry) media to a struct ifmedia. */
100f94bb788SPeter Wemm void	ifmedia_list_add(struct ifmedia *mp, struct ifmedia_entry *lp,
101f94bb788SPeter Wemm 	    int count);
102f94bb788SPeter Wemm 
103f94bb788SPeter Wemm /* Set default media type on initialization. */
104929ddbbbSAlfred Perlstein void	ifmedia_set(struct ifmedia *ifm, int mword);
105f94bb788SPeter Wemm 
106f94bb788SPeter Wemm /* Common ioctl function for getting/setting media, called by driver. */
107929ddbbbSAlfred Perlstein int	ifmedia_ioctl(struct ifnet *ifp, struct ifreq *ifr,
108929ddbbbSAlfred Perlstein 	    struct ifmedia *ifm, u_long cmd);
109f94bb788SPeter Wemm 
110efd19b8fSGleb Smirnoff /* Compute baudrate for a given media. */
111efd19b8fSGleb Smirnoff uint64_t	ifmedia_baudrate(int);
112efd19b8fSGleb Smirnoff 
113664a31e4SPeter Wemm #endif /*_KERNEL */
114f94bb788SPeter Wemm 
115f94bb788SPeter Wemm /*
116f94bb788SPeter Wemm  * if_media Options word:
117f94bb788SPeter Wemm  *	Bits	Use
118f94bb788SPeter Wemm  *	----	-------
11962811dadSJulian Elischer  *	0-4	Media variant
120f94bb788SPeter Wemm  *	5-7	Media type
121eb7e25b2SEric Joyner  *	8-15	Type specific options (includes added variant bits on Ethernet)
1221311709aSSam Leffler  *	16-18	Mode (for multi-mode devices)
1231311709aSSam Leffler  *	19	RFU
124f94bb788SPeter Wemm  *	20-27	Shared (global) options
125f94bb788SPeter Wemm  *	28-31	Instance
126f94bb788SPeter Wemm  */
127f94bb788SPeter Wemm 
128f94bb788SPeter Wemm /*
129f94bb788SPeter Wemm  * Ethernet
130eb7e25b2SEric Joyner  * In order to use more than 31 subtypes, Ethernet uses some of the option
131eb7e25b2SEric Joyner  * bits as part of the subtype field.  See the options section below for
132eb7e25b2SEric Joyner  * relevant definitions
133f94bb788SPeter Wemm  */
134f94bb788SPeter Wemm #define	IFM_ETHER	0x00000020
135eb7e25b2SEric Joyner #define	IFM_ETHER_SUBTYPE(x) (((x) & IFM_TMASK) | \
136eb7e25b2SEric Joyner 	(((x) & (IFM_ETH_XTYPE >> IFM_ETH_XSHIFT)) << IFM_ETH_XSHIFT))
137eb7e25b2SEric Joyner #define	IFM_X(x) IFM_ETHER_SUBTYPE(x)	/* internal shorthand */
138eb7e25b2SEric Joyner #define	IFM_ETHER_SUBTYPE_SET(x) (IFM_ETHER_SUBTYPE(x) | IFM_ETHER)
139eb7e25b2SEric Joyner #define	IFM_ETHER_SUBTYPE_GET(x) ((x) & (IFM_TMASK|IFM_ETH_XTYPE))
140eb7e25b2SEric Joyner #define	IFM_ETHER_IS_EXTENDED(x)	((x) & IFM_ETH_XTYPE)
141eb7e25b2SEric Joyner 
142f94bb788SPeter Wemm #define	IFM_10_T	3		/* 10BaseT - RJ45 */
143f94bb788SPeter Wemm #define	IFM_10_2	4		/* 10Base2 - Thinnet */
144f94bb788SPeter Wemm #define	IFM_10_5	5		/* 10Base5 - AUI */
145f94bb788SPeter Wemm #define	IFM_100_TX	6		/* 100BaseTX - RJ45 */
146f94bb788SPeter Wemm #define	IFM_100_FX	7		/* 100BaseFX - Fiber */
147f94bb788SPeter Wemm #define	IFM_100_T4	8		/* 100BaseT4 - 4 pair cat 3 */
148f94bb788SPeter Wemm #define	IFM_100_VG	9		/* 100VG-AnyLAN */
149f94bb788SPeter Wemm #define	IFM_100_T2	10		/* 100BaseT2 */
15045521525SPoul-Henning Kamp #define	IFM_1000_SX	11		/* 1000BaseSX - multi-mode fiber */
15127ab138fSBill Paul #define	IFM_10_STP	12		/* 10BaseT over shielded TP */
15245521525SPoul-Henning Kamp #define	IFM_10_FL	13		/* 10BaseFL - Fiber */
15345521525SPoul-Henning Kamp #define	IFM_1000_LX	14		/* 1000baseLX - single-mode fiber */
15445521525SPoul-Henning Kamp #define	IFM_1000_CX	15		/* 1000baseCX - 150ohm STP */
15545521525SPoul-Henning Kamp #define	IFM_1000_T	16		/* 1000baseT - 4 pair cat 5 */
15645521525SPoul-Henning Kamp #define	IFM_HPNA_1	17		/* HomePNA 1.0 (1Mb/s) */
157efd19b8fSGleb Smirnoff #define	IFM_10G_LR	18		/* 10GBase-LR 1310nm Single-mode */
158efd19b8fSGleb Smirnoff #define	IFM_10G_SR	19		/* 10GBase-SR 850nm Multi-mode */
1594ec449aeSGleb Smirnoff #define	IFM_10G_CX4	20		/* 10GBase CX4 copper */
160051e7561SDavid Christensen #define	IFM_2500_SX	21		/* 2500BaseSX - multi-mode fiber */
161a6c8d997SGeorge V. Neville-Neil #define	IFM_10G_TWINAX	22		/* 10GBase Twinax copper */
162a6c8d997SGeorge V. Neville-Neil #define	IFM_10G_TWINAX_LONG	23	/* 10GBase Twinax Long copper */
163a6c8d997SGeorge V. Neville-Neil #define	IFM_10G_LRM	24		/* 10GBase-LRM 850nm Multi-mode */
16452d9cb12SNavdeep Parhar #define	IFM_UNKNOWN	25		/* media types not defined yet */
165456ae550SNavdeep Parhar #define	IFM_10G_T	26		/* 10GBase-T - RJ45 */
16619a3210aSJohn Baldwin #define	IFM_40G_CR4	27		/* 40GBase-CR4 */
16719a3210aSJohn Baldwin #define	IFM_40G_SR4	28		/* 40GBase-SR4 */
16819a3210aSJohn Baldwin #define	IFM_40G_LR4	29		/* 40GBase-LR4 */
169eb7e25b2SEric Joyner #define	IFM_1000_KX	30		/* 1000Base-KX backplane */
170eb7e25b2SEric Joyner #define	IFM_OTHER	31		/* Other: one of the following */
171eb7e25b2SEric Joyner 
172eb7e25b2SEric Joyner /* following types are not visible to old binaries using only IFM_TMASK */
173eb7e25b2SEric Joyner #define	IFM_10G_KX4	IFM_X(32)	/* 10GBase-KX4 backplane */
174eb7e25b2SEric Joyner #define	IFM_10G_KR	IFM_X(33)	/* 10GBase-KR backplane */
175eb7e25b2SEric Joyner #define	IFM_10G_CR1	IFM_X(34)	/* 10GBase-CR1 Twinax splitter */
176eb7e25b2SEric Joyner #define	IFM_20G_KR2	IFM_X(35)	/* 20GBase-KR2 backplane */
177eb7e25b2SEric Joyner #define	IFM_2500_KX	IFM_X(36)	/* 2500Base-KX backplane */
178eb7e25b2SEric Joyner #define	IFM_2500_T	IFM_X(37)	/* 2500Base-T - RJ45 (NBaseT) */
179eb7e25b2SEric Joyner #define	IFM_5000_T	IFM_X(38)	/* 5000Base-T - RJ45 (NBaseT) */
180eb7e25b2SEric Joyner #define	IFM_50G_PCIE	IFM_X(39)	/* 50G Ethernet over PCIE */
181eb7e25b2SEric Joyner #define	IFM_25G_PCIE	IFM_X(40)	/* 25G Ethernet over PCIE */
182eb7e25b2SEric Joyner #define	IFM_1000_SGMII	IFM_X(41)	/* 1G media interface */
183eb7e25b2SEric Joyner #define	IFM_10G_SFI	IFM_X(42)	/* 10G media interface */
184eb7e25b2SEric Joyner #define	IFM_40G_XLPPI	IFM_X(43)	/* 40G media interface */
185eb7e25b2SEric Joyner #define	IFM_1000_CX_SGMII IFM_X(44)	/* 1000Base-CX-SGMII */
186eb7e25b2SEric Joyner #define	IFM_40G_KR4	IFM_X(45)	/* 40GBase-KR4 */
187eb7e25b2SEric Joyner #define	IFM_10G_ER	IFM_X(46)	/* 10GBase-ER */
188eb7e25b2SEric Joyner #define	IFM_100G_CR4	IFM_X(47)	/* 100GBase-CR4 */
189eb7e25b2SEric Joyner #define	IFM_100G_SR4	IFM_X(48)	/* 100GBase-SR4 */
190eb7e25b2SEric Joyner #define	IFM_100G_KR4	IFM_X(49)	/* 100GBase-KR4 */
191eb7e25b2SEric Joyner #define	IFM_100G_LR4	IFM_X(50)	/* 100GBase-LR4 */
192eb7e25b2SEric Joyner #define	IFM_56G_R4	IFM_X(51)	/* 56GBase-R4 */
193eb7e25b2SEric Joyner #define	IFM_100_T	IFM_X(52)	/* 100BaseT - RJ45 */
194eb7e25b2SEric Joyner #define	IFM_25G_CR	IFM_X(53)	/* 25GBase-CR */
195eb7e25b2SEric Joyner #define	IFM_25G_KR	IFM_X(54)	/* 25GBase-KR */
196eb7e25b2SEric Joyner #define	IFM_25G_SR	IFM_X(55)	/* 25GBase-SR */
197eb7e25b2SEric Joyner #define	IFM_50G_CR2	IFM_X(56)	/* 50GBase-CR2 */
198eb7e25b2SEric Joyner #define	IFM_50G_KR2	IFM_X(57)	/* 50GBase-KR2 */
1996e105d4eSEric Joyner #define	IFM_25G_LR	IFM_X(58)	/* 25GBase-LR */
2006e105d4eSEric Joyner #define	IFM_10G_AOC	IFM_X(59)	/* 10G active optical cable */
2016e105d4eSEric Joyner #define	IFM_25G_ACC	IFM_X(60)	/* 25G active copper cable */
2026e105d4eSEric Joyner #define	IFM_25G_AOC	IFM_X(61)	/* 25G active optical cable */
203fe2bf351SEric Joyner #define	IFM_100_SGMII	IFM_X(62)	/* 100M media interface */
204fe2bf351SEric Joyner #define	IFM_2500_X	IFM_X(63)	/* 2500BaseX */
205fe2bf351SEric Joyner #define	IFM_5000_KR	IFM_X(64)	/* 5GBase-KR backplane */
206fe2bf351SEric Joyner #define	IFM_25G_T	IFM_X(65)	/* 25GBase-T - RJ45 */
207fe2bf351SEric Joyner #define	IFM_25G_CR_S	IFM_X(66)	/* 25GBase-CR (short) */
208fe2bf351SEric Joyner #define	IFM_25G_CR1	IFM_X(67)	/* 25GBase-CR1 DA cable */
209fe2bf351SEric Joyner #define	IFM_25G_KR_S	IFM_X(68)	/* 25GBase-KR (short) */
210fe2bf351SEric Joyner #define	IFM_5000_KR_S	IFM_X(69)	/* 5GBase-KR backplane (short) */
211fe2bf351SEric Joyner #define	IFM_5000_KR1	IFM_X(70)	/* 5GBase-KR backplane */
212fe2bf351SEric Joyner #define	IFM_25G_AUI	IFM_X(71)	/* 25G-AUI-C2C (chip to chip) */
213fe2bf351SEric Joyner #define	IFM_40G_XLAUI	IFM_X(72)	/* 40G-XLAUI */
214fe2bf351SEric Joyner #define	IFM_40G_XLAUI_AC IFM_X(73)	/* 40G active copper/optical */
215fe2bf351SEric Joyner #define	IFM_40G_ER4	IFM_X(74)	/* 40GBase-ER4 */
216fe2bf351SEric Joyner #define	IFM_50G_SR2	IFM_X(75)	/* 50GBase-SR2 */
217fe2bf351SEric Joyner #define	IFM_50G_LR2	IFM_X(76)	/* 50GBase-LR2 */
218fe2bf351SEric Joyner #define	IFM_50G_LAUI2_AC IFM_X(77)	/* 50G active copper/optical */
219fe2bf351SEric Joyner #define	IFM_50G_LAUI2	IFM_X(78)	/* 50G-LAUI2 */
220fe2bf351SEric Joyner #define	IFM_50G_AUI2_AC	IFM_X(79)	/* 50G active copper/optical */
221fe2bf351SEric Joyner #define	IFM_50G_AUI2	IFM_X(80)	/* 50G-AUI2 */
222fe2bf351SEric Joyner #define	IFM_50G_CP	IFM_X(81)	/* 50GBase-CP */
223fe2bf351SEric Joyner #define	IFM_50G_SR	IFM_X(82)	/* 50GBase-SR */
224fe2bf351SEric Joyner #define	IFM_50G_LR	IFM_X(83)	/* 50GBase-LR */
225fe2bf351SEric Joyner #define	IFM_50G_FR	IFM_X(84)	/* 50GBase-FR */
226fe2bf351SEric Joyner #define	IFM_50G_KR_PAM4	IFM_X(85)	/* 50GBase-KR PAM4 */
227fe2bf351SEric Joyner #define	IFM_25G_KR1	IFM_X(86)	/* 25GBase-KR1 */
228fe2bf351SEric Joyner #define	IFM_50G_AUI1_AC	IFM_X(87)	/* 50G active copper/optical */
229fe2bf351SEric Joyner #define	IFM_50G_AUI1	IFM_X(88)	/* 50G-AUI1 */
230fe2bf351SEric Joyner #define	IFM_100G_CAUI4_AC IFM_X(89)	/* 100G-CAUI4 active copper/optical */
231fe2bf351SEric Joyner #define	IFM_100G_CAUI4 IFM_X(90)	/* 100G-CAUI4 */
232fe2bf351SEric Joyner #define	IFM_100G_AUI4_AC IFM_X(91)	/* 100G-AUI4 active copper/optical */
233fe2bf351SEric Joyner #define	IFM_100G_AUI4	IFM_X(92)	/* 100G-AUI4 */
234fe2bf351SEric Joyner #define	IFM_100G_CR_PAM4 IFM_X(93)	/* 100GBase-CR PAM4 */
235fe2bf351SEric Joyner #define	IFM_100G_KR_PAM4 IFM_X(94)	/* 100GBase-CR PAM4 */
236fe2bf351SEric Joyner #define	IFM_100G_CP2	IFM_X(95)	/* 100GBase-CP2 */
237fe2bf351SEric Joyner #define	IFM_100G_SR2	IFM_X(96)	/* 100GBase-SR2 */
238fe2bf351SEric Joyner #define	IFM_100G_DR	IFM_X(97)	/* 100GBase-DR */
239fe2bf351SEric Joyner #define	IFM_100G_KR2_PAM4 IFM_X(98)	/* 100GBase-KR2 PAM4 */
240fe2bf351SEric Joyner #define	IFM_100G_CAUI2_AC IFM_X(99)	/* 100G-CAUI2 active copper/optical */
241fe2bf351SEric Joyner #define	IFM_100G_CAUI2	IFM_X(100)	/* 100G-CAUI2 */
242fe2bf351SEric Joyner #define	IFM_100G_AUI2_AC IFM_X(101)	/* 100G-AUI2 active copper/optical */
243fe2bf351SEric Joyner #define	IFM_100G_AUI2	IFM_X(102)	/* 100G-AUI2 */
244fe2bf351SEric Joyner #define	IFM_200G_CR4_PAM4 IFM_X(103)	/* 200GBase-CR4 PAM4 */
245fe2bf351SEric Joyner #define	IFM_200G_SR4	IFM_X(104)	/* 200GBase-SR4 */
246fe2bf351SEric Joyner #define	IFM_200G_FR4	IFM_X(105)	/* 200GBase-FR4 */
247fe2bf351SEric Joyner #define	IFM_200G_LR4	IFM_X(106)	/* 200GBase-LR4 */
248fe2bf351SEric Joyner #define	IFM_200G_DR4	IFM_X(107)	/* 200GBase-DR4 */
249fe2bf351SEric Joyner #define	IFM_200G_KR4_PAM4 IFM_X(108)	/* 200GBase-KR4 PAM4 */
250fe2bf351SEric Joyner #define	IFM_200G_AUI4_AC IFM_X(109)	/* 200G-AUI4 active copper/optical */
251fe2bf351SEric Joyner #define	IFM_200G_AUI4	IFM_X(110)	/* 200G-AUI4 */
252fe2bf351SEric Joyner #define	IFM_200G_AUI8_AC IFM_X(111)	/* 200G-AUI8 active copper/optical */
253fe2bf351SEric Joyner #define	IFM_200G_AUI8	IFM_X(112)	/* 200G-AUI8 */
254fe2bf351SEric Joyner #define	IFM_400G_FR8	IFM_X(113)	/* 400GBase-FR8 */
255fe2bf351SEric Joyner #define	IFM_400G_LR8	IFM_X(114)	/* 400GBase-LR8 */
256fe2bf351SEric Joyner #define	IFM_400G_DR4	IFM_X(115)	/* 400GBase-DR4 */
257fe2bf351SEric Joyner #define	IFM_400G_AUI8_AC IFM_X(116)	/* 400G-AUI8 active copper/optical */
258fe2bf351SEric Joyner #define	IFM_400G_AUI8	IFM_X(117)	/* 400G-AUI8 */
2595d1277caSKonstantin Belousov #define	IFM_50G_KR4	IFM_X(118)	/* 50GBase-KR4 */
260ceff9b9dSMitchell Horne #define	IFM_40G_LM4	IFM_X(119)	/* 40GBase-LM4 */
261*78c63ed2STore Amundsen #define	IFM_1000_BX	IFM_X(120)	/* 1000Base-BX */
262eb7e25b2SEric Joyner 
26322dc101fSAndrey V. Elsukov /*
26422dc101fSAndrey V. Elsukov  * Please update ieee8023ad_lacp.c:lacp_compose_key()
26522dc101fSAndrey V. Elsukov  * after adding new Ethernet media types.
26622dc101fSAndrey V. Elsukov  */
267eb7e25b2SEric Joyner /* Note IFM_X(511) is the max! */
268f94bb788SPeter Wemm 
269eb7e25b2SEric Joyner /* Ethernet option values; includes bits used for extended variant field */
27045521525SPoul-Henning Kamp #define	IFM_ETH_MASTER	0x00000100	/* master mode (1000baseT) */
271efd4fc3fSMarius Strobl #define	IFM_ETH_RXPAUSE	0x00000200	/* receive PAUSE frames */
272efd4fc3fSMarius Strobl #define	IFM_ETH_TXPAUSE	0x00000400	/* transmit PAUSE frames */
273eb7e25b2SEric Joyner #define	IFM_ETH_XTYPE	0x00007800	/* extended media variants */
274eb7e25b2SEric Joyner #define	IFM_ETH_XSHIFT	6		/* shift XTYPE next to TMASK */
27545521525SPoul-Henning Kamp 
276f94bb788SPeter Wemm /*
277419d8080SPoul-Henning Kamp  * IEEE 802.11 Wireless
278419d8080SPoul-Henning Kamp  */
279419d8080SPoul-Henning Kamp #define	IFM_IEEE80211	0x00000080
2801311709aSSam Leffler /* NB: 0,1,2 are auto, manual, none defined below */
281419d8080SPoul-Henning Kamp #define	IFM_IEEE80211_FH1	3	/* Frequency Hopping 1Mbps */
282419d8080SPoul-Henning Kamp #define	IFM_IEEE80211_FH2	4	/* Frequency Hopping 2Mbps */
283419d8080SPoul-Henning Kamp #define	IFM_IEEE80211_DS1	5	/* Direct Sequence 1Mbps */
284419d8080SPoul-Henning Kamp #define	IFM_IEEE80211_DS2	6	/* Direct Sequence 2Mbps */
285419d8080SPoul-Henning Kamp #define	IFM_IEEE80211_DS5	7	/* Direct Sequence 5.5Mbps */
286419d8080SPoul-Henning Kamp #define	IFM_IEEE80211_DS11	8	/* Direct Sequence 11Mbps */
287419d8080SPoul-Henning Kamp #define	IFM_IEEE80211_DS22	9	/* Direct Sequence 22Mbps */
2881311709aSSam Leffler #define	IFM_IEEE80211_OFDM6	10	/* OFDM 6Mbps */
2891311709aSSam Leffler #define	IFM_IEEE80211_OFDM9	11	/* OFDM 9Mbps */
2901311709aSSam Leffler #define	IFM_IEEE80211_OFDM12	12	/* OFDM 12Mbps */
2911311709aSSam Leffler #define	IFM_IEEE80211_OFDM18	13	/* OFDM 18Mbps */
2921311709aSSam Leffler #define	IFM_IEEE80211_OFDM24	14	/* OFDM 24Mbps */
2931311709aSSam Leffler #define	IFM_IEEE80211_OFDM36	15	/* OFDM 36Mbps */
2941311709aSSam Leffler #define	IFM_IEEE80211_OFDM48	16	/* OFDM 48Mbps */
2951311709aSSam Leffler #define	IFM_IEEE80211_OFDM54	17	/* OFDM 54Mbps */
2961311709aSSam Leffler #define	IFM_IEEE80211_OFDM72	18	/* OFDM 72Mbps */
29794251138SMax Khon #define	IFM_IEEE80211_DS354k	19	/* Direct Sequence 354Kbps */
29894251138SMax Khon #define	IFM_IEEE80211_DS512k	20	/* Direct Sequence 512Kbps */
29941b3c790SSam Leffler #define	IFM_IEEE80211_OFDM3	21	/* OFDM 3Mbps */
30041b3c790SSam Leffler #define	IFM_IEEE80211_OFDM4	22	/* OFDM 4.5Mbps */
30141b3c790SSam Leffler #define	IFM_IEEE80211_OFDM27	23	/* OFDM 27Mbps */
30268e8e04eSSam Leffler /* NB: not enough bits to express MCS fully */
30368e8e04eSSam Leffler #define	IFM_IEEE80211_MCS	24	/* HT MCS rate */
3042a440d19SAndriy Voskoboinyk #define	IFM_IEEE80211_VHT	25	/* VHT MCS rate */
3054844aa7dSAtsushi Onoe 
306419d8080SPoul-Henning Kamp #define	IFM_IEEE80211_ADHOC	0x00000100	/* Operate in Adhoc mode */
30773ce5facSWarner Losh #define	IFM_IEEE80211_HOSTAP	0x00000200	/* Operate in Host AP mode */
308f6462e80SWarner Losh #define	IFM_IEEE80211_IBSS	0x00000400	/* Operate in IBSS mode */
309acaf1de6SSam Leffler #define	IFM_IEEE80211_WDS	0x00000800	/* Operate in WDS mode */
3101311709aSSam Leffler #define	IFM_IEEE80211_TURBO	0x00001000	/* Operate in turbo mode */
3112bbe529dSSam Leffler #define	IFM_IEEE80211_MONITOR	0x00002000	/* Operate in monitor mode */
31259aa14a9SRui Paulo #define	IFM_IEEE80211_MBSS	0x00004000	/* Operate in MBSS mode */
3134844aa7dSAtsushi Onoe 
3141311709aSSam Leffler /* operating mode for multi-mode devices */
3154844aa7dSAtsushi Onoe #define	IFM_IEEE80211_11A	0x00010000	/* 5Ghz, OFDM mode */
3164844aa7dSAtsushi Onoe #define	IFM_IEEE80211_11B	0x00020000	/* Direct Sequence mode */
3174844aa7dSAtsushi Onoe #define	IFM_IEEE80211_11G	0x00030000	/* 2Ghz, CCK mode */
3184844aa7dSAtsushi Onoe #define	IFM_IEEE80211_FH	0x00040000	/* 2Ghz, GFSK mode */
31968e8e04eSSam Leffler #define	IFM_IEEE80211_11NA	0x00050000	/* 5Ghz, HT mode */
32068e8e04eSSam Leffler #define	IFM_IEEE80211_11NG	0x00060000	/* 2Ghz, HT mode */
321fdbc9e6eSAdrian Chadd #define	IFM_IEEE80211_VHT5G	0x00070000	/* 5Ghz, VHT mode */
322fdbc9e6eSAdrian Chadd #define	IFM_IEEE80211_VHT2G	0x00080000	/* 2Ghz, VHT mode */
323419d8080SPoul-Henning Kamp 
324419d8080SPoul-Henning Kamp /*
3252b75e097SHartmut Brandt  * ATM
3262b75e097SHartmut Brandt  */
3272b75e097SHartmut Brandt #define	IFM_ATM	0x000000a0
3282b75e097SHartmut Brandt #define	IFM_ATM_UNKNOWN		3
3292b75e097SHartmut Brandt #define	IFM_ATM_UTP_25		4
3302b75e097SHartmut Brandt #define	IFM_ATM_TAXI_100	5
3312b75e097SHartmut Brandt #define	IFM_ATM_TAXI_140	6
3322b75e097SHartmut Brandt #define	IFM_ATM_MM_155		7
3332b75e097SHartmut Brandt #define	IFM_ATM_SM_155		8
3342b75e097SHartmut Brandt #define	IFM_ATM_UTP_155		9
3352b75e097SHartmut Brandt #define	IFM_ATM_MM_622		10
3362b75e097SHartmut Brandt #define	IFM_ATM_SM_622		11
3376eadc708SHartmut Brandt #define	IFM_ATM_VIRTUAL		12
3382b75e097SHartmut Brandt #define	IFM_ATM_SDH		0x00000100	/* SDH instead of SONET */
3392b75e097SHartmut Brandt #define	IFM_ATM_NOSCRAMB	0x00000200	/* no scrambling */
3402b75e097SHartmut Brandt #define	IFM_ATM_UNASSIGNED	0x00000400	/* unassigned cells */
3412b75e097SHartmut Brandt 
3422b75e097SHartmut Brandt /*
343f94bb788SPeter Wemm  * Shared media sub-types
344f94bb788SPeter Wemm  */
345f94bb788SPeter Wemm #define	IFM_AUTO	0		/* Autoselect best media */
346f94bb788SPeter Wemm #define	IFM_MANUAL	1		/* Jumper/dipswitch selects media */
347f94bb788SPeter Wemm #define	IFM_NONE	2		/* Deselect all media */
348f94bb788SPeter Wemm 
349f94bb788SPeter Wemm /*
350f94bb788SPeter Wemm  * Shared options
351f94bb788SPeter Wemm  */
352f94bb788SPeter Wemm #define	IFM_FDX		0x00100000	/* Force full duplex */
353f94bb788SPeter Wemm #define	IFM_HDX		0x00200000	/* Force half duplex */
354efd4fc3fSMarius Strobl #define	IFM_FLOW	0x00400000	/* enable hardware flow control */
355f94bb788SPeter Wemm #define	IFM_FLAG0	0x01000000	/* Driver defined flag */
356f94bb788SPeter Wemm #define	IFM_FLAG1	0x02000000	/* Driver defined flag */
357f94bb788SPeter Wemm #define	IFM_FLAG2	0x04000000	/* Driver defined flag */
358f94bb788SPeter Wemm #define	IFM_LOOP	0x08000000	/* Put hardware in loopback */
359f94bb788SPeter Wemm 
360f94bb788SPeter Wemm /*
361f94bb788SPeter Wemm  * Masks
362f94bb788SPeter Wemm  */
363f94bb788SPeter Wemm #define	IFM_NMASK	0x000000e0	/* Network type */
36462811dadSJulian Elischer #define	IFM_TMASK	0x0000001f	/* Media sub-type */
365f94bb788SPeter Wemm #define	IFM_IMASK	0xf0000000	/* Instance */
366f94bb788SPeter Wemm #define	IFM_ISHIFT	28		/* Instance shift */
367f94bb788SPeter Wemm #define	IFM_OMASK	0x0000ff00	/* Type specific options */
3681311709aSSam Leffler #define	IFM_MMASK	0x00070000	/* Mode */
3691311709aSSam Leffler #define	IFM_MSHIFT	16		/* Mode shift */
370f94bb788SPeter Wemm #define	IFM_GMASK	0x0ff00000	/* Global options */
371f94bb788SPeter Wemm 
372efd4fc3fSMarius Strobl /* Ethernet flow control mask */
373efd4fc3fSMarius Strobl #define	IFM_ETH_FMASK	(IFM_FLOW | IFM_ETH_RXPAUSE | IFM_ETH_TXPAUSE)
374efd4fc3fSMarius Strobl 
375f94bb788SPeter Wemm /*
376f94bb788SPeter Wemm  * Status bits
377f94bb788SPeter Wemm  */
378f94bb788SPeter Wemm #define	IFM_AVALID	0x00000001	/* Active bit valid */
379f94bb788SPeter Wemm #define	IFM_ACTIVE	0x00000002	/* Interface attached to working net */
380f94bb788SPeter Wemm 
381e4bd8f10SAndre Oppermann /* Mask of "status valid" bits, for ifconfig(8). */
382e4bd8f10SAndre Oppermann #define	IFM_STATUS_VALID	IFM_AVALID
383e4bd8f10SAndre Oppermann 
384e4bd8f10SAndre Oppermann /* List of "status valid" bits, for ifconfig(8). */
385e4bd8f10SAndre Oppermann #define	IFM_STATUS_VALID_LIST {						\
386e4bd8f10SAndre Oppermann 	IFM_AVALID,							\
387e4bd8f10SAndre Oppermann 	0								\
388e4bd8f10SAndre Oppermann }
389e4bd8f10SAndre Oppermann 
390f94bb788SPeter Wemm /*
391f94bb788SPeter Wemm  * Macros to extract various bits of information from the media word.
392f94bb788SPeter Wemm  */
393f94bb788SPeter Wemm #define	IFM_TYPE(x)		((x) & IFM_NMASK)
394eb7e25b2SEric Joyner #define	IFM_SUBTYPE(x)	\
395eb7e25b2SEric Joyner   (IFM_TYPE(x) == IFM_ETHER ? IFM_ETHER_SUBTYPE_GET(x) : ((x) & IFM_TMASK))
396eb7e25b2SEric Joyner #define	IFM_TYPE_MATCH(x,y) \
397eb7e25b2SEric Joyner   (IFM_TYPE(x) == IFM_TYPE(y) && IFM_SUBTYPE(x) == IFM_SUBTYPE(y))
398722012ccSJulian Elischer #define	IFM_TYPE_OPTIONS(x)	((x) & IFM_OMASK)
399f94bb788SPeter Wemm #define	IFM_INST(x)		(((x) & IFM_IMASK) >> IFM_ISHIFT)
40027ab138fSBill Paul #define	IFM_OPTIONS(x)		((x) & (IFM_OMASK | IFM_GMASK))
401c66380c1SAtsushi Onoe #define	IFM_MODE(x)		((x) & IFM_MMASK)
40227ab138fSBill Paul 
40327ab138fSBill Paul #define	IFM_INST_MAX		IFM_INST(IFM_IMASK)
40427ab138fSBill Paul 
40527ab138fSBill Paul /*
40627ab138fSBill Paul  * Macro to create a media word.
40727ab138fSBill Paul  */
40827ab138fSBill Paul #define	IFM_MAKEWORD(type, subtype, options, instance)			\
40927ab138fSBill Paul 	((type) | (subtype) | (options) | ((instance) << IFM_ISHIFT))
4101311709aSSam Leffler #define	IFM_MAKEMODE(mode) \
4111311709aSSam Leffler 	(((mode) << IFM_MSHIFT) & IFM_MMASK)
412f94bb788SPeter Wemm 
413f94bb788SPeter Wemm /*
414f94bb788SPeter Wemm  * NetBSD extension not defined in the BSDI API.  This is used in various
415f94bb788SPeter Wemm  * places to get the canonical description for a given type/subtype.
416f94bb788SPeter Wemm  *
417f94bb788SPeter Wemm  * NOTE: all but the top-level type descriptions must contain NO whitespace!
418f94bb788SPeter Wemm  * Otherwise, parsing these in ifconfig(8) would be a nightmare.
419f94bb788SPeter Wemm  */
420f94bb788SPeter Wemm struct ifmedia_description {
421f94bb788SPeter Wemm 	int	ifmt_word;		/* word value; may be masked */
422f94bb788SPeter Wemm 	const char *ifmt_string;	/* description */
423f94bb788SPeter Wemm };
424f94bb788SPeter Wemm 
425f94bb788SPeter Wemm #define	IFM_TYPE_DESCRIPTIONS {						\
426f94bb788SPeter Wemm 	{ IFM_ETHER,		"Ethernet" },				\
427419d8080SPoul-Henning Kamp 	{ IFM_IEEE80211,	"IEEE 802.11 Wireless Ethernet" },	\
4282b75e097SHartmut Brandt 	{ IFM_ATM,		"ATM" },				\
429f94bb788SPeter Wemm 	{ 0, NULL },							\
430f94bb788SPeter Wemm }
431f94bb788SPeter Wemm 
432f94bb788SPeter Wemm #define	IFM_SUBTYPE_ETHERNET_DESCRIPTIONS {				\
433f94bb788SPeter Wemm 	{ IFM_10_T,	"10baseT/UTP" },				\
434f94bb788SPeter Wemm 	{ IFM_10_2,	"10base2/BNC" },				\
435f94bb788SPeter Wemm 	{ IFM_10_5,	"10base5/AUI" },				\
436f94bb788SPeter Wemm 	{ IFM_100_TX,	"100baseTX" },					\
437f94bb788SPeter Wemm 	{ IFM_100_FX,	"100baseFX" },					\
438f94bb788SPeter Wemm 	{ IFM_100_T4,	"100baseT4" },					\
439f94bb788SPeter Wemm 	{ IFM_100_VG,	"100baseVG" },					\
440f94bb788SPeter Wemm 	{ IFM_100_T2,	"100baseT2" },					\
44127ab138fSBill Paul 	{ IFM_10_STP,	"10baseSTP" },					\
44227ab138fSBill Paul 	{ IFM_10_FL,	"10baseFL" },					\
4436b3cb593SBill Paul 	{ IFM_1000_SX,	"1000baseSX" },					\
4446b3cb593SBill Paul 	{ IFM_1000_LX,	"1000baseLX" },					\
4456b3cb593SBill Paul 	{ IFM_1000_CX,	"1000baseCX" },					\
446*78c63ed2STore Amundsen 	{ IFM_1000_BX,	"1000baseBX" },					\
44769237b10SAntoine Brodin 	{ IFM_1000_T,	"1000baseT" },					\
44845521525SPoul-Henning Kamp 	{ IFM_HPNA_1,	"homePNA" },					\
449a7c959feSGleb Smirnoff 	{ IFM_10G_LR,	"10Gbase-LR" },					\
450a7c959feSGleb Smirnoff 	{ IFM_10G_SR,	"10Gbase-SR" },					\
4514ec449aeSGleb Smirnoff 	{ IFM_10G_CX4,	"10Gbase-CX4" },				\
452051e7561SDavid Christensen 	{ IFM_2500_SX,	"2500BaseSX" },					\
453a6c8d997SGeorge V. Neville-Neil 	{ IFM_10G_LRM,	"10Gbase-LRM" },				\
454a6c8d997SGeorge V. Neville-Neil 	{ IFM_10G_TWINAX,	"10Gbase-Twinax" },			\
455a6c8d997SGeorge V. Neville-Neil 	{ IFM_10G_TWINAX_LONG,	"10Gbase-Twinax-Long" },		\
456a6c8d997SGeorge V. Neville-Neil 	{ IFM_UNKNOWN,	"Unknown" },					\
457456ae550SNavdeep Parhar 	{ IFM_10G_T,	"10Gbase-T" },					\
45819a3210aSJohn Baldwin 	{ IFM_40G_CR4,	"40Gbase-CR4" },				\
45919a3210aSJohn Baldwin 	{ IFM_40G_SR4,	"40Gbase-SR4" },				\
46019a3210aSJohn Baldwin 	{ IFM_40G_LR4,	"40Gbase-LR4" },				\
461ceff9b9dSMitchell Horne 	{ IFM_40G_LM4,	"40GBase-LM4" },				\
462eb7e25b2SEric Joyner 	{ IFM_1000_KX,	"1000Base-KX" },				\
463eb7e25b2SEric Joyner 	{ IFM_OTHER,	"Other" },					\
464eb7e25b2SEric Joyner 	{ IFM_10G_KX4,	"10GBase-KX4" },				\
465eb7e25b2SEric Joyner 	{ IFM_10G_KR,	"10GBase-KR" },					\
466eb7e25b2SEric Joyner 	{ IFM_10G_CR1,	"10GBase-CR1" },				\
467eb7e25b2SEric Joyner 	{ IFM_20G_KR2,	"20GBase-KR2" },				\
468eb7e25b2SEric Joyner 	{ IFM_2500_KX,	"2500Base-KX" },				\
469eb7e25b2SEric Joyner 	{ IFM_2500_T,	"2500Base-T" },					\
470eb7e25b2SEric Joyner 	{ IFM_5000_T,	"5000Base-T" },					\
471eb7e25b2SEric Joyner 	{ IFM_50G_PCIE,	"PCIExpress-50G" },				\
472eb7e25b2SEric Joyner 	{ IFM_25G_PCIE,	"PCIExpress-25G" },				\
473eb7e25b2SEric Joyner 	{ IFM_1000_SGMII,	"1000Base-SGMII" },			\
474eb7e25b2SEric Joyner 	{ IFM_10G_SFI,	"10GBase-SFI" },				\
475eb7e25b2SEric Joyner 	{ IFM_40G_XLPPI,	"40GBase-XLPPI" },			\
476eb7e25b2SEric Joyner 	{ IFM_1000_CX_SGMII,	"1000Base-CX-SGMII" },			\
477eb7e25b2SEric Joyner 	{ IFM_40G_KR4,	"40GBase-KR4" },				\
478eb7e25b2SEric Joyner 	{ IFM_10G_ER,	"10GBase-ER" },					\
479eb7e25b2SEric Joyner 	{ IFM_100G_CR4,	"100GBase-CR4" },				\
480eb7e25b2SEric Joyner 	{ IFM_100G_SR4,	"100GBase-SR4" },				\
481eb7e25b2SEric Joyner 	{ IFM_100G_KR4,	"100GBase-KR4" },				\
482eb7e25b2SEric Joyner 	{ IFM_100G_LR4, "100GBase-LR4" },				\
483eb7e25b2SEric Joyner 	{ IFM_56G_R4,	"56GBase-R4" },					\
484eb7e25b2SEric Joyner 	{ IFM_100_T,	"100BaseT" },					\
485eb7e25b2SEric Joyner 	{ IFM_25G_CR,	"25GBase-CR" },					\
486eb7e25b2SEric Joyner 	{ IFM_25G_KR,	"25GBase-KR" },					\
487eb7e25b2SEric Joyner 	{ IFM_25G_SR,	"25GBase-SR" },					\
488eb7e25b2SEric Joyner 	{ IFM_50G_CR2,	"50GBase-CR2" },				\
489eb7e25b2SEric Joyner 	{ IFM_50G_KR2,	"50GBase-KR2" },				\
4905d1277caSKonstantin Belousov 	{ IFM_50G_KR4,	"50GBase-KR4" },				\
4916e105d4eSEric Joyner 	{ IFM_25G_LR,	"25GBase-LR" },					\
4926e105d4eSEric Joyner 	{ IFM_10G_AOC,	"10GBase-AOC" },				\
4936e105d4eSEric Joyner 	{ IFM_25G_ACC,	"25GBase-ACC" },				\
4946e105d4eSEric Joyner 	{ IFM_25G_AOC,	"25GBase-AOC" },				\
495fe2bf351SEric Joyner 	{ IFM_100_SGMII,	"100M-SGMII" },				\
496fe2bf351SEric Joyner 	{ IFM_2500_X,	"2500Base-X" },					\
497fe2bf351SEric Joyner 	{ IFM_5000_KR,	"5000Base-KR" },				\
498fe2bf351SEric Joyner 	{ IFM_25G_T,	"25GBase-T" },					\
499fe2bf351SEric Joyner 	{ IFM_25G_CR_S,	"25GBase-CR-S" },				\
500fe2bf351SEric Joyner 	{ IFM_25G_CR1,	"25GBase-CR1" },				\
501fe2bf351SEric Joyner 	{ IFM_25G_KR_S,	"25GBase-KR-S" },				\
502fe2bf351SEric Joyner 	{ IFM_5000_KR_S,	"5000Base-KR-S" },			\
503fe2bf351SEric Joyner 	{ IFM_5000_KR1,	"5000Base-KR1" },				\
504fe2bf351SEric Joyner 	{ IFM_25G_AUI,	"25G-AUI" },					\
505fe2bf351SEric Joyner 	{ IFM_40G_XLAUI,	"40G-XLAUI" },				\
506fe2bf351SEric Joyner 	{ IFM_40G_XLAUI_AC,	"40G-XLAUI-AC" },			\
507fe2bf351SEric Joyner 	{ IFM_40G_ER4,	"40GBase-ER4" },				\
508fe2bf351SEric Joyner 	{ IFM_50G_SR2,	"50GBase-SR2" },				\
509fe2bf351SEric Joyner 	{ IFM_50G_LR2,	"50GBase-LR2" },				\
510fe2bf351SEric Joyner 	{ IFM_50G_LAUI2_AC,	"50G-LAUI2-AC" },			\
511fe2bf351SEric Joyner 	{ IFM_50G_LAUI2,	"50G-LAUI2" },				\
512fe2bf351SEric Joyner 	{ IFM_50G_AUI2_AC,	"50G-AUI2-AC" },			\
513fe2bf351SEric Joyner 	{ IFM_50G_AUI2,	"50G-AUI2" },					\
514fe2bf351SEric Joyner 	{ IFM_50G_CP,	"50GBase-CP" },					\
515fe2bf351SEric Joyner 	{ IFM_50G_SR,	"50GBase-SR" },					\
516fe2bf351SEric Joyner 	{ IFM_50G_LR,	"50GBase-LR" },					\
517fe2bf351SEric Joyner 	{ IFM_50G_FR,	"50GBase-FR" },					\
518fe2bf351SEric Joyner 	{ IFM_50G_KR_PAM4,	"50GBase-KR-PAM4" },			\
519fe2bf351SEric Joyner 	{ IFM_25G_KR1,	"25GBase-KR1" },				\
520fe2bf351SEric Joyner 	{ IFM_50G_AUI1_AC,	"50G-AUI1-AC" },			\
521fe2bf351SEric Joyner 	{ IFM_50G_AUI1,	"50G-AUI1" },					\
522fe2bf351SEric Joyner 	{ IFM_100G_CAUI4_AC,	"100G-CAUI4-AC" },			\
523fe2bf351SEric Joyner 	{ IFM_100G_CAUI4,	"100G-CAUI4" },				\
524fe2bf351SEric Joyner 	{ IFM_100G_AUI4_AC,	"100G-AUI4-AC" },			\
525fe2bf351SEric Joyner 	{ IFM_100G_AUI4,	"100G-AUI4" },				\
526fe2bf351SEric Joyner 	{ IFM_100G_CR_PAM4,	"100GBase-CR-PAM4" },			\
527fe2bf351SEric Joyner 	{ IFM_100G_KR_PAM4,	"100GBase-KR-PAM4" },			\
528fe2bf351SEric Joyner 	{ IFM_100G_CP2,	"100GBase-CP2" },				\
529fe2bf351SEric Joyner 	{ IFM_100G_SR2,	"100GBase-SR2" },				\
530fe2bf351SEric Joyner 	{ IFM_100G_DR,	"100GBase-DR" },				\
531fe2bf351SEric Joyner 	{ IFM_100G_KR2_PAM4,	"100GBase-KR2-PAM4" },			\
532fe2bf351SEric Joyner 	{ IFM_100G_CAUI2_AC,	"100G-CAUI2-AC" },			\
533fe2bf351SEric Joyner 	{ IFM_100G_CAUI2,	"100G-CAUI2" },				\
534fe2bf351SEric Joyner 	{ IFM_100G_AUI2_AC,	"100G-AUI2-AC" },			\
535fe2bf351SEric Joyner 	{ IFM_100G_AUI2,	"100G-AUI2" },				\
536fe2bf351SEric Joyner 	{ IFM_200G_CR4_PAM4,	"200GBase-CR4-PAM4" },			\
537fe2bf351SEric Joyner 	{ IFM_200G_SR4,	"200GBase-SR4" },				\
538fe2bf351SEric Joyner 	{ IFM_200G_FR4,	"200GBase-FR4" },				\
539fe2bf351SEric Joyner 	{ IFM_200G_LR4,	"200GBase-LR4" },				\
540fe2bf351SEric Joyner 	{ IFM_200G_DR4,	"200GBase-DR4" },				\
541fe2bf351SEric Joyner 	{ IFM_200G_KR4_PAM4,	"200GBase-KR4-PAM4" },			\
542fe2bf351SEric Joyner 	{ IFM_200G_AUI4_AC,	"200G-AUI4-AC" },			\
543fe2bf351SEric Joyner 	{ IFM_200G_AUI4,	"200G-AUI4" },				\
544fe2bf351SEric Joyner 	{ IFM_200G_AUI8_AC,	"200G-AUI8-AC" },			\
545fe2bf351SEric Joyner 	{ IFM_200G_AUI8,	"200G-AUI8" },				\
546fe2bf351SEric Joyner 	{ IFM_400G_FR8,	"400GBase-FR8" },				\
547fe2bf351SEric Joyner 	{ IFM_400G_LR8,	"400GBase-LR8" },				\
548fe2bf351SEric Joyner 	{ IFM_400G_DR4,	"400GBase-DR4" },				\
549fe2bf351SEric Joyner 	{ IFM_400G_AUI8_AC,	"400G-AUI8-AC" },			\
550fe2bf351SEric Joyner 	{ IFM_400G_AUI8,	"400G-AUI8" },				\
551f94bb788SPeter Wemm 	{ 0, NULL },							\
552f94bb788SPeter Wemm }
553f94bb788SPeter Wemm 
554f94bb788SPeter Wemm #define	IFM_SUBTYPE_ETHERNET_ALIASES {					\
555d09c5f16SMarius Strobl 	{ IFM_10_T,	"10baseT" },					\
556f94bb788SPeter Wemm 	{ IFM_10_T,	"UTP" },					\
557f94bb788SPeter Wemm 	{ IFM_10_T,	"10UTP" },					\
558f94bb788SPeter Wemm 	{ IFM_10_2,	"BNC" },					\
559f94bb788SPeter Wemm 	{ IFM_10_2,	"10BNC" },					\
560f94bb788SPeter Wemm 	{ IFM_10_5,	"AUI" },					\
561f94bb788SPeter Wemm 	{ IFM_10_5,	"10AUI" },					\
562f94bb788SPeter Wemm 	{ IFM_100_TX,	"100TX" },					\
563f94bb788SPeter Wemm 	{ IFM_100_T4,	"100T4" },					\
564f94bb788SPeter Wemm 	{ IFM_100_VG,	"100VG" },					\
565f94bb788SPeter Wemm 	{ IFM_100_T2,	"100T2" },					\
56627ab138fSBill Paul 	{ IFM_10_STP,	"10STP" },					\
56727ab138fSBill Paul 	{ IFM_10_FL,	"10FL" },					\
56845521525SPoul-Henning Kamp 	{ IFM_1000_SX,	"1000SX" },					\
56945521525SPoul-Henning Kamp 	{ IFM_1000_LX,	"1000LX" },					\
57045521525SPoul-Henning Kamp 	{ IFM_1000_CX,	"1000CX" },					\
57169237b10SAntoine Brodin 	{ IFM_1000_T,	"1000baseTX" },					\
57245521525SPoul-Henning Kamp 	{ IFM_1000_T,	"1000TX" },					\
57345521525SPoul-Henning Kamp 	{ IFM_1000_T,	"1000T" },					\
574051e7561SDavid Christensen 	{ IFM_2500_SX,	"2500SX" },					\
575d09c5f16SMarius Strobl 									\
576d09c5f16SMarius Strobl 	/*								\
577d09c5f16SMarius Strobl 	 * Shorthands for common media+option combinations as announced	\
578d09c5f16SMarius Strobl 	 * by miibus(4)							\
579d09c5f16SMarius Strobl 	 */								\
580d09c5f16SMarius Strobl 	{ IFM_10_T | IFM_FDX,			"10baseT-FDX" },	\
581d09c5f16SMarius Strobl 	{ IFM_10_T | IFM_FDX | IFM_FLOW,	"10baseT-FDX-flow" },	\
582d09c5f16SMarius Strobl 	{ IFM_100_TX | IFM_FDX,			"100baseTX-FDX" },	\
583d09c5f16SMarius Strobl 	{ IFM_100_TX | IFM_FDX | IFM_FLOW,	"100baseTX-FDX-flow" },	\
584d09c5f16SMarius Strobl 	{ IFM_1000_T | IFM_FDX,			"1000baseT-FDX" },	\
585d09c5f16SMarius Strobl 	{ IFM_1000_T | IFM_FDX | IFM_FLOW,	"1000baseT-FDX-flow" },	\
586d09c5f16SMarius Strobl 	{ IFM_1000_T | IFM_FDX | IFM_FLOW | IFM_ETH_MASTER,		\
587d09c5f16SMarius Strobl 	    "1000baseT-FDX-flow-master" },				\
588d09c5f16SMarius Strobl 	{ IFM_1000_T | IFM_FDX | IFM_ETH_MASTER,			\
589d09c5f16SMarius Strobl 	    "1000baseT-FDX-master" },					\
590d09c5f16SMarius Strobl 	{ IFM_1000_T | IFM_ETH_MASTER,		"1000baseT-master" },	\
591d09c5f16SMarius Strobl 									\
592f94bb788SPeter Wemm 	{ 0, NULL },							\
593f94bb788SPeter Wemm }
594f94bb788SPeter Wemm 
595f94bb788SPeter Wemm #define	IFM_SUBTYPE_ETHERNET_OPTION_DESCRIPTIONS {			\
596efd4fc3fSMarius Strobl 	{ IFM_ETH_MASTER,	"master" },				\
597efd4fc3fSMarius Strobl 	{ IFM_ETH_RXPAUSE,	"rxpause" },				\
598efd4fc3fSMarius Strobl 	{ IFM_ETH_TXPAUSE,	"txpause" },				\
599f94bb788SPeter Wemm 	{ 0, NULL },							\
600f94bb788SPeter Wemm }
601f94bb788SPeter Wemm 
602419d8080SPoul-Henning Kamp #define	IFM_SUBTYPE_IEEE80211_DESCRIPTIONS {				\
603419d8080SPoul-Henning Kamp 	{ IFM_IEEE80211_FH1, "FH/1Mbps" },				\
604419d8080SPoul-Henning Kamp 	{ IFM_IEEE80211_FH2, "FH/2Mbps" },				\
605419d8080SPoul-Henning Kamp 	{ IFM_IEEE80211_DS1, "DS/1Mbps" },				\
606419d8080SPoul-Henning Kamp 	{ IFM_IEEE80211_DS2, "DS/2Mbps" },				\
607419d8080SPoul-Henning Kamp 	{ IFM_IEEE80211_DS5, "DS/5.5Mbps" },				\
608419d8080SPoul-Henning Kamp 	{ IFM_IEEE80211_DS11, "DS/11Mbps" },				\
609419d8080SPoul-Henning Kamp 	{ IFM_IEEE80211_DS22, "DS/22Mbps" },				\
6101311709aSSam Leffler 	{ IFM_IEEE80211_OFDM6, "OFDM/6Mbps" },				\
6111311709aSSam Leffler 	{ IFM_IEEE80211_OFDM9, "OFDM/9Mbps" },				\
6121311709aSSam Leffler 	{ IFM_IEEE80211_OFDM12, "OFDM/12Mbps" },			\
6131311709aSSam Leffler 	{ IFM_IEEE80211_OFDM18, "OFDM/18Mbps" },			\
6141311709aSSam Leffler 	{ IFM_IEEE80211_OFDM24, "OFDM/24Mbps" },			\
6151311709aSSam Leffler 	{ IFM_IEEE80211_OFDM36, "OFDM/36Mbps" },			\
6161311709aSSam Leffler 	{ IFM_IEEE80211_OFDM48, "OFDM/48Mbps" },			\
6171311709aSSam Leffler 	{ IFM_IEEE80211_OFDM54, "OFDM/54Mbps" },			\
6181311709aSSam Leffler 	{ IFM_IEEE80211_OFDM72, "OFDM/72Mbps" },			\
61994251138SMax Khon 	{ IFM_IEEE80211_DS354k, "DS/354Kbps" },				\
62094251138SMax Khon 	{ IFM_IEEE80211_DS512k, "DS/512Kbps" },				\
62141b3c790SSam Leffler 	{ IFM_IEEE80211_OFDM3, "OFDM/3Mbps" },				\
62241b3c790SSam Leffler 	{ IFM_IEEE80211_OFDM4, "OFDM/4.5Mbps" },			\
62341b3c790SSam Leffler 	{ IFM_IEEE80211_OFDM27, "OFDM/27Mbps" },			\
62459fe4a8cSRui Paulo 	{ IFM_IEEE80211_MCS, "MCS" },					\
625f69a29b5SAdrian Chadd 	{ IFM_IEEE80211_VHT, "VHT" },					\
626419d8080SPoul-Henning Kamp 	{ 0, NULL },							\
627419d8080SPoul-Henning Kamp }
628419d8080SPoul-Henning Kamp 
629419d8080SPoul-Henning Kamp #define	IFM_SUBTYPE_IEEE80211_ALIASES {					\
630419d8080SPoul-Henning Kamp 	{ IFM_IEEE80211_FH1, "FH1" },					\
631419d8080SPoul-Henning Kamp 	{ IFM_IEEE80211_FH2, "FH2" },					\
632419d8080SPoul-Henning Kamp 	{ IFM_IEEE80211_FH1, "FrequencyHopping/1Mbps" },		\
633419d8080SPoul-Henning Kamp 	{ IFM_IEEE80211_FH2, "FrequencyHopping/2Mbps" },		\
634419d8080SPoul-Henning Kamp 	{ IFM_IEEE80211_DS1, "DS1" },					\
635419d8080SPoul-Henning Kamp 	{ IFM_IEEE80211_DS2, "DS2" },					\
636419d8080SPoul-Henning Kamp 	{ IFM_IEEE80211_DS5, "DS5.5" },					\
637419d8080SPoul-Henning Kamp 	{ IFM_IEEE80211_DS11, "DS11" },					\
638419d8080SPoul-Henning Kamp 	{ IFM_IEEE80211_DS22, "DS22" },					\
639419d8080SPoul-Henning Kamp 	{ IFM_IEEE80211_DS1, "DirectSequence/1Mbps" },			\
640419d8080SPoul-Henning Kamp 	{ IFM_IEEE80211_DS2, "DirectSequence/2Mbps" },			\
641419d8080SPoul-Henning Kamp 	{ IFM_IEEE80211_DS5, "DirectSequence/5.5Mbps" },		\
642419d8080SPoul-Henning Kamp 	{ IFM_IEEE80211_DS11, "DirectSequence/11Mbps" },		\
643419d8080SPoul-Henning Kamp 	{ IFM_IEEE80211_DS22, "DirectSequence/22Mbps" },		\
6441311709aSSam Leffler 	{ IFM_IEEE80211_OFDM6, "OFDM6" },				\
6451311709aSSam Leffler 	{ IFM_IEEE80211_OFDM9, "OFDM9" },				\
6461311709aSSam Leffler 	{ IFM_IEEE80211_OFDM12, "OFDM12" },				\
6471311709aSSam Leffler 	{ IFM_IEEE80211_OFDM18, "OFDM18" },				\
6481311709aSSam Leffler 	{ IFM_IEEE80211_OFDM24, "OFDM24" },				\
6491311709aSSam Leffler 	{ IFM_IEEE80211_OFDM36, "OFDM36" },				\
6501311709aSSam Leffler 	{ IFM_IEEE80211_OFDM48, "OFDM48" },				\
6511311709aSSam Leffler 	{ IFM_IEEE80211_OFDM54, "OFDM54" },				\
6521311709aSSam Leffler 	{ IFM_IEEE80211_OFDM72, "OFDM72" },				\
6531311709aSSam Leffler 	{ IFM_IEEE80211_DS1, "CCK1" },					\
6541311709aSSam Leffler 	{ IFM_IEEE80211_DS2, "CCK2" },					\
6551311709aSSam Leffler 	{ IFM_IEEE80211_DS5, "CCK5.5" },				\
6561311709aSSam Leffler 	{ IFM_IEEE80211_DS11, "CCK11" },				\
65794251138SMax Khon 	{ IFM_IEEE80211_DS354k, "DS354K" },				\
65894251138SMax Khon 	{ IFM_IEEE80211_DS354k, "DirectSequence/354Kbps" },		\
65994251138SMax Khon 	{ IFM_IEEE80211_DS512k, "DS512K" },				\
66094251138SMax Khon 	{ IFM_IEEE80211_DS512k, "DirectSequence/512Kbps" },		\
66141b3c790SSam Leffler 	{ IFM_IEEE80211_OFDM3, "OFDM3" },				\
66241b3c790SSam Leffler 	{ IFM_IEEE80211_OFDM4, "OFDM4.5" },				\
66341b3c790SSam Leffler 	{ IFM_IEEE80211_OFDM27, "OFDM27" },				\
66459fe4a8cSRui Paulo 	{ IFM_IEEE80211_MCS, "MCS" },					\
665f69a29b5SAdrian Chadd 	{ IFM_IEEE80211_VHT, "VHT" },					\
666419d8080SPoul-Henning Kamp 	{ 0, NULL },							\
667419d8080SPoul-Henning Kamp }
668419d8080SPoul-Henning Kamp 
669419d8080SPoul-Henning Kamp #define	IFM_SUBTYPE_IEEE80211_OPTION_DESCRIPTIONS {			\
670419d8080SPoul-Henning Kamp 	{ IFM_IEEE80211_ADHOC, "adhoc" },				\
67173ce5facSWarner Losh 	{ IFM_IEEE80211_HOSTAP, "hostap" },				\
672f6462e80SWarner Losh 	{ IFM_IEEE80211_IBSS, "ibss" },					\
673acaf1de6SSam Leffler 	{ IFM_IEEE80211_WDS, "wds" },					\
6741311709aSSam Leffler 	{ IFM_IEEE80211_TURBO, "turbo" },				\
6752bbe529dSSam Leffler 	{ IFM_IEEE80211_MONITOR, "monitor" },				\
67659aa14a9SRui Paulo 	{ IFM_IEEE80211_MBSS, "mesh" },					\
6771311709aSSam Leffler 	{ 0, NULL },							\
6781311709aSSam Leffler }
6791311709aSSam Leffler 
6801311709aSSam Leffler #define	IFM_SUBTYPE_IEEE80211_MODE_DESCRIPTIONS {			\
6812dd59091SSam Leffler 	{ IFM_AUTO, "autoselect" },					\
6821311709aSSam Leffler 	{ IFM_IEEE80211_11A, "11a" },					\
6831311709aSSam Leffler 	{ IFM_IEEE80211_11B, "11b" },					\
6841311709aSSam Leffler 	{ IFM_IEEE80211_11G, "11g" },					\
6854844aa7dSAtsushi Onoe 	{ IFM_IEEE80211_FH, "fh" },					\
68668e8e04eSSam Leffler 	{ IFM_IEEE80211_11NA, "11na" },					\
68768e8e04eSSam Leffler 	{ IFM_IEEE80211_11NG, "11ng" },					\
688f69a29b5SAdrian Chadd 	{ IFM_IEEE80211_VHT5G, "11ac" },				\
689f69a29b5SAdrian Chadd 	{ IFM_IEEE80211_VHT2G, "11ac2" },				\
690419d8080SPoul-Henning Kamp 	{ 0, NULL },							\
691419d8080SPoul-Henning Kamp }
692419d8080SPoul-Henning Kamp 
6932dd59091SSam Leffler #define	IFM_SUBTYPE_IEEE80211_MODE_ALIASES {				\
6942dd59091SSam Leffler 	{ IFM_AUTO, "auto" },						\
6952dd59091SSam Leffler 	{ 0, NULL },							\
6962dd59091SSam Leffler }
6972dd59091SSam Leffler 
6982b75e097SHartmut Brandt #define	IFM_SUBTYPE_ATM_DESCRIPTIONS {					\
6992b75e097SHartmut Brandt 	{ IFM_ATM_UNKNOWN,	"Unknown" },				\
7002b75e097SHartmut Brandt 	{ IFM_ATM_UTP_25,	"UTP/25.6MBit" },			\
7012b75e097SHartmut Brandt 	{ IFM_ATM_TAXI_100,	"Taxi/100MBit" },			\
7022b75e097SHartmut Brandt 	{ IFM_ATM_TAXI_140,	"Taxi/140MBit" },			\
7032b75e097SHartmut Brandt 	{ IFM_ATM_MM_155,	"Multi-mode/155MBit" },			\
7042b75e097SHartmut Brandt 	{ IFM_ATM_SM_155,	"Single-mode/155MBit" },		\
7052b75e097SHartmut Brandt 	{ IFM_ATM_UTP_155,	"UTP/155MBit" },			\
706d68d53d4SHartmut Brandt 	{ IFM_ATM_MM_622,	"Multi-mode/622MBit" },			\
7072b75e097SHartmut Brandt 	{ IFM_ATM_SM_622,	"Single-mode/622MBit" },		\
7086eadc708SHartmut Brandt 	{ IFM_ATM_VIRTUAL,	"Virtual" },				\
7092b75e097SHartmut Brandt 	{ 0, NULL },							\
7102b75e097SHartmut Brandt }
7112b75e097SHartmut Brandt 
7122b75e097SHartmut Brandt #define	IFM_SUBTYPE_ATM_ALIASES {					\
7132b75e097SHartmut Brandt 	{ IFM_ATM_UNKNOWN,	"UNKNOWN" },				\
7142b75e097SHartmut Brandt 	{ IFM_ATM_UTP_25,	"UTP-25" },				\
7152b75e097SHartmut Brandt 	{ IFM_ATM_TAXI_100,	"TAXI-100" },				\
7162b75e097SHartmut Brandt 	{ IFM_ATM_TAXI_140,	"TAXI-140" },				\
7172b75e097SHartmut Brandt 	{ IFM_ATM_MM_155,	"MM-155" },				\
7182b75e097SHartmut Brandt 	{ IFM_ATM_SM_155,	"SM-155" },				\
7192b75e097SHartmut Brandt 	{ IFM_ATM_UTP_155,	"UTP-155" },				\
7202b75e097SHartmut Brandt 	{ IFM_ATM_MM_622,	"MM-622" },				\
7212b75e097SHartmut Brandt 	{ IFM_ATM_SM_622,	"SM-622" },				\
7226eadc708SHartmut Brandt 	{ IFM_ATM_VIRTUAL,	"VIRTUAL" },				\
7232b75e097SHartmut Brandt 	{ 0, NULL },							\
7242b75e097SHartmut Brandt }
7252b75e097SHartmut Brandt 
7262b75e097SHartmut Brandt #define	IFM_SUBTYPE_ATM_OPTION_DESCRIPTIONS {				\
7272b75e097SHartmut Brandt 	{ IFM_ATM_SDH, "SDH" },						\
7282b75e097SHartmut Brandt 	{ IFM_ATM_NOSCRAMB, "Noscramb" },				\
7292b75e097SHartmut Brandt 	{ IFM_ATM_UNASSIGNED, "Unassigned" },				\
7302b75e097SHartmut Brandt 	{ 0, NULL },							\
7312b75e097SHartmut Brandt }
7322b75e097SHartmut Brandt 
733f94bb788SPeter Wemm #define	IFM_SUBTYPE_SHARED_DESCRIPTIONS {				\
734f94bb788SPeter Wemm 	{ IFM_AUTO,	"autoselect" },					\
735f94bb788SPeter Wemm 	{ IFM_MANUAL,	"manual" },					\
736f94bb788SPeter Wemm 	{ IFM_NONE,	"none" },					\
737f94bb788SPeter Wemm 	{ 0, NULL },							\
738f94bb788SPeter Wemm }
739f94bb788SPeter Wemm 
740f94bb788SPeter Wemm #define	IFM_SUBTYPE_SHARED_ALIASES {					\
741f94bb788SPeter Wemm 	{ IFM_AUTO,	"auto" },					\
742d09c5f16SMarius Strobl 									\
743d09c5f16SMarius Strobl 	/*								\
744d09c5f16SMarius Strobl 	 * Shorthands for common media+option combinations as announced	\
745d09c5f16SMarius Strobl 	 * by miibus(4)							\
746d09c5f16SMarius Strobl 	 */								\
747d09c5f16SMarius Strobl 	{ IFM_AUTO | IFM_FLOW,	"auto-flow" },				\
748d09c5f16SMarius Strobl 									\
749f94bb788SPeter Wemm 	{ 0, NULL },							\
750f94bb788SPeter Wemm }
751f94bb788SPeter Wemm 
752f94bb788SPeter Wemm #define	IFM_SHARED_OPTION_DESCRIPTIONS {				\
753f94bb788SPeter Wemm 	{ IFM_FDX,	"full-duplex" },				\
754f94bb788SPeter Wemm 	{ IFM_HDX,	"half-duplex" },				\
755efd4fc3fSMarius Strobl 	{ IFM_FLOW,	"flowcontrol" },				\
756f94bb788SPeter Wemm 	{ IFM_FLAG0,	"flag0" },					\
757f94bb788SPeter Wemm 	{ IFM_FLAG1,	"flag1" },					\
758f94bb788SPeter Wemm 	{ IFM_FLAG2,	"flag2" },					\
759f94bb788SPeter Wemm 	{ IFM_LOOP,	"hw-loopback" },				\
760f94bb788SPeter Wemm 	{ 0, NULL },							\
761f94bb788SPeter Wemm }
762f94bb788SPeter Wemm 
763a0fc3825SMarius Strobl #define	IFM_SHARED_OPTION_ALIASES {					\
764a0fc3825SMarius Strobl 	{ IFM_FDX,	"fdx" },					\
765a0fc3825SMarius Strobl 	{ IFM_HDX,	"hdx" },					\
766a0fc3825SMarius Strobl 	{ IFM_FLOW,	"flow" },					\
767a0fc3825SMarius Strobl 	{ IFM_LOOP,	"loop" },					\
768a0fc3825SMarius Strobl 	{ IFM_LOOP,	"loopback" },					\
769a0fc3825SMarius Strobl 	{ 0, NULL },							\
770a0fc3825SMarius Strobl }
771a0fc3825SMarius Strobl 
772efd19b8fSGleb Smirnoff /*
773efd19b8fSGleb Smirnoff  * Baudrate descriptions for the various media types.
774efd19b8fSGleb Smirnoff  */
775efd19b8fSGleb Smirnoff struct ifmedia_baudrate {
776efd19b8fSGleb Smirnoff 	int		ifmb_word;		/* media word */
777efd19b8fSGleb Smirnoff 	uint64_t	ifmb_baudrate;		/* corresponding baudrate */
778efd19b8fSGleb Smirnoff };
779efd19b8fSGleb Smirnoff 
780efd19b8fSGleb Smirnoff #define	IFM_BAUDRATE_DESCRIPTIONS {					\
781efd19b8fSGleb Smirnoff 	{ IFM_ETHER | IFM_10_T,		IF_Mbps(10) },			\
782efd19b8fSGleb Smirnoff 	{ IFM_ETHER | IFM_10_2,		IF_Mbps(10) },			\
783efd19b8fSGleb Smirnoff 	{ IFM_ETHER | IFM_10_5,		IF_Mbps(10) },			\
784efd19b8fSGleb Smirnoff 	{ IFM_ETHER | IFM_100_TX,	IF_Mbps(100) },			\
785efd19b8fSGleb Smirnoff 	{ IFM_ETHER | IFM_100_FX,	IF_Mbps(100) },			\
786efd19b8fSGleb Smirnoff 	{ IFM_ETHER | IFM_100_T4,	IF_Mbps(100) },			\
787efd19b8fSGleb Smirnoff 	{ IFM_ETHER | IFM_100_VG,	IF_Mbps(100) },			\
788efd19b8fSGleb Smirnoff 	{ IFM_ETHER | IFM_100_T2,	IF_Mbps(100) },			\
789efd19b8fSGleb Smirnoff 	{ IFM_ETHER | IFM_1000_SX,	IF_Mbps(1000) },		\
790efd19b8fSGleb Smirnoff 	{ IFM_ETHER | IFM_10_STP,	IF_Mbps(10) },			\
791efd19b8fSGleb Smirnoff 	{ IFM_ETHER | IFM_10_FL,	IF_Mbps(10) },			\
792efd19b8fSGleb Smirnoff 	{ IFM_ETHER | IFM_1000_LX,	IF_Mbps(1000) },		\
793efd19b8fSGleb Smirnoff 	{ IFM_ETHER | IFM_1000_CX,	IF_Mbps(1000) },		\
794*78c63ed2STore Amundsen 	{ IFM_ETHER | IFM_1000_BX,	IF_Mbps(1000) },		\
795efd19b8fSGleb Smirnoff 	{ IFM_ETHER | IFM_1000_T,	IF_Mbps(1000) },		\
796efd19b8fSGleb Smirnoff 	{ IFM_ETHER | IFM_HPNA_1,	IF_Mbps(1) },			\
797efd19b8fSGleb Smirnoff 	{ IFM_ETHER | IFM_10G_LR,	IF_Gbps(10ULL) },		\
7984ec449aeSGleb Smirnoff 	{ IFM_ETHER | IFM_10G_SR,	IF_Gbps(10ULL) },		\
7994ec449aeSGleb Smirnoff 	{ IFM_ETHER | IFM_10G_CX4,	IF_Gbps(10ULL) },		\
800051e7561SDavid Christensen 	{ IFM_ETHER | IFM_2500_SX,	IF_Mbps(2500ULL) },		\
801a6c8d997SGeorge V. Neville-Neil 	{ IFM_ETHER | IFM_10G_TWINAX,	IF_Gbps(10ULL) },		\
802a6c8d997SGeorge V. Neville-Neil 	{ IFM_ETHER | IFM_10G_TWINAX_LONG,	IF_Gbps(10ULL) },	\
803a6c8d997SGeorge V. Neville-Neil 	{ IFM_ETHER | IFM_10G_LRM,	IF_Gbps(10ULL) },		\
804456ae550SNavdeep Parhar 	{ IFM_ETHER | IFM_10G_T,	IF_Gbps(10ULL) },		\
80519a3210aSJohn Baldwin 	{ IFM_ETHER | IFM_40G_CR4,	IF_Gbps(40ULL) },		\
80619a3210aSJohn Baldwin 	{ IFM_ETHER | IFM_40G_SR4,	IF_Gbps(40ULL) },		\
80719a3210aSJohn Baldwin 	{ IFM_ETHER | IFM_40G_LR4,	IF_Gbps(40ULL) },		\
808ceff9b9dSMitchell Horne 	{ IFM_ETHER | IFM_40G_LM4,	IF_Gbps(40ULL) },		\
809eb7e25b2SEric Joyner 	{ IFM_ETHER | IFM_1000_KX,	IF_Mbps(1000) },		\
810eb7e25b2SEric Joyner 	{ IFM_ETHER | IFM_10G_KX4,	IF_Gbps(10ULL) },		\
811eb7e25b2SEric Joyner 	{ IFM_ETHER | IFM_10G_KR,	IF_Gbps(10ULL) },		\
812eb7e25b2SEric Joyner 	{ IFM_ETHER | IFM_10G_CR1,	IF_Gbps(10ULL) },		\
813eb7e25b2SEric Joyner 	{ IFM_ETHER | IFM_20G_KR2,	IF_Gbps(20ULL) },		\
8142ae32ca2SBjoern A. Zeeb 	{ IFM_ETHER | IFM_2500_KX,	IF_Mbps(2500ULL) },		\
8152ae32ca2SBjoern A. Zeeb 	{ IFM_ETHER | IFM_2500_T,	IF_Mbps(2500ULL) },		\
8162ae32ca2SBjoern A. Zeeb 	{ IFM_ETHER | IFM_5000_T,	IF_Mbps(5000ULL) },		\
817eb7e25b2SEric Joyner 	{ IFM_ETHER | IFM_50G_PCIE,	IF_Gbps(50ULL) },		\
818eb7e25b2SEric Joyner 	{ IFM_ETHER | IFM_25G_PCIE,	IF_Gbps(25ULL) },		\
819eb7e25b2SEric Joyner 	{ IFM_ETHER | IFM_1000_SGMII,	IF_Mbps(1000) },		\
820eb7e25b2SEric Joyner 	{ IFM_ETHER | IFM_10G_SFI,	IF_Gbps(10ULL) },		\
821eb7e25b2SEric Joyner 	{ IFM_ETHER | IFM_40G_XLPPI,	IF_Gbps(40ULL) },		\
822eb7e25b2SEric Joyner 	{ IFM_ETHER | IFM_1000_CX_SGMII, IF_Mbps(1000) },		\
823eb7e25b2SEric Joyner 	{ IFM_ETHER | IFM_40G_KR4,	IF_Gbps(40ULL) },		\
824eb7e25b2SEric Joyner 	{ IFM_ETHER | IFM_10G_ER,	IF_Gbps(10ULL) },		\
825eb7e25b2SEric Joyner 	{ IFM_ETHER | IFM_100G_CR4,	IF_Gbps(100ULL) },		\
826eb7e25b2SEric Joyner 	{ IFM_ETHER | IFM_100G_SR4,	IF_Gbps(100ULL) },		\
827eb7e25b2SEric Joyner 	{ IFM_ETHER | IFM_100G_KR4,	IF_Gbps(100ULL) },		\
828eb7e25b2SEric Joyner 	{ IFM_ETHER | IFM_100G_LR4,	IF_Gbps(100ULL) },		\
829eb7e25b2SEric Joyner 	{ IFM_ETHER | IFM_56G_R4,	IF_Gbps(56ULL) },		\
830eb7e25b2SEric Joyner 	{ IFM_ETHER | IFM_100_T,	IF_Mbps(100ULL) },		\
831eb7e25b2SEric Joyner 	{ IFM_ETHER | IFM_25G_CR,	IF_Gbps(25ULL) },		\
832eb7e25b2SEric Joyner 	{ IFM_ETHER | IFM_25G_KR,	IF_Gbps(25ULL) },		\
833eb7e25b2SEric Joyner 	{ IFM_ETHER | IFM_25G_SR,	IF_Gbps(25ULL) },		\
834eb7e25b2SEric Joyner 	{ IFM_ETHER | IFM_50G_CR2,	IF_Gbps(50ULL) },		\
835eb7e25b2SEric Joyner 	{ IFM_ETHER | IFM_50G_KR2,	IF_Gbps(50ULL) },		\
8365d1277caSKonstantin Belousov 	{ IFM_ETHER | IFM_50G_KR4,	IF_Gbps(50ULL) },		\
8376e105d4eSEric Joyner 	{ IFM_ETHER | IFM_25G_LR,	IF_Gbps(25ULL) },		\
8386e105d4eSEric Joyner 	{ IFM_ETHER | IFM_10G_AOC,	IF_Gbps(10ULL) },		\
8396e105d4eSEric Joyner 	{ IFM_ETHER | IFM_25G_ACC,	IF_Gbps(25ULL) },		\
8406e105d4eSEric Joyner 	{ IFM_ETHER | IFM_25G_AOC,	IF_Gbps(25ULL) },		\
841fe2bf351SEric Joyner 	{ IFM_ETHER | IFM_100_SGMII,	IF_Mbps(100) },			\
842fe2bf351SEric Joyner 	{ IFM_ETHER | IFM_2500_X,	IF_Mbps(2500ULL) },		\
843fe2bf351SEric Joyner 	{ IFM_ETHER | IFM_5000_KR,	IF_Mbps(5000ULL) },		\
844fe2bf351SEric Joyner 	{ IFM_ETHER | IFM_25G_T,	IF_Gbps(25ULL) },		\
845fe2bf351SEric Joyner 	{ IFM_ETHER | IFM_25G_CR_S,	IF_Gbps(25ULL) },		\
846fe2bf351SEric Joyner 	{ IFM_ETHER | IFM_25G_CR1,	IF_Gbps(25ULL) },		\
847fe2bf351SEric Joyner 	{ IFM_ETHER | IFM_25G_KR_S,	IF_Gbps(25ULL) },		\
848fe2bf351SEric Joyner 	{ IFM_ETHER | IFM_5000_KR_S,	IF_Mbps(5000ULL) },		\
849fe2bf351SEric Joyner 	{ IFM_ETHER | IFM_5000_KR1,	IF_Mbps(5000ULL) },		\
850fe2bf351SEric Joyner 	{ IFM_ETHER | IFM_25G_AUI,	IF_Gbps(25ULL) },		\
851fe2bf351SEric Joyner 	{ IFM_ETHER | IFM_40G_XLAUI,	IF_Gbps(40ULL) },		\
852fe2bf351SEric Joyner 	{ IFM_ETHER | IFM_40G_XLAUI_AC,	IF_Gbps(40ULL) },		\
853fe2bf351SEric Joyner 	{ IFM_ETHER | IFM_40G_ER4,	IF_Gbps(40ULL) },		\
854fe2bf351SEric Joyner 	{ IFM_ETHER | IFM_50G_SR2,	IF_Gbps(50ULL) },		\
855fe2bf351SEric Joyner 	{ IFM_ETHER | IFM_50G_LR2,	IF_Gbps(50ULL) },		\
856fe2bf351SEric Joyner 	{ IFM_ETHER | IFM_50G_LAUI2_AC,	IF_Gbps(50ULL) },		\
857fe2bf351SEric Joyner 	{ IFM_ETHER | IFM_50G_LAUI2,	IF_Gbps(50ULL) },		\
858fe2bf351SEric Joyner 	{ IFM_ETHER | IFM_50G_AUI2_AC,	IF_Gbps(50ULL) },		\
859fe2bf351SEric Joyner 	{ IFM_ETHER | IFM_50G_AUI2,	IF_Gbps(50ULL) },		\
860fe2bf351SEric Joyner 	{ IFM_ETHER | IFM_50G_CP,	IF_Gbps(50ULL) },		\
861fe2bf351SEric Joyner 	{ IFM_ETHER | IFM_50G_SR,	IF_Gbps(50ULL) },		\
862fe2bf351SEric Joyner 	{ IFM_ETHER | IFM_50G_LR,	IF_Gbps(50ULL) },		\
863fe2bf351SEric Joyner 	{ IFM_ETHER | IFM_50G_FR,	IF_Gbps(50ULL) },		\
864fe2bf351SEric Joyner 	{ IFM_ETHER | IFM_50G_KR_PAM4,	IF_Gbps(50ULL) },		\
865fe2bf351SEric Joyner 	{ IFM_ETHER | IFM_25G_KR1,	IF_Gbps(25ULL) },		\
866fe2bf351SEric Joyner 	{ IFM_ETHER | IFM_50G_AUI1_AC,	IF_Gbps(50ULL) },		\
867fe2bf351SEric Joyner 	{ IFM_ETHER | IFM_50G_AUI1,	IF_Gbps(50ULL) },		\
868fe2bf351SEric Joyner 	{ IFM_ETHER | IFM_100G_CAUI4_AC, IF_Gbps(100ULL) },		\
869fe2bf351SEric Joyner 	{ IFM_ETHER | IFM_100G_CAUI4,	IF_Gbps(100ULL) },		\
870fe2bf351SEric Joyner 	{ IFM_ETHER | IFM_100G_AUI4_AC,	IF_Gbps(100ULL) },		\
871fe2bf351SEric Joyner 	{ IFM_ETHER | IFM_100G_AUI4,	IF_Gbps(100ULL) },		\
872fe2bf351SEric Joyner 	{ IFM_ETHER | IFM_100G_CR_PAM4,	IF_Gbps(100ULL) },		\
873fe2bf351SEric Joyner 	{ IFM_ETHER | IFM_100G_KR_PAM4,	IF_Gbps(100ULL) },		\
874fe2bf351SEric Joyner 	{ IFM_ETHER | IFM_100G_CP2,	IF_Gbps(100ULL) },		\
875fe2bf351SEric Joyner 	{ IFM_ETHER | IFM_100G_SR2,	IF_Gbps(100ULL) },		\
876fe2bf351SEric Joyner 	{ IFM_ETHER | IFM_100G_DR,	IF_Gbps(100ULL) },		\
877fe2bf351SEric Joyner 	{ IFM_ETHER | IFM_100G_KR2_PAM4, IF_Gbps(100ULL) },		\
878fe2bf351SEric Joyner 	{ IFM_ETHER | IFM_100G_CAUI2_AC, IF_Gbps(100ULL) },		\
879fe2bf351SEric Joyner 	{ IFM_ETHER | IFM_100G_CAUI2,	IF_Gbps(100ULL) },		\
880fe2bf351SEric Joyner 	{ IFM_ETHER | IFM_100G_AUI2_AC,	IF_Gbps(100ULL) },		\
881fe2bf351SEric Joyner 	{ IFM_ETHER | IFM_100G_AUI2,	IF_Gbps(100ULL) },		\
882fe2bf351SEric Joyner 	{ IFM_ETHER | IFM_200G_CR4_PAM4, IF_Gbps(200ULL) },		\
883fe2bf351SEric Joyner 	{ IFM_ETHER | IFM_200G_SR4,	IF_Gbps(200ULL) },		\
884fe2bf351SEric Joyner 	{ IFM_ETHER | IFM_200G_FR4,	IF_Gbps(200ULL) },		\
885fe2bf351SEric Joyner 	{ IFM_ETHER | IFM_200G_LR4,	IF_Gbps(200ULL) },		\
886fe2bf351SEric Joyner 	{ IFM_ETHER | IFM_200G_DR4,	IF_Gbps(200ULL) },		\
887fe2bf351SEric Joyner 	{ IFM_ETHER | IFM_200G_KR4_PAM4, IF_Gbps(200ULL) },		\
888fe2bf351SEric Joyner 	{ IFM_ETHER | IFM_200G_AUI4_AC,	IF_Gbps(200ULL) },		\
889fe2bf351SEric Joyner 	{ IFM_ETHER | IFM_200G_AUI4,	IF_Gbps(200ULL) },		\
890fe2bf351SEric Joyner 	{ IFM_ETHER | IFM_200G_AUI8_AC,	IF_Gbps(200ULL) },		\
891fe2bf351SEric Joyner 	{ IFM_ETHER | IFM_200G_AUI8,	IF_Gbps(200ULL) },		\
892fe2bf351SEric Joyner 	{ IFM_ETHER | IFM_400G_FR8,	IF_Gbps(400ULL) },		\
893fe2bf351SEric Joyner 	{ IFM_ETHER | IFM_400G_LR8,	IF_Gbps(400ULL) },		\
894fe2bf351SEric Joyner 	{ IFM_ETHER | IFM_400G_DR4,	IF_Gbps(400ULL) },		\
895fe2bf351SEric Joyner 	{ IFM_ETHER | IFM_400G_AUI8_AC,	IF_Gbps(400ULL) },		\
896fe2bf351SEric Joyner 	{ IFM_ETHER | IFM_400G_AUI8,	IF_Gbps(400ULL) },		\
897efd19b8fSGleb Smirnoff 									\
898efd19b8fSGleb Smirnoff 	{ IFM_IEEE80211 | IFM_IEEE80211_FH1,	IF_Mbps(1) },		\
899efd19b8fSGleb Smirnoff 	{ IFM_IEEE80211 | IFM_IEEE80211_FH2,	IF_Mbps(2) },		\
900efd19b8fSGleb Smirnoff 	{ IFM_IEEE80211 | IFM_IEEE80211_DS2,	IF_Mbps(2) },		\
901efd19b8fSGleb Smirnoff 	{ IFM_IEEE80211 | IFM_IEEE80211_DS5,	IF_Kbps(5500) },	\
902efd19b8fSGleb Smirnoff 	{ IFM_IEEE80211 | IFM_IEEE80211_DS11,	IF_Mbps(11) },		\
903efd19b8fSGleb Smirnoff 	{ IFM_IEEE80211 | IFM_IEEE80211_DS1,	IF_Mbps(1) },		\
904efd19b8fSGleb Smirnoff 	{ IFM_IEEE80211 | IFM_IEEE80211_DS22,	IF_Mbps(22) },		\
905efd19b8fSGleb Smirnoff 	{ IFM_IEEE80211 | IFM_IEEE80211_OFDM6,	IF_Mbps(6) },		\
906efd19b8fSGleb Smirnoff 	{ IFM_IEEE80211 | IFM_IEEE80211_OFDM9,	IF_Mbps(9) },		\
907efd19b8fSGleb Smirnoff 	{ IFM_IEEE80211 | IFM_IEEE80211_OFDM12,	IF_Mbps(12) },		\
908efd19b8fSGleb Smirnoff 	{ IFM_IEEE80211 | IFM_IEEE80211_OFDM18,	IF_Mbps(18) },		\
909efd19b8fSGleb Smirnoff 	{ IFM_IEEE80211 | IFM_IEEE80211_OFDM24,	IF_Mbps(24) },		\
910efd19b8fSGleb Smirnoff 	{ IFM_IEEE80211 | IFM_IEEE80211_OFDM36,	IF_Mbps(36) },		\
911efd19b8fSGleb Smirnoff 	{ IFM_IEEE80211 | IFM_IEEE80211_OFDM48,	IF_Mbps(48) },		\
912efd19b8fSGleb Smirnoff 	{ IFM_IEEE80211 | IFM_IEEE80211_OFDM54,	IF_Mbps(54) },		\
913efd19b8fSGleb Smirnoff 	{ IFM_IEEE80211 | IFM_IEEE80211_OFDM72,	IF_Mbps(72) },		\
914efd19b8fSGleb Smirnoff 									\
915efd19b8fSGleb Smirnoff 	{ 0, 0 },							\
916efd19b8fSGleb Smirnoff }
917efd19b8fSGleb Smirnoff 
918e4bd8f10SAndre Oppermann /*
919e4bd8f10SAndre Oppermann  * Status descriptions for the various media types.
920e4bd8f10SAndre Oppermann  */
921e4bd8f10SAndre Oppermann struct ifmedia_status_description {
922e4bd8f10SAndre Oppermann 	int	   ifms_type;
923e4bd8f10SAndre Oppermann 	int	   ifms_valid;
924e4bd8f10SAndre Oppermann 	int	   ifms_bit;
925e4bd8f10SAndre Oppermann 	const char *ifms_string[2];
926e4bd8f10SAndre Oppermann };
927e4bd8f10SAndre Oppermann 
928e4bd8f10SAndre Oppermann #define	IFM_STATUS_DESC(ifms, bit)					\
929e4bd8f10SAndre Oppermann 	(ifms)->ifms_string[((ifms)->ifms_bit & (bit)) ? 1 : 0]
930e4bd8f10SAndre Oppermann 
931e4bd8f10SAndre Oppermann #define	IFM_STATUS_DESCRIPTIONS {					\
932e4bd8f10SAndre Oppermann 	{ IFM_ETHER,		IFM_AVALID,	IFM_ACTIVE,		\
933e4bd8f10SAndre Oppermann 	    { "no carrier", "active" } },				\
934e4bd8f10SAndre Oppermann 	{ IFM_IEEE80211,	IFM_AVALID,	IFM_ACTIVE,		\
935e4bd8f10SAndre Oppermann 	    { "no network", "active" } },				\
936e4bd8f10SAndre Oppermann 	{ IFM_ATM,		IFM_AVALID,	IFM_ACTIVE,		\
937e4bd8f10SAndre Oppermann 	    { "no network", "active" } },				\
938e4bd8f10SAndre Oppermann 	{ 0,			0,		0,			\
939e4bd8f10SAndre Oppermann 	    { NULL, NULL } }						\
940e4bd8f10SAndre Oppermann }
941f94bb788SPeter Wemm #endif	/* _NET_IF_MEDIA_H_ */
942