Deleted Added
full compact
if_media.h (215297) if_media.h (217010)
1/* $NetBSD: if_media.h,v 1.3 1997/03/26 01:19:27 thorpej Exp $ */
1/* $NetBSD: if_media.h,v 1.3 1997/03/26 01:19:27 thorpej Exp $ */
2/* $FreeBSD: head/sys/net/if_media.h 215297 2010-11-14 13:26:10Z marius $ */
2/* $FreeBSD: head/sys/net/if_media.h 217010 2011-01-05 14:51:04Z marius $ */
3
4/*-
5 * Copyright (c) 1997
6 * Jonathan Stone and Jason R. Thorpe. All rights reserved.
7 *
8 * This software is derived from information provided by Matt Thomas.
9 *
10 * Redistribution and use in source and binary forms, with or without

--- 20 unchanged lines hidden (view full) ---

31 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
32 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
33 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 * SUCH DAMAGE.
36 */
37
38#ifndef _NET_IF_MEDIA_H_
3
4/*-
5 * Copyright (c) 1997
6 * Jonathan Stone and Jason R. Thorpe. All rights reserved.
7 *
8 * This software is derived from information provided by Matt Thomas.
9 *
10 * Redistribution and use in source and binary forms, with or without

--- 20 unchanged lines hidden (view full) ---

31 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
32 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
33 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 * SUCH DAMAGE.
36 */
37
38#ifndef _NET_IF_MEDIA_H_
39#define _NET_IF_MEDIA_H_
39#define _NET_IF_MEDIA_H_
40
41/*
42 * Prototypes and definitions for BSD/OS-compatible network interface
43 * media selection.
44 *
45 * Where it is safe to do so, this code strays slightly from the BSD/OS
46 * design. Software which uses the API (device drivers, basically)
47 * shouldn't notice any difference.

--- 91 unchanged lines hidden (view full) ---

139#define IFM_10_FL 13 /* 10BaseFL - Fiber */
140#define IFM_1000_LX 14 /* 1000baseLX - single-mode fiber */
141#define IFM_1000_CX 15 /* 1000baseCX - 150ohm STP */
142#define IFM_1000_T 16 /* 1000baseT - 4 pair cat 5 */
143#define IFM_HPNA_1 17 /* HomePNA 1.0 (1Mb/s) */
144#define IFM_10G_LR 18 /* 10GBase-LR 1310nm Single-mode */
145#define IFM_10G_SR 19 /* 10GBase-SR 850nm Multi-mode */
146#define IFM_10G_CX4 20 /* 10GBase CX4 copper */
40
41/*
42 * Prototypes and definitions for BSD/OS-compatible network interface
43 * media selection.
44 *
45 * Where it is safe to do so, this code strays slightly from the BSD/OS
46 * design. Software which uses the API (device drivers, basically)
47 * shouldn't notice any difference.

--- 91 unchanged lines hidden (view full) ---

139#define IFM_10_FL 13 /* 10BaseFL - Fiber */
140#define IFM_1000_LX 14 /* 1000baseLX - single-mode fiber */
141#define IFM_1000_CX 15 /* 1000baseCX - 150ohm STP */
142#define IFM_1000_T 16 /* 1000baseT - 4 pair cat 5 */
143#define IFM_HPNA_1 17 /* HomePNA 1.0 (1Mb/s) */
144#define IFM_10G_LR 18 /* 10GBase-LR 1310nm Single-mode */
145#define IFM_10G_SR 19 /* 10GBase-SR 850nm Multi-mode */
146#define IFM_10G_CX4 20 /* 10GBase CX4 copper */
147#define IFM_2500_SX 21 /* 2500BaseSX - multi-mode fiber */
148#define IFM_10G_TWINAX 22 /* 10GBase Twinax copper */
149#define IFM_10G_TWINAX_LONG 23 /* 10GBase Twinax Long copper */
150#define IFM_10G_LRM 24 /* 10GBase-LRM 850nm Multi-mode */
151#define IFM_UNKNOWN 25 /* media types not defined yet */
152#define IFM_10G_T 26 /* 10GBase-T - RJ45 */
147#define IFM_2500_SX 21 /* 2500BaseSX - multi-mode fiber */
148#define IFM_10G_TWINAX 22 /* 10GBase Twinax copper */
149#define IFM_10G_TWINAX_LONG 23 /* 10GBase Twinax Long copper */
150#define IFM_10G_LRM 24 /* 10GBase-LRM 850nm Multi-mode */
151#define IFM_UNKNOWN 25 /* media types not defined yet */
152#define IFM_10G_T 26 /* 10GBase-T - RJ45 */
153
153
154
155/* note 31 is the max! */
156
157#define IFM_ETH_MASTER 0x00000100 /* master mode (1000baseT) */
158#define IFM_ETH_RXPAUSE 0x00000200 /* receive PAUSE frames */
159#define IFM_ETH_TXPAUSE 0x00000400 /* transmit PAUSE frames */
160
161/*
162 * Token ring

--- 64 unchanged lines hidden (view full) ---

227#define IFM_IEEE80211_11G 0x00030000 /* 2Ghz, CCK mode */
228#define IFM_IEEE80211_FH 0x00040000 /* 2Ghz, GFSK mode */
229#define IFM_IEEE80211_11NA 0x00050000 /* 5Ghz, HT mode */
230#define IFM_IEEE80211_11NG 0x00060000 /* 2Ghz, HT mode */
231
232/*
233 * ATM
234 */
154/* note 31 is the max! */
155
156#define IFM_ETH_MASTER 0x00000100 /* master mode (1000baseT) */
157#define IFM_ETH_RXPAUSE 0x00000200 /* receive PAUSE frames */
158#define IFM_ETH_TXPAUSE 0x00000400 /* transmit PAUSE frames */
159
160/*
161 * Token ring

--- 64 unchanged lines hidden (view full) ---

226#define IFM_IEEE80211_11G 0x00030000 /* 2Ghz, CCK mode */
227#define IFM_IEEE80211_FH 0x00040000 /* 2Ghz, GFSK mode */
228#define IFM_IEEE80211_11NA 0x00050000 /* 5Ghz, HT mode */
229#define IFM_IEEE80211_11NG 0x00060000 /* 2Ghz, HT mode */
230
231/*
232 * ATM
233 */
235#define IFM_ATM 0x000000a0
236#define IFM_ATM_UNKNOWN 3
237#define IFM_ATM_UTP_25 4
238#define IFM_ATM_TAXI_100 5
239#define IFM_ATM_TAXI_140 6
240#define IFM_ATM_MM_155 7
241#define IFM_ATM_SM_155 8
242#define IFM_ATM_UTP_155 9
243#define IFM_ATM_MM_622 10
244#define IFM_ATM_SM_622 11
234#define IFM_ATM 0x000000a0
235#define IFM_ATM_UNKNOWN 3
236#define IFM_ATM_UTP_25 4
237#define IFM_ATM_TAXI_100 5
238#define IFM_ATM_TAXI_140 6
239#define IFM_ATM_MM_155 7
240#define IFM_ATM_SM_155 8
241#define IFM_ATM_UTP_155 9
242#define IFM_ATM_MM_622 10
243#define IFM_ATM_SM_622 11
245#define IFM_ATM_VIRTUAL 12
244#define IFM_ATM_VIRTUAL 12
246#define IFM_ATM_SDH 0x00000100 /* SDH instead of SONET */
247#define IFM_ATM_NOSCRAMB 0x00000200 /* no scrambling */
248#define IFM_ATM_UNASSIGNED 0x00000400 /* unassigned cells */
245#define IFM_ATM_SDH 0x00000100 /* SDH instead of SONET */
246#define IFM_ATM_NOSCRAMB 0x00000200 /* no scrambling */
247#define IFM_ATM_UNASSIGNED 0x00000400 /* unassigned cells */
249
250/*
251 * CARP Common Address Redundancy Protocol
252 */
253#define IFM_CARP 0x000000c0
254
255/*
256 * Shared media sub-types

--- 33 unchanged lines hidden (view full) ---

290 */
291#define IFM_AVALID 0x00000001 /* Active bit valid */
292#define IFM_ACTIVE 0x00000002 /* Interface attached to working net */
293
294/* Mask of "status valid" bits, for ifconfig(8). */
295#define IFM_STATUS_VALID IFM_AVALID
296
297/* List of "status valid" bits, for ifconfig(8). */
248
249/*
250 * CARP Common Address Redundancy Protocol
251 */
252#define IFM_CARP 0x000000c0
253
254/*
255 * Shared media sub-types

--- 33 unchanged lines hidden (view full) ---

289 */
290#define IFM_AVALID 0x00000001 /* Active bit valid */
291#define IFM_ACTIVE 0x00000002 /* Interface attached to working net */
292
293/* Mask of "status valid" bits, for ifconfig(8). */
294#define IFM_STATUS_VALID IFM_AVALID
295
296/* List of "status valid" bits, for ifconfig(8). */
298#define IFM_STATUS_VALID_LIST { \
299 IFM_AVALID, \
300 0 \
297#define IFM_STATUS_VALID_LIST { \
298 IFM_AVALID, \
299 0 \
301}
302
303/*
304 * Macros to extract various bits of information from the media word.
305 */
300}
301
302/*
303 * Macros to extract various bits of information from the media word.
304 */
306#define IFM_TYPE(x) ((x) & IFM_NMASK)
307#define IFM_SUBTYPE(x) ((x) & IFM_TMASK)
308#define IFM_TYPE_OPTIONS(x) ((x) & IFM_OMASK)
309#define IFM_INST(x) (((x) & IFM_IMASK) >> IFM_ISHIFT)
310#define IFM_OPTIONS(x) ((x) & (IFM_OMASK|IFM_GMASK))
311#define IFM_MODE(x) ((x) & IFM_MMASK)
305#define IFM_TYPE(x) ((x) & IFM_NMASK)
306#define IFM_SUBTYPE(x) ((x) & IFM_TMASK)
307#define IFM_TYPE_OPTIONS(x) ((x) & IFM_OMASK)
308#define IFM_INST(x) (((x) & IFM_IMASK) >> IFM_ISHIFT)
309#define IFM_OPTIONS(x) ((x) & (IFM_OMASK | IFM_GMASK))
310#define IFM_MODE(x) ((x) & IFM_MMASK)
312
311
313#define IFM_INST_MAX IFM_INST(IFM_IMASK)
312#define IFM_INST_MAX IFM_INST(IFM_IMASK)
314
315/*
316 * Macro to create a media word.
317 */
318#define IFM_MAKEWORD(type, subtype, options, instance) \
319 ((type) | (subtype) | (options) | ((instance) << IFM_ISHIFT))
320#define IFM_MAKEMODE(mode) \
321 (((mode) << IFM_MSHIFT) & IFM_MMASK)

