b806b4d297174ec8f76274e33c23b9ab1e085bc0
[safe/jmp/linux-2.6] / drivers / staging / vt6656 / mib.h
1 /*
2  * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
3  * All rights reserved.
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  *
19  * File: mib.h
20  *
21  * Purpose: Implement MIB Data Structure
22  *
23  * Author: Tevin Chen
24  *
25  * Date: May 21, 1996
26  *
27  */
28
29 #ifndef __MIB_H__
30 #define __MIB_H__
31
32 #include "ttype.h"
33 #include "tether.h"
34 #include "desc.h"
35
36 /*---------------------  Export Definitions -------------------------*/
37
38
39 //
40 // USB counter
41 //
42 typedef struct tagSUSBCounter {
43     DWORD dwCrc;
44
45 } SUSBCounter, *PSUSBCounter;
46
47
48
49 //
50 // 802.11 counter
51 //
52
53
54 typedef struct tagSDot11Counters {
55 //    ULONG       Length;             // Length of structure
56     ULONGLONG   TransmittedFragmentCount;
57     ULONGLONG   MulticastTransmittedFrameCount;
58     ULONGLONG   FailedCount;
59     ULONGLONG   RetryCount;
60     ULONGLONG   MultipleRetryCount;
61     ULONGLONG   RTSSuccessCount;
62     ULONGLONG   RTSFailureCount;
63     ULONGLONG   ACKFailureCount;
64     ULONGLONG   FrameDuplicateCount;
65     ULONGLONG   ReceivedFragmentCount;
66     ULONGLONG   MulticastReceivedFrameCount;
67     ULONGLONG   FCSErrorCount;
68     ULONGLONG   TKIPLocalMICFailures;
69     ULONGLONG   TKIPRemoteMICFailures;
70     ULONGLONG   TKIPICVErrors;
71     ULONGLONG   TKIPCounterMeasuresInvoked;
72     ULONGLONG   TKIPReplays;
73     ULONGLONG   CCMPFormatErrors;
74     ULONGLONG   CCMPReplays;
75     ULONGLONG   CCMPDecryptErrors;
76     ULONGLONG   FourWayHandshakeFailures;
77 //    ULONGLONG   WEPUndecryptableCount;
78 //    ULONGLONG   WEPICVErrorCount;
79 //    ULONGLONG   DecryptSuccessCount;
80 //    ULONGLONG   DecryptFailureCount;
81 } SDot11Counters, *PSDot11Counters;
82
83
84 //
85 // MIB2 counter
86 //
87 typedef struct tagSMib2Counter {
88     LONG    ifIndex;
89     char    ifDescr[256];               // max size 255 plus zero ending
90                                         // e.g. "interface 1"
91     LONG    ifType;
92     LONG    ifMtu;
93     DWORD   ifSpeed;
94     BYTE    ifPhysAddress[U_ETHER_ADDR_LEN];
95     LONG    ifAdminStatus;
96     LONG    ifOperStatus;
97     DWORD   ifLastChange;
98     DWORD   ifInOctets;
99     DWORD   ifInUcastPkts;
100     DWORD   ifInNUcastPkts;
101     DWORD   ifInDiscards;
102     DWORD   ifInErrors;
103     DWORD   ifInUnknownProtos;
104     DWORD   ifOutOctets;
105     DWORD   ifOutUcastPkts;
106     DWORD   ifOutNUcastPkts;
107     DWORD   ifOutDiscards;
108     DWORD   ifOutErrors;
109     DWORD   ifOutQLen;
110     DWORD   ifSpecific;
111 } SMib2Counter, *PSMib2Counter;
112
113 // Value in the ifType entry
114 //#define ETHERNETCSMACD      6           //
115 #define WIRELESSLANIEEE80211b      6           //
116
117 // Value in the ifAdminStatus/ifOperStatus entry
118 #define UP                  1           //
119 #define DOWN                2           //
120 #define TESTING             3           //
121
122
123 //
124 // RMON counter
125 //
126 typedef struct tagSRmonCounter {
127     LONG    etherStatsIndex;
128     DWORD   etherStatsDataSource;
129     DWORD   etherStatsDropEvents;
130     DWORD   etherStatsOctets;
131     DWORD   etherStatsPkts;
132     DWORD   etherStatsBroadcastPkts;
133     DWORD   etherStatsMulticastPkts;
134     DWORD   etherStatsCRCAlignErrors;
135     DWORD   etherStatsUndersizePkts;
136     DWORD   etherStatsOversizePkts;
137     DWORD   etherStatsFragments;
138     DWORD   etherStatsJabbers;
139     DWORD   etherStatsCollisions;
140     DWORD   etherStatsPkt64Octets;
141     DWORD   etherStatsPkt65to127Octets;
142     DWORD   etherStatsPkt128to255Octets;
143     DWORD   etherStatsPkt256to511Octets;
144     DWORD   etherStatsPkt512to1023Octets;
145     DWORD   etherStatsPkt1024to1518Octets;
146     DWORD   etherStatsOwners;
147     DWORD   etherStatsStatus;
148 } SRmonCounter, *PSRmonCounter;
149
150 //
151 // Custom counter
152 //
153 typedef struct tagSCustomCounters {
154     ULONG       Length;
155
156     ULONGLONG   ullTsrAllOK;
157
158     ULONGLONG   ullRsr11M;
159     ULONGLONG   ullRsr5M;
160     ULONGLONG   ullRsr2M;
161     ULONGLONG   ullRsr1M;
162
163     ULONGLONG   ullRsr11MCRCOk;
164     ULONGLONG   ullRsr5MCRCOk;
165     ULONGLONG   ullRsr2MCRCOk;
166     ULONGLONG   ullRsr1MCRCOk;
167
168     ULONGLONG   ullRsr54M;
169     ULONGLONG   ullRsr48M;
170     ULONGLONG   ullRsr36M;
171     ULONGLONG   ullRsr24M;
172     ULONGLONG   ullRsr18M;
173     ULONGLONG   ullRsr12M;
174     ULONGLONG   ullRsr9M;
175     ULONGLONG   ullRsr6M;
176
177     ULONGLONG   ullRsr54MCRCOk;
178     ULONGLONG   ullRsr48MCRCOk;
179     ULONGLONG   ullRsr36MCRCOk;
180     ULONGLONG   ullRsr24MCRCOk;
181     ULONGLONG   ullRsr18MCRCOk;
182     ULONGLONG   ullRsr12MCRCOk;
183     ULONGLONG   ullRsr9MCRCOk;
184     ULONGLONG   ullRsr6MCRCOk;
185
186 } SCustomCounters, *PSCustomCounters;
187
188
189 //
190 // Custom counter
191 //
192 typedef struct tagSISRCounters {
193     ULONG   Length;
194
195     DWORD   dwIsrTx0OK;
196     DWORD   dwIsrAC0TxOK;
197     DWORD   dwIsrBeaconTxOK;
198     DWORD   dwIsrRx0OK;
199     DWORD   dwIsrTBTTInt;
200     DWORD   dwIsrSTIMERInt;
201     DWORD   dwIsrWatchDog;
202     DWORD   dwIsrUnrecoverableError;
203     DWORD   dwIsrSoftInterrupt;
204     DWORD   dwIsrMIBNearfull;
205     DWORD   dwIsrRxNoBuf;
206
207     DWORD   dwIsrUnknown;               // unknown interrupt count
208
209     DWORD   dwIsrRx1OK;
210     DWORD   dwIsrATIMTxOK;
211     DWORD   dwIsrSYNCTxOK;
212     DWORD   dwIsrCFPEnd;
213     DWORD   dwIsrATIMEnd;
214     DWORD   dwIsrSYNCFlushOK;
215     DWORD   dwIsrSTIMER1Int;
216     /////////////////////////////////////
217 } SISRCounters, *PSISRCounters;
218
219
220 // Value in the etherStatsStatus entry
221 #define VALID               1           //
222 #define CREATE_REQUEST      2           //
223 #define UNDER_CREATION      3           //
224 #define INVALID             4           //
225
226
227 //
228 // Tx packet information
229 //
230 typedef struct tagSTxPktInfo {
231     BYTE    byBroadMultiUni;
232     WORD    wLength;
233     WORD    wFIFOCtl;
234     BYTE    abyDestAddr[U_ETHER_ADDR_LEN];
235 } STxPktInfo, *PSTxPktInfo;
236
237
238 #define MAX_RATE            12
239 //
240 // statistic counter
241 //
242 typedef struct tagSStatCounter {
243     //
244     // ISR status count
245     //
246
247     SISRCounters ISRStat;
248
249     // RSR status count
250     //
251     DWORD   dwRsrFrmAlgnErr;
252     DWORD   dwRsrErr;
253     DWORD   dwRsrCRCErr;
254     DWORD   dwRsrCRCOk;
255     DWORD   dwRsrBSSIDOk;
256     DWORD   dwRsrADDROk;
257     DWORD   dwRsrBCNSSIDOk;
258     DWORD   dwRsrLENErr;
259     DWORD   dwRsrTYPErr;
260
261     DWORD   dwNewRsrDECRYPTOK;
262     DWORD   dwNewRsrCFP;
263     DWORD   dwNewRsrUTSF;
264     DWORD   dwNewRsrHITAID;
265     DWORD   dwNewRsrHITAID0;
266
267     DWORD   dwRsrLong;
268     DWORD   dwRsrRunt;
269
270     DWORD   dwRsrRxControl;
271     DWORD   dwRsrRxData;
272     DWORD   dwRsrRxManage;
273
274     DWORD   dwRsrRxPacket;
275     DWORD   dwRsrRxOctet;
276     DWORD   dwRsrBroadcast;
277     DWORD   dwRsrMulticast;
278     DWORD   dwRsrDirected;
279     // 64-bit OID
280     ULONGLONG   ullRsrOK;
281
282     // for some optional OIDs (64 bits) and DMI support
283     ULONGLONG   ullRxBroadcastBytes;
284     ULONGLONG   ullRxMulticastBytes;
285     ULONGLONG   ullRxDirectedBytes;
286     ULONGLONG   ullRxBroadcastFrames;
287     ULONGLONG   ullRxMulticastFrames;
288     ULONGLONG   ullRxDirectedFrames;
289
290     DWORD   dwRsrRxFragment;
291     DWORD   dwRsrRxFrmLen64;
292     DWORD   dwRsrRxFrmLen65_127;
293     DWORD   dwRsrRxFrmLen128_255;
294     DWORD   dwRsrRxFrmLen256_511;
295     DWORD   dwRsrRxFrmLen512_1023;
296     DWORD   dwRsrRxFrmLen1024_1518;
297
298     // TSR status count
299     //
300     DWORD   dwTsrTotalRetry;        // total collision retry count
301     DWORD   dwTsrOnceRetry;         // this packet only occur one collision
302     DWORD   dwTsrMoreThanOnceRetry; // this packet occur more than one collision
303     DWORD   dwTsrRetry;             // this packet has ever occur collision,
304                                          // that is (dwTsrOnceCollision0 + dwTsrMoreThanOnceCollision0)
305     DWORD   dwTsrACKData;
306     DWORD   dwTsrErr;
307     DWORD   dwAllTsrOK;
308     DWORD   dwTsrRetryTimeout;
309     DWORD   dwTsrTransmitTimeout;
310
311     DWORD   dwTsrTxPacket;
312     DWORD   dwTsrTxOctet;
313     DWORD   dwTsrBroadcast;
314     DWORD   dwTsrMulticast;
315     DWORD   dwTsrDirected;
316
317     // RD/TD count
318     DWORD   dwCntRxFrmLength;
319     DWORD   dwCntTxBufLength;
320
321     BYTE    abyCntRxPattern[16];
322     BYTE    abyCntTxPattern[16];
323
324
325
326     // Software check....
327     DWORD   dwCntRxDataErr;             // rx buffer data software compare CRC err count
328     DWORD   dwCntDecryptErr;            // rx buffer data software compare CRC err count
329     DWORD   dwCntRxICVErr;              // rx buffer data software compare CRC err count
330
331
332     // 64-bit OID
333     ULONGLONG   ullTsrOK;
334
335     // for some optional OIDs (64 bits) and DMI support
336     ULONGLONG   ullTxBroadcastFrames;
337     ULONGLONG   ullTxMulticastFrames;
338     ULONGLONG   ullTxDirectedFrames;
339     ULONGLONG   ullTxBroadcastBytes;
340     ULONGLONG   ullTxMulticastBytes;
341     ULONGLONG   ullTxDirectedBytes;
342
343     // for autorate
344     DWORD   dwTxOk[MAX_RATE+1];
345     DWORD   dwTxFail[MAX_RATE+1];
346     DWORD   dwTxRetryCount[8];
347
348     STxPktInfo  abyTxPktInfo[16];
349
350     SUSBCounter USB_EP0Stat;
351     SUSBCounter USB_BulkInStat;
352     SUSBCounter USB_BulkOutStat;
353     SUSBCounter USB_InterruptStat;
354
355     SCustomCounters CustomStat;
356
357    #ifdef Calcu_LinkQual
358        //Tx count:
359     ULONG TxNoRetryOkCount;         //success tx no retry !
360     ULONG TxRetryOkCount;              //sucess tx but retry !
361     ULONG TxFailCount;                      //fail tx ?
362       //Rx count:
363     ULONG RxOkCnt;                          //sucess rx !
364     ULONG RxFcsErrCnt;                    //fail rx ?
365       //statistic
366     ULONG SignalStren;
367     ULONG LinkQuality;
368    #endif
369
370 } SStatCounter, *PSStatCounter;
371
372 #define NTSTATUS        int
373
374 /*---------------------  Export Classes  ----------------------------*/
375
376 /*---------------------  Export Variables  --------------------------*/
377
378 /*---------------------  Export Functions  --------------------------*/
379
380 void STAvClearAllCounter(PSStatCounter pStatistic);
381
382 void STAvUpdateIsrStatCounter (PSStatCounter pStatistic, BYTE byIsr0, BYTE byIsr1);
383
384 void STAvUpdateRDStatCounter(PSStatCounter pStatistic,
385                               BYTE byRSR, BYTE byNewRSR, BYTE byRxSts, BYTE byRxRate,
386                               PBYTE pbyBuffer, UINT cbFrameLength);
387
388 void STAvUpdateRDStatCounterEx(PSStatCounter pStatistic,
389                               BYTE byRSR, BYTE byNewRSR, BYTE byRxSts, BYTE byRxRate,
390                               PBYTE pbyBuffer, UINT cbFrameLength);
391
392
393 void
394 STAvUpdateTDStatCounter (
395     PSStatCounter   pStatistic,
396     BYTE            byPktNum,
397     BYTE            byRate,
398     BYTE            byTSR
399     );
400
401
402 void
403 STAvUpdate802_11Counter(
404     PSDot11Counters         p802_11Counter,
405     PSStatCounter           pStatistic,
406     BYTE                    byRTSSuccess,
407     BYTE                    byRTSFail,
408     BYTE                    byACKFail,
409     BYTE                    byFCSErr
410     );
411
412 void STAvClear802_11Counter(PSDot11Counters p802_11Counter);
413
414 void
415 STAvUpdateUSBCounter(
416     PSUSBCounter    pUsbCounter,
417     NTSTATUS        ntStatus
418     );
419
420 #endif // __MIB_H__
421
422
423