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