--- 214 unchanged lines hidden (view full) ---

536 { 0, NULL }, \
537}
538
539#define IFM_SUBTYPE_IEEE80211_MODE_ALIASES { \
540 { IFM_AUTO, "auto" }, \
541 { 0, NULL }, \
542}
543
313
314/*
315 * Macro to create a media word.
316 */
317#define IFM_MAKEWORD(type, subtype, options, instance) \
318 ((type) | (subtype) | (options) | ((instance) << IFM_ISHIFT))
319#define IFM_MAKEMODE(mode) \
320 (((mode) << IFM_MSHIFT) & IFM_MMASK)

--- 214 unchanged lines hidden (view full) ---

535 { 0, NULL }, \
536}
537
538#define IFM_SUBTYPE_IEEE80211_MODE_ALIASES { \
539 { IFM_AUTO, "auto" }, \
540 { 0, NULL }, \
541}
542
544# define IFM_SUBTYPE_ATM_DESCRIPTIONS { \
543#define IFM_SUBTYPE_ATM_DESCRIPTIONS { \
545 { IFM_ATM_UNKNOWN, "Unknown" }, \
546 { IFM_ATM_UTP_25, "UTP/25.6MBit" }, \
547 { IFM_ATM_TAXI_100, "Taxi/100MBit" }, \
548 { IFM_ATM_TAXI_140, "Taxi/140MBit" }, \
549 { IFM_ATM_MM_155, "Multi-mode/155MBit" }, \
550 { IFM_ATM_SM_155, "Single-mode/155MBit" }, \
551 { IFM_ATM_UTP_155, "UTP/155MBit" }, \
552 { IFM_ATM_MM_622, "Multi-mode/622MBit" }, \
553 { IFM_ATM_SM_622, "Single-mode/622MBit" }, \
554 { IFM_ATM_VIRTUAL, "Virtual" }, \
555 { 0, NULL }, \
556}
557
544 { IFM_ATM_UNKNOWN, "Unknown" }, \
545 { IFM_ATM_UTP_25, "UTP/25.6MBit" }, \
546 { IFM_ATM_TAXI_100, "Taxi/100MBit" }, \
547 { IFM_ATM_TAXI_140, "Taxi/140MBit" }, \
548 { IFM_ATM_MM_155, "Multi-mode/155MBit" }, \
549 { IFM_ATM_SM_155, "Single-mode/155MBit" }, \
550 { IFM_ATM_UTP_155, "UTP/155MBit" }, \
551 { IFM_ATM_MM_622, "Multi-mode/622MBit" }, \
552 { IFM_ATM_SM_622, "Single-mode/622MBit" }, \
553 { IFM_ATM_VIRTUAL, "Virtual" }, \
554 { 0, NULL }, \
555}
556
558# define IFM_SUBTYPE_ATM_ALIASES { \
557#define IFM_SUBTYPE_ATM_ALIASES { \
559 { IFM_ATM_UNKNOWN, "UNKNOWN" }, \
560 { IFM_ATM_UTP_25, "UTP-25" }, \
561 { IFM_ATM_TAXI_100, "TAXI-100" }, \
562 { IFM_ATM_TAXI_140, "TAXI-140" }, \
563 { IFM_ATM_MM_155, "MM-155" }, \
564 { IFM_ATM_SM_155, "SM-155" }, \
565 { IFM_ATM_UTP_155, "UTP-155" }, \
566 { IFM_ATM_MM_622, "MM-622" }, \

