2 * SPDX-License-Identifier: (BSD-2-Clause-FreeBSD AND BSD-4-Clause)
4 * Copyright (c) 1999, 2000 Kenneth D. Merry.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions, and the following disclaimer,
12 * without modification, immediately at the beginning of the file.
13 * 2. The name of the author may not be used to endorse or promote products
14 * derived from this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * The ti_stats structure below is from code with the following copyright,
32 * and originally comes from the Alteon firmware documentation.
35 * Copyright (c) 1997, 1998, 1999
36 * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved.
38 * Redistribution and use in source and binary forms, with or without
39 * modification, are permitted provided that the following conditions
41 * 1. Redistributions of source code must retain the above copyright
42 * notice, this list of conditions and the following disclaimer.
43 * 2. Redistributions in binary form must reproduce the above copyright
44 * notice, this list of conditions and the following disclaimer in the
45 * documentation and/or other materials provided with the distribution.
46 * 3. All advertising materials mentioning features or use of this software
47 * must display the following acknowledgement:
48 * This product includes software developed by Bill Paul.
49 * 4. Neither the name of the author nor the names of any co-contributors
50 * may be used to endorse or promote products derived from this software
51 * without specific prior written permission.
53 * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
54 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
55 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
56 * ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
57 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
58 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
59 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
60 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
61 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
62 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
63 * THE POSSIBILITY OF SUCH DAMAGE.
65 * from: if_tireg.h,v 1.8 1999/07/23 18:46:24 wpaul Exp $
71 #include <sys/ioccom.h>
74 * Tigon statistics counters.
78 * MAC stats, taken from RFC 1643, ethernet-like MIB
80 volatile u_int32_t dot3StatsAlignmentErrors; /* 0 */
81 volatile u_int32_t dot3StatsFCSErrors; /* 1 */
82 volatile u_int32_t dot3StatsSingleCollisionFrames; /* 2 */
83 volatile u_int32_t dot3StatsMultipleCollisionFrames; /* 3 */
84 volatile u_int32_t dot3StatsSQETestErrors; /* 4 */
85 volatile u_int32_t dot3StatsDeferredTransmissions; /* 5 */
86 volatile u_int32_t dot3StatsLateCollisions; /* 6 */
87 volatile u_int32_t dot3StatsExcessiveCollisions; /* 7 */
88 volatile u_int32_t dot3StatsInternalMacTransmitErrors; /* 8 */
89 volatile u_int32_t dot3StatsCarrierSenseErrors; /* 9 */
90 volatile u_int32_t dot3StatsFrameTooLongs; /* 10 */
91 volatile u_int32_t dot3StatsInternalMacReceiveErrors; /* 11 */
93 * interface stats, taken from RFC 1213, MIB-II, interfaces group
95 volatile u_int32_t ifIndex; /* 12 */
96 volatile u_int32_t ifType; /* 13 */
97 volatile u_int32_t ifMtu; /* 14 */
98 volatile u_int32_t ifSpeed; /* 15 */
99 volatile u_int32_t ifAdminStatus; /* 16 */
100 #define IF_ADMIN_STATUS_UP 1
101 #define IF_ADMIN_STATUS_DOWN 2
102 #define IF_ADMIN_STATUS_TESTING 3
103 volatile u_int32_t ifOperStatus; /* 17 */
104 #define IF_OPER_STATUS_UP 1
105 #define IF_OPER_STATUS_DOWN 2
106 #define IF_OPER_STATUS_TESTING 3
107 #define IF_OPER_STATUS_UNKNOWN 4
108 #define IF_OPER_STATUS_DORMANT 5
109 volatile u_int32_t ifLastChange; /* 18 */
110 volatile u_int32_t ifInDiscards; /* 19 */
111 volatile u_int32_t ifInErrors; /* 20 */
112 volatile u_int32_t ifInUnknownProtos; /* 21 */
113 volatile u_int32_t ifOutDiscards; /* 22 */
114 volatile u_int32_t ifOutErrors; /* 23 */
115 volatile u_int32_t ifOutQLen; /* deprecated */ /* 24 */
116 volatile u_int8_t ifPhysAddress[8]; /* 8 bytes */ /* 25 - 26 */
117 volatile u_int8_t ifDescr[32]; /* 27 - 34 */
118 u_int32_t alignIt; /* align to 64 bit for u_int64_ts following */
120 * more interface stats, taken from RFC 1573, MIB-IIupdate,
123 volatile u_int64_t ifHCInOctets; /* 36 - 37 */
124 volatile u_int64_t ifHCInUcastPkts; /* 38 - 39 */
125 volatile u_int64_t ifHCInMulticastPkts; /* 40 - 41 */
126 volatile u_int64_t ifHCInBroadcastPkts; /* 42 - 43 */
127 volatile u_int64_t ifHCOutOctets; /* 44 - 45 */
128 volatile u_int64_t ifHCOutUcastPkts; /* 46 - 47 */
129 volatile u_int64_t ifHCOutMulticastPkts; /* 48 - 49 */
130 volatile u_int64_t ifHCOutBroadcastPkts; /* 50 - 51 */
131 volatile u_int32_t ifLinkUpDownTrapEnable; /* 52 */
132 volatile u_int32_t ifHighSpeed; /* 53 */
133 volatile u_int32_t ifPromiscuousMode; /* 54 */
134 volatile u_int32_t ifConnectorPresent; /* follow link state 55 */
138 volatile u_int32_t nicCmdsHostState; /* 56 */
139 volatile u_int32_t nicCmdsFDRFiltering; /* 57 */
140 volatile u_int32_t nicCmdsSetRecvProdIndex; /* 58 */
141 volatile u_int32_t nicCmdsUpdateGencommStats; /* 59 */
142 volatile u_int32_t nicCmdsResetJumboRing; /* 60 */
143 volatile u_int32_t nicCmdsAddMCastAddr; /* 61 */
144 volatile u_int32_t nicCmdsDelMCastAddr; /* 62 */
145 volatile u_int32_t nicCmdsSetPromiscMode; /* 63 */
146 volatile u_int32_t nicCmdsLinkNegotiate; /* 64 */
147 volatile u_int32_t nicCmdsSetMACAddr; /* 65 */
148 volatile u_int32_t nicCmdsClearProfile; /* 66 */
149 volatile u_int32_t nicCmdsSetMulticastMode; /* 67 */
150 volatile u_int32_t nicCmdsClearStats; /* 68 */
151 volatile u_int32_t nicCmdsSetRecvJumboProdIndex; /* 69 */
152 volatile u_int32_t nicCmdsSetRecvMiniProdIndex; /* 70 */
153 volatile u_int32_t nicCmdsRefreshStats; /* 71 */
154 volatile u_int32_t nicCmdsUnknown; /* 72 */
158 volatile u_int32_t nicEventsNICFirmwareOperational; /* 73 */
159 volatile u_int32_t nicEventsStatsUpdated; /* 74 */
160 volatile u_int32_t nicEventsLinkStateChanged; /* 75 */
161 volatile u_int32_t nicEventsError; /* 76 */
162 volatile u_int32_t nicEventsMCastListUpdated; /* 77 */
163 volatile u_int32_t nicEventsResetJumboRing; /* 78 */
167 volatile u_int32_t nicRingSetSendProdIndex; /* 79 */
168 volatile u_int32_t nicRingSetSendConsIndex; /* 80 */
169 volatile u_int32_t nicRingSetRecvReturnProdIndex; /* 81 */
173 volatile u_int32_t nicInterrupts; /* 82 */
174 volatile u_int32_t nicAvoidedInterrupts; /* 83 */
176 * BD Coalessing Thresholds
178 volatile u_int32_t nicEventThresholdHit; /* 84 */
179 volatile u_int32_t nicSendThresholdHit; /* 85 */
180 volatile u_int32_t nicRecvThresholdHit; /* 86 */
184 volatile u_int32_t nicDmaRdOverrun; /* 87 */
185 volatile u_int32_t nicDmaRdUnderrun; /* 88 */
186 volatile u_int32_t nicDmaWrOverrun; /* 89 */
187 volatile u_int32_t nicDmaWrUnderrun; /* 90 */
188 volatile u_int32_t nicDmaWrMasterAborts; /* 91 */
189 volatile u_int32_t nicDmaRdMasterAborts; /* 92 */
193 volatile u_int32_t nicDmaWriteRingFull; /* 93 */
194 volatile u_int32_t nicDmaReadRingFull; /* 94 */
195 volatile u_int32_t nicEventRingFull; /* 95 */
196 volatile u_int32_t nicEventProducerRingFull; /* 96 */
197 volatile u_int32_t nicTxMacDescrRingFull; /* 97 */
198 volatile u_int32_t nicOutOfTxBufSpaceFrameRetry; /* 98 */
199 volatile u_int32_t nicNoMoreWrDMADescriptors; /* 99 */
200 volatile u_int32_t nicNoMoreRxBDs; /* 100 */
201 volatile u_int32_t nicNoSpaceInReturnRing; /* 101 */
202 volatile u_int32_t nicSendBDs; /* current count 102 */
203 volatile u_int32_t nicRecvBDs; /* current count 103 */
204 volatile u_int32_t nicJumboRecvBDs; /* current count 104 */
205 volatile u_int32_t nicMiniRecvBDs; /* current count 105 */
206 volatile u_int32_t nicTotalRecvBDs; /* current count 106 */
207 volatile u_int32_t nicTotalSendBDs; /* current count 107 */
208 volatile u_int32_t nicJumboSpillOver; /* 108 */
209 volatile u_int32_t nicSbusHangCleared; /* 109 */
210 volatile u_int32_t nicEnqEventDelayed; /* 110 */
212 * Stats from MAC rx completion
214 volatile u_int32_t nicMacRxLateColls; /* 111 */
215 volatile u_int32_t nicMacRxLinkLostDuringPkt; /* 112 */
216 volatile u_int32_t nicMacRxPhyDecodeErr; /* 113 */
217 volatile u_int32_t nicMacRxMacAbort; /* 114 */
218 volatile u_int32_t nicMacRxTruncNoResources; /* 115 */
220 * Stats from the mac_stats area
222 volatile u_int32_t nicMacRxDropUla; /* 116 */
223 volatile u_int32_t nicMacRxDropMcast; /* 117 */
224 volatile u_int32_t nicMacRxFlowControl; /* 118 */
225 volatile u_int32_t nicMacRxDropSpace; /* 119 */
226 volatile u_int32_t nicMacRxColls; /* 120 */
230 volatile u_int32_t nicMacRxTotalAttns; /* 121 */
231 volatile u_int32_t nicMacRxLinkAttns; /* 122 */
232 volatile u_int32_t nicMacRxSyncAttns; /* 123 */
233 volatile u_int32_t nicMacRxConfigAttns; /* 124 */
234 volatile u_int32_t nicMacReset; /* 125 */
235 volatile u_int32_t nicMacRxBufDescrAttns; /* 126 */
236 volatile u_int32_t nicMacRxBufAttns; /* 127 */
237 volatile u_int32_t nicMacRxZeroFrameCleanup; /* 128 */
238 volatile u_int32_t nicMacRxOneFrameCleanup; /* 129 */
239 volatile u_int32_t nicMacRxMultipleFrameCleanup; /* 130 */
240 volatile u_int32_t nicMacRxTimerCleanup; /* 131 */
241 volatile u_int32_t nicMacRxDmaCleanup; /* 132 */
243 * Stats from the mac_stats area
245 volatile u_int32_t nicMacTxCollisionHistogram[15]; /* 133 */
249 volatile u_int32_t nicMacTxTotalAttns; /* 134 */
253 volatile u_int32_t nicProfile[32]; /* 135 */
273 TI_PARAM_NONE = 0x00,
274 TI_PARAM_STAT_TICKS = 0x01,
275 TI_PARAM_RX_COAL_TICKS = 0x02,
276 TI_PARAM_TX_COAL_TICKS = 0x04,
277 TI_PARAM_RX_COAL_BDS = 0x08,
278 TI_PARAM_TX_COAL_BDS = 0x10,
279 TI_PARAM_TX_BUF_RATIO = 0x20,
284 u_int32_t ti_stat_ticks;
285 u_int32_t ti_rx_coal_ticks;
286 u_int32_t ti_tx_coal_ticks;
287 u_int32_t ti_rx_max_coal_bds;
288 u_int32_t ti_tx_max_coal_bds;
289 u_int32_t ti_tx_buf_ratio;
290 ti_param_mask param_mask;
294 TI_TRACE_TYPE_NONE = 0x00000000,
295 TI_TRACE_TYPE_SEND = 0x00000001,
296 TI_TRACE_TYPE_RECV = 0x00000002,
297 TI_TRACE_TYPE_DMA = 0x00000004,
298 TI_TRACE_TYPE_EVENT = 0x00000008,
299 TI_TRACE_TYPE_COMMAND = 0x00000010,
300 TI_TRACE_TYPE_MAC = 0x00000020,
301 TI_TRACE_TYPE_STATS = 0x00000040,
302 TI_TRACE_TYPE_TIMER = 0x00000080,
303 TI_TRACE_TYPE_DISP = 0x00000100,
304 TI_TRACE_TYPE_MAILBOX = 0x00000200,
305 TI_TRACE_TYPE_RECV_BD = 0x00000400,
306 TI_TRACE_TYPE_LNK_PHY = 0x00000800,
307 TI_TRACE_TYPE_LNK_NEG = 0x00001000,
308 TI_TRACE_LEVEL_1 = 0x10000000,
309 TI_TRACE_LEVEL_2 = 0x20000000
312 struct ti_trace_buf {
316 u_long cur_trace_ptr;
319 #define TIIOCGETSTATS _IOR('T', 1, struct ti_stats)
320 #define TIIOCGETPARAMS _IOR('T', 2, struct ti_params)
321 #define TIIOCSETPARAMS _IOW('T', 3, struct ti_params)
322 #define TIIOCSETTRACE _IOW('T', 11, ti_trace_type)
323 #define TIIOCGETTRACE _IOWR('T', 12, struct ti_trace_buf)
326 * Taken from Alteon's altioctl.h. Alteon's ioctl numbers 1-6 aren't
327 * used by the FreeBSD driver.
329 #define ALT_ATTACH _IO('a', 7)
330 #define ALT_READ_TG_MEM _IOWR('a', 10, struct tg_mem)
331 #define ALT_WRITE_TG_MEM _IOWR('a', 11, struct tg_mem)
332 #define ALT_READ_TG_REG _IOWR('a', 12, struct tg_reg)
333 #define ALT_WRITE_TG_REG _IOWR('a', 13, struct tg_reg)
335 #endif /* _SYS_TIIO_H_ */