xref: /illumos-gate/usr/src/uts/common/sys/mac_ether.h (revision 43051d27)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  *
25  * Copyright 2015 Garrett D'Amore <garrett@damore.org>
26  */
27 
28 #ifndef	_SYS_MAC_ETHER_H
29 #define	_SYS_MAC_ETHER_H
30 
31 /*
32  * Ethernet MAC Plugin
33  */
34 
35 #ifdef	__cplusplus
36 extern "C" {
37 #endif
38 
39 #ifdef	_KERNEL
40 
41 #define	MAC_PLUGIN_IDENT_ETHER	"mac_ether"
42 
43 /*
44  * Do not reorder, and add only to the end of this list.
45  */
46 enum ether_stat {
47 	/* RFC 1643 stats */
48 	ETHER_STAT_ALIGN_ERRORS = MACTYPE_STAT_MIN,
49 	ETHER_STAT_FCS_ERRORS,
50 	ETHER_STAT_FIRST_COLLISIONS,
51 	ETHER_STAT_MULTI_COLLISIONS,
52 	ETHER_STAT_SQE_ERRORS,
53 	ETHER_STAT_DEFER_XMTS,
54 	ETHER_STAT_TX_LATE_COLLISIONS,
55 	ETHER_STAT_EX_COLLISIONS,
56 	ETHER_STAT_MACXMT_ERRORS,
57 	ETHER_STAT_CARRIER_ERRORS,
58 	ETHER_STAT_TOOLONG_ERRORS,
59 	ETHER_STAT_MACRCV_ERRORS,
60 
61 	/* MII/GMII stats */
62 	ETHER_STAT_XCVR_ADDR,
63 	ETHER_STAT_XCVR_ID,
64 	ETHER_STAT_XCVR_INUSE,
65 	ETHER_STAT_CAP_1000FDX,
66 	ETHER_STAT_CAP_1000HDX,
67 	ETHER_STAT_CAP_100FDX,
68 	ETHER_STAT_CAP_100HDX,
69 	ETHER_STAT_CAP_10FDX,
70 	ETHER_STAT_CAP_10HDX,
71 	ETHER_STAT_CAP_ASMPAUSE,
72 	ETHER_STAT_CAP_PAUSE,
73 	ETHER_STAT_CAP_AUTONEG,
74 	ETHER_STAT_ADV_CAP_1000FDX,
75 	ETHER_STAT_ADV_CAP_1000HDX,
76 	ETHER_STAT_ADV_CAP_100FDX,
77 	ETHER_STAT_ADV_CAP_100HDX,
78 	ETHER_STAT_ADV_CAP_10FDX,
79 	ETHER_STAT_ADV_CAP_10HDX,
80 	ETHER_STAT_ADV_CAP_ASMPAUSE,
81 	ETHER_STAT_ADV_CAP_PAUSE,
82 	ETHER_STAT_ADV_CAP_AUTONEG,
83 	ETHER_STAT_LP_CAP_1000FDX,
84 	ETHER_STAT_LP_CAP_1000HDX,
85 	ETHER_STAT_LP_CAP_100FDX,
86 	ETHER_STAT_LP_CAP_100HDX,
87 	ETHER_STAT_LP_CAP_10FDX,
88 	ETHER_STAT_LP_CAP_10HDX,
89 	ETHER_STAT_LP_CAP_ASMPAUSE,
90 	ETHER_STAT_LP_CAP_PAUSE,
91 	ETHER_STAT_LP_CAP_AUTONEG,
92 	ETHER_STAT_LINK_ASMPAUSE,
93 	ETHER_STAT_LINK_PAUSE,
94 	ETHER_STAT_LINK_AUTONEG,
95 	ETHER_STAT_LINK_DUPLEX,
96 
97 	ETHER_STAT_TOOSHORT_ERRORS,
98 	ETHER_STAT_CAP_REMFAULT,
99 	ETHER_STAT_ADV_REMFAULT,
100 	ETHER_STAT_LP_REMFAULT,
101 
102 	ETHER_STAT_JABBER_ERRORS,
103 	ETHER_STAT_CAP_100T4,
104 	ETHER_STAT_ADV_CAP_100T4,
105 	ETHER_STAT_LP_CAP_100T4,
106 
107 	ETHER_STAT_CAP_10GFDX,
108 	ETHER_STAT_ADV_CAP_10GFDX,
109 	ETHER_STAT_LP_CAP_10GFDX,
110 
111 	ETHER_STAT_CAP_40GFDX,
112 	ETHER_STAT_ADV_CAP_40GFDX,
113 	ETHER_STAT_LP_CAP_40GFDX,
114 
115 	ETHER_STAT_CAP_100GFDX,
116 	ETHER_STAT_ADV_CAP_100GFDX,
117 	ETHER_STAT_LP_CAP_100GFDX,
118 
119 	ETHER_STAT_CAP_2500FDX,
120 	ETHER_STAT_ADV_CAP_2500FDX,
121 	ETHER_STAT_LP_CAP_2500FDX,
122 
123 	ETHER_STAT_CAP_5000FDX,
124 	ETHER_STAT_ADV_CAP_5000FDX,
125 	ETHER_STAT_LP_CAP_5000FDX,
126 };
127 
128 #define	ETHER_NSTAT	\
129 	(ETHER_STAT_LP_CAP_5000FDX - ETHER_STAT_ALIGN_ERRORS + 1)
130 
131 #define	ETHER_STAT_ISACOUNTER(_ether_stat)				\
132 	    ((_ether_stat) == ETHER_STAT_ALIGN_ERRORS ||		\
133 		(_ether_stat) == ETHER_STAT_FCS_ERRORS ||		\
134 		(_ether_stat) == ETHER_STAT_FIRST_COLLISIONS ||		\
135 		(_ether_stat) == ETHER_STAT_MULTI_COLLISIONS ||		\
136 		(_ether_stat) == ETHER_STAT_SQE_ERRORS ||		\
137 		(_ether_stat) == ETHER_STAT_DEFER_XMTS ||		\
138 		(_ether_stat) == ETHER_STAT_TX_LATE_COLLISIONS ||	\
139 		(_ether_stat) == ETHER_STAT_EX_COLLISIONS ||		\
140 		(_ether_stat) == ETHER_STAT_MACXMT_ERRORS ||		\
141 		(_ether_stat) == ETHER_STAT_CARRIER_ERRORS ||		\
142 		(_ether_stat) == ETHER_STAT_TOOLONG_ERRORS ||		\
143 		(_ether_stat) == ETHER_STAT_TOOSHORT_ERRORS ||		\
144 		(_ether_stat) == ETHER_STAT_JABBER_ERRORS ||		\
145 		(_ether_stat) == ETHER_STAT_MACRCV_ERRORS)
146 
147 #endif	/* _KERNEL */
148 
149 #ifdef	__cplusplus
150 }
151 #endif
152 
153 #endif /* _SYS_MAC_ETHER_H */
154