--- 4 unchanged lines hidden (view full) ---

571
572#define IFM_SUBTYPE_ATM_OPTION_DESCRIPTIONS { \
573 { IFM_ATM_SDH, "SDH" }, \
574 { IFM_ATM_NOSCRAMB, "Noscramb" }, \
575 { IFM_ATM_UNASSIGNED, "Unassigned" }, \
576 { 0, NULL }, \
577}
578
558 { IFM_ATM_UNKNOWN, "UNKNOWN" }, \
559 { IFM_ATM_UTP_25, "UTP-25" }, \
560 { IFM_ATM_TAXI_100, "TAXI-100" }, \
561 { IFM_ATM_TAXI_140, "TAXI-140" }, \
562 { IFM_ATM_MM_155, "MM-155" }, \
563 { IFM_ATM_SM_155, "SM-155" }, \
564 { IFM_ATM_UTP_155, "UTP-155" }, \
565 { IFM_ATM_MM_622, "MM-622" }, \

--- 4 unchanged lines hidden (view full) ---

570
571#define IFM_SUBTYPE_ATM_OPTION_DESCRIPTIONS { \
572 { IFM_ATM_SDH, "SDH" }, \
573 { IFM_ATM_NOSCRAMB, "Noscramb" }, \
574 { IFM_ATM_UNASSIGNED, "Unassigned" }, \
575 { 0, NULL }, \
576}
577
579
580#define IFM_SUBTYPE_SHARED_DESCRIPTIONS { \
581 { IFM_AUTO, "autoselect" }, \
582 { IFM_MANUAL, "manual" }, \
583 { IFM_NONE, "none" }, \
584 { 0, NULL }, \
585}
586
587#define IFM_SUBTYPE_SHARED_ALIASES { \

