xref: /dragonfly/sys/net/if_mib.h (revision 86d7f5d3)
1 /*
2  * Copyright 1996 Massachusetts Institute of Technology
3  *
4  * Permission to use, copy, modify, and distribute this software and
5  * its documentation for any purpose and without fee is hereby
6  * granted, provided that both the above copyright notice and this
7  * permission notice appear in all copies, that both the above
8  * copyright notice and this permission notice appear in all
9  * supporting documentation, and that the name of M.I.T. not be used
10  * in advertising or publicity pertaining to distribution of the
11  * software without specific, written prior permission.  M.I.T. makes
12  * no representations about the suitability of this software for any
13  * purpose.  It is provided "as is" without express or implied
14  * warranty.
15  *
16  * THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''.  M.I.T. DISCLAIMS
17  * ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE,
18  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
20  * SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
23  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
26  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27  * SUCH DAMAGE.
28  *
29  * $FreeBSD: src/sys/net/if_mib.h,v 1.6 1999/08/28 00:48:19 peter Exp $
30  * $DragonFly: src/sys/net/if_mib.h,v 1.3 2006/05/20 02:42:08 dillon Exp $
31  */
32 
33 #ifndef _NET_IF_MIB_H_
34 #define	_NET_IF_MIB_H_
35 
36 #ifndef _NET_IF_H_
37 #include <net/if.h>
38 #endif
39 
40 struct ifmibdata {
41 	char	ifmd_name[IFNAMSIZ]; /* name of interface */
42 	int	ifmd_pcount;	/* number of promiscuous listeners */
43 	int	ifmd_flags;	/* interface flags */
44 	int	ifmd_snd_len;	/* instantaneous length of send queue */
45 	int	ifmd_snd_maxlen; /* maximum length of send queue */
46 	int	ifmd_snd_drops;	/* number of drops in send queue */
47 	int	ifmd_filler[4];	/* for future expansion */
48 	struct	if_data ifmd_data; /* generic information and statistics */
49 };
50 
51 /*
52  * sysctl MIB tags at the net.link.generic level
53  */
54 #define	IFMIB_SYSTEM	1	/* non-interface-specific */
55 #define	IFMIB_IFDATA	2	/* per-interface data table */
56 
57 /*
58  * MIB tags for the various net.link.generic.ifdata tables
59  */
60 #define	IFDATA_GENERAL	1	/* generic stats for all kinds of ifaces */
61 #define	IFDATA_LINKSPECIFIC	2 /* specific to the type of interface */
62 
63 /*
64  * MIB tags at the net.link.generic.system level
65  */
66 #define	IFMIB_IFCOUNT	1	/* number of interfaces configured */
67 
68 /*
69  * MIB tags as the net.link level
70  * All of the other values are IFT_* names defined in if_types.h.
71  */
72 #define	NETLINK_GENERIC	0	/* functions not specific to a type of iface */
73 
74 /*
75  * The reason why the IFDATA_LINKSPECIFIC stuff is not under the
76  * net.link.<iftype> branches is twofold:
77  *   1) It's easier to code this way, and doesn't require duplication.
78  *   2) The fourth level under net.link.<iftype> is <pf>; that is to say,
79  *	the net.link.<iftype> tree instruments the adaptation layers between
80  *	<iftype> and a particular protocol family (e.g., net.link.ether.inet
81  *	instruments ARP).  This does not really leave room for anything else
82  *	that needs to have a well-known number.
83  */
84 
85 /*
86  * Link-specific MIB structures for various link types.
87  */
88 
89 /* For IFT_ETHER, IFT_ISO88023, and IFT_STARLAN, as used by RFC 1650 */
90 struct ifmib_iso_8802_3 {
91 	u_int32_t	dot3StatsAlignmentErrors;
92 	u_int32_t	dot3StatsFCSErrors;
93 	u_int32_t	dot3StatsSingleCollisionFrames;
94 	u_int32_t	dot3StatsMultipleCollisionFrames;
95 	u_int32_t	dot3StatsSQETestErrors;
96 	u_int32_t	dot3StatsDeferredTransmissions;
97 	u_int32_t	dot3StatsLateCollisions;
98 	u_int32_t	dot3StatsExcessiveCollisions;
99 	u_int32_t	dot3StatsInternalMacTransmitErrors;
100 	u_int32_t	dot3StatsCarrierSenseErrors;
101 	u_int32_t	dot3StatsFrameTooLongs;
102 	u_int32_t	dot3StatsInternalMacReceiveErrors;
103 	u_int32_t	dot3StatsEtherChipSet;
104 	/* Matt Thomas wants this one, not included in RFC 1650: */
105 	u_int32_t	dot3StatsMissedFrames;
106 
107 	u_int32_t	dot3StatsCollFrequencies[16]; /* NB: index origin */
108 
109 	u_int32_t	dot3Compliance;
110 #define	DOT3COMPLIANCE_STATS	1
111 #define	DOT3COMPLIANCE_COLLS	2
112 };
113 
114 /*
115  * Chipset identifiers are normally part of the vendor's enterprise MIB.
116  * However, we don't want to be trying to represent arbitrary-length
117  * OBJECT IDENTIFIERs here (ick!), and the right value is not necessarily
118  * obvious to the driver implementor.  So, we define our own identification
119  * mechanism here, and let the agent writer deal with the translation.
120  */
121 #define	DOT3CHIPSET_VENDOR(x)	((x) >> 16)
122 #define	DOT3CHIPSET_PART(x)	((x) & 0xffff)
123 #define	DOT3CHIPSET(v,p)	(((v) << 16) + ((p) & 0xffff))
124 
125 /* Driver writers!  Add your vendors here! */
126 enum dot3Vendors {
127 	dot3VendorAMD = 1,
128 	dot3VendorIntel = 2,
129 	dot3VendorNational = 4,
130 	dot3VendorFujitsu = 5,
131 	dot3VendorDigital = 6,
132 	dot3VendorWesternDigital = 7
133 };
134 
135 /* Driver writers!  Add your chipsets here! */
136 enum {
137 	dot3ChipSetAMD7990 = 1,
138 	dot3ChipSetAMD79900 = 2,
139 	dot3ChipSetAMD79C940 = 3
140 };
141 
142 enum {
143 	dot3ChipSetIntel82586 = 1,
144 	dot3ChipSetIntel82596 = 2,
145 	dot3ChipSetIntel82557 = 3
146 };
147 
148 enum {
149 	dot3ChipSetNational8390 = 1,
150 	dot3ChipSetNationalSonic = 2
151 };
152 
153 enum {
154 	dot3ChipSetFujitsu86950 = 1
155 };
156 
157 enum {
158 	dot3ChipSetDigitalDC21040 = 1,
159 	dot3ChipSetDigitalDC21140 = 2,
160 	dot3ChipSetDigitalDC21041 = 3,
161 	dot3ChipSetDigitalDC21140A = 4,
162 	dot3ChipSetDigitalDC21142 = 5
163 };
164 
165 enum {
166 	dot3ChipSetWesternDigital83C690 = 1,
167 	dot3ChipSetWesternDigital83C790 = 2
168 };
169 /* END of Ethernet-link MIB stuff */
170 
171 /*
172  * Put other types of interface MIBs here, or in interface-specific
173  * header files if convenient ones already exist.
174  */
175 #endif /* _NET_IF_MIB_H_ */
176