--- 15 unchanged lines hidden (view full) ---

603/*
604 * Baudrate descriptions for the various media types.
605 */
606struct ifmedia_baudrate {
607 int ifmb_word; /* media word */
608 uint64_t ifmb_baudrate; /* corresponding baudrate */
609};
610
578#define IFM_SUBTYPE_SHARED_DESCRIPTIONS { \
579 { IFM_AUTO, "autoselect" }, \
580 { IFM_MANUAL, "manual" }, \
581 { IFM_NONE, "none" }, \
582 { 0, NULL }, \
583}
584
585#define IFM_SUBTYPE_SHARED_ALIASES { \

--- 15 unchanged lines hidden (view full) ---

601/*
602 * Baudrate descriptions for the various media types.
603 */
604struct ifmedia_baudrate {
605 int ifmb_word; /* media word */
606 uint64_t ifmb_baudrate; /* corresponding baudrate */
607};
608
611#define IFM_BAUDRATE_DESCRIPTIONS { \
609#define IFM_BAUDRATE_DESCRIPTIONS { \
612 { IFM_ETHER | IFM_10_T, IF_Mbps(10) }, \
613 { IFM_ETHER | IFM_10_2, IF_Mbps(10) }, \
614 { IFM_ETHER | IFM_10_5, IF_Mbps(10) }, \
615 { IFM_ETHER | IFM_100_TX, IF_Mbps(100) }, \
616 { IFM_ETHER | IFM_100_FX, IF_Mbps(100) }, \
617 { IFM_ETHER | IFM_100_T4, IF_Mbps(100) }, \
618 { IFM_ETHER | IFM_100_VG, IF_Mbps(100) }, \
619 { IFM_ETHER | IFM_100_T2, IF_Mbps(100) }, \

--- 47 unchanged lines hidden (view full) ---

667 */
668struct ifmedia_status_description {
669 int ifms_type;
670 int ifms_valid;
671 int ifms_bit;
672 const char *ifms_string[2];
673};
674
610 { IFM_ETHER | IFM_10_T, IF_Mbps(10) }, \
611 { IFM_ETHER | IFM_10_2, IF_Mbps(10) }, \
612 { IFM_ETHER | IFM_10_5, IF_Mbps(10) }, \
613 { IFM_ETHER | IFM_100_TX, IF_Mbps(100) }, \
614 { IFM_ETHER | IFM_100_FX, IF_Mbps(100) }, \
615 { IFM_ETHER | IFM_100_T4, IF_Mbps(100) }, \
616 { IFM_ETHER | IFM_100_VG, IF_Mbps(100) }, \
617 { IFM_ETHER | IFM_100_T2, IF_Mbps(100) }, \

--- 47 unchanged lines hidden (view full) ---

665 */
666struct ifmedia_status_description {
667 int ifms_type;
668 int ifms_valid;
669 int ifms_bit;
670 const char *ifms_string[2];
671};
672
675#define IFM_STATUS_DESC(ifms, bit) \
673#define IFM_STATUS_DESC(ifms, bit) \
676 (ifms)->ifms_string[((ifms)->ifms_bit & (bit)) ? 1 : 0]
677
674 (ifms)->ifms_string[((ifms)->ifms_bit & (bit)) ? 1 : 0]
675
678#define IFM_STATUS_DESCRIPTIONS { \
676#define IFM_STATUS_DESCRIPTIONS { \
679 { IFM_ETHER, IFM_AVALID, IFM_ACTIVE, \
680 { "no carrier", "active" } }, \
681 { IFM_FDDI, IFM_AVALID, IFM_ACTIVE, \
682 { "no ring", "inserted" } }, \
683 { IFM_TOKEN, IFM_AVALID, IFM_ACTIVE, \
684 { "no ring", "inserted" } }, \
685 { IFM_IEEE80211, IFM_AVALID, IFM_ACTIVE, \
686 { "no network", "active" } }, \
687 { IFM_ATM, IFM_AVALID, IFM_ACTIVE, \
688 { "no network", "active" } }, \
689 { IFM_CARP, IFM_AVALID, IFM_ACTIVE, \
690 { "backup", "master" } }, \
691 { 0, 0, 0, \
692 { NULL, NULL } } \
693}
694#endif /* _NET_IF_MEDIA_H_ */
677 { IFM_ETHER, IFM_AVALID, IFM_ACTIVE, \
678 { "no carrier", "active" } }, \
679 { IFM_FDDI, IFM_AVALID, IFM_ACTIVE, \
680 { "no ring", "inserted" } }, \
681 { IFM_TOKEN, IFM_AVALID, IFM_ACTIVE, \
682 { "no ring", "inserted" } }, \
683 { IFM_IEEE80211, IFM_AVALID, IFM_ACTIVE, \
684 { "no network", "active" } }, \
685 { IFM_ATM, IFM_AVALID, IFM_ACTIVE, \
686 { "no network", "active" } }, \
687 { IFM_CARP, IFM_AVALID, IFM_ACTIVE, \
688 { "backup", "master" } }, \
689 { 0, 0, 0, \
690 { NULL, NULL } } \
691}
692#endif /* _NET_IF_MEDIA_H_ */